Examples of DSSKeyPairGenerator


Examples of gnu.java.security.key.dss.DSSKeyPairGenerator

public class TestOfDSSKeyGeneration implements Testlet
{
  public void test(TestHarness harness)
  {
    harness.checkPoint("TestOfDSSKeyGeneration");
    DSSKeyPairGenerator kpg = new DSSKeyPairGenerator();
    HashMap map = new HashMap();
    map.put(DSSKeyPairGenerator.MODULUS_LENGTH, new Integer(530));

    try
      {
        kpg.setup(map);
        harness.fail("L should be <= 1024 and of the form 512 + 64n");
      }
    catch (IllegalArgumentException x)
      {
        harness.check(true, "L should be <= 1024 and of the form 512 + 64n");
      }

    map.put(DSSKeyPairGenerator.MODULUS_LENGTH, new Integer(512));
    map.put(DSSKeyPairGenerator.USE_DEFAULTS, new Boolean(false));
    kpg.setup(map);
    KeyPair kp = kpg.generate();

    BigInteger p1 = ((DSAPublicKey) kp.getPublic()).getParams().getP();
    BigInteger p2 = ((DSAPrivateKey) kp.getPrivate()).getParams().getP();
    harness.check(p1.equals(p2), "p1.equals(p2)");
View Full Code Here

Examples of gnu.java.security.key.dss.DSSKeyPairGenerator

  {
    map = new HashMap();
    map.put(DSSKeyPairGenerator.MODULUS_LENGTH, new Integer(512));
    map.put(DSSKeyPairGenerator.USE_DEFAULTS, new Boolean(false));

    kpg = new DSSKeyPairGenerator();
    kpg.setup(map);
  }
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.