Java Code Examples for java.security.KeyStore.Builder#getKeyStore()
The following examples show how to use
java.security.KeyStore.Builder#getKeyStore() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SunPKCS11KeyStoreAdaptor.java From freehealth-connector with GNU Affero General Public License v3.0 | 5 votes |
private void init() throws KeyStoreException { try { Builder ksBuilder = Builder.newInstance("PKCS11", (Provider)null, new CallbackHandlerProtection(EidPinCallBackHandlerFactory.getHandler())); this.keyStore = ksBuilder.getKeyStore(); } catch (TechnicalConnectorException var3) { LOG.error("" + var3); throw new KeyStoreException(var3); } }
Example 2
Source File: SunPKCS11KeyStoreAdaptor.java From freehealth-connector with GNU Affero General Public License v3.0 | 5 votes |
private void init() throws KeyStoreException { try { Builder ksBuilder = Builder.newInstance("PKCS11", (Provider)null, new CallbackHandlerProtection(EidPinCallBackHandlerFactory.getHandler())); this.keyStore = ksBuilder.getKeyStore(); } catch (TechnicalConnectorException var3) { LOG.error("" + var3); throw new KeyStoreException(var3); } }
Example 3
Source File: SunPKCS11KeyStoreAdaptor.java From freehealth-connector with GNU Affero General Public License v3.0 | 5 votes |
private void init() throws KeyStoreException { try { Builder ksBuilder = Builder.newInstance("PKCS11", (Provider)null, new CallbackHandlerProtection(EidPinCallBackHandlerFactory.getHandler())); this.keyStore = ksBuilder.getKeyStore(); } catch (TechnicalConnectorException var3) { LOG.error("" + var3); throw new KeyStoreException(var3); } }
Example 4
Source File: SunPKCS11KeyStoreAdaptor.java From freehealth-connector with GNU Affero General Public License v3.0 | 5 votes |
private void init() throws KeyStoreException { try { Builder ksBuilder = Builder.newInstance("PKCS11", (Provider)null, new CallbackHandlerProtection(EidPinCallBackHandlerFactory.getHandler())); this.keyStore = ksBuilder.getKeyStore(); } catch (TechnicalConnectorException var3) { LOG.error("" + var3); throw new KeyStoreException(var3); } }
Example 5
Source File: SunPKCS11KeyStoreAdaptor.java From freehealth-connector with GNU Affero General Public License v3.0 | 5 votes |
private void init() throws KeyStoreException { try { Builder ksBuilder = Builder.newInstance("PKCS11", (Provider)null, new CallbackHandlerProtection(EidPinCallBackHandlerFactory.getHandler())); this.keyStore = ksBuilder.getKeyStore(); } catch (TechnicalConnectorException var3) { LOG.error("" + var3); throw new KeyStoreException(var3); } }
Example 6
Source File: CAdESSignerTest.java From signer with GNU Lesser General Public License v3.0 | 5 votes |
/** * * Faz a leitura do token em LINUX, precisa setar a lib (.SO) e a senha do token. */ @SuppressWarnings("restriction") private KeyStore getKeyStoreToken() { try { // ATENÇÃO ALTERAR CONFIGURAÇÃO ABAIXO CONFORME O TOKEN USADO // Para TOKEN Branco a linha abaixo String pkcs11LibraryPath = "/usr/lib/watchdata/ICP/lib/libwdpkcs_icp.so"; // Para TOKEN Azul a linha abaixo //String pkcs11LibraryPath = "/usr/lib/libeToken.so"; StringBuilder buf = new StringBuilder(); buf.append("library = ").append(pkcs11LibraryPath).append("\nname = Provedor\n"); Provider p = new sun.security.pkcs11.SunPKCS11(new ByteArrayInputStream(buf.toString().getBytes())); Security.addProvider(p); // ATENÇÃO ALTERAR "SENHA" ABAIXO Builder builder = KeyStore.Builder.newInstance("PKCS11", p, new KeyStore.PasswordProtection("senha".toCharArray())); KeyStore ks; ks = builder.getKeyStore(); return ks; } catch (Exception e1) { e1.printStackTrace(); return null; } finally { } }
Example 7
Source File: CAdESTimeStampSignerTest.java From signer with GNU Lesser General Public License v3.0 | 5 votes |
@SuppressWarnings("restriction") private KeyStore getKeyStoreToken() { try { // ATENÇÃO ALTERAR CONFIGURAÇÃO ABAIXO CONFORME O TOKEN USADO // Para TOKEN Branco a linha abaixo // String pkcs11LibraryPath = // "/usr/lib/watchdata/ICP/lib/libwdpkcs_icp.so"; // Para TOKEN Azul a linha abaixo String pkcs11LibraryPath = "/usr/lib/libeToken.so"; StringBuilder buf = new StringBuilder(); buf.append("library = ").append(pkcs11LibraryPath).append("\nname = Provedor\n"); Provider p = new sun.security.pkcs11.SunPKCS11(new ByteArrayInputStream(buf.toString().getBytes())); Security.addProvider(p); // ATENÇÃO ALTERAR "SENHA" ABAIXO Builder builder = KeyStore.Builder.newInstance("PKCS11", p, new KeyStore.PasswordProtection("senha".toCharArray())); KeyStore ks; ks = builder.getKeyStore(); return ks; } catch (Exception e1) { e1.printStackTrace(); return null; } }
Example 8
Source File: PDFSigner.java From signer with GNU Lesser General Public License v3.0 | 5 votes |
/** * * Faz a leitura do token em LINUX, precisa setar a lib (.SO) e a senha do token. */ @SuppressWarnings("restriction") private KeyStore getKeyStoreToken() { try { // ATENÇÃO ALTERAR CONFIGURAÇÃO ABAIXO CONFORME O TOKEN USADO // Para TOKEN Branco a linha abaixo // String pkcs11LibraryPath = // "/usr/lib/watchdata/ICP/lib/libwdpkcs_icp.so"; // Para TOKEN Azul a linha abaixo String pkcs11LibraryPath = "/usr/lib/libeToken.so"; StringBuilder buf = new StringBuilder(); buf.append("library = ").append(pkcs11LibraryPath).append("\nname = Provedor\n"); Provider p = new sun.security.pkcs11.SunPKCS11(new ByteArrayInputStream(buf.toString().getBytes())); Security.addProvider(p); // ATENÇÃO ALTERAR "SENHA" ABAIXO Builder builder = KeyStore.Builder.newInstance("PKCS11", p, new KeyStore.PasswordProtection("senha".toCharArray())); KeyStore ks; ks = builder.getKeyStore(); return ks; } catch (Exception e1) { e1.printStackTrace(); return null; } finally { } }