Skip to Content.
Sympa Menu

mace-opensaml-users - Re: [OpenSAML] Signature problems

Subject: OpenSAML user discussion

List archive

Re: [OpenSAML] Signature problems


Chronological Thread 
  • From: Paul Hethmon <>
  • To: <>, OpenSAML List <>
  • Subject: Re: [OpenSAML] Signature problems
  • Date: Thu, 06 Nov 2008 12:01:09 -0500

Title: Re: [OpenSAML] Signature problems
You need to add the signature to the assertion, then marshall it, then sign it:

      assertion.setSignature(signature);
      // Get the marshaller factory
      MarshallerFactory marshallerFactory = org.opensaml.Configuration.getMarshallerFactory();
      Marshaller marshaller = marshallerFactory.getMarshaller(assertion);
      try {
        // By marshalling the assertion, we will create the XML so that the signing will have something to sign
        marshaller.marshall(assertion);
      } catch (MarshallingException e) {
        e.printStackTrace();
      }
      // Now sign it
      org.opensaml.xml.signature.Signer.signObject(signature);
      //System.out.print("Assertion is now signed ...");

Paul



On 11/6/08 10:49 AM, "" <> wrote:

Hi, we have to read and modify an SAMLResponse.

//read SAMLResponse
from a string
Response response = (Response) responseUnmarsh.unmarshall
(XMLUtils.parse("<samlp:Response>...</samlp:Response>").
getDocumentElement());

//modify SAMLResponse
response.setInResponseTo
("...");

//Recreate SAMLResponse
new ResponseMarshaller().marshall
(response);

//Now, we have to computing the Signature Value
Signature
signature = response.getSignature();
Signer.signObject(signature);


But, Signer.signObject throws this exception

Original Exception was
java.security.SignatureException: object not initialized for signature
or verification
Where is the error?


_______________________________________________________________



Telefona e naviga senza limiti con Tiscali Voce 8 Mega a soli € 15 al mese per i primi 12 mesi. In seguito paghi € 29,90 al mese. Attiva entro il 6/11/08! http://abbonati.tiscali.it/promo/voce8mega/




-----
Paul Hethmon
Chief Software Architect
Clareity Security, LLC
865.824.1350 - office
865.250.3517 - mobile
www.clareitysecurity.com
-----

Give a man a fire and he's warm for the day. But set fire to him and he's warm for the rest of his life.

 -- Terry Pratchett, Discworld




Archive powered by MHonArc 2.6.16.

Top of Page