Java exception client authentication TLS: password must not be null

luca

i have wrote this code to communicate with ejbca(JBoss 5.1.0.GA-jdk6 and EJBCA 4.0.10. and openjdk-6-jdk ) server:

CryptoProviderTools.installBCProvider();    
String urlstr = "https://ejbca05:8443/ejbca/ejbcaws/ejbcaws?wsdl";

System.setProperty("javax.net.ssl.trustStore","C:\\Users\\l.\\keystore.jks"); 
System.setProperty("javax.net.ssl.trustStorePassword","provae); 
System.setProperty("javax.net.ssl.keyStore","C:\\Users\\l.\\keystore.jks");
System.setProperty("javax.net.sslews.keyStorePassword","provae"); 
QName qname = new QName("http://ws.protocol.core.ejbca.org/", "EjbcaWSService");
EjbcaWSService service = null;
try {
    service = new EjbcaWSService(new URL(urlstr),qname);
} catch (MalformedURLException e) {
    // TODO Auto-generated catch block
    System.out.println("errore nell'url");
}
EjbcaWS ejbcaraws = service.getEjbcaWSPort(); 

but I have this exception:

Exception in thread "main" javax.xml.ws.WebServiceException: Failed to access the WSDL at: https://ejbca05:8443/ejbca/ejbcaws/ejbcaws?wsdl. It failed with: 
    Got java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext) while opening stream from https://ejbca05:8443/ejbca/ejbcaws/ejbcaws?wsdl.
    at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.tryWithMex(RuntimeWSDLParser.java:173)
..........
.......
Caused by: java.security.UnrecoverableKeyException: Password must not be null
    at sun.security.provider.JavaKeyStore.engineGetKey(JavaKeyStore.java:124)
    at sun.security.provider.JavaKeyStore$JKS.engineGetKey(JavaKeyStore.java:55)
    at java.security.KeyStore.getKey(KeyStore.java:792)

The keystore is superadmin.p12 converted in jks....i have tried also with other keystore created with ejbca or with keytool but i obtain the same error. Anyone know why?

luca

using this code seems to work

String urlstr = "https://ejbca05.prv:8443/ejbca/ejbcaws/ejbcaws?wsdl";
        System.setProperty("javax.net.ssl.trustStore","C:/Users/l./Downloads/truststore.jks");
        System.setProperty("javax.net.ssl.trustStorePassword","provae");
        System.setProperty("javax.net.ssl.keyStore","C:/Users/l./Downloads/superadmin.p12");
        System.setProperty("javax.net.ssl.keyStoreType", "pkcs12");
        System.setProperty("javax.net.ssl.keyStorePassword","provae");

maybe converting p12 to jks keystore was not working properly.

EDIT: it is possible convervet to jks with this command

keytool -importkeystore -srckeystore [MY_FILE.p12] -srcstoretype pkcs12
 -srcalias [ALIAS_SRC] -destkeystore [MY_KEYSTORE.jks]
 -deststoretype jks -deststorepass [PASSWORD_JKS] -destalias [ALIAS_DEST]

本文收集自互联网,转载请注明来源。

如有侵权,请联系debugcn@gmail.com 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

FATAL: password authentication failed for user "postgres"

来自分类Dev

如何使TLS与Java一起使用?

来自分类Dev

com.dropbox.client2.exception.DropboxUnlinkedException

来自分类Dev

从Java代码执行Cypher查询时出现Null Exception错误。(Neo4J)

来自分类Dev

Symfony\Component\DependencyInjection\Exception\InvalidArgumentException The parameter "..." must be defined

来自分类Dev

getFragmentManager returning null pointer exception

来自分类Dev

TCP Server and Client java

来自分类Dev

Is it more Java-thonic to throw an exception or return null?

来自分类Dev

是否接受带有http-client-tls或tls的特定证书?

来自分类Dev

NSURLSessionTask authentication challenge completionHandler and NSURLAuthenticationChallenge client

来自分类Dev

Java - SSLServerSocket with only TLS

来自分类Dev

Java-仅带TLS的SSLServerSocket

来自分类Dev

Java HttpsURLConnection和TLS 1.2

来自分类Dev

Java Elasticsearch Client始终为null

来自分类Dev

将null传递给java中的重载方法 重载的变量是Exception类型

来自分类Dev

Authentication for ServiceStack JavaScript Server Events Client

来自分类Dev

Correct way of handling Node.js TLS server and C TLS client (openSSL) connections

来自分类Dev

Postgres password authentication fails

来自分类Dev

Java的11 +铬/火狐= TLS解密错误

来自分类Dev

AWS DocumentDB TLS与Java的连接

来自分类Dev

Mysql2 :: Client :: LONG_PASSWORD(NameError)

来自分类Dev

NOT NULL约束失败:auth_user.password

来自分类Dev

Java Bouncy Castle TLS协议版本顺序?

来自分类Dev

com.dropbox.client2.exception.DropboxUnlinkedException

来自分类Dev

FreeBSD 11端口acme-client的tls握手失败

来自分类Dev

Automatize One-Time-Password Authentication

来自分类Dev

client.getInputStream返回null

来自分类Dev

Java中MQTT的TLS / SSL连接

来自分类Dev

使用某些JDK重置Java TLS连接

Related 相关文章

  1. 1

    FATAL: password authentication failed for user "postgres"

  2. 2

    如何使TLS与Java一起使用?

  3. 3

    com.dropbox.client2.exception.DropboxUnlinkedException

  4. 4

    从Java代码执行Cypher查询时出现Null Exception错误。(Neo4J)

  5. 5

    Symfony\Component\DependencyInjection\Exception\InvalidArgumentException The parameter "..." must be defined

  6. 6

    getFragmentManager returning null pointer exception

  7. 7

    TCP Server and Client java

  8. 8

    Is it more Java-thonic to throw an exception or return null?

  9. 9

    是否接受带有http-client-tls或tls的特定证书?

  10. 10

    NSURLSessionTask authentication challenge completionHandler and NSURLAuthenticationChallenge client

  11. 11

    Java - SSLServerSocket with only TLS

  12. 12

    Java-仅带TLS的SSLServerSocket

  13. 13

    Java HttpsURLConnection和TLS 1.2

  14. 14

    Java Elasticsearch Client始终为null

  15. 15

    将null传递给java中的重载方法 重载的变量是Exception类型

  16. 16

    Authentication for ServiceStack JavaScript Server Events Client

  17. 17

    Correct way of handling Node.js TLS server and C TLS client (openSSL) connections

  18. 18

    Postgres password authentication fails

  19. 19

    Java的11 +铬/火狐= TLS解密错误

  20. 20

    AWS DocumentDB TLS与Java的连接

  21. 21

    Mysql2 :: Client :: LONG_PASSWORD(NameError)

  22. 22

    NOT NULL约束失败:auth_user.password

  23. 23

    Java Bouncy Castle TLS协议版本顺序?

  24. 24

    com.dropbox.client2.exception.DropboxUnlinkedException

  25. 25

    FreeBSD 11端口acme-client的tls握手失败

  26. 26

    Automatize One-Time-Password Authentication

  27. 27

    client.getInputStream返回null

  28. 28

    Java中MQTT的TLS / SSL连接

  29. 29

    使用某些JDK重置Java TLS连接

热门标签

归档