Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions src/Microsoft.IdentityModel.Tokens/CryptoProviderFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ public virtual KeyedHashAlgorithm CreateKeyedHashAlgorithm(byte[] keyBytes, stri
}

// In the case of Aes128CbcHmacSha256, Aes192CbcHmacSha384, Aes256CbcHmacSha512 which are Authenticated Encryption algorithms
// SymmetricSignatureProvider will get passed a key with 1/2 the minimum keysize expected size for the HashAlgorithm. 16 bytes for SHA256, instead of 32 bytes.
// SymmetricSignatureProvider will get passed a key with 1/2 the minimum key size expected size for the HashAlgorithm. 16 bytes for SHA256, instead of 32 bytes.
// see: https://datatracker.ietf.org/doc/html/rfc7518#section-5.2.2.1
switch (algorithm)
{
Expand Down Expand Up @@ -704,10 +704,10 @@ private SignatureProvider CreateSignatureProvider(
// CryptoProviderCache.TryAdd will return false if unable to add the SignatureProvider.
// One possibility is the SignatureProvider was added between when we called TryGetSignatureProvider and here.
// SignatureProvider.IsCached will be false and CryptoProviderFactory.Release will dispose the SignatureProvider.
// Since the SignatueProvider, was never added to the cache, TryGetSignatureProvider will not return this instance, we can dispose.
// Since the SignatureProvider, was never added to the cache, TryGetSignatureProvider will not return this instance, we can dispose.
// This will result in sometimes (rarely) creating a SignatureProvider that is never cached.
// The alternative is to use a lock after the call to TryGetSignatureProvider, and then check again: { TryGet, lock, TryGet }.
// This will result in excesive locking for different keys, which is common in POP scenarios.
// This will result in excessive locking for different keys, which is common in POP scenarios.
signatureProvider.IsCached = CryptoProviderCache.TryAdd(signatureProvider);
}
else
Expand Down
6 changes: 3 additions & 3 deletions src/Microsoft.IdentityModel.Tokens/RsaSecurityKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class RsaSecurityKey : AsymmetricSecurityKey
internal RsaSecurityKey(JsonWebKey webKey)
: base(webKey)
{
IntializeWithRsaParameters(webKey.CreateRsaParameters());
InitializeWithRsaParameters(webKey.CreateRsaParameters());
webKey.ConvertedSecurityKey = this;
}

Expand All @@ -33,10 +33,10 @@ internal RsaSecurityKey(JsonWebKey webKey)
/// <param name="rsaParameters"><see cref="RSAParameters"/></param>
public RsaSecurityKey(RSAParameters rsaParameters)
{
IntializeWithRsaParameters(rsaParameters);
InitializeWithRsaParameters(rsaParameters);
}

internal void IntializeWithRsaParameters(RSAParameters rsaParameters)
internal void InitializeWithRsaParameters(RSAParameters rsaParameters)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@westin-m Shouldn't this change have triggered the public API analyzer?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we cannot take any spelling changes if they impact the public API.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a similar thought, but this is internal. I double checked SAL and MISE and there aren't usages of this through friend assemblies

{
// must have modulus and exponent otherwise the crypto operations fail later
if (rsaParameters.Modulus == null)
Expand Down
Loading