RSAKeyValuepublic class RSAKeyValue extends SignatureElementProxy implements KeyValueContent
Fields Summary |
---|
static Logger | log{@link java.util.logging} logging facility |
Constructors Summary |
---|
public RSAKeyValue(Element element, String BaseURI)Constructor RSAKeyValue
super(element, BaseURI);
| public RSAKeyValue(Document doc, BigInteger modulus, BigInteger exponent)Constructor RSAKeyValue
super(doc);
XMLUtils.addReturnToElement(this._constructionElement);
this.addBigIntegerElement(modulus, Constants._TAG_MODULUS);
this.addBigIntegerElement(exponent, Constants._TAG_EXPONENT);
| public RSAKeyValue(Document doc, Key key)Constructor RSAKeyValue
super(doc);
XMLUtils.addReturnToElement(this._constructionElement);
if (key instanceof java.security.interfaces.RSAPublicKey ) {
this.addBigIntegerElement(((RSAPublicKey) key).getModulus(),
Constants._TAG_MODULUS);
this.addBigIntegerElement(((RSAPublicKey) key).getPublicExponent(),
Constants._TAG_EXPONENT);
} else {
Object exArgs[] = { Constants._TAG_RSAKEYVALUE,
key.getClass().getName() };
throw new IllegalArgumentException(I18n
.translate("KeyValue.IllegalArgument", exArgs));
}
|
Methods Summary |
---|
public java.lang.String | getBaseLocalName()
return Constants._TAG_RSAKEYVALUE;
| public java.security.PublicKey | getPublicKey()
try {
KeyFactory rsaFactory = KeyFactory.getInstance("RSA");
// KeyFactory rsaFactory = KeyFactory.getInstance(JCE_RSA);
RSAPublicKeySpec rsaKeyspec =
new RSAPublicKeySpec(this
.getBigIntegerFromChildElement(Constants._TAG_MODULUS, Constants
.SignatureSpecNS), this
.getBigIntegerFromChildElement(Constants
._TAG_EXPONENT, Constants.SignatureSpecNS));
PublicKey pk = rsaFactory.generatePublic(rsaKeyspec);
return pk;
} catch (NoSuchAlgorithmException ex) {
throw new XMLSecurityException("empty", ex);
} catch (InvalidKeySpecException ex) {
throw new XMLSecurityException("empty", ex);
}
|
|