WSDL client authentication and multiple certificates


other:

So I'm having issues with wsdls here, with multiple certificates selected in Java. For example, a smart card has multiple certificates on it for signing, encryption and identification. I have a WSDL that generates code for client auth connections, but as far as I know you can set the path to the keystore by setting a property to the wsdl like this

  System.setProperty("javax.net.ssl.keyStore",
    keyStore);
  System.setProperty("javax.net.ssl.keyStorePassword",
    keyStorePassword);

I am following this tutorial . Now, with multiple certificates in a keystore (e.g. a smart card), this presents a problem because there is no way to specify which WHICH certificate to use on that smart card. The wsdl seems to pick the first certificate in the keystore, which is probably the wrong certificate for authentication.

My question is 2x:

  1. Is there any other way than doing an action System.setPropertyto tell the wsdl which certificate to use ? Since most of the code is generated using wsdl, how can I specify which certificate wsconsume?

  2. System.setProperty()Only the paths you specify will be allowed. Is there a way to specify an object? The way I get the certificate from the smart card is to use the SunPKCS11 class (as shown here ). However, as far as I can tell, this returns a keystore object and requires System.setProperty()a path.

thank you for your help!

other:

I finally found the answer to my question. Remember, I'm using CXF.

So when I call wsdl2java on wsdl I get a bunch of generated code. In particular, there are two files that deal with authorization, called Authorization and AuthorizationService. In my code, in order to call these links, I do the following

AuthorizationService authSvc = new AuthorizationService();
Authorization authWs = authSvc.getAuthorizationPort();

At this point, you need to construct your own keyManager and trustmanager by creating a new keystore from the chosen certificate. A good place to get started is this

Then you need to construct TLSClientParameters

TLSClientParameters params = new TLSClientParameters();
params.setKeyManagers(keyManagers);
params.setTrustManagers(trustManagers);

Then create your HTTPConduit.

HTTPConduit conduit = (HTTPConduit) ClientProxy.getClient(authWs).getConduit();
conduit.setTlsClientParameters(params);

Then you can use the web service with the certificate of the user's choice.

Related


WSDL client authentication and multiple certificates

other: So I'm having issues with wsdls here, with multiple certificates selected in Java. For example, a smart card has multiple certificates on it for signing, encryption and identification. I have a WSDL that generates code for client auth connections, but a

WSDL client authentication and multiple certificates

other: So I'm having issues with wsdls here, with multiple certificates selected in Java. For example, a smart card has multiple certificates on it for signing, encryption and identification. I have a WSDL that generates code for client auth connections, but a

Nginx client authentication using multiple client certificates

Jonathan Nagin I'm trying to setup NGINX to perform client authentication for multiple clients. My problem is that those clients will have different certificates, basically different root CAs: [clientA.crt] ClientA > IntermediateA > RootA [clientB.crt] ClientB

Nginx client authentication using multiple client certificates

Jonathan Nagin I'm trying to setup NGINX to perform client authentication for multiple clients. My problem is that those clients will have different certificates, basically different root CAs: [clientA.crt] ClientA > IntermediateA > RootA [clientB.crt] ClientB

Nginx client authentication using multiple client certificates

Jonathan Nagin I'm trying to setup NGINX to perform client authentication for multiple clients. My problem is that those clients will have different certificates, basically different root CAs: [clientA.crt] ClientA > IntermediateA > RootA [clientB.crt] ClientB

AWS Multiple VPN Client Certificates

Ludo21 South With AWS, I need to make sure I have multiple clients using the VPN network. Each client will use the same server certificate I created earlier. Now, using this document, I managed to set up my own VPN and was able to connect to it using the gener

AWS Multiple VPN Client Certificates

Ludo21 South With AWS, I need to make sure I have multiple clients using the VPN network. Each client will use the same server certificate I created earlier. Now, using this document, I managed to set up my own VPN and was able to connect to it using the gener

AWS Multiple VPN Client Certificates

Ludo21 South With AWS, I need to make sure I have multiple clients using the VPN network. Each client will use the same server certificate I created earlier. Now, using this document, I managed to set up my own VPN and was able to connect to it using the gener

AWS Multiple VPN Client Certificates

Ludo21 South With AWS, I need to make sure I have multiple clients using the VPN network. Each client will use the same server certificate I created earlier. Now, using this document, I managed to set up my own VPN and was able to connect to it using the gener

Generate server and client certificates with multiple hostnames

Naftuli Kay When you start the Puppet Master for the first time, it automatically generates its own server certificate, which is awesome. My server's hostname is kungfumasterand the Puppet Master generates a certificate with a common name of: kungfumaster.myne

Generate server and client certificates with multiple hostnames

Naftuli Kay When you start the Puppet Master for the first time, it automatically generates its own server certificate, which is awesome. My server's hostname is kungfumasterand the Puppet Master generates a certificate with a common name of: kungfumaster.myne

Using multiple SSL client certificates with the same host in Java

cwick: In my Java application, I need to connect to the same host using SSL, but using a different certificate each time. The reason I need to use a different certificate is that the remote site uses the userid attribute embedded in the certificate to identify