Class Keys

java.lang.Object
org.acemq.amqp.crypto.Keys

public final class Keys extends Object
Getting an AES key from the shapes one usually arrives in.
  • Method Details

    • generate

      public static SecretKey generate()
      Returns:
      a new 256-bit key from the platform's secure random
    • fromBytes

      public static SecretKey fromBytes(byte[] bytes)
      Parameters:
      bytes - 16, 24 or 32 bytes of key material
      Returns:
      the key
    • fromBase64

      public static SecretKey fromBase64(String base64)
      The usual way a key arrives from a secret store or an environment variable.
      Parameters:
      base64 - key material, Base64 encoded
      Returns:
      the key
    • toBase64

      public static String toBase64(SecretKey key)
      For writing a generated key into a secret store.
      Parameters:
      key - the key
      Returns:
      its material, Base64 encoded