Skip to Content.
Sympa Menu

mace-opensaml-users - getting and setting x509 credential

Subject: OpenSAML user discussion

List archive

getting and setting x509 credential


Chronological Thread 
  • From:
  • To:
  • Subject: getting and setting x509 credential
  • Date: Tue, 30 Mar 2010 10:09:38 -0500 (EST)

Hello all,

I'm totally new to using SAML and OpenSAML in particular. I need to create a
sender-vouches assertion that is signed using an x509 key. (for NYS Heal5
HIE, if anyone is wondering) I have the following code:

DefaultBootstrap.bootstrap(); // initialize the opensaml library
// jtc -- now, build the assertion
XMLObjectBuilderFactory builderFactory = Configuration.getBuilderFactory();
SAMLObjectBuilder<Assertion> builder = (SAMLObjectBuilder<Assertion>)
builderFactory.getBuilder(Assertion.DEFAULT_ELEMENT_NAME);
Assertion assertion = builder.buildObject();
// jtc -- we have the naked assertion now. let's add the interesting stuff.

// jtc - signature and credential
BasicX509Credential privateCredential = new BasicX509Credential();
InputStream inStream = new FileInputStream((String) samlInfoVector.get(0));
// position 0 has the key file
X509Certificate cert = X509Certificate.getInstance(inStream);
inStream.close();
privateCredential.setEntityCertificate(cert);

I'm having a problem with that last line, setting the EntityCertificate. The
error I'm getting is:

The method setEntityCertificate(X509Certificate) in the type
BasicX509Credential is not applicable for the arguments (X509Certificate)

Any guidance on what's going here would be much appreciated.

Thanks
Jason Countryman



Archive powered by MHonArc 2.6.16.

Top of Page