Hi,<br><br>I am following this wiki: <a href="https://wiki.shibboleth.net/confluence/display/OpenSAML/OSTwoUserManJavaDSIG">https://wiki.shibboleth.net/confluence/display/OpenSAML/OSTwoUserManJavaDSIG</a>, to create signature for a saml object, here is my code:<br>
<br><br><br>public void createSignature( KeyStoreManager keyStore, SignableXMLObject samlObject ) throws GeneralSecurityException, SecurityException, MarshallingException, SignatureException<br> {<br> Credential signingCredential = SecurityHelper.getSimpleCredential( (X509Certificate)keyStore.getCertificate(), keyStore.getPrivateKey() );<br>
<br> Signature signature = createSAMLObject( Signature.class );//a wrapper to create a saml object easier.<br> signature.setSigningCredential(signingCredential);<br><br> // This is also the default if a null SecurityConfiguration is specified<br>
SecurityConfiguration secConfig = Configuration.getGlobalSecurityConfiguration();<br> // If null this would result in the default KeyInfoGenerator being used<br> String keyInfoGeneratorProfile = "XMLSignature";<br>
<br> SecurityHelper.prepareSignatureParams(signature, signingCredential, secConfig, keyInfoGeneratorProfile);<br> <br> samlObject.setSignature(signature);<br> <br> marshallMessage( samlObject );<br>
Signer.signObject( signature );<br> }<br><br>When I use it, it always give me this exception:<br><br>Caused by: java.lang.IllegalArgumentException: Manager with name 'XMLSignature' does not exist<br> at org.opensaml.xml.security.keyinfo.NamedKeyInfoGeneratorManager.getFactory(NamedKeyInfoGeneratorManager.java:157)<br>
at org.opensaml.xml.security.SecurityHelper.getKeyInfoGenerator(SecurityHelper.java:1050)<br> at org.opensaml.xml.security.SecurityHelper.prepareSignatureParams(SecurityHelper.java:847)<br> at com.actuate.server.saml.SAML.createSignature(SAML.java:191)<br>
at com.actuate.server.saml.SPMetadataGenerator.generateMetadata(SPMetadataGenerator.java:66)<br> ... 27 more<br><br>What is wrong with my code?<br><br>Thanks,<br clear="all">Yaowen<br>