You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Alistair Young <al...@smo.uhi.ac.uk> on 2006/01/19 16:04:49 UTC
XMLSignature support
I saw mails from last August suggesting you can't verify a signature
once you've loaded a doc into XMLBeans:
ResponseDocument responseDocument = ResponseDocument.Factory.parse
(samlResponse);
ResponseType responseType = responseDocument.getResponse();
CertificateFactory certFactory = CertificateFactory.getInstance("x.
509");
ByteArrayInputStream certByteStream = new ByteArrayInputStream
(x509CertBytes[cc]);
X509Certificate x509Cert = (X509Certificate)
certFactory.generateCertificate(certByteStream);
certByteStream.close();
SignatureType sigType = responseType.getSignature();
XMLSignature sig = new XMLSignature((Element)sigType.getDomNode(), "");
sig.checkSignatureValue(x509Cert);
always fails to verify the signature. I heard something about
XMLBeans not adding prefixes when loading from file.
Is this still the case or is there something I can use in XmlOptions
when loading?
thanks,
Alistair
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org
Re: XMLSignature support
Posted by Alistair Young <al...@smo.uhi.ac.uk>.
aha! daft me spotted the problem. When saving the signed xml to file
I was setting all sorts of pretty print options, which of course
ruined the digest etc.
Works fine now: XML -> XMLBeans -> XMLSignature.sign() -> XMLBeans ->
XML -> XMLBeans -> XMLSignature.checkSignatureValue()
Alistair
On 19 Jan 2006, at 15:04, Alistair Young wrote:
> I saw mails from last August suggesting you can't verify a
> signature once you've loaded a doc into XMLBeans:
>
> ResponseDocument responseDocument = ResponseDocument.Factory.parse
> (samlResponse);
> ResponseType responseType = responseDocument.getResponse();
>
> CertificateFactory certFactory = CertificateFactory.getInstance("x.
> 509");
> ByteArrayInputStream certByteStream = new ByteArrayInputStream
> (x509CertBytes[cc]);
> X509Certificate x509Cert = (X509Certificate)
> certFactory.generateCertificate(certByteStream);
> certByteStream.close();
>
> SignatureType sigType = responseType.getSignature();
> XMLSignature sig = new XMLSignature((Element)sigType.getDomNode(),
> "");
> sig.checkSignatureValue(x509Cert);
>
> always fails to verify the signature. I heard something about
> XMLBeans not adding prefixes when loading from file.
>
> Is this still the case or is there something I can use in
> XmlOptions when loading?
>
> thanks,
>
> Alistair
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org