Class NativeSecretKeyFactorySpi


  • public class NativeSecretKeyFactorySpi
    extends java.lang.Object
    NativeSecretKeyFactoryGenerator Service Provider Mock
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int nativeGetAlgorithm​(byte[] algorithmBytes)
      Get the supported algorithm native ID.
      static int nativeGetCloseId​(int algorithmId)
      Gets the id of the native close function.
      static int nativeGetKeyData​(int algorithmId, byte[] password, int passwordLength, byte[] salt, int saltLength, int iterations, int keyLength)
      Generate a Password Based Encryption Key from the encoded key format.
      • Methods inherited from class java.lang.Object

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

      • NativeSecretKeyFactorySpi

        public NativeSecretKeyFactorySpi()
    • Method Detail

      • nativeGetAlgorithm

        public static int nativeGetAlgorithm​(byte[] algorithmBytes)
        Get the supported algorithm native ID.
        Parameters:
        algorithmBytes - Null terminated string that describes the algorithm
        Returns:
        algorithm ID on success or -1 on error.
      • nativeGetKeyData

        public static int nativeGetKeyData​(int algorithmId,
                                           byte[] password,
                                           int passwordLength,
                                           byte[] salt,
                                           int saltLength,
                                           int iterations,
                                           int keyLength)
        Generate a Password Based Encryption Key from the encoded key format.
        Parameters:
        algorithmId - the algorithm ID
        password - the password to encode, a null terminated '\0' byte array representation of the format in String
        passwordLength - the length of password
        salt - salty
        saltLength - salty
        iterations - number of iterations
        keyLength - the length of encodedKey to generate (in bits)
        Returns:
        the pointer of the C structure holding the key data
        Throws:
        ej.sni.NativeException - on error
      • nativeGetCloseId

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