mace-opensaml-users - Error with Signer.signObject()
Subject: OpenSAML user discussion
List archive
- From: "Jason Countryman" <>
- To:
- Subject: Error with Signer.signObject()
- Date: Thu, 8 Apr 2010 14:23:07 -0400
Hopefully someone has run across this before. I'm having an issue trying to sign my assertion. I've got a fully loaded up BasicX509Credential in privateCredential. I'm not sure what's fallling apart here.
Here's my code:
Signature signature = (Signature) Configuration.getBuilderFactory().getBuilder(Signature.DEFAULT_ELEMENT_NAME).buildObject(Signature.DEFAULT_ELEMENT_NAME);
signature.setSigningCredential(privateCredential);
signature.setSignatureAlgorithm(SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA1);
signature.setCanonicalizationAlgorithm(SignatureConstants.ALGO_ID_C14N_EXCL_OMIT_COMMENTS);
KeyInfoBuilder keyInfoBuilder = (KeyInfoBuilder) builderFactory.getBuilder(KeyInfo.DEFAULT_ELEMENT_NAME);
KeyInfo keyinfo = (KeyInfo) keyInfoBuilder.buildObject(KeyInfo.DEFAULT_ELEMENT_NAME);
X509Certificate certificate = privateCredential.getEntityCertificate();
KeyInfoHelper.addCertificate(keyinfo, certificate);
KeyInfoHelper.addPublicKey(keyinfo, privateCredential.getPublicKey());
signature.setKeyInfo(keyinfo);
assertion.setSignature(signature);
if (sLogger.isDebugEnabled())
sLogger.debug("Marshalling Assertion");
try {
Configuration.getMarshallerFactory().getMarshaller(assertion).marshall(assertion);
} catch (MarshallingException e) {
sLogger.error("Error getting Asssertion Marshaller");
}
try {
Signer.signObject(signature);
} catch (SignatureException e) {
sLogger.error("Error signing object");
}
java.lang.RuntimeException: org.apache.xml.security.signature.XMLSignatureException: object not initialized for signature or verification
Original Exception was java.security.SignatureException: object not initialized for signature or verification
at org.apache.xml.security.utils.SignerOutputStream.write(Unknown Source)
at org.apache.xml.security.utils.UnsyncBufferedOutputStream.flushBuffer(Unknown Source)
at org.apache.xml.security.utils.UnsyncBufferedOutputStream.flush(Unknown Source)
at org.apache.xml.security.utils.UnsyncBufferedOutputStream.close(Unknown Source)
at org.apache.xml.security.c14n.implementations.CanonicalizerBase.engineCanonicalizeSubTree(Unknown Source)
at org.apache.xml.security.c14n.implementations.Canonicalizer20010315Excl.engineCanonicalizeSubTree(Unknown Source)
at org.apache.xml.security.c14n.implementations.Canonicalizer20010315Excl.engineCanonicalizeSubTree(Unknown Source)
at org.apache.xml.security.c14n.Canonicalizer.canonicalizeSubtree(Unknown Source)
at org.apache.xml.security.signature.SignedInfo.signInOctectStream(Unknown Source)
at org.apache.xml.security.signature.XMLSignature.sign(Unknown Source)
at org.opensaml.xml.signature.Signer.signObject(Signer.java:78)
at org.openhealthtools.ihe.xua.xuser.XUser.getSHINNYToken(XUser.java:447)
______________________________ Jason T. Countryman Programmer Community Computer Service This message and any attachments may contain information that is protected by law as privileged and confidential, and is transmitted for the sole use of the intended recipient(s). If you are not the intended recipient, you are hereby notified that any use, dissemination, copying or retention of this e-mail or the information contained herein is strictly prohibited. If you received this e-mail in error, please immediately notify the sender by e-mail, and permanently delete this e-mail. |
- Error with Signer.signObject(), Jason Countryman, 04/08/2010
- Re: [OpenSAML] Error with Signer.signObject(), Brent Putman, 04/08/2010
- Re: [OpenSAML] Error with Signer.signObject(), Jason Countryman, 04/08/2010
- Re: [OpenSAML] Error with Signer.signObject(), Brent Putman, 04/08/2010
- Re: [OpenSAML] Error with Signer.signObject(), Jason Countryman, 04/08/2010
- Re: [OpenSAML] Error with Signer.signObject(), Brent Putman, 04/08/2010
Archive powered by MHonArc 2.6.16.