Class NativeRSACipherSpi


  • public class NativeRSACipherSpi
    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 nativeDecrypt​(int nativeTransformationId, int nativeId, byte[] buffer, int bufferOffset, int len, byte[] output, int outputOffset)
      Decrypts the message contained in buffer.
      static int nativeEncrypt​(int nativeTransformationId, int nativeId, byte[] buffer, int bufferOffset, int len, byte[] output, int outputOffset)
      Encrypts the message contained in buffer.
      static int nativeGetCloseId​(int nativeTransformationId)
      Gets the id of the native close function.
      static int nativeGetTransformationDescription​(byte[] transformation, byte[] description)
      Gets for the given transformation the cipher description.
      static int nativeInit​(int nativeTransformationId, boolean decrypting, int keyNativeId, int padding, int hash)
      Initializes a Cipher resource.
      • Methods inherited from class java.lang.Object

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

      • NativeRSACipherSpi

        public NativeRSACipherSpi()
    • Method Detail

      • nativeGetTransformationDescription

        public static int nativeGetTransformationDescription​(byte[] transformation,
                                                             byte[] description)
        Gets for the given transformation the cipher description.
        Parameters:
        transformation - Null terminated string that describes the transformation
        description - must be filled-in with:
        Returns:
        transformation ID on success or -1 on error.
      • nativeInit

        public static int nativeInit​(int nativeTransformationId,
                                     boolean decrypting,
                                     int keyNativeId,
                                     int padding,
                                     int hash)
                              throws ej.sni.NativeException
        Initializes a Cipher resource.
        Parameters:
        nativeTransformationId - ID of the transformation
        decrypting - true for decrypting, false for encryting.
        keyNativeId - ID of the key used by the cipher
        padding - padding mode used by the cipher
        hash - hash algorithm used by the cipher
        Returns:
        the nativeId of the newly initialized resource
        Throws:
        ej.sni.NativeException - on error.
      • nativeEncrypt

        public static int nativeEncrypt​(int nativeTransformationId,
                                        int nativeId,
                                        byte[] buffer,
                                        int bufferOffset,
                                        int len,
                                        byte[] output,
                                        int outputOffset)
                                 throws ej.sni.NativeException
        Encrypts the message contained in buffer.
        Parameters:
        nativeTransformationId - ID of the transformation
        nativeId - the resource's native ID
        buffer - the buffer containing the plaintext message to encrypt
        bufferOffset - the buffer offset
        len - the buffer length
        output - the output buffer containing the encrypted message
        outputOffset - the output offset
        Returns:
        the length of the buffer
        Throws:
        ej.sni.NativeException - on error
      • nativeDecrypt

        public static int nativeDecrypt​(int nativeTransformationId,
                                        int nativeId,
                                        byte[] buffer,
                                        int bufferOffset,
                                        int len,
                                        byte[] output,
                                        int outputOffset)
                                 throws ej.sni.NativeException
        Decrypts the message contained in buffer.
        Parameters:
        nativeTransformationId - ID of the transformation
        nativeId - the resource's native ID
        buffer - the buffer containing the message to decrypt
        bufferOffset - the buffer offset
        len - the buffer length
        output - the output buffer containing the plaintext message
        outputOffset - the output offset
        Returns:
        the length of the buffer
        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