t.c.s.keys : module documentation

Part of twisted.conch.ssh View Source

Handling of RSA and DSA keys.

Maintainer: Paul Swartz
Class BadKeyError Raised when a key isn't what we expected from it.
Class EncryptedKeyError Raised when an encrypted key is presented to fromString/fromFile without a password.
Class Key No summary
Function getPublicKeyString Return a public key string suitable for being sent over the wire. Takes a filename or data of a public key. Currently handles OpenSSH and LSH keys.
Function makePublicKeyString Return an public key given a Crypto.PublicKey.pubkey.pubkey object. kind is one of ('openssh', 'lsh')
Function getPublicKeyObject Return a Crypto.PublicKey.pubkey.pubkey corresponding to the SSHv2 public key data. data is in the over-the-wire public key format.
Function getPrivateKeyObject Return a Crypto.PublicKey.pubkey.pubkey object corresponding to the private key file/data. If the private key is encrypted, passphrase must be specified, other wise a BadKeyError will be raised.
Function makePrivateKeyString No summary
Function makePublicKeyBlob Make a public key blob from a Crypto.PublicKey.pubkey.pubkey.
Function objectType Return the SSH key type corresponding to a Crypto.PublicKey.pubkey.pubkey object.
Function pkcs1Pad Pad out data to messageLength according to the PKCS#1 standard. @type data: str @type messageLength: int
Function pkcs1Digest No summary
Function lenSig Return the length of the signature in bytes for a key object.
Function signData Sign the data with the given Crypto.PublicKey.pubkey.pubkey object.
Function verifySignature Verify that the signature for the data is valid.
Function printKey Pretty print a Crypto.PublicKey.pubkey.pubkey object.
def getPublicKeyString(filename=None, line=0, data=''): (source)

Return a public key string suitable for being sent over the wire. Takes a filename or data of a public key. Currently handles OpenSSH and LSH keys.

This function has been deprecated since Twisted Conch 0.9. Use Key.fromString() instead.
Parametersfilename (type: str )
line (type: int )
data (type: str )
Returns (type: str )
def makePublicKeyString(obj, comment='', kind='openssh'): (source)

Return an public key given a Crypto.PublicKey.pubkey.pubkey object. kind is one of ('openssh', 'lsh')

This function is deprecated since Twisted Conch 0.9. Instead use Key(obj).toString().
Parametersobj (type: Crypto.PublicKey.pubkey.pubkey )
comment (type: str )
kind (type: str )
Returns (type: str )
def getPublicKeyObject(data): (source)

Return a Crypto.PublicKey.pubkey.pubkey corresponding to the SSHv2 public key data. data is in the over-the-wire public key format.

This function is deprecated since Twisted Conch 0.9. Instead, use Key.fromString().
Parametersdata (type: str )
Returns (type: Crypto.PublicKey.pubkey.pubkey )
def getPrivateKeyObject(filename=None, data='', passphrase=''): (source)

Return a Crypto.PublicKey.pubkey.pubkey object corresponding to the private key file/data. If the private key is encrypted, passphrase must be specified, other wise a BadKeyError will be raised.

This method is deprecated since Twisted Conch 0.9. Instead, use the fromString or fromFile classmethods of Key.
Parametersfilename (type: str )
data (type: str )
passphrase (type: str )
Returns (type: Crypto.PublicKey.pubkey.pubkey )
RaisesBadKeyErrorif the key is invalid or a passphrase is not specified
def makePrivateKeyString(obj, passphrase=None, kind='openssh'): (source)

Return an OpenSSH-style private key for a Crypto.PublicKey.pubkey.pubkey object. If passphrase is given, encrypt the private key with it. kind is one of ('openssh', 'lsh', 'agentv3')

This function is deprecated since Twisted Conch 0.9. Instead use Key(obj).toString().
Parametersobj (type: Crypto.PublicKey.pubkey.pubkey )
passphrase (type: str/None )
kind (type: str )
Returns (type: str )
def makePublicKeyBlob(obj): (source)

Make a public key blob from a Crypto.PublicKey.pubkey.pubkey.

This function is deprecated since Twisted Conch 0.9. Use Key().blob() instead.
def objectType(obj): (source)
Return the SSH key type corresponding to a Crypto.PublicKey.pubkey.pubkey object.
Parametersobj (type: Crypto.PublicKey.pubkey.pubkey )
Returns (type: str )
def pkcs1Pad(data, messageLength): (source)
Pad out data to messageLength according to the PKCS#1 standard.
Parametersdata (type: str )
messageLength (type: int )
def pkcs1Digest(data, messageLength): (source)
Create a message digest using the SHA1 hash algorithm according to the PKCS#1 standard.
Parametersdata (type: str )
messageLength (type: str )
def lenSig(obj): (source)
Return the length of the signature in bytes for a key object.
Parametersobj (type: Crypto.PublicKey.pubkey.pubkey )
Returns (type: long )
def signData(obj, data): (source)

Sign the data with the given Crypto.PublicKey.pubkey.pubkey object.

This method is deprecated since Twisted Conch 0.9. Instead use Key().sign().
Parametersobj (type: Crypto.PublicKey.pubkey.pubkey )
data (type: str )
Returns (type: str )
def verifySignature(obj, sig, data): (source)

Verify that the signature for the data is valid.

This method is deprecated since Twisted Conch 0.9. Use Key().verify().
Parametersobj (type: Crypto.PublicKey.pubkey.pubkey )
sig (type: str )
data (type: str )
Returns (type: bool )
def printKey(obj): (source)

Pretty print a Crypto.PublicKey.pubkey.pubkey object.

This function is deprecated since Twisted Conch 0.9. Use repr(Key()).
Parametersobj (type: Crypto.PublicKey.pubkey.pubkey )
API Documentation for Twisted, generated by pydoctor at 2011-10-27 15:57:47.