Hi,
I blog about this here
http://dotnetjunkies.com/WebLog/softwaremaker/archive/2004/10/20/29158.aspx
WS-Security DOESNT allow for the sending of any Private Key over SOAP. It
will (usually) send the Binary representation of the X509 over during
digital signatures as we cannot assume that everyone has our Public Keys.
I dont know much about JWSDP1.4 on why and how it sends the
binarySecurityToken over. However, the X509SubjectKeyIdentifier is embedded
in the binarySecurityToken. Can you map the binarySecurityToken to a X509
Digital Cert ? If you can do that successfully, find out if the
SubjectKeyIdentifier property of the cert corresponds to the Private Key
certificate that is supposed to be in your keystore.
hth.

Signature
Thank you.
Regards,
Softwaremaker
http://www.softwaremaker.net/blog
=========================================
> Hello,
>
[quoted text clipped - 21 lines]
> System.InvalidOperationException: Private Key is not available
> at
Microsoft.Web.Services2.Security.Cryptography.RSACryptoServiceProvider.Decry
> pt(Byte[] ciphertext, Boolean useOAEP)
> at
Microsoft.Web.Services2.Security.Cryptography.RSA15KeyExchangeFormatter.Decr
> yptKey(Byte[] cipherKey)
> -------------------------------------
[quoted text clipped - 57 lines]
> </wsse:Security>
> </env:Header
Bo Yan - 28 Oct 2004 23:58 GMT
Dear hth,
Thank you for your reply. Let me make my question more clear.
There is NO Private Key in the soap request. JWSDP1.4(the client) does send
the X509 certificate to the soap server, including the public key of the
sever, with which to encrypt its request message.
To verify the correctness of the embeded x509 cert, I copied the embeded
BinarySecurityToken to a C# application, created an instance of
Microsoft.Web.Services2.Security.X509.X509Certificate successfully with WSE2
API. The X509SubjectKeyIdentifier is exactly the one in the cert store with
a private key. Actually, the x509 cert attached in my original question is
just the X509 Certificate of WSE2QuickStartServer.
My question is, will WSE2 go to certificate store to search for the x509
cert and private key in it if there is the same certificate already in the
coming soap request only with a public key?
I totally agree it does not make any sense to embed private key into SOAP
request, but it does make sense to embed the referenced X509 certificate
(with public key only) into a request.
Thanks,
Bo
> Hi,
>
[quoted text clipped - 16 lines]
>
> hth.
Softwaremaker - 29 Oct 2004 02:49 GMT
> Dear hth,
> Thank you for your reply. Let me make my question more clear.
[quoted text clipped - 10 lines]
> cert and private key in it if there is the same certificate already in the
> coming soap request only with a public key?
[Softwaremaker] Yes, WSE2 does set to look for the corresponding PrivateKey
pair of the same certificate in the specified keyStore, provided you tell it
to look for it in the right place via the config file.
> I totally agree it does not make any sense to embed private key into SOAP
> request, but it does make sense to embed the referenced X509 certificate
[quoted text clipped - 22 lines]
> >
> > hth.
Bo Yan - 29 Oct 2004 03:36 GMT
Thanks once again for the very quick reply, but your answer raised another
question.
After I deleted the x509 certificate with private key from the cert store,
when calling the WSE2 soap server using WSE2 client(so
X509SubjectKeyIdentifier is used), the error message is "<faultstring>
Microsoft.Web.Services2.Security.SecurityFault: Referenced security token
could not be retrieved", which is in my expectation.
But when jwsdp client is used(i.e. the x509 cert embeded), the error usage
is "System.InvalidOperationException: Private Key is not available".
Why does WSE give such a error message even it can not find the x509 cert in
the cert store? No one will expect it find the private key from the coming
soap header. What makes the error messages so different for the two incoming
requests?
Thanks and cheers,
Bo
>> Dear hth,
>> Thank you for your reply. Let me make my question more clear.
[quoted text clipped - 16 lines]
> provided you tell it to look for it in the right place via the config
> file.