Class SecretKeyPacket

    • Constructor Detail

      • SecretKeyPacket

        public SecretKeyPacket​(PublicKeyPacket pubKeyPacket,
                               int encAlgorithm,
                               S2K s2k,
                               byte[] iv,
                               byte[] secKeyData)
        Construct a SecretKeyPacket. Note: secKeyData needs to be prepared by applying encryption/checksum beforehand.
        Parameters:
        pubKeyPacket - pubkey packet corresponding to this secret key packet.
        encAlgorithm - algorithm id of the symmetric key algorithm that was used to encrypt the secret key material
        s2k - s2k identifier for deriving a key from a passphrase
        iv - IV that was used to encrypt the secret key material
        secKeyData - encrypted/checksum'd secret key material
      • SecretKeyPacket

        public SecretKeyPacket​(PublicKeyPacket pubKeyPacket,
                               int encAlgorithm,
                               int s2kUsage,
                               S2K s2k,
                               byte[] iv,
                               byte[] secKeyData)
        Construct a SecretKeyPacket or SecretSubkeyPacket. Note: secKeyData needs to be prepared by applying encryption/checksum beforehand.
        Parameters:
        pubKeyPacket - pubkey packet corresponding to this secret key packet.
        encAlgorithm - algorithm id of the symmetric key algorithm that was used to encrypt the secret key material
        s2kUsage - octet indicating, how the secert key material was protected
        s2k - s2k identifier for deriving a key from a passphrase
        iv - IV that was used to encrypt the secret key material
        secKeyData - encrypted/checksum'd secret key material
      • SecretKeyPacket

        public SecretKeyPacket​(PublicKeyPacket pubKeyPacket,
                               int encAlgorithm,
                               int aeadAlgorithm,
                               int s2kUsage,
                               S2K s2k,
                               byte[] iv,
                               byte[] secKeyData)
        Construct a SecretKeyPacket or SecretSubkeyPacket. Note: secKeyData needs to be prepared by applying encryption/checksum beforehand.
        Parameters:
        pubKeyPacket - pubkey packet corresponding to this secret key packet.
        encAlgorithm - algorithm id of the symmetric key algorithm that was used to encrypt the secret key material
        aeadAlgorithm - AEAD algorithm scheme used to protect the secret key material with
        s2kUsage - octet indicating how the secret key material was encrypted
        s2k - s2k identifier for deriving a key from a passphrase
        iv - IV that was used to encrypt the secret key material
        secKeyData - encrypted/checksum'd secret key material
    • Method Detail

      • getEncAlgorithm

        public int getEncAlgorithm()
        Return the algorithm ID of the symmetric key algorithm that was used to encrypt the secret key material.
        Returns:
        symmetric key enc algorithm id
      • getAeadAlgorithm

        public int getAeadAlgorithm()
        Return the algorithm ID of the AEAD algorithm that was used to protect the secret key material.
        Returns:
        aead algorithm id
      • getS2KUsage

        public int getS2KUsage()
        Return the S2K usage mode indicating how the secret key material is protected.
        Returns:
        s2k usage
      • getIV

        public byte[] getIV()
        Return the IV that was used to protect the secret key material.
        Returns:
        IV
      • getS2K

        public S2K getS2K()
        Return the S2K identifier describing, how to derive the symmetric key to protect the secret key material with.
        Returns:
        s2k identifier
      • getPublicKeyPacket

        public PublicKeyPacket getPublicKeyPacket()
        Return the public key packet corresponding to the secret key packet.
        Returns:
        public key packet
      • getSecretKeyData

        public byte[] getSecretKeyData()
        Return the encrypted/checksum'd secret key data.
        Returns:
        secret key data
      • getEncodedContents

        public byte[] getEncodedContents()
                                  throws java.io.IOException
        Return the encoded packet content without packet frame.
        Returns:
        encoded packet contents
        Throws:
        java.io.IOException