Best code examples for Java 8 DSAPublicKey class (java.security.interfaces.DSAPublicKey)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 DSAPublicKey class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Java 8 DSAPublicKey examples from Open Source projects
This code example shows how to use the following methods: getParams, getY
	public void testRecoverKeyPair_Dsa() throws Exception { 
		KeyPair kp = PubkeyUtils.recoverKeyPair(DSA_KEY_PKCS8);
 
		DSAPublicKey pubKey = (DSAPublicKey) kp.getPublic();
 
		assertEquals(DSA_KEY_pub, pubKey.getY());
 
		DSAParams params = pubKey.getParams();
		assertEquals(params.getG(), DSA_KEY_G);
		assertEquals(params.getP(), DSA_KEY_P);
		assertEquals(params.getQ(), DSA_KEY_Q);
	} 
 
	public void testRecoverKeyPair_Rsa() throws Exception { 
		KeyPair kp = PubkeyUtils.recoverKeyPair(RSA_KEY_PKCS8);
 
		RSAPublicKey pubKey = (RSAPublicKey) kp.getPublic();
 
		assertEquals(RSA_KEY_N, pubKey.getModulus());
		assertEquals(RSA_KEY_E, pubKey.getPublicExponent());
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getParams, getY
    { 
        if (key instanceof DSAPublicKey)
        { 
            DSAPublicKey    k = (DSAPublicKey)key;
 
            return new DSAPublicKeyParameters(k.getY(),
                new DSAParameters(k.getParams().getP(), k.getParams().getQ(), k.getParams().getG()));
        } 
 
        throw new InvalidKeyException("can't identify DSA public key: " + key.getClass().getName());
    } 
 
    static public AsymmetricKeyParameter generatePrivateKeyParameter( 
        PrivateKey    key)
        throws InvalidKeyException 
    { 
        if (key instanceof DSAPrivateKey)
        { 
            DSAPrivateKey    k = (DSAPrivateKey)key;
 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getParams, getY
    { 
        if (spec.isAssignableFrom(DSAPublicKeySpec.class) && key instanceof DSAPublicKey)
        { 
            DSAPublicKey k = (DSAPublicKey)key;
 
            return new DSAPublicKeySpec(k.getY(), k.getParams().getP(), k.getParams().getQ(), k.getParams().getG());
        } 
        else if (spec.isAssignableFrom(DSAPrivateKeySpec.class) && key instanceof java.security.interfaces.DSAPrivateKey)
        { 
            java.security.interfaces.DSAPrivateKey k = (java.security.interfaces.DSAPrivateKey)key;
 
            return new DSAPrivateKeySpec(k.getX(), k.getParams().getP(), k.getParams().getQ(), k.getParams().getG());
        } 
 
        return super.engineGetKeySpec(key, spec);
    } 
 
    protected Key engineTranslateKey(
        Key key)
        throws InvalidKeyException 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getParams, getY
	public void testRecoverKeyPair_Dsa() throws Exception { 
		KeyPair kp = PubkeyUtils.recoverKeyPair(DSA_KEY_PKCS8);
 
		DSAPublicKey pubKey = (DSAPublicKey) kp.getPublic();
 
		assertEquals(DSA_KEY_pub, pubKey.getY());
 
		DSAParams params = pubKey.getParams();
		assertEquals(params.getG(), DSA_KEY_G);
		assertEquals(params.getP(), DSA_KEY_P);
		assertEquals(params.getQ(), DSA_KEY_Q);
	} 
 
	public void testRecoverKeyPair_Rsa() throws Exception { 
		KeyPair kp = PubkeyUtils.recoverKeyPair(RSA_KEY_PKCS8);
 
		RSAPublicKey pubKey = (RSAPublicKey) kp.getPublic();
 
		assertEquals(RSA_KEY_N, pubKey.getModulus());
		assertEquals(RSA_KEY_E, pubKey.getPublicExponent());
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getParams, getY
    } 
 
    BCDSAPublicKey( 
        DSAPublicKey key)
    { 
        this.y = key.getY();
        this.dsaSpec = key.getParams();
    } 
 
    BCDSAPublicKey( 
        DSAPublicKeyParameters params)
    { 
        this.y = params.getY();
        this.dsaSpec = new DSAParameterSpec(params.getParameters().getP(), params.getParameters().getQ(), params.getParameters().getG());
    } 
 
    BCDSAPublicKey( 
        BigInteger y,
        DSAParameterSpec dsaSpec)
    { 
Full Snippet Info
6
CodeRank