Examples of SRPPrivateKey


Examples of gnu.javax.crypto.key.srp6.SRPPrivateKey

  {
    harness.checkPoint("TestOfSRPCodec.testKeyPairRawCodec");
    setUp();

    SRPPublicKey pubK = (SRPPublicKey) kp.getPublic();
    SRPPrivateKey secK = (SRPPrivateKey) kp.getPrivate();

    byte[] pk1, pk2;
    try
      { // an invalid format ID
        pk1 = ((SRPPublicKey) pubK).getEncoded(0);
        harness.fail("Succeeded with unknown format ID");
      }
    catch (IllegalArgumentException x)
      {
        harness.check(true, "Recognised unknown format ID");
      }

    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

Examples of gnu.javax.crypto.key.srp6.SRPPrivateKey

  public void testPrivateKeyValueOf(TestHarness harness)
  {
    harness.checkPoint("TestOfSRPCodec.testPrivateKeyValueOf");
    setUp();

    SRPPrivateKey privateK = (SRPPrivateKey) kp.getPrivate();

    byte[] pk = ((SRPPrivateKey) privateK).getEncoded(IKeyPairCodec.RAW_FORMAT);
    PrivateKey newSecK = SRPPrivateKey.valueOf(pk);

    harness.check(privateK.equals(newSecK),
                  "SRP public key valueOf(<raw-value>) 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.