Class RecipientKekSizes

java.lang.Object
zeroecho.sdk.guard.RecipientKekSizes

public final class RecipientKekSizes extends Object
Defines the KEK sizes supported by recipient entries without an encoded size discriminator.

The current recipient format permits AES-128 and AES-256 wrapping only. Validation must occur before an entry is registered so every emitted entry remains openable by the corresponding recipient opener.

Since:
1.0
  • Field Details

    • AES_128_BYTES

      public static final int AES_128_BYTES
      AES-128 key size in bytes.
      See Also:
    • AES_256_BYTES

      public static final int AES_256_BYTES
      AES-256 key size in bytes.
      See Also:
  • Method Details

    • requireSupported

      public static int requireSupported(int kekBytes)
      Validates and returns a supported recipient KEK size.
      Parameters:
      kekBytes - requested KEK size in bytes
      Returns:
      kekBytes when it is exactly 16 or 32
      Throws:
      IllegalArgumentException - if the size is not exactly 16 or 32