Package keyczar :: Module keys :: Class HmacKey
[hide private]
[frames] | no frames]

Class HmacKey

source code

object --+        
         |        
       Key --+    
             |    
  SymmetricKey --+
                 |
                HmacKey

Represents HMAC-SHA1 symmetric private keys.

Instance Methods [hide private]
 
__init__(self, key_string, size=256)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
__str__(self)
str(x)
source code
string
Sign(self, msg)
Return raw byte string of signature on the message.
source code
boolean
Verify(self, msg, sig_bytes)
Return True if the signature corresponds to the message.
source code

Inherited from SymmetricKey (private): _GetKeyString

Inherited from Key: Header

Inherited from Key (private): _Hash

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__

Static Methods [hide private]
HmacKey
Generate(size=256)
Return a newly generated HMAC-SHA1 key.
source code
HmacKey
Read(key)
Reads an HMAC-SHA1 key from a JSON string representation of it.
source code
Properties [hide private]

Inherited from Key: hash, key_bytes, key_string, size

Inherited from object: __class__

Method Details [hide private]

__init__(self, key_string, size=256)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)

Generate(size=256)
Static Method

source code 

Return a newly generated HMAC-SHA1 key.

Parameters:
  • size (integer) - length of key in bits to generate
Returns: HmacKey
an HMAC-SHA1 key

Read(key)
Static Method

source code 

Reads an HMAC-SHA1 key from a JSON string representation of it.

Parameters:
  • key (string) - a JSON representation of an HMAC-SHA1 key
Returns: HmacKey
an HMAC-SHA1 key

Sign(self, msg)

source code 

Return raw byte string of signature on the message.

Parameters:
  • msg (string) - message to be signed
Returns: string
raw byte string signature

Verify(self, msg, sig_bytes)

source code 

Return True if the signature corresponds to the message.

Parameters:
  • msg (string) - message that has been signed
  • sig_bytes (string) - raw byte string of the signature
Returns: boolean
True if signature is valid for message. False otherwise.