SecurityConfiguration secConfiguration = Configuration.getGlobalSecurityConfiguration();
NamedKeyInfoGeneratorManager namedKeyInfoGeneratorManager = secConfiguration.getKeyInfoGeneratorManager();
KeyInfoGeneratorManager keyInfoGeneratorManager = namedKeyInfoGeneratorManager.getDefaultManager();
KeyInfoGeneratorFactory keyInfoGeneratorFactory = keyInfoGeneratorManager.getFactory(credential);
KeyInfoGenerator keyInfoGenerator = keyInfoGeneratorFactory.newInstance();
KeyInfo keyInfo =
Thanks
anyz wrote:
> On debuging i found keyInfo generated is NULL. Is there something
> wrong with code for generating keyinfo?
>
>
>
> On Thu, May 7, 2009 at 11:16 AM, anyz <any...@gmail.com
> <mailto:any...@gmail.com>> wrote:
>
> I have generated authResponse message using OpenSAML. However when
> verified through
> http://www.infomosaic.net/SecureXMLVerifyWS.htm service the
> signatures are not validated. I saw the sample response message at
> infomosaic includes KeyInfo tags in Signature elements.
>
> <Signature xmlns="http://www.w3.org/2000/09/xmldsig#"
> Id="MySignature">
>
> <KeyInfo><KeyValue><RSAKeyValue><Modulus>xxxxx</Modulus><Exponent>AQAB</Exponent></RSAKeyValue></KeyValue>
> <X509Data><X509Certificate>xxxxxxxx</X509Certificate></X509Data></KeyInfo></Signature>
>
> I tried tutorial at
> https://spaces.internet2.edu/display/OpenSAML/OSTwoUserManJavaDSIG and
> forums but could not add KeyInfo in AuthReponse message. Can you
> guide what i'm missing? Following is snnipet how id tried adding
> keyinfo.
>
>
>
> SecurityConfiguration secConfiguration =
> Configuration./getGlobalSecurityConfiguration/();
> NamedKeyInfoGeneratorManager namedKeyInfoGeneratorManager =
> secConfiguration.getKeyInfoGeneratorManager();
> KeyInfoGeneratorManager keyInfoGeneratorManager =
> namedKeyInfoGeneratorManager.getDefaultManager();
> KeyInfoGeneratorFactory keyInfoGeneratorFactory =
> keyInfoGeneratorManager.getFactory(credential);
> KeyInfoGenerator keyInfoGenerator =
> keyInfoGeneratorFactory.newInstance();
> KeyInfo keyInfo =
>
> *null*;
> *try*{
> keyInfo = keyInfoGenerator.generate(credential);
> }*catch* (SecurityException e) {
> System./out/.println(e);
> }
> signature.setKeyInfo(keyInfo);
>
> Thanks
>
>
>
>
Finally this snippet of code seems working:
KeyInfoBuilder keyInfoBuilder =(KeyInfoBuilder) builderFactory.getBuilder(KeyInfo.DEFAULT_ELEMENT_NAME);
KeyInfo keyInfo = (KeyInfo) keyInfoBuilder.buildObject(KeyInfo.DEFAULT_ELEMENT_NAME);
X509Certificate certificate = (X509Certificate)ks.getCertificate("xxxxx");
credential.setEntityCertificate(certificate);
KeyInfoHelper.addPublicKey(keyInfo, certificate.getPublicKey());
KeyInfoHelper.addCertificate(keyInfo, certificate);
signature.setKeyInfo(keyInfo);
however i still can't validate through http://www.infomosaic.net/SecureXMLVerifyWS.htm. If anyone has used it please suggest?
Thanks
On Thu, May 7, 2009 at 3:06 PM, anyz <any...@gmail.com> wrote:
Is it possible to generate keyinfo in above format? Also when i try to verify AuthResponse generated by OpenSAML(without KeyInfo in it ) through http://www.infomosaic.net/SecureXMLVerifyWS.htm it gives "Digest validation or calculation failed " error.
I think it is due to missing KeyInfo value.