Class InsecureNonceAesGcmJce


  • public final class InsecureNonceAesGcmJce
    extends java.lang.Object
    Insecure version of AesGcmJce that allows the caller to set the IV.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] decrypt​(byte[] iv, byte[] ciphertext, byte[] associatedData)
      Decrypts ciphertext with iv and associatedData.
      byte[] decrypt​(byte[] iv, byte[] ciphertextWithPrefix, int ciphertextOffset, byte[] associatedData)
      Decrypts ciphertextWithPrefix with iv and associatedData.
      byte[] encrypt​(byte[] iv, byte[] plaintext, byte[] associatedData)
      Encrypts plaintext with iv and associatedData.
      byte[] encrypt​(byte[] iv, byte[] plaintext, int ciphertextOffset, byte[] associatedData)
      Encrypts plaintext with iv and associatedData.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • InsecureNonceAesGcmJce

        public InsecureNonceAesGcmJce​(byte[] key)
                               throws java.security.GeneralSecurityException
        Throws:
        java.security.GeneralSecurityException
    • Method Detail

      • encrypt

        public byte[] encrypt​(byte[] iv,
                              byte[] plaintext,
                              byte[] associatedData)
                       throws java.security.GeneralSecurityException
        Encrypts plaintext with iv and associatedData.
        Throws:
        java.security.GeneralSecurityException
      • encrypt

        public byte[] encrypt​(byte[] iv,
                              byte[] plaintext,
                              int ciphertextOffset,
                              byte[] associatedData)
                       throws java.security.GeneralSecurityException
        Encrypts plaintext with iv and associatedData.

        The ciphertextOffset is the offset at which the ciphertext should start in the returned byte array.

        Throws:
        java.security.GeneralSecurityException
      • decrypt

        public byte[] decrypt​(byte[] iv,
                              byte[] ciphertext,
                              byte[] associatedData)
                       throws java.security.GeneralSecurityException
        Decrypts ciphertext with iv and associatedData.
        Throws:
        java.security.GeneralSecurityException
      • decrypt

        public byte[] decrypt​(byte[] iv,
                              byte[] ciphertextWithPrefix,
                              int ciphertextOffset,
                              byte[] associatedData)
                       throws java.security.GeneralSecurityException
        Decrypts ciphertextWithPrefix with iv and associatedData.

        The ciphertextOffset is the offset at which the ciphertext starts within ciphertextWithPrefix.

        Throws:
        java.security.GeneralSecurityException