Arun Michael:
Tengo que llamar a un archivo DLL advapi32.dll en java para que pueda utilizar su CryptEncrypt función de cifrado. ¿Es posible acceder a las funciones de los archivos DLL a través de JNI o hay otras maneras mejores
advapi32.dll se encuentra en system32 de ventanas
He intentado utilizar
System.loadLibrary("advapi32");
y
Runtime.getRuntime().loadLibrary("C:/Windows/System32/crypt32.dll");
Runtime.getRuntime (). LoadLibrary () dando los siguientes errores
Exception in thread "main" java.lang.UnsatisfiedLinkError: no C:/Windows/System32/crypt32.dll in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.Runtime.loadLibrary(Unknown Source)
at mail.encrypt.main(encrypt.java:17)
Shizhen:
Especificar la ruta lib mediante el siguiente comando
java -Djava.library.path=C:/Windows/System32/
O utilizar a continuación la piratería camino dentro de código
System.setProperty( "java.library.path", "C:/Windows/System32/" );
Field fieldSysPath = ClassLoader.class.getDeclaredField("sys_paths");
fieldSysPath.setAccessible( true );
fieldSysPath.set( null, null );