Skip to Content.
Sympa Menu

mace-opensaml-users - Re: [OpenSAML] getting and setting x509 credential

Subject: OpenSAML user discussion

List archive

Re: [OpenSAML] getting and setting x509 credential


Chronological Thread 
  • From: Chad La Joie <>
  • To:
  • Subject: Re: [OpenSAML] getting and setting x509 credential
  • Date: Tue, 30 Mar 2010 11:14:18 -0400
  • Organization: Itumi, LLC

Make sure you're using the correct certificate object type. The JDK
includes two difference ones and, I would guess, bouncycastle (which is
included with OpenSAML) also includes such an object. The one you want
is java.security.cert.X509Certificate I think.

On 3/30/10 11:09 AM,

wrote:
> 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

--
Chad La Joie
www.itumi.biz
trusted identities, delivered



Archive powered by MHonArc 2.6.16.

Top of Page