JavaKeyStore extends AbstractKeyStore implements KeyStore { @Override public Signer load(final Authentication authentication) { try { assertNotNull(authentication, "Authentication must not null"); logger.debug("Load with authentication: {}", authentication); java.security.Key rawKey; synchronized (lock) { if (!isExists(authentication)) { throw new InvalidAuthenticationException("Invalid authentication"); } rawKey = loadRawKey(authentication); } final AergoKey aergoKey = convertPrivateKey(rawKey); logger.trace("Loaded key: {}", aergoKey); return aergoKey; } catch (Exception e) { throw converter.convert(e); } } JavaKeyStore(final java.security.KeyStore delegate); @Deprecated  JavaKeyStore(final String type); @Deprecated  JavaKeyStore(final String type, final java.security.Provider provider); @Deprecated  JavaKeyStore(final String type, final InputStream inputStream, final char[] password);  JavaKeyStore(final String type, final java.security.Provider provider,
      final InputStream inputStream, final char[] password); @Override void save(final Authentication authentication, final AergoKey key); @Override Signer load(final Authentication authentication); @Override void remove(final Authentication authentication); @Override EncryptedPrivateKey export(final Authentication authentication, final String password); @Override List<Identity> listIdentities(); @Override void store(final String path, final char[] password);  }
@Test public void testLoadExistingOne() { final InputStream in = open("keystore.p12"); final String ksPassword = "password"; final JavaKeyStore keyStore = new JavaKeyStore("PKCS12", in, ksPassword.toCharArray()); final KeyAlias alias = new KeyAlias("keyalias"); final String keyPassword = "password"; final Authentication authentication = Authentication.of(alias, keyPassword); final Signer signer = keyStore.load(authentication); logger.info("Signer: {}", signer); assertNotNull(signer); }