Hi all,
In one of my application I need to invoke a web service.The web service uses OASIS standard. The conditions are as follows:
A ) The request has to be digitally signed using the private key of the user.Signature
include key info element that contains X.509 certificate details.This is needed for
server to validate the signer.The below elements in the SOAP request has to be signed
Timestamp
UsernameToken
Body
B) After signing, the request has to be encrypted using the e-Filing’s public key
Use the URI https://incometaxindiaefiling.gov.in/eFiling/Portal/WebServiceIncomeTaxPublicKey.cer to download the public key.
The below contents are encrypted using the public key
UsernameToken
Body
BulkPanService Servicee = new BulkPanService();
UsernameToken userToken;
userToken = new UsernameToken("XXXXXX", "XXXXX", PasswordOption.SendHashed);
Servicee.SetClientCredential(userToken);
SoapContext context = Servicee.RequestSoapContext;
context.Security.Timestamp.TtlInSeconds = 60000;
context.Security.Tokens.Add(userToken);
MessageSignature sig = new MessageSignature(signatureToken);
sig.SignatureOptions = SignatureOptions.IncludeTimestamp | SignatureOptions.IncludeSoapBody;
context.Security.Elements.Add(sig);
BulkPanRequest request = new BulkPanRequest();
request.uniqueRequestId = "XXXXXXXX";
FileStream stream = File.OpenRead(@"path");
byte[] fileBytes = new byte[stream.Length];
stream.Read(fileBytes, 0, fileBytes.Length);
stream.Close();
request.dataHandler = fileBytes;
X509SecurityToken encryptingToken = GetServerToken();
Servicee.RequestSoapContext.Security.Elements.Add(new EncryptedData(encryptingToken));
BulkPanResponse response = new BulkPanResponse();
response = Servicee.uploadBulkPan(request);
But when
Servicee.RequestSoapContext.Security.Elements.Add(new EncryptedData(encryptingToken));
line executes It is throwing error
WSE527: The SecurityToken does not support data encryption.
.
Please anyone who knows how to invoke the webservice with the above condition, help me to sort this issue.
Thank You