Code example for DSAPrivateKey

Methods: getParams, getX

0
 
        if (key != null) {
            if (key instanceof DSAPrivateKey) {
 
                DSAPrivateKey privateKey = (DSAPrivateKey) key;
                DSAParams params = privateKey.getParams();
 
                try { 
                    return engineGeneratePrivate(new DSAPrivateKeySpec(
                            privateKey.getX(), params.getP(), params.getQ(),
                            params.getG()));
                } catch (InvalidKeySpecException e) {
                    // Actually this exception shouldn't be thrown 
                    throw new InvalidKeyException(Messages.getString(
                            "security.1A0", e)); //$NON-NLS-1$
                } 
            } 
 
            if (key instanceof DSAPublicKey) {
 
                DSAPublicKey publicKey = (DSAPublicKey) key;