55using System . Security . Cryptography ;
66using Microsoft . IdentityModel . Logging ;
77
8- #if NET9_0_OR_GREATER
9- using System . Threading ;
10- #endif
11-
128namespace Microsoft . IdentityModel . Tokens
139{
1410 /// <summary>
@@ -19,13 +15,9 @@ public class SymmetricKeyWrapProvider : KeyWrapProvider
1915 private static readonly byte [ ] _defaultIV = new byte [ ] { 0xA6 , 0xA6 , 0xA6 , 0xA6 , 0xA6 , 0xA6 , 0xA6 , 0xA6 } ;
2016 private const int _blockSizeInBits = 64 ;
2117 private const int _blockSizeInBytes = _blockSizeInBits >> 3 ;
22- #if NET9_0_OR_GREATER
23- private static readonly Lock s_encryptorLock = new ( ) ;
24- private static readonly Lock s_decryptorLock = new ( ) ;
25- #else
26- private static readonly object s_encryptorLock = new ( ) ;
27- private static readonly object s_decryptorLock = new ( ) ;
28- #endif
18+ private static readonly object _encryptorLock = new object ( ) ;
19+ private static readonly object _decryptorLock = new object ( ) ;
20+
2921 private Lazy < SymmetricAlgorithm > _symmetricAlgorithm ;
3022 private ICryptoTransform _symmetricAlgorithmEncryptor ;
3123 private ICryptoTransform _symmetricAlgorithmDecryptor ;
@@ -267,7 +259,7 @@ Return an error
267259
268260 if ( _symmetricAlgorithmDecryptor == null )
269261 {
270- lock ( s_decryptorLock )
262+ lock ( _decryptorLock )
271263 {
272264 if ( _symmetricAlgorithmDecryptor == null )
273265 _symmetricAlgorithmDecryptor = _symmetricAlgorithm . Value . CreateDecryptor ( ) ;
@@ -417,7 +409,7 @@ private byte[] WrapKeyPrivate(byte[] inputBuffer, int inputOffset, int inputCoun
417409
418410 if ( _symmetricAlgorithmEncryptor == null )
419411 {
420- lock ( s_encryptorLock )
412+ lock ( _encryptorLock )
421413 {
422414 if ( _symmetricAlgorithmEncryptor == null )
423415 _symmetricAlgorithmEncryptor = _symmetricAlgorithm . Value . CreateEncryptor ( ) ;
0 commit comments