Examples of GnuPublicKeyring


Examples of gnu.javax.crypto.keyring.GnuPublicKeyring

  private static final String ALIAS = "verisignclass1ca";

  public void test(final TestHarness harness)
  {
    harness.checkPoint("TestOfPublicKeyring");
    final GnuPublicKeyring kr = new GnuPublicKeyring();
    try
      {
        final Map attributes = new HashMap();
        attributes.put(IKeyring.KEYRING_DATA_IN,
                       new ByteArrayInputStream(keyring));
        attributes.put(IKeyring.KEYRING_PASSWORD, "password".toCharArray());

        Security.addProvider(new Gnu());

        kr.load(attributes);
        harness.check(true, "load(...)");

        harness.check(kr.containsCertificate(ALIAS), "containsCertificate(...)");

        final List list = kr.get(ALIAS);
        harness.check(list.size() == 1, "get(...).size() == 1");

        final Certificate cert = kr.getCertificate(ALIAS);
        harness.check(cert != null, "getCertificate(...) != null");

//        System.out.println("cert="+cert);
      }
    catch (Exception x)
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.