List of usage examples for org.bouncycastle.jcajce.provider.asymmetric.dsa DSAUtil generatePublicKeyParameter
static public AsymmetricKeyParameter generatePublicKeyParameter(PublicKey key) throws InvalidKeyException
From source file:org.xipki.ca.server.impl.X509SelfSignedCertBuilder.java
License:Open Source License
public static AsymmetricKeyParameter generatePublicKeyParameter(final PublicKey key) throws InvalidKeyException { if (key instanceof RSAPublicKey) { RSAPublicKey k = (RSAPublicKey) key; return new RSAKeyParameters(false, k.getModulus(), k.getPublicExponent()); } else if (key instanceof ECPublicKey) { return ECUtil.generatePublicKeyParameter(key); } else if (key instanceof DSAPublicKey) { return DSAUtil.generatePublicKeyParameter(key); } else {/*w ww . j a va 2 s . c o m*/ throw new InvalidKeyException("unknown key " + key.getClass().getName()); } }
From source file:org.xipki.commons.security.util.KeyUtil.java
License:Open Source License
public static AsymmetricKeyParameter generatePublicKeyParameter(final PublicKey key) throws InvalidKeyException { ParamUtil.requireNonNull("key", key); if (key instanceof RSAPublicKey) { RSAPublicKey rsaKey = (RSAPublicKey) key; return new RSAKeyParameters(false, rsaKey.getModulus(), rsaKey.getPublicExponent()); } else if (key instanceof ECPublicKey) { return ECUtil.generatePublicKeyParameter(key); } else if (key instanceof DSAPublicKey) { return DSAUtil.generatePublicKeyParameter(key); } else {/*from www. j a v a 2 s .c o m*/ throw new InvalidKeyException("unknown key " + key.getClass().getName()); } }
From source file:org.xipki.pki.ca.server.impl.X509SelfSignedCertBuilder.java
License:Open Source License
public static AsymmetricKeyParameter generatePublicKeyParameter(final PublicKey key) throws InvalidKeyException { ParamUtil.requireNonNull("key", key); if (key instanceof RSAPublicKey) { RSAPublicKey rsakey = (RSAPublicKey) key; return new RSAKeyParameters(false, rsakey.getModulus(), rsakey.getPublicExponent()); } else if (key instanceof ECPublicKey) { return ECUtil.generatePublicKeyParameter(key); } else if (key instanceof DSAPublicKey) { return DSAUtil.generatePublicKeyParameter(key); } else {/*from w w w . j a va 2 s. co m*/ throw new InvalidKeyException("unknown key " + key.getClass().getName()); } }