[java-xmltooling COMMIT] /branches/REL_1/src/main/java/org/opensaml/xml/security/keyinfo/KeyInfoHelper.java
noreply at shibboleth.net
noreply at shibboleth.net
Tue Jan 22 21:23:12 EST 2013
Author: scantor
Date: Tue Jan 22 21:23:12 2013
New Revision: 783
URL: http://svn.shibboleth.net/view/java-xmltooling?rev=783&view=rev
Log:
Forgot to decode DER bytes in KeyInfo.
Modified:
branches/REL_1/src/main/java/org/opensaml/xml/security/keyinfo/KeyInfoHelper.java
Modified: branches/REL_1/src/main/java/org/opensaml/xml/security/keyinfo/KeyInfoHelper.java
URL: http://svn.shibboleth.net/view/java-xmltooling/branches/REL_1/src/main/java/org/opensaml/xml/security/keyinfo/KeyInfoHelper.java?rev=783&r1=782&r2=783&view=diff
==============================================================================
--- branches/REL_1/src/main/java/org/opensaml/xml/security/keyinfo/KeyInfoHelper.java (original)
+++ branches/REL_1/src/main/java/org/opensaml/xml/security/keyinfo/KeyInfoHelper.java Tue Jan 22 21:23:12 2013
@@ -747,7 +747,7 @@
*
* @return a native Java security {@link java.security.Key} object
*
- * @throws KeyException thrown if the given key data can not be converted into {@link PublicKey}
+ * @throws KeyException thrown if the given key data cannot be converted into {@link PublicKey}
*/
public static PublicKey getKey(DEREncodedKeyValue keyValue) throws KeyException{
String[] supportedKeyTypes = { "RSA", "DSA", "EC"};
@@ -755,7 +755,7 @@
if (keyValue.getValue() == null) {
throw new KeyException("No data found in key value element");
}
- byte[] encodedKey = keyValue.getValue().getBytes();
+ byte[] encodedKey = Base64.decode(keyValue.getValue());
// Iterate over the supported key types until one produces a public key.
for (String keyType : supportedKeyTypes) {
@@ -767,9 +767,9 @@
return publicKey;
}
} catch (NoSuchAlgorithmException e) {
- // Do nothing, try the next type
+ // ignore
} catch (InvalidKeySpecException e) {
- // Do nothing, try the next type
+ // ignore
}
}
throw new KeyException("DEREncodedKeyValue did not contain a supported key type");
More information about the commits
mailing list