I'm trying to write a Java application for digitally signing documents using a bit4Id miniLector token.
I'm in a Linux development environment.
The token is correctly installed, I can sign my documents also with the app downloaded from the manufacturer, but I have to write a new one for other purposes. The driver used is located at
/usr/lib/x86_64-linux-gnu/engines-1.1/pkcs11.so
I'm stuck with this error:
/usr/lib/jvm/jdk1.8.0_111/bin/java ...
Exception in thread "main" java.security.ProviderException: Initialization failed
at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:376)
at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:103)
at com.itextpdf.samples.signatures.chapter02.C2_01_SignHelloWorld.main
(C2_01_SignHelloWorld.java:83)
Caused by: java.io.IOException: ERROR: C_GetFunctionList == NULL
at sun.security.pkcs11.wrapper.PKCS11.connect(Native Method)
at sun.security.pkcs11.wrapper.PKCS11.<init>(PKCS11.java:138)
at sun.security.pkcs11.wrapper.PKCS11.getInstance(PKCS11.java:151)
at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:313)
... 2 more
The provider is listed in $JAVA_HOME/jre/lib/security/java.security file as:
security.provider.10=sun.security.pkcs11.SunPKCS11
The code behaving this way is this:
String configFile = "/opt/bar/cfg/pkcs11.cfg";
Provider provider = new sun.security.pkcs11.SunPKCS11(configFile); <-- line 83
The needed libraries are all imported by my IDE and I have no compile/link errors.
I didn't find this exact type of error in hours of googling.
If you need any further information let me know, any kind help is very appreciated, thanks.
For visual clarity I add all missing information with respect to the original question here below
Updates
Content of the pkcs11.cfg file:
$ cat /opt/bar/cfg/pkcs11.cfg
name="bit4id miniLector-EVO"
library=/usr/lib/x86_64-linux-gnu/engines-1.1/pkcs11.so
Ok, I got it.
The problem is the driver.
Replacing
/usr/lib/x86_64-linux-gnu/engines-1.1/pkcs11.so
with
/opt/Firma4NG/System/Firma4NG_Linux/Firma4/drivers/mu-x64/libbit4xpki.so
that is one of the manufacturer's driver, now I can go further and, for example, dumping all info about the card:
Information for provider SunPKCS11-bit4id miniLector-EVO
Library info:
cryptokiVersion: 2.20
manufacturerID: bit4id srl
flags: 0
libraryDescription: bit4id PKCS#11
libraryVersion: 1.02
...
This question can be closed.
hi i use this project in my app :
https://github.com/schwabe/ics-openvpn
and write a vpn application
its work fine on all android version because on android 10 i give this error on logcat :
2020-04-01 01:47:56.914 2540-2839/com.vpnfree.approid I/OpenVPN: Starting openvpn
2020-04-01 01:47:56.920 2540-2839/com.vpnfree.approid E/OpenVPN: OpenVPNThread Got java.lang.NullPointerException: Attempt to invoke virtual method 'void java.lang.Process.destroy()' on a null object reference
2020-04-01 01:47:56.920 2540-2839/com.packagename.approid E/level: LEVEL_NOTCONNECTED
2020-04-01 01:47:56.959 2540-2839/com.packagename.approid I/OpenVPN: Exiting
It's not working because when you call destroy(), you are calling it on a null object. This is throwing an NPE can preventing you from connecting.
This null pointer exception can be the result of process builder starting a new process by loading a binary from assets which is not supported by android.
You can confirm this case by using e.printStackTrace(); in catch clause near line 187 - line 188 of method private void startOpenVPNThreadArgs(String[] argv) which can be found in OpenVPNThread.java.
If you get error 13 in your log cat like this:
java.io.IOException: Cannot run program "...": error=13, Permission denied
Then you might be using older version of ics-openvpn. In this case please refer to this:
My answer to: "Creating VPN by using OpenVPN"
My comment on the "What change in API 29" issue in the schwabe /
ics-openvpn GitHub repository
I hope that this will resolve your issue.
android:extractNativeLibs="true"
tools:replace="android:extractNativeLibs"
Add This Two Lines In Your Manifest Application
I'm trying to profile a Java stored proc inside an Oracle DB. My user has been granted role JMXSERVER, but when I run call dbms_java.start_jmx_agent('22222', 'false', 'false'); I get:
ORA-29532: Java call terminated by uncaught Java exception: java.lang.RuntimeException: java.lang.RuntimeException: Management agent class failed
ORA-06512: at "SYS.DBMS_JAVA", line 803
ORA-06512: at "SYS.DBMS_JAVA", line 812
ORA-06512: at line 1
I've traced the error to this line in JDK: https://github.com/frohoff/jdk8u-dev-jdk/blob/master/src/share/classes/sun/management/Agent.java#L483, and the exception details are printed to System.err, but where does Oracle write its stderr to?
You have to redirect the output like this:
select DBMS_JAVA.SET_OUTPUT_TO_SQL('1', 'begin dbms_output.put_line(:1); end;','TEXT') from dual;
Then the error will be printed to the SQL session output. In my case the culprit was a missing file javavm//lib/management/management.properties, so I went to server admins.
You can also redirect the Java System.out and System.err to DBMS_OUTPUT:
dbms_java.set_output(100);
By the way, I tried the DBMS_JAVA.SET_OUTPUT_TO_SQL function as provided by Alexey but it failed with "Parameter 2 has invalid SQL" error. Did it work for you?
I am working on a java project in which i have to communicate with the ejabberd (create/delete a jabber user etc.. ) xmpp server. From the different suggestions available in the internet I understood that xml rpc one method to achieve that.
I tried to install the mod_xmlrpc as per the suggesions in this thread. Error while starting ejabberd with xml_rpc
But I had failed to start the ejabberd after configuration of mod_xmlrpc. The ejabberd log says,
=ERROR REPORT==== 2015-03-15 20:23:27 ===
C(<0.42.0>:gen_mod:75) : Problem starting the module mod_adhoc for host "example.com"
options: []
exit: {noproc,
{gen_server,call,
[ejabberd_iq_sup,
{start_child,["example.com",mod_adhoc,process_local_iq]},
infinity]}}
=ERROR REPORT==== 2015-03-15 20:23:27 ===
C(<0.42.0>:gen_mod:80) : ejabberd initialization was aborted because a module start failed.
and the erlang log says,
=CRASH REPORT==== 15-Mar-2015::20:23:27 ===
crasher:
initial call: supervisor:ejabberd_listener/1
pid: <0.270.0>
registered_name: []
exception exit: {undef,
[{ejabberd_xmlrpc,socket_type,[],[]},
{ejabberd_listener,'-bind_tcp_ports/0-fun-0-',1,
[{file,"ejabberd_listener.erl"},{line,63}]},
{lists,foreach,2,[{file,"lists.erl"},{line,1323}]},
{ejabberd_listener,init,1,
[{file,"ejabberd_listener.erl"},{line,52}]},
{supervisor,init,1,
[{file,"supervisor.erl"},{line,239}]},
{gen_server,init_it,6,
[{file,"gen_server.erl"},{line,304}]},
{proc_lib,init_p_do_apply,3,
[{file,"proc_lib.erl"},{line,239}]}]}
in function gen_server:init_it/6 (gen_server.erl, line 328)
ancestors: [ejabberd_sup,<0.42.0>]
messages: []
links: [#Port<0.3747>,<0.234.0>,#Port<0.3744>]
dictionary: []
trap_exit: true
status: running
heap_size: 987
stack_size: 27
reductions: 1215
neighbours:
=SUPERVISOR REPORT==== 15-Mar-2015::20:23:27 ===
Supervisor: {local,ejabberd_sup}
Context: start_error
Reason: {undef,
[{ejabberd_xmlrpc,socket_type,[],[]},
{ejabberd_listener,'-bind_tcp_ports/0-fun-0-',1,
[{file,"ejabberd_listener.erl"},{line,63}]},
{lists,foreach,2,[{file,"lists.erl"},{line,1323}]},
{ejabberd_listener,init,1,
[{file,"ejabberd_listener.erl"},{line,52}]},
{supervisor,init,1,[{file,"supervisor.erl"},{line,239}]},
{gen_server,init_it,6,
[{file,"gen_server.erl"},{line,304}]},
{proc_lib,init_p_do_apply,3,
[{file,"proc_lib.erl"},{line,239}]}]}
Offender: [{pid,undefined},
{name,ejabberd_listener},
{mfargs,{ejabberd_listener,start_link,[]}},
{restart_type,permanent},
{shutdown,infinity},
{child_type,supervisor}]
Since I am a newbie to the ejabberd & erlang world I am finding it hard to track the root cause. Please help me to identify the root cause of this crash.
BTW is there any other method for communicating with ejabberd (create/delete a jabber user etc..) from java services ?
The erlang log says that it can't find the function socket_type with no argument in the module ejabberd_xmlrpc. As it is a valid call, and both the module and function exist in the application ejabberd, this means that something went wrong during installation (compilation fails, wrong path ???)
I am basically walking the LDAP tree in Active Directory.
At each level I query for "(objectClass=*)". When I do this on the root eg "dc=example,dc=com" I get the exception below. This works fine on our other LDAP instances. For some reason only on our Active Directory server I get this exception. I also get the same exception when using JXplorer on our Active Directory server.
From reading around online I found people saying you should turn on following, not sure what that means... So on my controls object (javax.naming.directory.SearchControls) that I pass with the query I call searchControls.setDerefLinkFlag(true). I also have tried setting it to false with the same result. Any a suggestions on what else could cause this? Maybe how I could fix it?
Note: In this post I changed the baseDn from dc=<my company domain> to example for my companies privacy.
javax.naming.PartialResultException: Unprocessed Continuation Reference(s); remaining name 'dc=example,dc=com'
at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2820)
at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2794)
at com.sun.jndi.ldap.LdapCtx.searchAux(LdapCtx.java:1826)
at com.sun.jndi.ldap.LdapCtx.c_search(LdapCtx.java:1749)
at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_search(ComponentDirContext.java:368)
at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(PartialCompositeDirContext.java:338)
at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(PartialCompositeDirContext.java:321)
at javax.naming.directory.InitialDirContext.search(InitialDirContext.java:248)
at com.motio.pi.gui.panels.useraccess.ldap.LDAPConnector.query(LDAPConnector.java:262)
at com.motio.pi.gui.selector.directory.CognosDirectoryBrowserController.expandCognosTreeNode(CognosDirectoryBrowserController.java:99)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.motio.pi.utils.PIThreadDelegate$1.run(PIThreadDelegate.java:54)
at java.lang.Thread.run(Thread.java:662)
So when I was creating my naming context with the method:
javax.naming.ldap.InitialLdapContext.InitialLdapContext(
Hashtable<?, ?> environment, Control[] connCtls)
In the argument environment there is a property with the name Context.REFERRAL and its value should be set to: follow. This was the setting that I needed.
If you get an exception while referral usage in follow (for example: connection timed out) you can use referral ignore but you dont want to get partial exception you can use 3268 port number instead of 389 this port is using global catalog for ldap. You can find info from following link;
https://technet.microsoft.com/en-us/library/how-global-catalog-servers-work(v=ws.10).aspx