Skip to Content.
Sympa Menu

mace-opensaml-users - Problems creating KeyInfo object

Subject: OpenSAML user discussion

List archive

Problems creating KeyInfo object


Chronological Thread 
  • From: "Joana M. F. Trindade" <>
  • To:
  • Subject: Problems creating KeyInfo object
  • Date: Wed, 25 Jun 2008 18:41:53 -0300
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=qexW2fIykom5kWy2vPJETQjrmr5GA1DU68maVVVhGWYJhIiNuhP8v4n/GcZ3SpbYH6 qgd+k2JcaederryeKqhaJiBgQqr20mJs5UEq6JSVNoZo6NZivOeu+Nx4pEWctADmoq+d d5mE0c8IkuuWkko2GvuAHI6hE9hUFrTxPKQ4I=

Hi,

I'm trying to create a KeyInfo object and set it to an OpenSAML Signature, but I'm having problems. The signing seems to be working fine (well-formed signature value), so I assume there must be something wrong with the way I'm generating the KeyInfo object. My code is the following:

// ------
Signature signature = (Signature) Configuration.getBuilderFactory().getBuilder(Signature.DEFAULT_ELEMENT_NAME)
            .buildObject(Signature.DEFAULT_ELEMENT_NAME);

signature.setSigningCredential(credential);
signature.setSignatureAlgorithm(SignatureConstants.ALGO_ID_SIGNATURE_RSA);
signature.setCanonicalizationAlgorithm(SignatureConstants.ALGO_ID_C14N_EXCL_OMIT_COMMENTS);

X509KeyInfoGeneratorFactory kiFactory = new X509KeyInfoGeneratorFactory();
KeyInfoGenerator kiGenerator = kiFactory.newInstance();
KeyInfo keyInfo = kiGenerator.generate(credential);
                      
signature.setKeyInfo(keyInfo);
// ------

The only information I found about how to set a KeyInfo was the guide on how to sign objects [1]. However, there's no example on how to create the KeyInfo object from a Credential using a KeyInfoGenerator or the like. I also tried google (of course..) but no success either. The OpenSAML and XMLTooling versions I'm using are, respectively, 2.2.0 and 1.1.0.

Thanks,
Joana

[1] - https://spaces.internet2.edu/display/OpenSAML/OSTwoUserManJavaDSIG

--
Joana M. F. da Trindade

Email:
Personal Homepage: http://www.inf.ufrgs.br/~jmftrindade
LinkedIn: http://www.linkedin.com/in/joanatrindade


Archive powered by MHonArc 2.6.16.

Top of Page