throws InvalidKeySpecException {
if (keySpec != null) {
if (keySpec instanceof DSAPublicKeySpec) {
return new DSAPublicKeyImpl((DSAPublicKeySpec) keySpec);
}
if (keySpec instanceof X509EncodedKeySpec) {
return new DSAPublicKeyImpl((X509EncodedKeySpec) keySpec);
}
}
throw new InvalidKeySpecException(Messages.getString("security.19D")); //$NON-NLS-1$
}