- Joined
- Mar 3, 2017
- Messages
- 1
- Reaction score
- 0
Public Void Method1()
{
Service1 serviceProxy = new Service1();
serviceProxy.UseDefaultCredentials = true;
serviceProxy.RequireMtom = true;
KerberosAssertion assertion = new KerberosAssertion();
KerberosToken token = GetSecurityToken();
assertion.EstablishSecurityContext = false;
assertion.RenewExpiredSecurityContext = true;
assertion.RequireSignatureConfirmation = false;
assertion.MessageProtectionOrder = MessageProtectionOrder.SignBeforeEncrypt;
assertion.RequireDerivedKeys = true;
assertion.TtlInSeconds = 300;
assertion.Protection.Request.SignatureOptions = Microsoft.Web.Services3.Security.SignatureOptions.IncludeAddressing;
assertion.Protection.Request.SignatureOptions = Microsoft.Web.Services3.Security.SignatureOptions.IncludeTimestamp;
assertion.Protection.Request.SignatureOptions = Microsoft.Web.Services3.Security.SignatureOptions.IncludeSoapBody;
assertion.Protection.Request.EncryptBody = true;
assertion.Protection.Response.SignatureOptions = Microsoft.Web.Services3.Security.SignatureOptions.IncludeAddressing;
assertion.Protection.Response.SignatureOptions = Microsoft.Web.Services3.Security.SignatureOptions.IncludeTimestamp;
assertion.Protection.Response.SignatureOptions = Microsoft.Web.Services3.Security.SignatureOptions.IncludeSoapBody;
assertion.Protection.Response.EncryptBody = true;
assertion.Protection.Fault.SignatureOptions = Microsoft.Web.Services3.Security.SignatureOptions.IncludeAddressing;
assertion.Protection.Fault.SignatureOptions = Microsoft.Web.Services3.Security.SignatureOptions.IncludeTimestamp;
assertion.Protection.Fault.SignatureOptions = Microsoft.Web.Services3.Security.SignatureOptions.IncludeSoapBody;
assertion.Protection.Fault.EncryptBody = false;
serviceProxy.SetClientCredential(token);
Policy policy = new Policy();
policy.Assertions.Add(assertion);
serviceProxy.SetPolicy(policy);
string str = serviceProxy.HelloWorld();
}
KerberosToken GetSecurityToken()
{
KerberosToken securityToken = new KerberosToken(“host/INBLRN0143”, ImpersonationLevel.Impersonation);
return securityToken;
}
But what happened, When I Debug the line KerberosToken token = GetSecurityToken();
and see the token object in watch window, Key through the exception
Key = 'securityToken.Key' threw an exception of type 'System.ArgumentException'
But after refreshing the token object, it create the key
Key = {Microsoft.Web.Services3.Security.Cryptography.AES128}
I don't understand why this kind of error is coming.
{
Service1 serviceProxy = new Service1();
serviceProxy.UseDefaultCredentials = true;
serviceProxy.RequireMtom = true;
KerberosAssertion assertion = new KerberosAssertion();
KerberosToken token = GetSecurityToken();
assertion.EstablishSecurityContext = false;
assertion.RenewExpiredSecurityContext = true;
assertion.RequireSignatureConfirmation = false;
assertion.MessageProtectionOrder = MessageProtectionOrder.SignBeforeEncrypt;
assertion.RequireDerivedKeys = true;
assertion.TtlInSeconds = 300;
assertion.Protection.Request.SignatureOptions = Microsoft.Web.Services3.Security.SignatureOptions.IncludeAddressing;
assertion.Protection.Request.SignatureOptions = Microsoft.Web.Services3.Security.SignatureOptions.IncludeTimestamp;
assertion.Protection.Request.SignatureOptions = Microsoft.Web.Services3.Security.SignatureOptions.IncludeSoapBody;
assertion.Protection.Request.EncryptBody = true;
assertion.Protection.Response.SignatureOptions = Microsoft.Web.Services3.Security.SignatureOptions.IncludeAddressing;
assertion.Protection.Response.SignatureOptions = Microsoft.Web.Services3.Security.SignatureOptions.IncludeTimestamp;
assertion.Protection.Response.SignatureOptions = Microsoft.Web.Services3.Security.SignatureOptions.IncludeSoapBody;
assertion.Protection.Response.EncryptBody = true;
assertion.Protection.Fault.SignatureOptions = Microsoft.Web.Services3.Security.SignatureOptions.IncludeAddressing;
assertion.Protection.Fault.SignatureOptions = Microsoft.Web.Services3.Security.SignatureOptions.IncludeTimestamp;
assertion.Protection.Fault.SignatureOptions = Microsoft.Web.Services3.Security.SignatureOptions.IncludeSoapBody;
assertion.Protection.Fault.EncryptBody = false;
serviceProxy.SetClientCredential(token);
Policy policy = new Policy();
policy.Assertions.Add(assertion);
serviceProxy.SetPolicy(policy);
string str = serviceProxy.HelloWorld();
}
KerberosToken GetSecurityToken()
{
KerberosToken securityToken = new KerberosToken(“host/INBLRN0143”, ImpersonationLevel.Impersonation);
return securityToken;
}
But what happened, When I Debug the line KerberosToken token = GetSecurityToken();
and see the token object in watch window, Key through the exception
Key = 'securityToken.Key' threw an exception of type 'System.ArgumentException'
But after refreshing the token object, it create the key
Key = {Microsoft.Web.Services3.Security.Cryptography.AES128}
I don't understand why this kind of error is coming.