Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dead code. #4397

Merged
merged 1 commit into from
Oct 16, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
}
}
}
}
}