Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add well formatted toString() for KeyRingInfo class #224

Open
vanitasvitae opened this issue Dec 4, 2021 · 1 comment
Open

Add well formatted toString() for KeyRingInfo class #224

vanitasvitae opened this issue Dec 4, 2021 · 1 comment
Labels
enhancement New feature or request module: core Issue affects the core module

Comments

@vanitasvitae
Copy link
Member

No description provided.

@vanitasvitae vanitasvitae added enhancement New feature or request module: core Issue affects the core module labels Dec 4, 2021
@vanitasvitae
Copy link
Member Author

vanitasvitae commented Dec 14, 2021

I started creating a StreamDumper utility, which can be used to pretty-print OpenPGP packet structures in a human readable way.

The current work is tracked in https://github.com/pgpainless/pgpainless/tree/streamdump

Example output:

##############################################
Encrypted Message
##############################################
Public-Key Encrypted Session Key Packet
  Recipient: 8bd88e94c0d20333
  No Decryption Method

  Modification Detection Code Packet


##############################################
Signed Message
##############################################
One-Pass Signature Packet
  Type: BINARY_DOCUMENT
  Public Key Algorithm: RSA_GENERAL
  Hash Algorithm: SHA256
  Issuer Key ID: d03f6f865226fe8b

One-Pass Signature Packet
  Type: BINARY_DOCUMENT
  Public Key Algorithm: EDDSA
  Hash Algorithm: SHA512
  Issuer Key ID: 935e20fdc99d986

Literal Data Packet
  Format: BINARY
  Content: "Hello, world!\n"

Signature Packet
  Version: 4
  Type: BINARY_DOCUMENT
  Public Key Algorithm: EDDSA
  Hash Algorithm: SHA512
  Hashed Area:
    Signature Creation Time: 2019-02-27 13:48:34 UTC (critical)
    Issuer Fingerprint: 8de64cad1758fc194560cf590935e20fdc99d986
    Issuer Key ID: 935e20fdc99d986
  Digest Prefix: b902
  Signature: 
    53f143f0f3eaa8006b91d83d6d5e1a4e83fa6043605c6abc33b488bd36b39e5dcd4a74e2ac5163d0821e40269de4394cd23bbbfe6eb7f0d373b5c1068e9a0b07

Signature Packet
  Version: 4
  Type: BINARY_DOCUMENT
  Public Key Algorithm: RSA_GENERAL
  Hash Algorithm: SHA256
  Hashed Area:
    Signature Creation Time: 2019-09-29 12:36:15 UTC (critical)
    Issuer Fingerprint: 3e8877c877274692975189f5d03f6f865226fe8b
    Issuer Key ID: d03f6f865226fe8b
  Digest Prefix: 10d5
  Signature: 
    6c2e2e2fad4342b474b3ede7ec1cbc469d1c7e9a5f47de0d2bd194b4270bd370a2efcaa29a98dc6636beaf4df14e3e2bdd31804919e06980f470e53e7ab17d0cedcf3c664ac5a8ceaad157a1029d4275216919d4d8231f2febe84731fb905b2cbdc1f3cbb2687850cbc5a76df32ca61e6def37ea030776fcb96544cda54c9fbd5c6e327396c2c168b7254a513f363dfac7d4deba79c785927b0459a44da05d5b991d06da8857a3228bec62623aedae4173624103373ea12b6b28f128e9686724dad4a2052af26dfd3f08b5b06fff9e8bac8b3e2e807dbc73fb9629e238f136451d8de4053451318b1d0350f568c2165037d87066f25799f5338bbd7e041e8db8

##############################################
Encrypted Message (with Wrong Session Key)
##############################################
Public-Key Encrypted Session Key Packet
  Recipient: 8bd88e94c0d20333
  Session Key: 920b1779565c8df4dd9db46966cdf2b51bc882c241de8ef437cadec711e7ebff
  Symmetric Algorithm: AES_256
  Decryption Successful

  Decryption Failed

  Modification Detection Code Packet


##############################################
Signed Compressed Data
##############################################
Compressed Data Packet
  Algorithm: ZIP

  One-Pass Signature Packet
    Type: BINARY_DOCUMENT
    Public Key Algorithm: EDDSA
    Hash Algorithm: SHA256
    Issuer Key ID: e189d2125de7da64

  Literal Data Packet
    Format: BINARY
    Modification Date: 2019-03-14 13:37:49 UTC
    Content: "Hello, world!\n"

  Signature Packet
    Version: 4
    Type: BINARY_DOCUMENT
    Public Key Algorithm: EDDSA
    Hash Algorithm: SHA256
    Hashed Area:
      Issuer Fingerprint: 6eb35bef25ca35e594659359e189d2125de7da64
      Signature Creation Time: 2019-03-14 13:37:49 UTC
    Unhashed Area:
      Issuer Key ID: e189d2125de7da64
    Digest Prefix: 7e3f
    Signature: 
      6847982fc9ad640f30bbb8a0e18eb0f3898ecdd1e916a160b1c3f971826d1d73b1f83c7e0ec06b6706113b818163877b389bd95e97947c393c00aa40ae04020a

##############################################
Encrypted Message for Two Recipients
##############################################
Public-Key Encrypted Session Key Packet
  Recipient: 8bd88e94c0d20333
  Session Key: 092f816748b2c6fca49130e931f9ddcf46e4106ce3c4a8437ab660e0c6fed0a1
  Symmetric Algorithm: AES_256
  Decryption Successful

  Literal Data Packet
    Format: BINARY
    Content: "Test, 1-2-3.\n"

  Modification Detection Code Packet
    Valid: true

Public-Key Encrypted Session Key Packet
  Recipient: 49e2118166c92632
  Decryption Failed

  Modification Detection Code Packet


##############################################
Secret Key
##############################################
Secret-Key Packet
  Version: 4
  Creation Time: 2018-06-11 14:12:09 UTC
  Public Key Algorithm: EDDSA
  Public Key Size: 256
  Fingerprint: 8e8c33fa4626337976d97978069c0c348dd82c19
  Key-ID: 69c0c348dd82c19

User-ID Packet
  Value: Emmelie Dorothea Dina Samantha Awina Ed25519

Signature Packet
  Version: 4
  Type: POSITIVE_CERTIFICATION
  Public Key Algorithm: EDDSA
  Hash Algorithm: SHA256
  Hashed Area:
    Issuer Fingerprint: 8e8c33fa4626337976d97978069c0c348dd82c19
    Signature Creation Time: 2018-06-11 14:12:09 UTC
    Key Flags: [CERTIFY_OTHER, SIGN_DATA]
    Preferred Symmetric Algorithms: [AES_256, AES_192, AES_128, TRIPLE_DES]
    Preferred Hash Algorithms: [SHA512, SHA384, SHA256, SHA224, SHA1]
    Preferred Compression Algorithms: [ZLIB, BZIP2, ZIP]
    Features: [MODIFICATION_DETECTION]
    Key Server Preferences: [NO_MODIFY]
  Unhashed Area:
    Issuer Key ID: 69c0c348dd82c19
  Digest Prefix: 68e7
  Signature: 
    0760b24e1fe111039a655e7a4ea46969b63ece90acd9c4d7ec88d99e4122e4e045b10080afc890642888adb606e7c905e6975532b2067f56fd1dccd6fe520b0f

Secret-Subkey Packet
  Version: 4
  Creation Time: 2018-08-27 10:55:43 UTC
  Public Key Algorithm: EDDSA
  Public Key Size: 256
  Fingerprint: 061c3ca44aff0ec58dc66e9522e3fafe96b56c32
  Key-ID: 22e3fafe96b56c32

Signature Packet
  Version: 4
  Type: SUBKEY_BINDING
  Public Key Algorithm: EDDSA
  Hash Algorithm: SHA256
  Hashed Area:
    Issuer Fingerprint: 8e8c33fa4626337976d97978069c0c348dd82c19
    Signature Creation Time: 2018-08-27 10:55:43 UTC
    Key Flags: [SIGN_DATA]
  Unhashed Area:
    Issuer Key ID: 69c0c348dd82c19
    Embedded Signature:
      Signature Packet
        Version: 4
        Type: PRIMARYKEY_BINDING
        Public Key Algorithm: EDDSA
        Hash Algorithm: SHA256
        Hashed Area:
          Issuer Fingerprint: 061c3ca44aff0ec58dc66e9522e3fafe96b56c32
          Signature Creation Time: 2018-08-27 10:55:43 UTC
        Unhashed Area:
          Issuer Key ID: 22e3fafe96b56c32
        Digest Prefix: 684d
        Signature: 
          7181f61054419638e74fa0e23c9604251a33e4801782729a3a7b573c0ffdb826df29a37f2f13d6ae04ba4e33c40a3552120861b76366ce7b604843c2b6e5b90a
    Digest Prefix: 2780
    Signature: 
      dd4a315f8b6f905d821d7132f8c620bc93f9a547ddd229a63fe60659c73b79ab518034f58aebc997021a30bf07abfb9a1b547277daf07c0b74b5faa3d1d6350b

##############################################
Encrypted Message (with Session Key)
##############################################
Public-Key Encrypted Session Key Packet
  Recipient: 8bd88e94c0d20333
  Session Key: 920b1779565c8df4dd9db46966cdf2b51bc882c241de8ef437cadec711e7eb04
  Symmetric Algorithm: AES_256
  Decryption Successful

  Literal Data Packet
    Format: BINARY
    Content: "Test, 1-2-3.\n"

  Modification Detection Code Packet
    Valid: true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request module: core Issue affects the core module
Projects
None yet
Development

No branches or pull requests

1 participant