Class CipherCore


  • public class CipherCore
    extends Object
    • Constructor Detail

      • CipherCore

        public CipherCore​(com.fortanix.sdkms.v1.model.ObjectType alg,
                          int blkSize,
                          CipherCore.CipherType cipherType)
    • Method Detail

      • initMultiCore

        public void initMultiCore()
      • update

        public byte[] update​(byte[] input,
                             int inputOffset,
                             int inputLen)
        return encrypted / plain bytes depend upon cipher mode
      • update

        public int update​(byte[] input,
                          int inputOffset,
                          int inputLen,
                          byte[] output,
                          int outputOffset)
                   throws ShortBufferException
        This method doesn't perform any encryption. Call doFinal for encryption/decryption operation
        Parameters:
        input -
        inputOffset -
        inputLen -
        output -
        outputOffset -
        Returns:
        zero. As nothing is copied into output
        Throws:
        ShortBufferException
      • doFinal

        public byte[] doFinal​(byte[] input,
                              int inputOffset,
                              int inputLen)
        Parameters:
        input -
        inputOffset -
        inputLen -
        Returns:
        encrypted/decrypted content
      • doFinal

        public int doFinal​(byte[] input,
                           int inputOffset,
                           int inputLen,
                           byte[] output,
                           int outputOffset)
                    throws ShortBufferException
        Parameters:
        input -
        inputOffset -
        inputLen -
        output - , cipher/plain text as per operation mode
        outputOffset -
        Returns:
        Throws:
        ShortBufferException
      • prepareDoFinal

        protected void prepareDoFinal()
      • setCryptMode

        public void setCryptMode​(com.fortanix.sdkms.v1.model.CryptMode cryptMode)
      • setPadding

        public void setPadding​(String padding)
      • getOutputSize

        public int getOutputSize​(int inputLen)
        The actual encrypted/decrypted data size can be smaller then the length return by this method
        Parameters:
        inputLen -
        Returns:
        required output buffer size in bytes
      • updateAAD

        public void updateAAD​(byte[] src,
                              int offset,
                              int len)
      • unwrap

        public Key unwrap​(byte[] wrappedKey,
                          String wrappedKeyAlgorithm,
                          int wrappedKeyType)
                   throws InvalidKeyException
        Decrypt the wrapped key and return JCE key object
        Parameters:
        wrappedKey -
        wrappedKeyAlgorithm -
        wrappedKeyType -
        Returns:
        Key object
        Throws:
        InvalidKeyException
      • getIv

        public byte[] getIv()
      • getPadding

        public String getPadding()
      • getOperation

        public String getOperation()
      • getCryptMode

        public com.fortanix.sdkms.v1.model.CryptMode getCryptMode()
      • getBlockSize

        public int getBlockSize()
      • setBlockSize

        public void setBlockSize​(int blockSize)
      • validateParameters

        protected void validateParameters()
      • switchCryptMode

        protected void switchCryptMode()
      • isPaddingRequired

        protected boolean isPaddingRequired()
      • setState

        public void setState​(byte[] state)
      • resetFields

        protected void resetFields()