Code example for DSAPublicKey

Methods: getParams, getY

0
    { 
        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;
 
            return new DSAPrivateKeyParameters(k.getX(),