Class EncryptionMaterials

  • All Implemented Interfaces:
    Serializable
    Direct Known Subclasses:
    KMSEncryptionMaterials

    public class EncryptionMaterials
    extends Object
    implements Serializable
    The "key encrypting key" materials used in encrypt/decryption. These materials may be either an asymmetric key pair or a symmetric key but not both.
    See Also:
    Serialized Form
    • Constructor Detail

      • EncryptionMaterials

        public EncryptionMaterials​(KeyPair keyPair)
        Constructs a new EncryptionMaterials object, storing an asymmetric key pair.
        Parameters:
        keyPair - The asymmetric key pair to be stored in this EncryptionMaterials object.
      • EncryptionMaterials

        public EncryptionMaterials​(SecretKey symmetricKey)
        Constructs a new EncryptionMaterials object, storing a symmetric key.
        Parameters:
        symmetricKey - The symmetric key to be stored in this EncryptionMaterials object.
      • EncryptionMaterials

        protected EncryptionMaterials​(KeyPair keyPair,
                                      SecretKey symmetricKey)
        Base constructor for the EncryptionMaterials object. This is not publicly visible since it should not be possible to create an EncryptionMaterials object that contains both an asymmetric key pair and a symmetric key.
    • Method Detail

      • getKeyPair

        public KeyPair getKeyPair()
        Returns the key pair stored in this EncryptionMaterials object.
        Returns:
        the key pair stored in this EncryptionMaterials object.
      • getSymmetricKey

        public SecretKey getSymmetricKey()
        Returns the symmetric key stored in this EncryptionMaterials object.
        Returns:
        the symmetric key stored in this EncryptionMaterials object.
      • getMaterialsDescription

        public Map<String,​String> getMaterialsDescription()
        Returns a snapshot of the current material description; never null.
      • getAccessor

        public EncryptionMaterialsAccessor getAccessor()
        Returns null since the EncryptionMaterials base class does not have a materials accessor. Subclasses may override this method.
        Returns:
        null
      • isKMSEnabled

        public boolean isKMSEnabled()
        Returns true if this is a KMS material description; false otherwise.
        Returns:
        false by default
      • getDescription

        protected String getDescription​(String name)