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

Class RsaPrivateKey

source code

object --+            
         |            
       Key --+        
             |        
 AsymmetricKey --+    
                 |    
        PrivateKey --+
                     |
                    RsaPrivateKey

Represents RSA private keys in an asymmetric RSA key pair.

Instance Methods [hide private]
 
__init__(self, params, pkcs8, pub, key, size=2048)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
__Decode(self, em, p='') source code
 
Encrypt(self, data) source code
string
Decrypt(self, input_bytes)
Decrypts the given ciphertext.
source code
string
Sign(self, msg)
Return raw byte string of signature on the SHA-1 hash of the message.
source code
 
Verify(self, msg, sig) source code

Inherited from PrivateKey: __str__

Inherited from PrivateKey (private): _GetKeyString, _Hash

Inherited from Key: Header

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

Static Methods [hide private]
RsaPrivateKey
Generate(size=2048)
Return a newly generated RSA private key.
source code
RsaPrivateKey
Read(key)
Reads a RSA private 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, params, pkcs8, pub, key, size=2048)
(Constructor)

source code 

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

Overrides: object.__init__
(inherited documentation)

Generate(size=2048)
Static Method

source code 

Return a newly generated RSA private key.

Parameters:
  • size (integer) - length of key in bits to generate
Returns: RsaPrivateKey
a RSA private key

Read(key)
Static Method

source code 

Reads a RSA private key from a JSON string representation of it.

Parameters:
  • key (string) - a JSON representation of a RSA private key
Returns: RsaPrivateKey
a RSA private key

Encrypt(self, data)

source code 

Decrypt(self, input_bytes)

source code 

Decrypts the given ciphertext.

Parameters:
  • input_bytes (string) - raw byte string formatted as Header|Ciphertext.
Returns: string
plaintext message

Sign(self, msg)

source code 

Return raw byte string of signature on the SHA-1 hash of the message.

Parameters:
  • msg (string) - message to be signed
Returns: string
string representation of long int signature over message

Verify(self, msg, sig)

source code