Skip to Content.
Sympa Menu

mace-opensaml-users - Validate Signature Against Certificate

Subject: OpenSAML user discussion

List archive

Validate Signature Against Certificate


Chronological Thread 
  • From: "Bailo, John" <>
  • To: <>
  • Cc: "Bailo, John" <>
  • Subject: Validate Signature Against Certificate
  • Date: Wed, 24 Sep 2008 12:26:38 -0400

 

For a SAML1 object that I am told has a valid signature, when I do a SignatureValidate.validate() it throws the exception.

 

Validation Problem Signature did not validate against the credential's key

 

I am following the examples in https://spaces.internet2.edu/display/OpenSAML/OSTwoUserManJavaDSIG

 

Here is my code.   The certificate exists as a crt file.   Have I implemented correctly?

             

     sign509 = new BasicX509Credential();

     X509Certificate cert;

     CertificateFactory cf;

     java.io.InputStream inStream=null;

     ServletContext servletcontext = getServletContext();

             

     try {

                  

          inStream

         = servletcontext.getResourceAsStream("Signing 20080314.crt");

         

          cf = CertificateFactory.getInstance("X.509");

          cert = (X509Certificate)cf.generateCertificate(inStream);

          cert.checkValidity();

          sign509.setEntityCertificate(cert);  

                  

              } catch (CertificateException e1) {

                   out.println(e1.toString());

                   e1.printStackTrace();

              }

              // ….

                                  

              Signature sig = samlResponse.getSignature();

 

              try {

              signaturevalidator = new SignatureValidator(sign509);

              signaturevalidator.validate(sig);

              } catch(ValidationException e){

              out.println("Validation Problem " + e.getMessage());

              e.printStackTrace();

              }

CONFIDENTIALITY NOTICE: The information in this Internet email is confidential and may be legally privileged. It is intended solely for the addressee. Access to this email by anyone else is unauthorized. 




Archive powered by MHonArc 2.6.16.

Top of Page