Class NativeAESWrapCipherSpi


  • public class NativeAESWrapCipherSpi
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void nativeClose​(int nativeTransformationId, int nativeId)
      Closes the resource related to the native ID
      static int nativeGetCloseId​(int nativeTransformationId)
      Gets the id of the native close function.
      static int nativeGetTransformation​(byte[] transformationBytes)
      Gets for the given transformation the cipher id.
      static int nativeInit​(int nativeTransformationId, boolean decrypting, int keyEncryptionKeyId)
      Initializes a AES Key Wrap resource.
      static int nativeUnWrap​(int nativeTransformationId, int nativeId, byte[] buffer, int bufferOffset, int len, byte[] algorithm)
      Unwraps a wrapped key blob into an AES data Key.
      static int nativeWrap​(int nativeTransformationId, int nativeId, int keyId, byte[] output, int outputOffset, int outputLength, byte[] algorithm)
      Wraps a AES data key.
      • Methods inherited from class java.lang.Object

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

      • nativeGetTransformation

        public static int nativeGetTransformation​(byte[] transformationBytes)
        Gets for the given transformation the cipher id.
        Parameters:
        transformationBytes - Null terminated string that describes the transformation
        Returns:
        transformation ID on success or -1 on error.
      • nativeInit

        public static int nativeInit​(int nativeTransformationId,
                                     boolean decrypting,
                                     int keyEncryptionKeyId)
                              throws ej.sni.NativeException
        Initializes a AES Key Wrap resource.
        Parameters:
        nativeTransformationId - ID of the transformation
        decrypting - true for wrapping, false for unwrapping.
        keyEncryptionKeyId - the key encryption key id
        Returns:
        the nativeId of the newly initialized resource
        Throws:
        ej.sni.NativeException - on error.
      • nativeWrap

        public static int nativeWrap​(int nativeTransformationId,
                                     int nativeId,
                                     int keyId,
                                     byte[] output,
                                     int outputOffset,
                                     int outputLength,
                                     byte[] algorithm)
                              throws ej.sni.NativeException
        Wraps a AES data key.
        Parameters:
        nativeTransformationId - ID of the transformation
        nativeId - the resource's native ID
        keyId - the key native ID to be wrapped
        output - the output buffer containing the wrapped key
        outputOffset - the output offset
        outputLength - the output length
        algorithm - the wrapped key algorithm string
        Returns:
        the length of the buffer
        Throws:
        ej.sni.NativeException - on error
      • nativeUnWrap

        public static int nativeUnWrap​(int nativeTransformationId,
                                       int nativeId,
                                       byte[] buffer,
                                       int bufferOffset,
                                       int len,
                                       byte[] algorithm)
                                throws ej.sni.NativeException
        Unwraps a wrapped key blob into an AES data Key.
        Parameters:
        nativeTransformationId - ID of the transformation
        nativeId - the resource's native ID
        buffer - the buffer containing the wrapped key blob
        bufferOffset - the buffer offset
        len - the buffer length
        algorithm - the wrapped key algorithm string
        Returns:
        pointer of the C structure holding the key data
        Throws:
        ej.sni.NativeException - on error
      • nativeClose

        public static void nativeClose​(int nativeTransformationId,
                                       int nativeId)
                                throws ej.sni.NativeException
        Closes the resource related to the native ID
        Parameters:
        nativeTransformationId - ID of the transformation
        nativeId - the resource's native ID
        Throws:
        ej.sni.NativeException - on error
      • nativeGetCloseId

        public static int nativeGetCloseId​(int nativeTransformationId)
                                    throws ej.sni.NativeException
        Gets the id of the native close function.
        Parameters:
        nativeTransformationId - ID of the transformation
        Returns:
        the id of the static native close function
        Throws:
        ej.sni.NativeException - on error