Examples of IKeyPairCodec


Examples of gnu.java.security.key.IKeyPairCodec

  {
    harness.checkPoint("testKeyPairRawCodec");

    kp = kpg.generate();

    IKeyPairCodec codec = new DSSKeyPairRawCodec();
    byte[] pk;

    DSAPublicKey pubK = (DSAPublicKey) kp.getPublic();
    pk = ((DSSPublicKey) pubK).getEncoded(IKeyPairCodec.RAW_FORMAT);
    PublicKey newPubK = codec.decodePublicKey(pk);
    harness.check(pubK.equals(newPubK),
                  "DSS public key Raw encoder/decoder test");

    DSAPrivateKey secK = (DSAPrivateKey) kp.getPrivate();
    pk = ((DSSPrivateKey) secK).getEncoded(IKeyPairCodec.RAW_FORMAT);
    PrivateKey newSecK = codec.decodePrivateKey(pk);
    harness.check(secK.equals(newSecK),
                  "DSS private key Raw encoder/decoder test");
  }
View Full Code Here

Examples of gnu.java.security.key.IKeyPairCodec

  }

  private IKeyPairCodec getCodec(TestHarness harness, String codecName)
  {
    String msg = "Key-pair codec \"" + codecName + "\" MUST succeed";
    IKeyPairCodec result = null;
    try
      {
        result = KeyPairCodecFactory.getInstance(codecName);
        harness.check(result != null, msg);
        return result;
View Full Code Here

Examples of gnu.java.security.key.IKeyPairCodec

  public void testKeyPairRawCodec(TestHarness harness)
  {
    harness.checkPoint("testKeyPairRawCodec");

    byte[] pk;
    IKeyPairCodec codec = new RSAKeyPairRawCodec();
    kp = kpg.generate();

    RSAPublicKey pubK = (RSAPublicKey) kp.getPublic();
    pk = ((GnuRSAPublicKey) pubK).getEncoded(IKeyPairCodec.RAW_FORMAT);
    PublicKey newPubK = codec.decodePublicKey(pk);
    harness.check(pubK.equals(newPubK),
                  "RSA public key Raw encoder/decoder test");

    RSAPrivateKey secK = (RSAPrivateKey) kp.getPrivate();
    pk = ((GnuRSAPrivateKey) secK).getEncoded(IKeyPairCodec.RAW_FORMAT);
    PrivateKey newSecK = codec.decodePrivateKey(pk);
    harness.check(secK.equals(newSecK),
                  "RSA private key Raw encoder/decoder test");
  }
View Full Code Here

Examples of gnu.java.security.key.IKeyPairCodec

    byte[] pk1, pk2;

    pk1 = ((GnuDHPublicKey) pubK).getEncoded(IKeyPairCodec.RAW_FORMAT);
    pk2 = ((GnuDHPrivateKey) secK).getEncoded(IKeyPairCodec.RAW_FORMAT);

    IKeyPairCodec codec = new DHKeyPairRawCodec();
    PublicKey newPubK = codec.decodePublicKey(pk1);
    PrivateKey newSecK = codec.decodePrivateKey(pk2);

    harness.check(pubK.equals(newPubK),
                  "DH public key Raw encoder/decoder test");
    harness.check(secK.equals(newSecK),
                  "DH private key Raw encoder/decoder test");
View Full Code Here

Examples of gnu.java.security.key.IKeyPairCodec

      }

    pk1 = ((SRPPublicKey) pubK).getEncoded(IKeyPairCodec.RAW_FORMAT);
    pk2 = ((SRPPrivateKey) secK).getEncoded(IKeyPairCodec.RAW_FORMAT);

    IKeyPairCodec codec = new SRPKeyPairRawCodec();
    PublicKey newPubK = codec.decodePublicKey(pk1);
    PrivateKey newSecK = codec.decodePrivateKey(pk2);

    harness.check(pubK.equals(newPubK),
                  "SRP public key Raw encoder/decoder test");
    harness.check(secK.equals(newSecK),
                  "SRP private key Raw encoder/decoder test");
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.