Class PK11Cipher

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    public final class PK11Cipher
    extends Cipher
    implements java.lang.AutoCloseable
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void close()  
      byte[] doFinal()
      Deprecated.
      isPadded() in EncryptionAlgorithm has been deprecated
      byte[] doFinal​(byte[] bytes)
      Deprecated.
      isPadded() in EncryptionAlgorithm has been deprecated
      byte[] doFinal​(byte[] bytes, int offset, int length)
      Completes an cipher operation.
      void finalize()  
      void initDecrypt​(SymmetricKey key)
      Initializes a decryption context with a symmetric key.
      void initDecrypt​(SymmetricKey key, java.security.spec.AlgorithmParameterSpec parameters)
      Deprecated.
      isPadded() in EncryptionAlgorithm has been deprecated
      void initEncrypt​(SymmetricKey key)
      Initializes a encryption context with a symmetric key.
      void initEncrypt​(SymmetricKey key, java.security.spec.AlgorithmParameterSpec parameters)
      Deprecated.
      isPadded() in EncryptionAlgorithm has been deprecated
      byte[] update​(byte[] bytes)
      Updates the encryption context with additional input.
      byte[] update​(byte[] bytes, int offset, int length)
      Updates the encryption context with additional plaintext.
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • initEncrypt

        public void initEncrypt​(SymmetricKey key)
                         throws java.security.InvalidKeyException,
                                java.security.InvalidAlgorithmParameterException,
                                TokenException
        Description copied from class: Cipher
        Initializes a encryption context with a symmetric key.
        Specified by:
        initEncrypt in class Cipher
        Throws:
        java.security.InvalidKeyException
        java.security.InvalidAlgorithmParameterException
        TokenException
      • initDecrypt

        public void initDecrypt​(SymmetricKey key)
                         throws java.security.InvalidKeyException,
                                java.security.InvalidAlgorithmParameterException,
                                TokenException
        Description copied from class: Cipher
        Initializes a decryption context with a symmetric key.
        Specified by:
        initDecrypt in class Cipher
        Throws:
        java.security.InvalidKeyException
        java.security.InvalidAlgorithmParameterException
        TokenException
      • initEncrypt

        @Deprecated
        public void initEncrypt​(SymmetricKey key,
                                java.security.spec.AlgorithmParameterSpec parameters)
                         throws java.security.InvalidKeyException,
                                java.security.InvalidAlgorithmParameterException,
                                TokenException
        Deprecated.
        isPadded() in EncryptionAlgorithm has been deprecated
        Description copied from class: Cipher
        Initializes an encryption context with a symmetric key and algorithm parameters.
        Specified by:
        initEncrypt in class Cipher
        Throws:
        java.security.InvalidKeyException
        java.security.InvalidAlgorithmParameterException
        TokenException
      • initDecrypt

        @Deprecated
        public void initDecrypt​(SymmetricKey key,
                                java.security.spec.AlgorithmParameterSpec parameters)
                         throws java.security.InvalidKeyException,
                                java.security.InvalidAlgorithmParameterException,
                                TokenException
        Deprecated.
        isPadded() in EncryptionAlgorithm has been deprecated
        Description copied from class: Cipher
        Initializes a decryption context with a symmetric key and algorithm parameters.
        Specified by:
        initDecrypt in class Cipher
        Throws:
        java.security.InvalidKeyException
        java.security.InvalidAlgorithmParameterException
        TokenException
      • update

        public byte[] update​(byte[] bytes)
                      throws java.lang.IllegalStateException,
                             TokenException
        Description copied from class: Cipher
        Updates the encryption context with additional input.
        Specified by:
        update in class Cipher
        Parameters:
        bytes - Bytes of plaintext (if encrypting) or ciphertext (if decrypting).
        Returns:
        Bytes of ciphertext (if encrypting) or plaintext (if decrypting).
        Throws:
        java.lang.IllegalStateException
        TokenException
      • update

        public byte[] update​(byte[] bytes,
                             int offset,
                             int length)
                      throws java.lang.IllegalStateException,
                             TokenException
        Description copied from class: Cipher
        Updates the encryption context with additional plaintext.
        Specified by:
        update in class Cipher
        Parameters:
        bytes - Bytes of plaintext (if encrypting) or ciphertext (if decrypting).
        offset - The index in bytes at which to begin reading.
        length - The number of bytes from bytes to read.
        Returns:
        Bytes of ciphertext (if encrypting) or plaintext (if decrypting).
        Throws:
        java.lang.IllegalStateException
        TokenException
      • doFinal

        @Deprecated
        public byte[] doFinal​(byte[] bytes)
                       throws java.lang.IllegalStateException,
                              IllegalBlockSizeException,
                              javax.crypto.BadPaddingException,
                              TokenException
        Deprecated.
        isPadded() in EncryptionAlgorithm has been deprecated
        Description copied from class: Cipher
        Completes an cipher operation. This can be called directly after the context is initialized, or update may be called any number of times before calling final.
        Specified by:
        doFinal in class Cipher
        Parameters:
        bytes - Bytes of plaintext (if encrypting) or ciphertext (if decrypting).
        Returns:
        The last of the output.
        Throws:
        java.lang.IllegalStateException
        IllegalBlockSizeException
        javax.crypto.BadPaddingException
        TokenException
      • doFinal

        public byte[] doFinal​(byte[] bytes,
                              int offset,
                              int length)
                       throws java.lang.IllegalStateException,
                              IllegalBlockSizeException,
                              javax.crypto.BadPaddingException,
                              TokenException
        Description copied from class: Cipher
        Completes an cipher operation.
        Specified by:
        doFinal in class Cipher
        Parameters:
        bytes - Bytes of plaintext (if encrypting) or ciphertext (if decrypting).
        offset - The index in bytes at which to begin reading.
        length - The number of bytes from bytes to read.
        Returns:
        The last of the output.
        Throws:
        java.lang.IllegalStateException
        IllegalBlockSizeException
        javax.crypto.BadPaddingException
        TokenException
      • doFinal

        @Deprecated
        public byte[] doFinal()
                       throws java.lang.IllegalStateException,
                              IllegalBlockSizeException,
                              javax.crypto.BadPaddingException,
                              TokenException
        Deprecated.
        isPadded() in EncryptionAlgorithm has been deprecated
        Description copied from class: Cipher
        Completes an cipher operation.
        Specified by:
        doFinal in class Cipher
        Returns:
        The last of the output.
        Throws:
        java.lang.IllegalStateException
        IllegalBlockSizeException
        javax.crypto.BadPaddingException
        TokenException
      • finalize

        public void finalize()
                      throws java.lang.Throwable
        Overrides:
        finalize in class java.lang.Object
        Throws:
        java.lang.Throwable
      • close

        public void close()
                   throws java.lang.Exception
        Specified by:
        close in interface java.lang.AutoCloseable
        Throws:
        java.lang.Exception