Class PublicKeyEncSessionPacket

All Implemented Interfaces:
PacketTags, PublicKeyAlgorithmTags, org.bouncycastle.util.Encodable

public class PublicKeyEncSessionPacket extends ContainedPacket implements PublicKeyAlgorithmTags
basic packet for a PGP public key
  • Field Details

  • Constructor Details

    • PublicKeyEncSessionPacket

      public PublicKeyEncSessionPacket(long keyID, int algorithm, byte[][] data)
      Create a new V3 PKESK packet.
      Parameters:
      keyID - ID of the recipient key, 0 for anonymous
      algorithm - public key algorithm
      data - session data
    • PublicKeyEncSessionPacket

      public PublicKeyEncSessionPacket(int keyVersion, byte[] keyFingerprint, int algorithm, byte[][] data)
      Create a new V6 PKESK packet.
      Parameters:
      keyVersion - version of the key
      keyFingerprint - fingerprint of the key
      algorithm - public key algorithm
      data - session data
  • Method Details

    • createV3PKESKPacket

      public static PublicKeyEncSessionPacket createV3PKESKPacket(long keyID, int algorithm, byte[][] data)
      Create a new V3 PKESK packet.
      Parameters:
      keyID - ID of the recipient key, 0 for anonymous
      algorithm - public key algorithm
      data - session data
    • createV6PKESKPacket

      public static PublicKeyEncSessionPacket createV6PKESKPacket(int keyVersion, byte[] keyFingerprint, int algorithm, byte[][] data)
      Create a new V6 PKESK packet.
      Parameters:
      keyVersion - version of the key
      keyFingerprint - fingerprint of the key
      algorithm - public key algorithm
      data - session data
    • getVersion

      public int getVersion()
      Return the version of this PKESK packet.
      Returns:
      version
    • getKeyID

      public long getKeyID()
      Return the id of the recipient key. V3 PKESK only. TODO: Add conversion from fingerprint to key-id for V6 PKESK?
      Returns:
      key id
    • getKeyFingerprint

      public byte[] getKeyFingerprint()
      Return the fingerprint of the recipient key. If the recipient key is anonymous, this method returns an empty array. V6 PKESK packet only.
      Returns:
      key fingerprint
    • getKeyVersion

      public int getKeyVersion()
      Return the version number of the recipient key. If the recipient key is anonymous, this method returns 0. V6 PKESK packet only.
      Returns:
      key version
    • getAlgorithm

      public int getAlgorithm()
      Return the public key algorithm of the recipient key.
      Returns:
      public key algorithm
    • getEncSessionKey

      public byte[][] getEncSessionKey()
    • encode

      public void encode(BCPGOutputStream out) throws IOException
      Specified by:
      encode in class ContainedPacket
      Throws:
      IOException