org.bitcoinj.crypto.X509Utils.loadKeyStore()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(4.8k)|赞(0)|评价(0)|浏览(77)

本文整理了Java中org.bitcoinj.crypto.X509Utils.loadKeyStore()方法的一些代码示例,展示了X509Utils.loadKeyStore()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。X509Utils.loadKeyStore()方法的具体详情如下:
包路径:org.bitcoinj.crypto.X509Utils
类名称:X509Utils
方法名:loadKeyStore

X509Utils.loadKeyStore介绍

[英]Returns a key store loaded from the given stream. Just a convenience around the Java APIs.
[中]返回从给定流加载的密钥存储。只是为了方便使用Java API。

代码示例

代码示例来源:origin: cash.bitcoinj/bitcoinj-core

@Override
  public KeyStore getKeyStore() throws FileNotFoundException, KeyStoreException {
    return X509Utils.loadKeyStore(DEFAULT_KEYSTORE_TYPE, DEFAULT_KEYSTORE_PASSWORD, new FileInputStream(path));
  }
}

代码示例来源:origin: fr.acinq/bitcoinj-core

@Override
  public KeyStore getKeyStore() throws FileNotFoundException, KeyStoreException {
    return X509Utils.loadKeyStore(DEFAULT_KEYSTORE_TYPE, DEFAULT_KEYSTORE_PASSWORD, new FileInputStream(path));
  }
}

代码示例来源:origin: greenaddress/GreenBits

@Override
  public KeyStore getKeyStore() throws FileNotFoundException, KeyStoreException {
    return X509Utils.loadKeyStore(DEFAULT_KEYSTORE_TYPE, DEFAULT_KEYSTORE_PASSWORD, new FileInputStream(path));
  }
}

代码示例来源:origin: HashEngineering/dashj

@Override
  public KeyStore getKeyStore() throws FileNotFoundException, KeyStoreException {
    return X509Utils.loadKeyStore(DEFAULT_KEYSTORE_TYPE, DEFAULT_KEYSTORE_PASSWORD, new FileInputStream(path));
  }
}

代码示例来源:origin: HashEngineering/dashj

private KeyStore loadFallbackStore() throws FileNotFoundException, KeyStoreException {
    return X509Utils.loadKeyStore("JKS", DEFAULT_KEYSTORE_PASSWORD, getClass().getResourceAsStream("cacerts"));
  }
}

代码示例来源:origin: fr.acinq/bitcoinj-core

private KeyStore loadFallbackStore() throws FileNotFoundException, KeyStoreException {
    return X509Utils.loadKeyStore("JKS", DEFAULT_KEYSTORE_PASSWORD, getClass().getResourceAsStream("cacerts"));
  }
}

代码示例来源:origin: cash.bitcoinj/bitcoinj-core

private KeyStore loadFallbackStore() throws FileNotFoundException, KeyStoreException {
    return X509Utils.loadKeyStore("JKS", DEFAULT_KEYSTORE_PASSWORD, getClass().getResourceAsStream("cacerts"));
  }
}

代码示例来源:origin: greenaddress/GreenBits

private KeyStore loadFallbackStore() throws FileNotFoundException, KeyStoreException {
    return X509Utils.loadKeyStore("JKS", DEFAULT_KEYSTORE_PASSWORD, getClass().getResourceAsStream("cacerts"));
  }
}

代码示例来源:origin: fr.acinq/bitcoinj-core

return X509Utils.loadKeyStore(keystoreType, DEFAULT_KEYSTORE_PASSWORD,
      new FileInputStream(keystorePath));
} catch (FileNotFoundException e) {

代码示例来源:origin: cash.bitcoinj/bitcoinj-core

return X509Utils.loadKeyStore(keystoreType, DEFAULT_KEYSTORE_PASSWORD,
      new FileInputStream(keystorePath));
} catch (FileNotFoundException e) {

代码示例来源:origin: HashEngineering/dashj

return X509Utils.loadKeyStore(keystoreType, DEFAULT_KEYSTORE_PASSWORD,
      new FileInputStream(keystorePath));
} catch (FileNotFoundException e) {

代码示例来源:origin: greenaddress/GreenBits

return X509Utils.loadKeyStore(keystoreType, DEFAULT_KEYSTORE_PASSWORD,
      new FileInputStream(keystorePath));
} catch (FileNotFoundException e) {

代码示例来源:origin: greenaddress/GreenBits

@Before
public void setUp() throws Exception {
  caStore = X509Utils.loadKeyStore("JKS", "password", getClass().getResourceAsStream("test-cacerts"));
  caCert = (X509Certificate) caStore.getCertificate("test-cacert");
}

代码示例来源:origin: greenaddress/GreenBits

@Test(expected = PkiVerificationException.class)
public void testSignAndVerifyExpired() throws Exception {
  Protos.PaymentRequest.Builder paymentRequest = minimalPaymentRequest().toBuilder();
  // Sign
  KeyStore keyStore = X509Utils.loadKeyStore("JKS", "password",
      getClass().getResourceAsStream("test-expired-cert"));
  PrivateKey privateKey = (PrivateKey) keyStore.getKey("test-expired", "password".toCharArray());
  X509Certificate clientCert = (X509Certificate) keyStore.getCertificate("test-expired");
  PaymentProtocol.signPaymentRequest(paymentRequest, new X509Certificate[]{clientCert}, privateKey);
  // Verify
  PaymentProtocol.verifyPaymentRequestPki(paymentRequest.build(), caStore);
}

代码示例来源:origin: greenaddress/GreenBits

@Test
public void testSignAndVerifyValid() throws Exception {
  Protos.PaymentRequest.Builder paymentRequest = minimalPaymentRequest().toBuilder();
  // Sign
  KeyStore keyStore = X509Utils
      .loadKeyStore("JKS", "password", getClass().getResourceAsStream("test-valid-cert"));
  PrivateKey privateKey = (PrivateKey) keyStore.getKey("test-valid", "password".toCharArray());
  X509Certificate clientCert = (X509Certificate) keyStore.getCertificate("test-valid");
  PaymentProtocol.signPaymentRequest(paymentRequest, new X509Certificate[]{clientCert}, privateKey);
  // Verify
  PkiVerificationData verificationData = PaymentProtocol.verifyPaymentRequestPki(paymentRequest.build(), caStore);
  assertNotNull(verificationData);
  assertEquals(caCert, verificationData.rootAuthority.getTrustedCert());
}

相关文章