summaryrefslogtreecommitdiff
path: root/README.rst
diff options
context:
space:
mode:
authorYuval Adam <_@yuv.al>2018-03-19 11:58:49 +0200
committerYuval Adam <_@yuv.al>2018-03-19 11:58:49 +0200
commitba0b06637bcec3a01d8e6a11884fbad1a0f5d612 (patch)
tree39f86c393722ba56fa497493fa59acb8888514b9 /README.rst
parent46901c04955ea94c746ae96d09734143af63c51d (diff)
Add support for HMAC signatures, fixes #4
Diffstat (limited to 'README.rst')
-rw-r--r--README.rst25
1 files changed, 19 insertions, 6 deletions
diff --git a/README.rst b/README.rst
index 686bdc3..cb07b58 100644
--- a/README.rst
+++ b/README.rst
@@ -20,17 +20,19 @@ The Viewstate decoder accepts Base64 encoded .NET viewstate data and returns the
There are two main ways to use this package. First, it can be used as an imported library with the following typical use case:
-.. code-block:: python
+.. code-block:: pycon
- from viewstate import ViewState
- vs = ViewState(base64EncodedViewState)
- decoded_state = vs.decode()
+ >>> from viewstate import ViewState
+ >>> base64_encoded_viewstate = '/wEPBQVhYmNkZQ9nAgE='
+ >>> vs = ViewState(base64_encoded_viewstate)
+ >>> vs.decode()
+ ('abcde', (True, 1))
It is also possible to feed the raw bytes directly:
-.. code-block:: python
+.. code-block:: pycon
- vs = ViewState(raw=b'\xff\x01....')
+ >>> vs = ViewState(raw=b'\xff\x01....')
Alternatively, the library can be used via command line by directly executing the module:
@@ -40,6 +42,17 @@ Alternatively, the library can be used via command line by directly executing th
Which will pretty-print the decoded data structure.
+Viewstate HMAC signatures are also supported. In case there are any remaining bytes after parsing, they are assumed to be HMAC signatures, with the types estimated according to signature length.
+
+.. code-block:: pycon
+
+ >>> vs = ViewState(signed_view_state)
+ >>> vs.decode()
+ >>> vs.mac
+ 'hmac_sha256'
+ >>> vs.signature
+ b'....'
+
Development
-----------