Class EncryptionSecrets

java.lang.Object
org.apache.hadoop.fs.s3a.auth.delegation.EncryptionSecrets
All Implemented Interfaces:
Serializable, org.apache.hadoop.io.Writable

public class EncryptionSecrets extends Object implements org.apache.hadoop.io.Writable, Serializable
Encryption options in a form which can serialized or marshalled as a hadoop Writeable. Maintainers: For security reasons, don't print any of this. Note this design marshalls/unmarshalls its serialVersionUID in its writable, which is used to compare versions. Important. If the wire format is ever changed incompatibly, update the serial version UID to ensure that older clients get safely rejected. Important Do not import any AWS SDK classes, directly or indirectly. This is to ensure that S3A Token identifiers can be unmarshalled even without that SDK.
See Also:
  • Field Details

  • Constructor Details

    • EncryptionSecrets

      public EncryptionSecrets()
      Empty constructor, for use in marshalling.
    • EncryptionSecrets

      public EncryptionSecrets(S3AEncryptionMethods encryptionAlgorithm, String encryptionKey, String encryptionContext) throws IOException
      Create a pair of secrets.
      Parameters:
      encryptionAlgorithm - algorithm enumeration.
      encryptionKey - key/key reference.
      encryptionContext - base64-encoded string with the encryption context key-value pairs.
      Throws:
      IOException - failure to initialize.
    • EncryptionSecrets

      public EncryptionSecrets(String encryptionAlgorithm, String encryptionKey, String encryptionContext) throws IOException
      Create a pair of secrets.
      Parameters:
      encryptionAlgorithm - algorithm name
      encryptionKey - key/key reference.
      encryptionContext - base64-encoded string with the encryption context key-value pairs.
      Throws:
      IOException - failure to initialize.
  • Method Details

    • write

      public void write(DataOutput out) throws IOException
      Write out the encryption secrets.
      Specified by:
      write in interface org.apache.hadoop.io.Writable
      Parameters:
      out - DataOutput to serialize this object into.
      Throws:
      IOException - IO failure
    • readFields

      public void readFields(DataInput in) throws IOException
      Read in from the writable stream. After reading, call init().
      Specified by:
      readFields in interface org.apache.hadoop.io.Writable
      Parameters:
      in - DataInput to deserialize this object from.
      Throws:
      IOException - failure to read/validate data.
    • getEncryptionAlgorithm

      public String getEncryptionAlgorithm()
    • getEncryptionKey

      public String getEncryptionKey()
    • getEncryptionContext

      public String getEncryptionContext()
    • hasEncryptionAlgorithm

      public boolean hasEncryptionAlgorithm()
      Does this instance have encryption options? That is: is the algorithm non-null.
      Returns:
      true if there's an encryption algorithm.
    • hasEncryptionKey

      public boolean hasEncryptionKey()
      Does this instance have an encryption key?
      Returns:
      true if there's an encryption key.
    • hasEncryptionContext

      public boolean hasEncryptionContext()
      Does this instance have an encryption context?
      Returns:
      true if there's an encryption context.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getEncryptionMethod

      public S3AEncryptionMethods getEncryptionMethod()
      Get the encryption method.
      Returns:
      the encryption method
    • toString

      public String toString()
      String function returns the encryption mode but not any other secrets.
      Overrides:
      toString in class Object
      Returns:
      a string safe for logging.