cancel
Showing results for 
Search instead for 
Did you mean: 

Document Security in web service.

Former Member
0 Kudos

Hi all,

I am trying to implement document security in the web service. here for that i have create a Ejb and exposed it as web service. now that i have enabled the Document security for the SOAP message. i want to know that which certificate (Keys) are used for the encryption and decryption of the message.

I saw in help.sap.com that i have to use view WebServiceSecurity in which their is a key XMLEncryption.

Now i have following issues with it.

<b>I found no key in the view with name XMLEncryption</b>

Should i create one or not.

Now i created one key with that name.

Now when i am using that key from .Net client to access the web service i get following responce form the web service.

<b>0002E3562FFE004A00000012000003200003FB109FE6903A : Found 0 operation definitions using keys: Key name:'first-body-element-ns' key value:'urn:CostCenterSecureSignatureVi'; Key name:'SoapRequestWrapper' key value:'getDetail'</b>

How do i correct above problem.

Accepted Solutions (0)

Answers (1)

Answers (1)

martijndeboer
Advisor
Advisor
0 Kudos

Hi,

The key must be stored in the view WebServiceSecurity under the name XMLEncryption, typically the corresponding certificate is stored as XMLEncryption-cert. It must be created by an administrator after installation.

Can you verify you stored the key as XMLEncryption and ensure this is not the certificate?

We have successfully tested WS Security against .Net WSE 2.0

Best Regards,

Martijn de Boer

Former Member
0 Kudos

Ya You are right. I have created a key with the name XMLEncryption in the View WebServiceSecurity. and i have Exported the certificate from visual Administrator and i am using that Ceritificate in .net to encrypt the data.

Steps followed

1> Exported the Certificate XMLEncryption.

2> Added web refrence to .net project.

3> using certmgr.exe i added certificate to windows keystore.

following is the code

<b>Microsoft.Web.Services2.Security.X509.X509Certificate cert = GetCertificate("CN=XMLEncryption");

SecurityToken encToken = new X509SecurityToken(cert);

EncryptedData enc = new EncryptedData(encToken); proxy.RequestSoapContext.Security.Elements.Add(enc);

Bapi0012_CcoutputlistType output = proxy.getDetail("0001","Test","");</b>

GetCertificate method reads certificate from the windows key store.

is it wrong anywhere.

martijndeboer
Advisor
Advisor
0 Kudos

Hi,

I tested it again here, and it was running fine here.

To reproduce, I did the following:

1) Defined a EJB in Java and exposed it as WS

2) Created the key XMLEncryption and the cert XMLEncryption-cert

3) Exported the cert and used the following code for reading the cert


/**
* Read the certificate specified by the SubjectKeyIdentifier 
**/
store = X509CertificateStore.CurrentUserStore( X509CertificateStore.MyStore );
store.OpenRead();
X509CertificateCollection certs = store.FindCertificateByKeyIdentifier( Convert.FromBase64String( keyIdentifier ) );
store.Close();
if (certs.Count > 0)
{
// Get the first certificate in the collection
encToken = new X509SecurityToken( ((X509Certificate) certs[0]) );
}

4) Called the WS

Which version of WSE & .Net are you using?

Would it help you if I provided my example?

Regards,

Martijn de Boer

Former Member
0 Kudos

Hi Martijin,

Thanks for the reply

The problem is solved.

i recreate the WS configuration and the problem got solved automaticaly.

I tried to find out what was the diffrence, but was unable to do that.

I want to know one more thing from .net standalone web service client how can i pass saplogon ticket.