Class AesGcmParameters.Builder

  • Enclosing class:
    AesGcmParameters

    public static final class AesGcmParameters.Builder
    extends java.lang.Object
    Builds a new AesGcmParameters instance. The class AesGcmParameters is not responsible for checking if all allowed values for the parameters are implemented and satisfy any potential security policies. Some implementation may not support the full set of parameters at the moment and may restrict them to certain lengths (i.e. key size may be restricted to 16 or 32 bytes).
    • Method Detail

      • setKeySizeBytes

        @CanIgnoreReturnValue
        public AesGcmParameters.Builder setKeySizeBytes​(int keySizeBytes)
                                                 throws java.security.GeneralSecurityException
        Accepts key sizes of 16, 24 or 32 bytes.
        Throws:
        java.security.GeneralSecurityException
      • setIvSizeBytes

        @CanIgnoreReturnValue
        public AesGcmParameters.Builder setIvSizeBytes​(int ivSizeBytes)
                                                throws java.security.GeneralSecurityException
        IV size must greater than 0.
        Throws:
        java.security.GeneralSecurityException
      • setTagSizeBytes

        @CanIgnoreReturnValue
        public AesGcmParameters.Builder setTagSizeBytes​(int tagSizeBytes)
                                                 throws java.security.GeneralSecurityException
        Tag size must be between 12 and 16 bytes.
        Throws:
        java.security.GeneralSecurityException
      • build

        public AesGcmParameters build()
                               throws java.security.GeneralSecurityException
        Throws:
        java.security.GeneralSecurityException