Class SymmetricKeyEncSessionPacket

java.lang.Object
org.bouncycastle.bcpg.Packet
org.bouncycastle.bcpg.ContainedPacket
org.bouncycastle.bcpg.SymmetricKeyEncSessionPacket
All Implemented Interfaces:
PacketTags, org.bouncycastle.util.Encodable

public class SymmetricKeyEncSessionPacket extends ContainedPacket
Basic type for a symmetric encrypted session key packet
  • Field Details

  • Constructor Details

    • SymmetricKeyEncSessionPacket

      public SymmetricKeyEncSessionPacket(BCPGInputStream in) throws IOException
      Throws:
      IOException
    • SymmetricKeyEncSessionPacket

      public SymmetricKeyEncSessionPacket(BCPGInputStream in, boolean newPacketFormat) throws IOException
      Throws:
      IOException
    • SymmetricKeyEncSessionPacket

      public SymmetricKeyEncSessionPacket(int encAlgorithm, S2K s2k, byte[] secKeyData)
      Deprecated.
      use createVersion4Packet()
      Create a v4 SKESK packet.
      Parameters:
      encAlgorithm - symmetric encryption algorithm
      s2k - s2k
      secKeyData - encrypted session key
  • Method Details

    • createV4Packet

      public static SymmetricKeyEncSessionPacket createV4Packet(int encAlgorithm, S2K s2k, byte[] secKeyData)
      Create a v4 SKESK packet.
      Parameters:
      encAlgorithm - symmetric encryption algorithm
      s2k - s2k specifier
      secKeyData - encrypted session key
    • createV5Packet

      public static SymmetricKeyEncSessionPacket createV5Packet(int encAlgorithm, int aeadAlgorithm, byte[] iv, S2K s2k, byte[] secKeyData, byte[] authTag)
      Create a v5 SKESK packet.
      Parameters:
      encAlgorithm - symmetric encryption algorithm
      aeadAlgorithm - aead algorithm
      iv - initialization vector
      s2k - s2k specifier
      secKeyData - encrypted session key
      authTag - authentication tag
    • createV6Packet

      public static SymmetricKeyEncSessionPacket createV6Packet(int encAlgorithm, int aeadAlgorithm, byte[] iv, S2K s2k, byte[] secKeyData, byte[] authTag)
      Create a v6 SKESK packet.
      Parameters:
      encAlgorithm - symmetric encryption algorithm
      aeadAlgorithm - aead algorithm
      iv - initialization vector
      s2k - s2k specifier
      secKeyData - encrypted session key
      authTag - authentication tag
    • getEncAlgorithm

      public int getEncAlgorithm()
      Returns:
      int
    • getS2K

      public S2K getS2K()
      Returns:
      S2K
    • getSecKeyData

      public byte[] getSecKeyData()
      Returns:
      byte[]
    • getVersion

      public int getVersion()
      Returns:
      int
    • getAeadAlgorithm

      public int getAeadAlgorithm()
      Return the AEAD algorithm tag. V5 packet only.
      Returns:
      aead algorithm
    • getIv

      public byte[] getIv()
      Return the IV for the AEAD mode. This is also called nonce. V5 packet only.
      Returns:
      iv
    • getAuthTag

      public byte[] getAuthTag()
      Return the authentication tag for the AEAD mode. V5 packet only.
      Returns:
      AEAD auth tag
    • getAAData

      public byte[] getAAData()
    • createAAData

      public static byte[] createAAData(int version, int encAlgorithm, int aeadAlgorithm)
    • encode

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