From ee6ec8d3bdc6165f82c7abcc779ce6d7f50b0307 Mon Sep 17 00:00:00 2001 From: Carol Wang Date: Fri, 16 Oct 2020 11:49:06 +0800 Subject: [PATCH] Remove dead code. (#4397) --- .../System/ServiceModel/Security/WSTrust.cs | 66 ------------------- 1 file changed, 66 deletions(-) diff --git a/src/System.Private.ServiceModel/src/System/ServiceModel/Security/WSTrust.cs b/src/System.Private.ServiceModel/src/System/ServiceModel/Security/WSTrust.cs index d0ae7874d8d..5ca783b42b9 100644 --- a/src/System.Private.ServiceModel/src/System/ServiceModel/Security/WSTrust.cs +++ b/src/System.Private.ServiceModel/src/System/ServiceModel/Security/WSTrust.cs @@ -9,7 +9,6 @@ using System.Globalization; using System.Xml; using System.Runtime; -using System.Security.Cryptography; using System.IdentityModel.Policy; using System.IdentityModel.Selectors; using System.IdentityModel.Tokens; @@ -1265,71 +1264,6 @@ private static void ValidateRequestorEntropy(SecurityToken entropy, SecurityKeyE throw DiagnosticUtility.ExceptionUtility.ThrowHelperWarning(new InvalidOperationException(SR.Format(SR.EntropyModeCannotHaveRequestorEntropy, mode))); } } - - internal static void ProcessRstAndIssueKey(RequestSecurityToken requestSecurityToken, SecurityTokenResolver resolver, SecurityKeyEntropyMode keyEntropyMode, SecurityAlgorithmSuite algorithmSuite, out int issuedKeySize, out byte[] issuerEntropy, out byte[] proofKey, - out SecurityToken proofToken) - { - SecurityToken requestorEntropyToken = requestSecurityToken.GetRequestorEntropy(resolver); - ValidateRequestorEntropy(requestorEntropyToken, keyEntropyMode); - byte[] requestorEntropy; - if (requestorEntropyToken != null) - { - if (requestorEntropyToken is BinarySecretSecurityToken) - { - BinarySecretSecurityToken skToken = (BinarySecretSecurityToken)requestorEntropyToken; - requestorEntropy = skToken.GetKeyBytes(); - } - else - { - throw DiagnosticUtility.ExceptionUtility.ThrowHelperWarning(new InvalidOperationException(SR.Format(SR.TokenCannotCreateSymmetricCrypto, requestorEntropyToken))); - } - } - else - { - requestorEntropy = null; - } - - if (keyEntropyMode == SecurityKeyEntropyMode.ClientEntropy) - { - if (requestorEntropy != null) - { - // validate that the entropy length matches the algorithm suite - ValidateRequestedKeySize(requestorEntropy.Length * 8, algorithmSuite); - } - proofKey = requestorEntropy; - issuerEntropy = null; - issuedKeySize = 0; - proofToken = null; - } - else - { - if (requestSecurityToken.KeySize != 0) - { - ValidateRequestedKeySize(requestSecurityToken.KeySize, algorithmSuite); - issuedKeySize = requestSecurityToken.KeySize; - } - else - { - issuedKeySize = algorithmSuite.DefaultSymmetricKeyLength; - } - RNGCryptoServiceProvider random = new RNGCryptoServiceProvider(); - if (keyEntropyMode == SecurityKeyEntropyMode.ServerEntropy) - { - proofKey = new byte[issuedKeySize / 8]; - // proof key is completely issued by the server - random.GetNonZeroBytes(proofKey); - issuerEntropy = null; - proofToken = new BinarySecretSecurityToken(proofKey); - } - else - { - issuerEntropy = new byte[issuedKeySize / 8]; - random.GetNonZeroBytes(issuerEntropy); - proofKey = RequestSecurityTokenResponse.ComputeCombinedKey(requestorEntropy, issuerEntropy, issuedKeySize); - proofToken = null; - } - } - } } } }