* @param rsaPubKey a native Java {@link RSAPublicKey}
* @return an {@link RSAKeyValue} XMLObject
*/
public static RSAKeyValue buildRSAKeyValue(RSAPublicKey rsaPubKey) {
XMLObjectBuilderFactory builderFactory = Configuration.getBuilderFactory();
RSAKeyValue rsaKeyValue = (RSAKeyValue) builderFactory
.getBuilder(RSAKeyValue.DEFAULT_ELEMENT_NAME)
.buildObject(RSAKeyValue.DEFAULT_ELEMENT_NAME);
Modulus modulus = (Modulus) builderFactory
.getBuilder(Modulus.DEFAULT_ELEMENT_NAME)
.buildObject(Modulus.DEFAULT_ELEMENT_NAME);
Exponent exponent = (Exponent) builderFactory
.getBuilder(Exponent.DEFAULT_ELEMENT_NAME)
.buildObject(Exponent.DEFAULT_ELEMENT_NAME);
modulus.setValueBigInt(rsaPubKey.getModulus());
rsaKeyValue.setModulus(modulus);
exponent.setValueBigInt(rsaPubKey.getPublicExponent());
rsaKeyValue.setExponent(exponent);
return rsaKeyValue;
}