Module t.c.s.keys

Part of twisted.conch.ssh View Source

Handling of RSA and DSA keys.

Maintainer: Paul Swartz
Line # Kind Name Docs
30 Class BadKeyError Raised when a key isn't what we expected from it.
37 Class EncryptedKeyError Raised when an encrypted key is presented to fromString/fromFile without
43 Class Key An object representing a key. A key can be either a public or
694 Function getPublicKeyString Return a public key string suitable for being sent over the wire.
718 Function makePublicKeyString Return an public key given a Crypto.PublicKey.pubkey.pubkey
737 Function getPublicKeyObject Return a Crypto.PublicKey.pubkey.pubkey corresponding to the SSHv2
753 Function getPrivateKeyObject Return a Crypto.PublicKey.pubkey.pubkey object corresponding to the
778 Function makePrivateKeyString Return an OpenSSH-style private key for a
798 Function makePublicKeyBlob Make a public key blob from a Crypto.PublicKey.pubkey.pubkey.
810 Function objectType Return the SSH key type corresponding to a Crypto.PublicKey.pubkey.pubkey
828 Function pkcs1Pad Pad out data to messageLength according to the PKCS#1 standard.
837 Function pkcs1Digest Create a message digest using the SHA1 hash algorithm according to the
847 Function lenSig Return the length of the signature in bytes for a key object.
856 Function signData Sign the data with the given Crypto.PublicKey.pubkey.pubkey object.
872 Function verifySignature Verify that the signature for the data is valid.
889 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 2008-10-26 16:12:37.