Package gnu.javax.crypto.key.srp6

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


  public void testKeyPairRawCodec(TestHarness harness)
  {
    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


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

    SRPPublicKey pubK = (SRPPublicKey) kp.getPublic();

    byte[] pk = ((SRPPublicKey) pubK).getEncoded(IKeyPairCodec.RAW_FORMAT);
    PublicKey newPubK = SRPPublicKey.valueOf(pk);

    harness.check(pubK.equals(newPubK),
                  "SRP public key valueOf(<raw-value>) test");
  }
View Full Code Here

                sig.update((byte) srpSalt.length);
                sig.update(srpSalt, 0, srpSalt.length);
                updateSig(sig, B);
                s = new Signature(sig.sign(), suite.getSignature());
              }
            final SRPPublicKey pubkey = new SRPPublicKey(N, g, B);
            skex = new ServerKeyExchange(pubkey, s, srpSalt);
          }
        if (skex != null)
          {
            msg = new Handshake(Handshake.Type.SERVER_KEY_EXCHANGE, skex);
View Full Code Here

TOP

Related Classes of gnu.javax.crypto.key.srp6.SRP6User

Copyright © 2018 www.massapicom. 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.