Java 8 DSAParameterSpec - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 DSAParameterSpec class.

This code example shows how to use the following methods:getG, getP, getQ
        { 
            throw new InvalidAlgorithmParameterException("parameter object not a DSAParameterSpec");
        } 
        DSAParameterSpec dsaParams = (DSAParameterSpec)params;
 
        param = new DSAKeyGenerationParameters(random, new DSAParameters(dsaParams.getP(), dsaParams.getQ(), dsaParams.getG()));
 
        engine.init(param);
        initialised = true;
    } 
 
    public KeyPair generateKeyPair()
    { 
        if (!initialised)
        { 
            DSAParametersGenerator pGen = new DSAParametersGenerator();
 
            pGen.init(strength, certainty, random);
            param = new DSAKeyGenerationParameters(random, pGen.generateParameters());
            engine.init(param);
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getG, getP, getQ
        { 
            throw new InvalidAlgorithmParameterException("parameter object not a DSAParameterSpec");
        } 
        DSAParameterSpec dsaParams = (DSAParameterSpec)params;
 
        param = new DSAKeyGenerationParameters(random, new DSAParameters(dsaParams.getP(), dsaParams.getQ(), dsaParams.getG()));
 
        engine.init(param);
        initialised = true;
    } 
 
    public KeyPair generateKeyPair()
    { 
        if (!initialised)
        { 
            DSAParametersGenerator pGen = new DSAParametersGenerator();
 
            pGen.init(strength, certainty, random);
            param = new DSAKeyGenerationParameters(random, pGen.generateParameters());
            engine.init(param);
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
    /** 
     * java.security.interfaces.DSAKeyPairGenerator 
     * #initialize(DSAParams params, SecureRandom random) 
     */ 
    public void test_DSAKeyPairGenerator01() { 
        DSAParams dsaParams = new DSAParameterSpec(p, q, g);
        SecureRandom random = null;
        MyDSA dsa = new MyDSA(dsaParams);
        try { 
            random = SecureRandom.getInstance("SHA1PRNG");
        } catch (Exception e) {
            fail("Unexpected exception for SecureRandom: " + e);
        } 
 
        try { 
            dsa.initialize(dsaParams, random);
        } catch (Exception e) {
            fail("Unexpected exception: " + e);
        } 
 

6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getG, getP, getQ
        { 
            throw new InvalidAlgorithmParameterException("parameter object not a DSAParameterSpec");
        } 
        DSAParameterSpec dsaParams = (DSAParameterSpec)params;
 
        param = new DSAKeyGenerationParameters(random, new DSAParameters(dsaParams.getP(), dsaParams.getQ(), dsaParams.getG()));
 
        engine.init(param);
        initialised = true;
    } 
 
    public KeyPair generateKeyPair()
    { 
        if (!initialised)
        { 
            DSAParametersGenerator pGen = new DSAParametersGenerator();
 
            pGen.init(strength, certainty, random);
            param = new DSAKeyGenerationParameters(random, pGen.generateParameters());
            engine.init(param);
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getG, getP, getQ
        this.random = random;
 
        if (params instanceof DSAParameterSpec) {
            DSAParameterSpec dsaParams = (DSAParameterSpec) params;
 
            BigInteger gInt = dsaParams.getG();
            if (gInt != null) {
                g = gInt.toByteArray();
            } 
 
            BigInteger pInt = dsaParams.getP();
            if (pInt != null) {
                p = pInt.toByteArray();
            } 
 
            BigInteger qInt = dsaParams.getQ();
            if (qInt != null) {
                q = qInt.toByteArray();
            } 
        } else if (params != null) {
            throw new InvalidAlgorithmParameterException("Params must be DSAParameterSpec");
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getG, getP, getQ
  { 
    if (! (spec instanceof DSAParameterSpec))
      throw new InvalidParameterSpecException("Wrong AlgorithmParameterSpec type: "
                                              + spec.getClass().getName());
    DSAParameterSpec dsaSpec = (DSAParameterSpec) spec;
    p = dsaSpec.getP();
    q = dsaSpec.getQ();
    g = dsaSpec.getG();
  } 
 
  /** 
   * Decodes the set of DSS parameters as per RFC-2459; i.e. the DER-encoded 
   * form of the following ASN.1 construct: 
   * 
   * <pre> 
   *   DssParams ::= SEQUENCE { 
   *     p   INTEGER, 
   *     q   INTEGER, 
   *     g   INTEGER 
   *   } 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getP
 
    /** 
     * getP() test 
     */ 
    public final void testGetP() { 
        DSAParameterSpec dps = new DSAParameterSpec(
                new BigInteger("1"),
                new BigInteger("2"),
                new BigInteger("3"));
         
        assertEquals(1, dps.getP().intValue());
    } 
 
    /** 
     * getQ() test  
     */ 
    public final void testGetQ() { 
        DSAParameterSpec dps = new DSAParameterSpec(
                new BigInteger("1"),
                new BigInteger("2"),
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getG, getP, getQ
        a.init(2048, new DSATestSecureRandom(seed));
        AlgorithmParameters params = a.generateParameters();
 
        DSAParameterSpec dsaP = (DSAParameterSpec)params.getParameterSpec(DSAParameterSpec.class);
 
        if (!dsaP.getQ().equals(new BigInteger("C24ED361870B61E0D367F008F99F8A1F75525889C89DB1B673C45AF5867CB467", 16)))
        { 
            fail("Q incorrect"); 
        } 
 
        if (!dsaP.getP().equals(new BigInteger(
            "F56C2A7D366E3EBDEAA1891FD2A0D099" + 
            "436438A673FED4D75F594959CFFEBCA7BE0FC72E4FE67D91" + 
            "D801CBA0693AC4ED9E411B41D19E2FD1699C4390AD27D94C" + 
            "69C0B143F1DC88932CFE2310C886412047BD9B1C7A67F8A2" + 
            "5909132627F51A0C866877E672E555342BDF9355347DBD43" + 
            "B47156B2C20BAD9D2B071BC2FDCF9757F75C168C5D9FC431" + 
            "31BE162A0756D1BDEC2CA0EB0E3B018A8B38D3EF2487782A" + 
            "EB9FBF99D8B30499C55E4F61E5C7DCEE2A2BB55BD7F75FCD" + 
            "F00E48F2E8356BDB59D86114028F67B8E07B127744778AFF" + 

5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
 
 
    public AlgorithmParametersTestDSA() { 
        super("DSA", new AlgorithmParameterSignatureHelper<DSAParameterSpec>( 
                "DSA", DSAParameterSpec.class), new DSAParameterSpec( 
                new BigInteger(P), new BigInteger(Q), new BigInteger(G))); 
    } 
 
} 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
    public static final BigInteger elgg = new NativeBigInteger("2"); 
 
    /** 
     *  @since 0.9.9 
     */ 
    public static final DSAParameterSpec DSA_SHA1_SPEC = new DSAParameterSpec(dsap, dsaq, dsag); 
} 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
See Code Examples for Java 8 DSAParameterSpec Methods: