Exception when creating the signature using OpenSAML lib

Yaowen Tu yaowen.tu at gmail.com
Wed Oct 31 17:37:09 EDT 2012


Hi,

I am following this wiki:
https://wiki.shibboleth.net/confluence/display/OpenSAML/OSTwoUserManJavaDSIG,
to create signature for a saml object, here is my code:



public void createSignature( KeyStoreManager keyStore, SignableXMLObject
samlObject ) throws GeneralSecurityException, SecurityException,
MarshallingException, SignatureException
    {
        Credential signingCredential = SecurityHelper.getSimpleCredential(
(X509Certificate)keyStore.getCertificate(), keyStore.getPrivateKey() );

        Signature signature = createSAMLObject( Signature.class );//a
wrapper to create a saml object easier.
        signature.setSigningCredential(signingCredential);

        // This is also the default if a null SecurityConfiguration is
specified
        SecurityConfiguration secConfig =
Configuration.getGlobalSecurityConfiguration();
        // If null this would result in the default KeyInfoGenerator being
used
        String keyInfoGeneratorProfile = "XMLSignature";

        SecurityHelper.prepareSignatureParams(signature, signingCredential,
secConfig, keyInfoGeneratorProfile);

        samlObject.setSignature(signature);

        marshallMessage( samlObject );
        Signer.signObject( signature );
    }

When I use it, it always give me this exception:

Caused by: java.lang.IllegalArgumentException: Manager with name
'XMLSignature' does not exist
    at
org.opensaml.xml.security.keyinfo.NamedKeyInfoGeneratorManager.getFactory(NamedKeyInfoGeneratorManager.java:157)
    at
org.opensaml.xml.security.SecurityHelper.getKeyInfoGenerator(SecurityHelper.java:1050)
    at
org.opensaml.xml.security.SecurityHelper.prepareSignatureParams(SecurityHelper.java:847)
    at com.actuate.server.saml.SAML.createSignature(SAML.java:191)
    at
com.actuate.server.saml.SPMetadataGenerator.generateMetadata(SPMetadataGenerator.java:66)
    ... 27 more

What is wrong with my code?

Thanks,
Yaowen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://shibboleth.net/pipermail/users/attachments/20121031/0fc706d3/attachment.html 


More information about the users mailing list