/** * @return A Key store object of this type. Never <code>null</code>. * @throws KeyStoreException * if no Provider supports a KeyStoreSpi implementation for the * specified type. */ @Nonnull default KeyStore getKeyStore () throws KeyStoreException { return KeyStore.getInstance (getID ()); }
@Nonnull public KeyStore createNewKeyStore (@Nonnull final IKeyStoreType aKeyStoreType) throws KeyStoreException, NoSuchProviderException { try { // Try with BouncyCastle first (e.g. PKCS12) // Important, because JDK PKCS12 is partially case insensitive return aKeyStoreType.getKeyStore (m_sSecurityProviderName); } catch (final Exception ex) { // Try native (e.g. for JKS) return aKeyStoreType.getKeyStore (); } }
/** * @param aProvider * Security provider to be used. E.g. for BouncyCastle. May not be * <code>null</code>. * @return A Key store object of this type. Never <code>null</code>. * @throws KeyStoreException * if no Provider supports a KeyStoreSpi implementation for the * specified type. */ @Nonnull default KeyStore getKeyStore (@Nonnull final Provider aProvider) throws KeyStoreException { return KeyStore.getInstance (getID (), aProvider); } }
final KeyStore aKeyStore = aKeyStoreType.getKeyStore (); aKeyStore.load (aIS, aKeyStorePassword); return aKeyStore;
/** * @param sProvider * Security provider to be used. E.g. for BouncyCastle. May neither be * <code>null</code> nor empty. * @return A Key store object of this type. Never <code>null</code>. * @throws KeyStoreException * if no Provider supports a KeyStoreSpi implementation for the * specified type. * @exception NoSuchProviderException * if the specified provider is not registered in the security * provider list. */ @Nonnull default KeyStore getKeyStore (@Nonnull @Nonempty final String sProvider) throws KeyStoreException, NoSuchProviderException { return KeyStore.getInstance (getID (), sProvider); }
@Nonnull protected AS4CryptoFactory internalCreateCryptoFactory () { _checkKeyStoreAttributes (); final ICommonsMap <String, String> aCryptoProps = new CommonsLinkedHashMap <> (); aCryptoProps.put ("org.apache.wss4j.crypto.provider", org.apache.wss4j.common.crypto.Merlin.class.getName ()); aCryptoProps.put ("org.apache.wss4j.crypto.merlin.keystore.file", getKeyStoreResource ().getPath ()); aCryptoProps.put ("org.apache.wss4j.crypto.merlin.keystore.type", getKeyStoreType ().getID ()); aCryptoProps.put ("org.apache.wss4j.crypto.merlin.keystore.password", getKeyStorePassword ()); aCryptoProps.put ("org.apache.wss4j.crypto.merlin.keystore.alias", getKeyStoreAlias ()); aCryptoProps.put ("org.apache.wss4j.crypto.merlin.keystore.private.password", getKeyStoreKeyPassword ()); return new AS4CryptoFactory (aCryptoProps); }