Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Java Security > Extracting an X...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 1704 of 1789
Post > Topic >>

Extracting an X509Certificate from XML

by Ian Wilson <scobloke2@[EMAIL PROTECTED] > Jun 11, 2007 at 05:20 PM

I have a SOAP envelope digitally signed and including an X509 
certificate. I'd like to verify the signature using the public key from 
the certificate but cannot work out how to get the public key in my 
KeySelector implementation

Sun's do***entation at
http://java.sun.com/developer/technicalArticles/xml/dig_signature_api/
gives examples for when the <X509Data> is inside the <KeyInfo> but not 
for the construction below.

XML is
<soapenv:Envelope ...>
  <soapenv:Header>
   <wsse:Security ...>
    <wsse:BinarySecurityToken
         EncodingType="wsse:Base64Binary"
         Id="X509Token"
         ValueType="wsse:X509v3">
      MIIB9zCCAWCgAwIBAgIERZwdkzANBgkqhkiG9w0BAQUFADBAMQswCQYD
      VQQGEwJVUzEfMB0GA1UEChMWVGVzdCBDZXJ0aWZpY2F0ZXMgSW5jLjEQ
      MA4GA1UEAxMHTXkgTmFtZTAeFw0wNzAxMDMyMTE4MTFaFw0zMTA4MjUy
      ...
    </wsse:BinarySecurityToken>
    <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
      ...
      <ds:KeyInfo>
        <wsse:SecurityTokenReference>
          <wsse:Reference URI="#X509Token"/>
        </wsse:SecurityTokenReference>
      </ds:KeyInfo>
    </ds:Signature>
....

The above XML is loaded into a org.w3c.dom.Do***ent, I can extract the 
BinarySecurityToken into a org.w3c.dom.Node and get at the BASE64 data 
using getTextContent() but I can't work out how to extract a 
java.security.PublicKey from it.

Can anyone offer me a clue?
 




 1 Posts in Topic:
Extracting an X509Certificate from XML
Ian Wilson <scobloke2@  2007-06-11 17:20:04 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 18 21:01:40 CDT 2008.