Package yawPyCrypto :: Module AdvKey :: Class AsciiKey
[show private | hide private]
[frames | no frames]

Class AsciiKey

     object --+        
              |        
       IFlatten --+    
                  |    
     object --+   |    
              |   |    
AlgoDefinitions --+    
                  |    
                Key --+
                      |
                     AsciiKey


AsciiKey is a Key derived class which offers functionality to wrap Key data in base64 encoded packets. These packets have a header, a footer, and look similar to GPG ascii-armored packets (although their content is not interchangeable). Which headers/footers/packet signatures are used to wrap the data can be specified using the _head* attributes of this class; if you wish to change these, best is to derive a class from AsciiKey.
Method Summary
  __init__(self, keysize, algo_pub, **kwargs)
Create a new key. (inherited from Key)
  __cmp__(self, other)
Compares two keys. (inherited from Key)
  __delitem__(self, name)
Deletes the specified key argument from this key. (inherited from Key)
  __getitem__(self, name)
Loads the key attribute name from the current key object, and unserializes it. (inherited from Key)
  __hash__(self)
Returns a hash value of a key instance. (inherited from Key)
  __iter__(self)
Return an iterator over all names of key arguments. (inherited from Key)
a new object with type S, a subtype of T __new__(S, ...)
  __setitem__(self, name, value)
Sets the passed in keyword argument called name to the value that is passed in along. (inherited from Key)
  canDecrypt(self)
Returns a boolean whether this key can decrypt data. (inherited from Key)
  canEncrypt(self)
Returns a boolean whether this key can encrypt data. (inherited from Key)
  canSign(self)
Returns a boolean whether this key can sign data. (inherited from Key)
  canVerify(self)
Returns a boolean whether this key can verify signed data. (inherited from Key)
  cryptSize(self)
Returns the maximum string length of data which can be encrypted or signed. (inherited from Key)
  decrypt(self, encdata, wrap, *args, **kwargs)
Decrypt string data as passed in using data. (inherited from Key)
  encrypt(self, data, wrap, *args, **kwargs)
Encrypt string data as passed in using data. (inherited from Key)
  hasPrivate(self)
Checks whether this key has a private key part. (inherited from Key)
  hasPublic(self)
Checks whether this key has a public key part. (inherited from Key)
  keySize(self)
Returns the key's keysize in bits. (inherited from Key)
  publicKey(self)
Returns a new key object which contains only the public key associated with the current key, and only public key arguments. (inherited from Key)
  sign(self, data, hash_algo, wrap, *args, **kwargs)
Create a new signature for the data that is passed in. (inherited from Key)
  storeKey(self, wrap, *args, **kwargs)
Stores a key to a string of bytes. (inherited from Key)
  storePublicKey(self, wrap, *args, **kwargs)
Stores only the public key of this key to a string of bytes. (inherited from Key)
  update(self, args)
Dictionary style updating for a Key instance. (inherited from Key)
  verify(self, data, signature, wrap, *args, **kwargs)
Verify the signature of the passed in string. (inherited from Key)
  _asciiUnwrap(selfcls, data, datatype, *args, **kwargs)
Unwrapping function for unwrapping key data and encryption/signature packets from ascii-armored representation as returned by _asciiWrap().
  _asciiWrap(selfcls, data, datatype, *args, **kwargs)
Wrapping function for wrapping key data and encryption/signature packets in ascii-armor (base64 encoded).
  _IFlatten__serialize(self, *args, **kwargs)
(inherited from IFlatten)
  _IFlatten__unserialize(self, *args, **kwargs)
(inherited from IFlatten)
  _isPrivate(self, key)
Function which is called to check whether the current key argument should be treated as a private key argument (and as such is stored only on a call to storeKey()). (inherited from Key)
  _Key__createKey(self, keysize)
Function used to create a new key for this Key object. (inherited from Key)
  _Key__decrypt(self, data)
Decrypt the passed in PyCrypto output of encryption, and return the decrypted string. (inherited from Key)
  _Key__encrypt(self, data)
Encrypt data as passed in, and return the PyCrypto output of the encrypted data. (inherited from Key)
  _Key__getEncPrime(self)
Function used to get an encryption prime as required by the El Gamal public key encryption algorithm. (inherited from Key)
  _Key__getID(self)
Returns the yawPyCrypto ID of the current key object. (inherited from Key)
  _Key__serialize(self, private, network, *args, **kwargs)
Function called by the Flatten serialization library to serialize a key instance. (inherited from Key)
  _Key__sign(self, data)
Function that returns a PyCrypto signature for the data that is passed in. (inherited from Key)
  _Key__unserialize(self, serstate, *args, **kwargs)
Function called by the Flatten serialization library to unserialize a key instance from the dictionary passed in as serstate. (inherited from Key)
  _Key__verify(self, data, signature)
Function that verifies a PyCrypto signature for the data that is passed in. (inherited from Key)

Class Variable Summary
str _headend
str _headstart
str _headtypeenc
str _headtypeend
str _headtypekey
str _headtypesign
list _unwrappers
list _wrappers

Method Details

__new__(S, ...)

Returns:
a new object with type S, a subtype of T

_asciiUnwrap(selfcls, data, datatype, *args, **kwargs)

Unwrapping function for unwrapping key data and encryption/signature packets from ascii-armored representation as returned by _asciiWrap(). The data it is passed must not necessarily be exactly the same, the yawPyCrypto data block is searched, and only relevant data is returned. The Version: and Generated: headers of _asciiWrap() are silently ignored.

_asciiWrap(selfcls, data, datatype, *args, **kwargs)

Wrapping function for wrapping key data and encryption/signature
packets in ascii-armor (base64 encoded). The function is called
by __wrap() and __unwrap(). It returns data in a format similar to
the following:
    
    --- yawPyCrypto <name> packet ---
    Version: <yawPyCrypto creation version>
    Generated: <time packet was generated>
    
    <data encoded in base64>
    --- yawPyCrypto packet end    ---
    
The function should never need to be called directly.

Class Variable Details

_headend

Type:
str
Value:
'---'                                                                  

_headstart

Type:
str
Value:
'--- yawPyCrypto'                                                      

_headtypeenc

Type:
str
Value:
' encryption packet '                                                  

_headtypeend

Type:
str
Value:
' packet end        '                                                  

_headtypekey

Type:
str
Value:
' key packet        '                                                  

_headtypesign

Type:
str
Value:
' signature packet  '                                                  

_unwrappers

Type:
list
Value:
[(100, <function _asciiUnwrap at 0x40228e9c>)]                         

_wrappers

Type:
list
Value:
[(200, <function _asciiWrap at 0x40228e64>)]                           

Generated by Epydoc 1.1 on Sun Aug 17 03:32:33 2003 http://epydoc.sf.net