Package yum :: Module pgpmsg
[hide private]
[frames] | no frames]

Module pgpmsg

source code

Classes [hide private]
  pgp_packet
  public_key
  user_id
  user_attribute
  signature
  pgp_certificate
Functions [hide private]
 
get_whole_number(msg, idx, numlen)
extracts a "whole number" field of length numlen from msg at index idx returns (<whole number>, new_idx) where the whole number is a long integer and new_idx is the index of the next element in the message
source code
 
get_whole_int(msg, idx, numlen)
same as get_whole_number but returns the number as an int for convenience
source code
 
pack_long(l)
returns big-endian representation of unsigned long integer
source code
 
pack_mpi(l)
returns the PGP Multi-Precision Integer representation of unsigned long integer
source code
 
get_sig_subpak_len(msg, idx)
extracts a signature subpacket length field returns (subpak_len, new_idx)
source code
 
get_n_mpi(msg, idx)
extracts a multi-precision integer field from the message msg at index idx returns (n, <mpi>, new_idx) where the mpi is a long integer and new_idx is the index of the next element in the message and n is the number of bits of precision in <mpi>
source code
 
get_mpi(msg, idx)
extracts a multi-precision integer field from the message msg at index idx returns (<mpi>, new_idx) where the mpi is a long integer and new_idx is the index of the next element in the message
source code
 
str_to_hex(s) source code
 
duration_to_str(s) source code
 
map_to_str(m, vals) source code
 
get_ctb(msg, idx)
extracts a the "cypher type bit" information from message msg at index idx returns (type, len, new_idx) where type is the enumerated type of the packet, len is the length of the packet, and new_idx is the index of the next element in the message
source code
 
crc24(msg) source code
 
decode(msg) source code
 
decode_msg(msg)
decode_msg(msg) ==> list of OpenPGP "packet" objects Takes an ascii-armored PGP block and returns a list of objects each of which corresponds to a PGP "packets".
source code
 
decode_multiple_keys(msg) source code
Variables [hide private]
  debug = None
  CTB_76_NORMAL = 128
  CTB_76_NEW = 192
  CTB_76_MASK = 192
  CTB_PKTV2_MASK = 60
  CTB_PKT_MASK = 63
  CTB_PKT_PK_ENC = 1
  CTB_PKT_SIG = 2
  CTB_PKT_SK_ENC = 3
  CTB_PKT_OP_SIG = 4
  CTB_PKT_SK_CERT = 5
  CTB_PKT_PK_CERT = 6
  CTB_PKT_SK_SUB = 7
  CTB_PKT_COMPRESSED = 8
  CTB_PKT_ENC = 9
  CTB_PKT_MARKER = 10
  CTB_PKT_LIT = 11
  CTB_PKT_TRUST = 12
  CTB_PKT_USER_ID = 13
  CTB_PKT_PK_SUB = 14
  CTB_PKT_USER_ATTR = 17
  CTB_PKT_SYM_ENC_INT = 18
  CTB_PKT_MOD_DETECT = 19
  ctb_pkt_to_str = {1: 'public-key encrypted session packet', 2:...
  CTB_PKT_LEN_MASK = 3
  CTB_PKT_LEN_1 = 0
  CTB_PKT_LEN_2 = 1
  CTB_PKT_LEN_4 = 2
  CTB_PKT_LEN_UNDEF = 3
  ALGO_PK_RSA_ENC_OR_SIGN = 1
  ALGO_PK_RSA_ENC_ONLY = 2
  ALGO_PK_RSA_SIGN_ONLY = 3
  ALGO_PK_ELGAMAL_ENC_ONLY = 16
  ALGO_PK_DSA = 17
  ALGO_PK_ELLIPTIC_CURVE = 18
  ALGO_PK_ECDSA = 19
  ALGO_PK_ELGAMAL_ENC_OR_SIGN = 20
  ALGO_PK_DH = 21
  algo_pk_to_str = {1: 'RSA (Encrypt or Sign)', 2: 'RSA Encrypt-...
  ALGO_SK_PLAIN = 0
  ALGO_SK_IDEA = 1
  ALGO_SK_3DES = 2
  ALGO_SK_CAST5 = 3
  ALGO_SK_BLOWFISH = 4
  ALGO_SK_SAFER_SK128 = 5
  ALGO_SK_DES_SK = 6
  ALGO_SK_AES_128 = 7
  ALGO_SK_AES_192 = 8
  ALGO_SK_AES_256 = 9
  ALGO_SK_TWOFISH_256 = 10
  algo_sk_to_str = {0: 'Plaintext or unencrypted data', 1: 'IDEA...
  ALGO_COMP_UNCOMP = 0
  ALGO_COMP_ZIP = 1
  ALGO_COMP_ZLIB = 2
  ALGO_COMP_BZIP2 = 3
  algo_comp_to_str = {0: 'Uncompressed', 1: 'ZIP', 2: 'ZLIB', 3:...
  ALGO_HASH_MD5 = 1
  ALGO_HASH_SHA1 = 2
  ALGO_HASH_RIPEMD160 = 3
  ALGO_HASH_SHA_DBL = 4
  ALGO_HASH_MD2 = 5
  ALGO_HASH_TIGER192 = 6
  ALGO_HASH_HAVAL_5_160 = 7
  ALGO_HASH_SHA256 = 8
  ALGO_HASH_SHA384 = 9
  ALGO_HASH_SHA512 = 10
  ALGO_HASH_SHA224 = 11
  algo_hash_to_str = {1: 'MD5', 2: 'SHA1', 3: 'RIPEMD160', 4: 'd...
  SIG_TYPE_DOCUMENT = 0
  SIG_TYPE_DOCUMENT_CANON = 1
  SIG_TYPE_STANDALONE = 2
  SIG_TYPE_PK_USER_GEN = 16
  SIG_TYPE_PK_USER_PER = 17
  SIG_TYPE_PK_USER_CAS = 18
  SIG_TYPE_PK_USER_POS = 19
  SIG_TYPE_SUBKEY_BIND = 24
  SIG_TYPE_KEY = 31
  SIG_TYPE_KEY_REVOKE = 32
  SIG_TYPE_SUBKEY_REVOKE = 40
  SIG_TYPE_CERT_REVOKE = 48
  SIG_TYPE_TIMESTAMP = 64
  sig_type_to_str = {0: 'document signature, binary image', 1: '...
  SIG_SUB_TYPE_CREATE_TIME = 2
  SIG_SUB_TYPE_EXPIRE_TIME = 3
  SIG_SUB_TYPE_EXPORT_CERT = 4
  SIG_SUB_TYPE_TRUST_SIG = 5
  SIG_SUB_TYPE_REGEXP = 6
  SIG_SUB_TYPE_REVOCABLE = 7
  SIG_SUB_TYPE_KEY_EXPIRE = 9
  SIG_SUB_TYPE_PLACEHOLDER = 10
  SIG_SUB_TYPE_PREF_SYMM_ALGO = 11
  SIG_SUB_TYPE_REVOKE_KEY = 12
  SIG_SUB_TYPE_ISSUER_KEY_ID = 16
  SIG_SUB_TYPE_NOTATION = 20
  SIG_SUB_TYPE_PREF_HASH_ALGO = 21
  SIG_SUB_TYPE_PREF_COMP_ALGO = 22
  SIG_SUB_TYPE_KEY_SRV_PREF = 23
  SIG_SUB_TYPE_PREF_KEY_SRVR = 24
  SIG_SUB_TYPE_PRIM_USER_ID = 25
  SIG_SUB_TYPE_POLICY_URI = 26
  SIG_SUB_TYPE_KEY_FLAGS = 27
  SIG_SUB_TYPE_SGNR_USER_ID = 28
  SIG_SUB_TYPE_REVOKE_REASON = 29
  SIG_SUB_TYPE_FEATURES = 30
  SIG_SUB_TYPE_SIG_TARGET = 31
  SIG_SUB_TYPE_EMBEDDED_SIG = 32
  sig_sub_type_to_str = {2: 'signature creation time', 3: 'signa...
  REVOKE_REASON_NONE = 0
  REVOKE_REASON_SUPER = 1
  REVOKE_REASON_COMPR = 2
  REVOKE_REASON_NOT_USED = 3
  REVOKE_REASON_ID_INVALID = 32
  revoke_reason_to_str = {0: 'No reason specified', 1: 'Key is s...
  KEY_FLAGS1_MAY_CERTIFY = 1
  KEY_FLAGS1_MAY_SIGN = 2
  KEY_FLAGS1_MAY_ENC_COMM = 4
  KEY_FLAGS1_MAY_ENC_STRG = 8
  KEY_FLAGS1_PRIV_MAYBE_SPLIT = 16
  KEY_FLAGS1_GROUP = 128
  REVOKE_KEY_CLASS_MAND = 128
  REVOKE_KEY_CLASS_SENS = 64
  PGP_FEATURE_1_MOD_DETECT = 1
  pgp_feature_to_str = {1: 'Modification Detectiobn'}
  __package__ = 'yum'
Function Details [hide private]

decode_msg(msg)

source code 

decode_msg(msg) ==> list of OpenPGP "packet" objects Takes an ascii-armored PGP block and returns a list of objects each of which corresponds to a PGP "packets".

A PGP message is a series of packets. You need to understand how packets are to be combined together in order to know what to do with them. For example a PGP "certificate" includes a public key, user id(s), and signature.


Variables Details [hide private]

ctb_pkt_to_str

Value:
{1: 'public-key encrypted session packet',
 2: 'signature packet',
 3: 'symmetric-key encrypted session packet',
 4: 'one-pass signature packet',
 5: 'secret-key certificate packet',
 6: 'public-key certificate packet',
 7: 'secret-key subkey packet',
 8: 'compressed data packet',
...

algo_pk_to_str

Value:
{1: 'RSA (Encrypt or Sign)',
 2: 'RSA Encrypt-Only',
 3: 'RSA Sign-Only',
 16: 'Elgamal Encrypt-Only',
 17: 'DSA (Digital Signature Standard)',
 18: 'Elliptic Curve',
 19: 'ECDSA',
 20: 'Elgamal (Encrypt or Sign)',
...

algo_sk_to_str

Value:
{0: 'Plaintext or unencrypted data',
 1: 'IDEA',
 2: 'Triple-DES',
 3: 'CAST5',
 4: 'Blowfish',
 5: 'SAFER-SK128',
 6: 'DES/SK',
 7: 'AES 128-bit',
...

algo_comp_to_str

Value:
{0: 'Uncompressed', 1: 'ZIP', 2: 'ZLIB', 3: 'BZip2'}

algo_hash_to_str

Value:
{1: 'MD5',
 2: 'SHA1',
 3: 'RIPEMD160',
 4: 'double-width SHA',
 5: 'MD2',
 6: 'TIGER192',
 7: 'HAVAL-5-160',
 8: 'SHA256',
...

sig_type_to_str

Value:
{0: 'document signature, binary image',
 1: 'document signature, canonical text',
 2: 'signature over just subpackets',
 16: 'public key packet and user ID packet, generic certification',
 17: 'public key packet and user ID packet, persona',
 18: 'public key packet and user ID packet, casual certification',
 19: 'public key packet and user ID packet, positive certification',
 24: 'subkey binding',
...

sig_sub_type_to_str

Value:
{2: 'signature creation time',
 3: 'signature expiration time',
 4: 'exportable certification',
 5: 'trust signature',
 6: 'regular expression',
 7: 'revocable',
 9: 'key expiration time',
 10: 'placeholder for backward compatibility',
...

revoke_reason_to_str

Value:
{0: 'No reason specified',
 1: 'Key is superceded',
 2: 'Key has been compromised',
 3: 'Key is no longer used',
 32: 'user id information is no longer valid'}