Package gnu.java.security.key.rsa

Examples of gnu.java.security.key.rsa.RSAKeyPairRawCodec


  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

TOP

Related Classes of gnu.java.security.key.rsa.RSAKeyPairRawCodec

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.