[java-opensaml COMMIT] /trunk/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/keyinfo/KeyInfoSupport.java
noreply at shibboleth.net
noreply at shibboleth.net
Wed Jan 30 22:09:53 EST 2013
Author: scantor
Date: Wed Jan 30 22:09:53 2013
New Revision: 3199
URL: http://svn.shibboleth.net/view/java-opensaml?rev=3199&view=rev
Log:
Change DER method back to an add()
Modified:
trunk/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/keyinfo/KeyInfoSupport.java
Modified: trunk/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/keyinfo/KeyInfoSupport.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/keyinfo/KeyInfoSupport.java?rev=3199&r1=3198&r2=3199&view=diff
==============================================================================
--- trunk/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/keyinfo/KeyInfoSupport.java (original)
+++ trunk/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/keyinfo/KeyInfoSupport.java Wed Jan 30 22:09:53 2013
@@ -595,15 +595,17 @@
}
/**
- * Builds a {@link DEREncodedKeyValue} XMLObject from the Java security public key type.
- *
+ * Converts a Java public key into the corresponding XMLObject and stores it in a {@link KeyInfo} in a
+ * new {@link DEREncodedKeyValue} element.
+ *
+ * @param keyInfo the {@link KeyInfo} element to which to add the key
* @param pk the native Java {@link PublicKey} to convert
- * @return a {@link DEREncodedKeyValue} XMLObject
* @throws NoSuchAlgorithmException if the key type is unsupported
* @throws InvalidKeySpecException if the key type does not support X.509 SPKI encoding
*/
- @Nonnull public static DEREncodedKeyValue buildDEREncodedPublicKey(@Nonnull final PublicKey pk)
- throws NoSuchAlgorithmException, InvalidKeySpecException {
+ public static void addDEREncodedPublicKey(@Nonnull final KeyInfo keyInfo,
+ @Nonnull final PublicKey pk) throws NoSuchAlgorithmException, InvalidKeySpecException {
+ Constraint.isNotNull(keyInfo, "KeyInfo cannot be null");
Constraint.isNotNull(pk, "Public key cannot be null");
XMLObjectBuilder<DEREncodedKeyValue> builder =
@@ -616,7 +618,7 @@
X509EncodedKeySpec keySpec = keyFactory.getKeySpec(pk, X509EncodedKeySpec.class);
keyValue.setValue(Base64Support.encode(keySpec.getEncoded(), Base64Support.CHUNKED));
- return keyValue;
+ keyInfo.getXMLObjects(DEREncodedKeyValue.DEFAULT_ELEMENT_NAME).add(keyValue);
}
/**
More information about the commits
mailing list