Class RawKeyring<T>

  • Type Parameters:
    T - the type of key material used by this keyring
    All Implemented Interfaces:
    Keyring
    Direct Known Subclasses:
    AesKeyring, RsaKeyring

    public abstract class RawKeyring<T>
    extends S3Keyring
    This is an abstract base class for keyrings that use raw cryptographic keys (AES + RSA)
    • Method Detail

      • findKeyMaterialForDecryption

        protected T findKeyMaterialForDecryption​(DecryptionMaterials materials,
                                                 T defaultKeyMaterial)
        Finds the appropriate key material to use for decryption based on the materials description. If a matching key material is found in the additionalDecryptionKeyMaterial map, it is returned. Otherwise, the default key material is returned.
        Parameters:
        materials - the decryption materials containing the materials description
        defaultKeyMaterial - the default key material to use if no matching key material is found
        Returns:
        the key material to use for decryption
      • modifyMaterialsForRawKeyring

        public EncryptionMaterials modifyMaterialsForRawKeyring​(EncryptionMaterials materials)
        Modifies encryption materials with the keyring's materials description if present. Issues a warning if encryption context is found, as it provides no security benefit for raw keyrings.
        Parameters:
        materials - the encryption materials to modify
        Returns:
        modified encryption materials with the keyring's materials description or original encryption materials if no materials description is set
      • warnIfEncryptionContextIsPresent

        public void warnIfEncryptionContextIsPresent​(EncryptionMaterials materials)
        Checks if an encryption context is present in the EncryptionMaterials and issues a warning if an encryption context is found.

        Encryption context is not recommended for use with non-KMS keyrings as it does not provide additional security benefits and is not stored.

        Parameters:
        materials - EncryptionMaterials