206 references to CryptoPool
System.Security.Cryptography (206)
src\runtime\src\libraries\Common\src\Interop\Windows\BCrypt\Interop.BCryptExportKey.cs (4)
35byte[] rented = CryptoPool.Rent(numBytesNeeded); 40CryptoPool.Return(rented); 91byte[] rented = CryptoPool.Rent(numBytesNeeded); 110CryptoPool.Return(rented, clearSize: 0);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\CngHelpers.cs (2)
156byte[] buffer = CryptoPool.Rent(numBytesNeeded); 174CryptoPool.Return(buffer, clearSize: 0);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\CngPkcs8.cs (12)
141byte[] tmp = CryptoPool.Rent(pkcs8Writer.GetEncodedLength()); 150CryptoPool.Return(tmp, written); 194CryptoPool.Return(decrypted); 262CryptoPool.Return(decrypted); 295byte[] rented = CryptoPool.Rent(key.KeySize); 313rented = CryptoPool.Rent(checked(size * 2)); 314CryptoPool.Return(current, rentWritten); 326CryptoPool.Return(rented, rentWritten); 337byte[] rented = CryptoPool.Rent(key.KeySize); 350rented = CryptoPool.Rent(checked(size * 2)); 351CryptoPool.Return(current, rentWritten); 362CryptoPool.Return(rented, rentWritten);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\CompositeMLDsa.cs (4)
1885byte[] buffer = CryptoPool.Rent(size); 1891CryptoPool.Return(buffer); 1893buffer = CryptoPool.Rent(size); 1909CryptoPool.Return(buffer, written);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\CryptoPool.cs (2)
64CryptoPool.Return(_rented, clearSize); 83byte[] rented = CryptoPool.Rent(length);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\KeyFormatHelper.Encrypted.cs (10)
148byte[] decrypted = CryptoPool.Rent(epki.EncryptedData.Length); 185CryptoPool.Return(decrypted, clearSize: 0); 234byte[] encryptedRent = CryptoPool.Rent( 278CryptoPool.Return(encryptedRent, clearSize: 0); 329CryptoPool.Return(decrypted); 354CryptoPool.Return(decrypted); 380byte[] decrypted = CryptoPool.Rent(epki.EncryptedData.Length); 397CryptoPool.Return(decrypted); 434CryptoPool.Return(decrypted); 470CryptoPool.Return(decrypted);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\MLDsa.cs (8)
2049byte[] rented = CryptoPool.Rent(publicKeySizeInBytes); 2078CryptoPool.Return(rented, clearSize: 0); 2148byte[] buffer = CryptoPool.Rent(size); 2154CryptoPool.Return(buffer); 2156buffer = CryptoPool.Rent(size); 2172CryptoPool.Return(buffer, written); 2213byte[] rent = CryptoPool.Rent(privateKeySize); 2236CryptoPool.Return(rent, privateKeySize);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\MLDsaCng.Windows.cs (2)
246CryptoPool.Return(pkcs8); 513CryptoPool.Return(pkcs8);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\MLDsaImplementation.cs (2)
33byte[] rented = CryptoPool.Rent(alg.PrivateKeySizeInBytes); 50CryptoPool.Return(rented);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\MLDsaImplementation.Windows.cs (1)
251CryptoPool.Return(keyBlob);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\MLDsaPkcs8.cs (3)
32rented = CryptoPool.Rent(seedSize); 41rented = CryptoPool.Rent(privateKeySize); 67CryptoPool.Return(rented, written);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\MLKem.cs (12)
1638byte[] encapsulationKeyBuffer = CryptoPool.Rent(encapsulationKeySize); 1665CryptoPool.Return(encapsulationKeyBuffer, clearSize: 0); // SPKI is public info, skip clear. 1727byte[] rent = CryptoPool.Rent(decapsulationKeySize); 1750CryptoPool.Return(rent, decapsulationKeySize); 1772byte[] rented = CryptoPool.Rent(initialSize); 1777CryptoPool.Return(rented, 0); 1778rented = CryptoPool.Rent(rented.Length * 2); 1791CryptoPool.Return(rented, written); 1802byte[] buffer = CryptoPool.Rent(size); // Only passed out as span, callees can't keep a reference to it 1808CryptoPool.Return(buffer); 1810buffer = CryptoPool.Rent(size); 1821CryptoPool.Return(buffer, written);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\MLKemCng.Windows.cs (2)
262byte[] buffer = CryptoPool.Rent(bufferSize); 288CryptoPool.Return(buffer, clearSize: 0); // Manually cleared above.
src\runtime\src\libraries\Common\src\System\Security\Cryptography\MLKemImplementation.cs (2)
22byte[] rented = CryptoPool.Rent(alg.DecapsulationKeySizeInBytes); 41CryptoPool.Return(rented, size);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\MLKemImplementation.Windows.cs (2)
177CryptoPool.Return(key, clearSize: 0); 181CryptoPool.Return(key);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\MLKemPkcs8.cs (3)
32rented = CryptoPool.Rent(seedSize); 41rented = CryptoPool.Rent(decapsulationKeySize); 67CryptoPool.Return(rented, written);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\PasswordBasedEncryption.cs (10)
215rented = CryptoPool.Rent(byteCount); 250CryptoPool.Return(rented, clearSize: 0); 353byte[] sourceRent = CryptoPool.Rent(sourceLength); 470CryptoPool.Return(sourceRent, sourceLength); 500rented = CryptoPool.Rent(byteCount); 531CryptoPool.Return(rented, buf.Length); 966byte[] rentedEncryptedData = CryptoPool.Rent(encryptedData.Length); 967byte[] rentedDestination = CryptoPool.Rent(destination.Length); 1012CryptoPool.Return(rentedEncryptedData, encryptedData.Length); 1013CryptoPool.Return(rentedDestination, destination.Length);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\PemKeyHelpers.Factory.cs (4)
71byte[] decodeBuffer = CryptoPool.Rent(base64size); 91CryptoPool.Return(decodeBuffer, clearSize: bytesWritten); 136byte[] decodeBuffer = CryptoPool.Rent(base64size); 156CryptoPool.Return(decodeBuffer, clearSize: bytesWritten);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Pkcs\Pkcs12Builder.cs (4)
180rentedAuthSafe = CryptoPool.Rent(contentsWriter.GetEncodedLength()); 192rentedMac = CryptoPool.Rent(macKey.Length); 293CryptoPool.Return(rentedMac, clearSize: 0); 299CryptoPool.Return(rentedAuthSafe, clearSize: 0);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Pkcs\Pkcs12SafeContents.cs (2)
432byte[] encryptedRent = CryptoPool.Rent(contentsWriter.GetEncodedLength() + cipherBlockBytes); 487CryptoPool.Return(encryptedRent, clearSize: 0);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Pkcs\Pkcs8PrivateKeyInfo.cs (2)
200CryptoPool.Return(decrypted); 231CryptoPool.Return(decrypted);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Pkcs12Kdf.cs (2)
154IRented = CryptoPool.Rent(ILen); 229CryptoPool.Return(IRented, clearSize: 0);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\PqcBlobHelpers.cs (4)
122: (rented = CryptoPool.Rent(blobSize)); 154CryptoPool.Return(rented, blobSize); 243(rented = CryptoPool.Rent(blobSize)); 271CryptoPool.Return(rented, 0);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\RSACng.EncryptDecrypt.cs (4)
60byte[] rented = CryptoPool.Rent(modulusSizeInBytes); 83CryptoPool.Return(rented, clearSize: 0); 142byte[] rented = CryptoPool.Rent(modulusSizeInBytes); 165CryptoPool.Return(rented, clearSize: 0);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\RSACng.ImportExport.cs (1)
35CryptoPool.Return(keyBlob);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\RSAKeyFormatHelper.cs (2)
108byte[] rented = CryptoPool.Rent(pkcs1PublicKey.GetEncodedLength()); 119CryptoPool.Return(rented, clearSize: 0);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\RsaPaddingProcessor.cs (6)
349dbMask = CryptoPool.Rent(db.Length); 378CryptoPool.Return(dbMask, clearSize: 0); 421byte[] dbMaskRented = CryptoPool.Rent(dbLen); 469CryptoPool.Return(dbMaskRented, clearSize: 0); 519byte[] dbMaskRented = CryptoPool.Rent(maskedDb.Length); 583CryptoPool.Return(dbMaskRented, clearSize: 0);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\SlhDsa.cs (4)
1957byte[] buffer = CryptoPool.Rent(size); 1963CryptoPool.Return(buffer); 1965buffer = CryptoPool.Rent(size); 1981CryptoPool.Return(buffer, written);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Utf8DataEncoding.cs (2)
20(_rented = CryptoPool.Rent(maxLength)); 34CryptoPool.Return(_rented, clearSize: 0);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\X509Certificates\X509CertificateLoader.cs (2)
578CryptoPool.Return(rented, length); 650byte[] rented = CryptoPool.Rent(totalLength);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\X509Certificates\X509CertificateLoader.Pkcs12.cs (8)
939CryptoPool.Return(_decryptBuffer, _decryptBufferOffset); 944CryptoPool.Return(_keyDecryptBuffer, _keyDecryptBufferOffset); 975_decryptBuffer = CryptoPool.Rent(upperBound); 1098_keyDecryptBuffer = CryptoPool.Rent(spaceRequired); 1126CryptoPool.Return(decrypted); 1154CryptoPool.Return(decrypted); 1181CryptoPool.Return(decrypted); 1317byte[] ret = CryptoPool.Rent(writer.GetEncodedLength());
System\Security\Cryptography\AsymmetricAlgorithm.cs (4)
788byte[] buf = CryptoPool.Rent(bufSize); 804CryptoPool.Return(buf, bytesWritten); 818byte[] buf = CryptoPool.Rent(bufSize); 834CryptoPool.Return(buf, bytesWritten);
System\Security\Cryptography\Base64Transforms.cs (3)
158transformBuffer = transformBufferArray = CryptoPool.Rent(bytesToTransform); 205transformBuffer = transformBufferArray = CryptoPool.Rent(bytesToTransform); 326CryptoPool.Return(array, clearSize);
System\Security\Cryptography\BasicSymmetricCipherLiteBCrypt.cs (2)
56byte[] rented = CryptoPool.Rent(output.Length); 65CryptoPool.Return(rented, clearSize: numBytesWritten);
System\Security\Cryptography\BasicSymmetricCipherLiteNCrypt.cs (2)
66byte[] rented = CryptoPool.Rent(output.Length); 75CryptoPool.Return(rented, clearSize: numBytesWritten);
System\Security\Cryptography\CngHelpers.cs (1)
185byte[] rsaBlob = CryptoPool.Rent(blobSize);
System\Security\Cryptography\EccKeyFormatHelper.cs (4)
756basePointBytes = rented = CryptoPool.Rent(basePointLength); 768CryptoPool.Return(rented, clearSize: 0); 784publicKeyBytes = rented = CryptoPool.Rent(publicKeyLength); 796CryptoPool.Return(rented, clearSize: 0);
System\Security\Cryptography\Helpers.cs (2)
538? (rented = CryptoPool.Rent(messageLength)) 566CryptoPool.Return(rented);
System\Security\Cryptography\HKDF.Windows.cs (2)
133rented = CryptoPool.Rent(info.Length); 232CryptoPool.Return(rented, clearSize: 0); // Info is not considered secret.
System\Security\Cryptography\HKDFManagedImplementation.cs (2)
36rentedTempInfoBuffer = CryptoPool.Rent(info.Length); 81CryptoPool.Return(rentedTempInfoBuffer, clearSize: info.Length);
System\Security\Cryptography\LiteHashProvider.cs (4)
116byte[] rented = CryptoPool.Rent(4096); 133CryptoPool.Return(rented, clearSize: maxRead); 147byte[] rented = CryptoPool.Rent(4096); 164CryptoPool.Return(rented, clearSize: maxRead);
System\Security\Cryptography\LiteHashProvider.Xof.cs (2)
132byte[] rented = CryptoPool.Rent(4096); 149CryptoPool.Return(rented, clearSize: maxRead);
System\Security\Cryptography\PemKeyHelpers.cs (8)
32byte[] buffer = CryptoPool.Rent(bufferSize); 49CryptoPool.Return(buffer, bytesWritten); 68byte[] buffer = CryptoPool.Rent(bufferSize); 85CryptoPool.Return(buffer, bytesWritten); 137byte[] decodeBuffer = CryptoPool.Rent(base64size); 159CryptoPool.Return(decodeBuffer, clearSize: bytesWritten); 223byte[] decodeBuffer = CryptoPool.Rent(base64size); 245CryptoPool.Return(decodeBuffer, clearSize: bytesWritten);
System\Security\Cryptography\Rfc2898DeriveBytes.OneShot.cs (2)
282(rentedPasswordBuffer = CryptoPool.Rent(maxEncodedSize)) : 298CryptoPool.Return(rentedPasswordBuffer, clearSize: 0); // manually cleared above.
System\Security\Cryptography\RSA.cs (6)
684byte[] hash = CryptoPool.Rent(i); 694CryptoPool.Return(hash, hashLength); 734byte[] rented = CryptoPool.Rent(rentSize); 753CryptoPool.Return(rented, pkcs1Size); 777byte[] rented = CryptoPool.Rent(rentSize); 795CryptoPool.Return(rented, pkcs1Size);
System\Security\Cryptography\RSABCrypt.cs (2)
89CryptoPool.Return(keyBlob); 114CryptoPool.Return(keyBlob);
System\Security\Cryptography\UniversalCryptoDecryptor.cs (5)
89rentedCiphertext = CryptoPool.Rent(inputBuffer.Length); 96rentedCiphertext = CryptoPool.Rent(rentedCiphertextSize); 128CryptoPool.Return(rentedCiphertext, clearSize: rentedCiphertextSize); 137byte[] rented = CryptoPool.Rent(inputCount + InputBlockSize); 149CryptoPool.Return(rented, clearSize: written);
System\Security\Cryptography\UniversalCryptoOneShot.cs (2)
167byte[] rentedBuffer = CryptoPool.Rent(input.Length); 198CryptoPool.Return(rentedBuffer, clearSize: 0); // ZeroMemory clears the part of the buffer that was written to.
System\Security\Cryptography\X25519DiffieHellman.cs (8)
1459byte[] buffer = CryptoPool.Rent(size); 1465CryptoPool.Return(buffer); 1467buffer = CryptoPool.Rent(size); 1477CryptoPool.Return(buffer, written); 1525byte[] rented = CryptoPool.Rent(initialSize); 1530CryptoPool.Return(rented, 0); 1531rented = CryptoPool.Rent(rented.Length * 2); 1544CryptoPool.Return(rented, written);
System\Security\Cryptography\X25519DiffieHellmanImplementation.Windows.cs (2)
208CryptoPool.Return(key); 212CryptoPool.Return(key, clearSize: 0);
System\Security\Cryptography\X509Certificates\CertificateRequest.cs (3)
1103CryptoPool.Return(normalizedSerial); 1114newSerialNumber = CryptoPool.Rent(serialNumber.Length + 1); 1128newSerialNumber = CryptoPool.Rent(contentLength);
System\Security\Cryptography\X509Certificates\X509Certificate2.cs (9)
1533byte[] certBytes = CryptoPool.Rent(fields.DecodedDataLength); 1558CryptoPool.Return(certBytes, clearSize: 0); 2010byte[] base64Buffer = CryptoPool.Rent(fields.DecodedDataLength); 2011int base64ClearSize = CryptoPool.ClearAll; 2048CryptoPool.Return(base64Buffer, base64ClearSize); 2052CryptoPool.Return(decryptedPkcs8.Value); 2102byte[] base64Buffer = CryptoPool.Rent(fields.DecodedDataLength); 2103int clearSize = CryptoPool.ClearAll; 2131CryptoPool.Return(base64Buffer, clearSize);
System\Security\Cryptography\X509Certificates\X509CertificateLoader.Windows.cs (1)
228CryptoPool.Return(reassembled);
System\Security\Cryptography\X509Certificates\X509Pal.Windows.PublicKey.cs (2)
106CryptoPool.Return(keyBlob); 115CryptoPool.Return(keyBlob);