Code example for DSAPublicKey

Methods: getParams, getY

0
        if ((key instanceof OpenSSLDSAPublicKey) || (key instanceof OpenSSLDSAPrivateKey)) {
            return key;
        } else if (key instanceof DSAPublicKey) {
            DSAPublicKey dsaKey = (DSAPublicKey) key;
 
            BigInteger y = dsaKey.getY();
 
            DSAParams params = dsaKey.getParams();
            BigInteger p = params.getP();
            BigInteger q = params.getQ();
            BigInteger g = params.getG();
 
            try { 
                return engineGeneratePublic(new DSAPublicKeySpec(y, p, q, g));
            } catch (InvalidKeySpecException e) {
                throw new InvalidKeyException(e);
            } 
        } else if (key instanceof DSAPrivateKey) {
            DSAPrivateKey dsaKey = (DSAPrivateKey) key;
 
            BigInteger x = dsaKey.getX();