MCPcopy Create free account
hub / github.com/SecurityInnovation/PGPy / SKESessionKeyV4

Class SKESessionKeyV4

pgpy/packet/packets.py:496–610  ·  view source on GitHub ↗

5.3. Symmetric-Key Encrypted Session Key Packets (Tag 3) The Symmetric-Key Encrypted Session Key packet holds the symmetric-key encryption of a session key used to encrypt a message. Zero or more Public-Key Encrypted Session Key packets and/or Symmetric-Key Encrypted Session K

Source from the content-addressed store, hash-verified

494
495
496class SKESessionKeyV4(SKESessionKey):
497 """
498 5.3. Symmetric-Key Encrypted Session Key Packets (Tag 3)
499
500 The Symmetric-Key Encrypted Session Key packet holds the
501 symmetric-key encryption of a session key used to encrypt a message.
502 Zero or more Public-Key Encrypted Session Key packets and/or
503 Symmetric-Key Encrypted Session Key packets may precede a
504 Symmetrically Encrypted Data packet that holds an encrypted message.
505 The message is encrypted with a session key, and the session key is
506 itself encrypted and stored in the Encrypted Session Key packet or
507 the Symmetric-Key Encrypted Session Key packet.
508
509 If the Symmetrically Encrypted Data packet is preceded by one or
510 more Symmetric-Key Encrypted Session Key packets, each specifies a
511 passphrase that may be used to decrypt the message. This allows a
512 message to be encrypted to a number of public keys, and also to one
513 or more passphrases. This packet type is new and is not generated
514 by PGP 2.x or PGP 5.0.
515
516 The body of this packet consists of:
517
518 - A one-octet version number. The only currently defined version
519 is 4.
520
521 - A one-octet number describing the symmetric algorithm used.
522
523 - A string-to-key (S2K) specifier, length as defined above.
524
525 - Optionally, the encrypted session key itself, which is decrypted
526 with the string-to-key object.
527
528 If the encrypted session key is not present (which can be detected
529 on the basis of packet length and S2K specifier size), then the S2K
530 algorithm applied to the passphrase produces the session key for
531 decrypting the file, using the symmetric cipher algorithm from the
532 Symmetric-Key Encrypted Session Key packet.
533
534 If the encrypted session key is present, the result of applying the
535 S2K algorithm to the passphrase is used to decrypt just that
536 encrypted session key field, using CFB mode with an IV of all zeros.
537 The decryption result consists of a one-octet algorithm identifier
538 that specifies the symmetric-key encryption algorithm used to
539 encrypt the following Symmetrically Encrypted Data packet, followed
540 by the session key octets themselves.
541
542 Note: because an all-zero IV is used for this decryption, the S2K
543 specifier MUST use a salt value, either a Salted S2K or an
544 Iterated-Salted S2K. The salt value will ensure that the decryption
545 key is not repeated even if the passphrase is reused.
546 """
547 __ver__ = 4
548
549 @property
550 def symalg(self):
551 return self.s2k.encalg
552
553 def __init__(self):

Callers 1

encryptMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…