Package twisted :: Package conch :: Package ssh :: Module keys
[frames | no frames]

Module twisted.conch.ssh.keys

Handling of RSA and DSA keys.

This module is unstable.

Maintainer: Paul Swartz
Exceptions
BadKeyError raised when a key isn't what we expected from it.

Function Summary
  getPrivateKeyObject(filename, data, passphrase)
Return a Crypto.PublicKey.pubkey.pubkey object corresponding to the private key file/data.
  getPrivateKeyObject_lsh(data, passphrase)
  getPrivateKeyObject_openssh(data, passphrase)
Crypto.PublicKey.pubkey.pubkey getPublicKeyObject(data)
Return a Crypto.PublicKey.pubkey.pubkey corresponding to the SSHv2 public key data.
str getPublicKeyString(filename, line, data)
Return a public key string given a filename or data of a public key.
  getPublicKeyString_lsh(data)
  getPublicKeyString_openssh(data)
  lenSig(obj)
  makePrivateKeyBlob(obj)
str makePrivateKeyString(obj, passphrase, kind)
Return an OpenSSH-style private key for a Crypto.PublicKey.pubkey.pubkey object.
  makePrivateKeyString_lsh(obj, passphrase)
  makePrivateKeyString_openssh(obj, passphrase)
  makePublicKeyBlob(obj)
str makePublicKeyString(obj, comment, kind)
Return an public key given a Crypto.PublicKey.pubkey.pubkey object.
  makePublicKeyString_lsh(obj)
  makePublicKeyString_openssh(obj, comment)
str objectType(obj)
Return the SSH key type corresponding to a Crypto.PublicKey.pubkey.pubkey object.
  pkcs1Digest(data, lMod)
  pkcs1Pad(data, lMod)
  printKey(obj)
Pretty print a Crypto.PublicKey.pubkey.pubkey object.
str signData(obj, data)
Sign the data with the given Crypto.PublicKey.pubkey.pubkey object.
  signData_dsa(obj, data)
  signData_rsa(obj, data)
bool verifySignature(obj, sig, data)
Verify that the signature for the data is valid.
  verifySignature_dsa(obj, sig, data)
  verifySignature_rsa(obj, sig, data)

Variable Summary
str ID_SHA1 = '0!0\t\x06\x05+\x0e\x03\x02\x1a\x05\x00\x04\x1...

Function Details

getPrivateKeyObject(filename=None, data='', passphrase='')

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.
Parameters:
filename
           (type=str)
data
           (type=str)
passphrase
           (type=str)
Raises:
BadKeyError - if the key is invalid or a passphrase is not specified

getPublicKeyObject(data)

Return a Crypto.PublicKey.pubkey.pubkey corresponding to the SSHv2 public key data. data is in the over-the-wire public key format.
Parameters:
data
           (type=str)
Returns:
Crypto.PublicKey.pubkey.pubkey

getPublicKeyString(filename=None, line=0, data='')

Return a public key string given a filename or data of a public key. Currently handles OpenSSH and LSH keys.
Parameters:
filename
           (type=str)
line
           (type=int)
data
           (type=str)
Returns:
str

makePrivateKeyString(obj, passphrase=None, kind='openssh')

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')
Parameters:
obj
           (type=Crypto.PublicKey.pubkey.pubkey)
passphrase
           (type=str/None)
kind
           (type=str)
Returns:
str

makePublicKeyString(obj, comment='', kind='openssh')

Return an public key given a Crypto.PublicKey.pubkey.pubkey object. kind is one of ('openssh', 'lsh')
Parameters:
obj
           (type=Crypto.PublicKey.pubkey.pubkey)
comment
           (type=str)
kind
           (type=str)
Returns:
str

objectType(obj)

Return the SSH key type corresponding to a Crypto.PublicKey.pubkey.pubkey object.
Parameters:
obj
           (type=Crypto.PublicKey.pubkey.pubkey)
Returns:
str

printKey(obj)

Pretty print a Crypto.PublicKey.pubkey.pubkey object.
Parameters:
obj
           (type=Crypto.PublicKey.pubkey.pubkey)

signData(obj, data)

Sign the data with the given Crypto.PublicKey.pubkey.pubkey object.
Parameters:
obj
           (type=Crypto.PublicKey.pubkey.pubkey)
data
           (type=str)
Returns:
str

verifySignature(obj, sig, data)

Verify that the signature for the data is valid.
Parameters:
obj
           (type=Crypto.PublicKey.pubkey.pubkey)
sig
           (type=str)
data
           (type=str)
Returns:
bool

Variable Details

ID_SHA1

Type:
str
Value:
'0!0\t\x06\x05+\x0e\x03\x02\x1a\x05\x00\x04\x14'                       

Generated by Epydoc 2.0 on Sat May 15 20:08:11 2004 http://epydoc.sf.net