See Roshith response in stackoverflow.
WebClientOptions.setSSLClientCertificate(URL certificateUrl,String certificatePassword, String certificateType)
To this method can be accessed using a stream (containing the certificate)
To get a card certificate, see also in stackoverflow:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | String pkcs11Config = "name = SmartCard\nlibrary = /path/to/libraby.so"; ByteArrayInputStream confStream = new ByteArrayInputStream(pkcs11Config.getBytes()); Provider prov = new sun.security.pkcs11.SunPKCS11(confStream); Security.addProvider(prov); KeyStore cc = null; String pin = ""; try { cc = KeyStore.getInstance("PKCS11",prov); KeyStore.PasswordProtection pp = new KeyStore.PasswordProtection(pin.toCharArray()); cc.load(null , pp.getPassword() ); Enumeration aliases = cc.aliases(); while (aliases.hasMoreElements()) { Object alias = aliases.nextElement(); try { X509Certificate cert0 = (X509Certificate) cc.getCertificate(alias.toString()); System.out.println("I am: " + cert0.getSubjectDN().getName()); } catch (Exception e) { continue; } } } catch (Exception e) { e.printStackTrace(); } |
No hay comentarios:
Publicar un comentario