178 references to CryptoPool
System.Security.Cryptography (178)
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.Encode.cs (2)
61byte[] data = CryptoPool.Rent(size); 72CryptoPool.Return(data);
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.EvpPkey.cs (2)
149byte[] rented = CryptoPool.Rent(size); 200byte[] rented = CryptoPool.Rent(size);
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.PooledCrypto.cs (2)
26byte[] bytes = CryptoPool.Rent(targetSize); 32CryptoPool.Return(bytes);
src\libraries\Common\src\System\Security\Cryptography\Asn1Reader\AsnValueReader.cs (1)
253byte[] rented = CryptoPool.Rent(writer.GetEncodedLength());
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\libraries\Common\src\System\Security\Cryptography\CryptoPool.cs (2)
64CryptoPool.Return(_rented, clearSize); 83byte[] rented = CryptoPool.Rent(length);
src\libraries\Common\src\System\Security\Cryptography\KeyFormatHelper.Encrypted.cs (10)
118byte[] decrypted = CryptoPool.Rent(epki.EncryptedData.Length); 154CryptoPool.Return(decrypted, clearSize: 0); 203byte[] encryptedRent = CryptoPool.Rent( 247CryptoPool.Return(encryptedRent, clearSize: 0); 302CryptoPool.Return(decrypted); 333CryptoPool.Return(decrypted); 361byte[] decrypted = CryptoPool.Rent(epki.EncryptedData.Length); 378CryptoPool.Return(decrypted); 415CryptoPool.Return(decrypted); 451CryptoPool.Return(decrypted);
src\libraries\Common\src\System\Security\Cryptography\MLDsa.cs (8)
2084byte[] rented = CryptoPool.Rent(publicKeySizeInBytes); 2113CryptoPool.Return(rented, clearSize: 0); 2183byte[] buffer = CryptoPool.Rent(size); 2188CryptoPool.Return(buffer); 2190buffer = CryptoPool.Rent(size); 2206CryptoPool.Return(buffer, written); 2247byte[] rent = CryptoPool.Rent(privateKeySize); 2270CryptoPool.Return(rent, privateKeySize);
src\libraries\Common\src\System\Security\Cryptography\MLDsaImplementation.cs (2)
33byte[] rented = CryptoPool.Rent(alg.PrivateKeySizeInBytes); 50CryptoPool.Return(rented);
src\libraries\Common\src\System\Security\Cryptography\MLDsaPkcs8.cs (3)
33rented = CryptoPool.Rent(seedSize); 42rented = CryptoPool.Rent(privateKeySize); 68CryptoPool.Return(rented, written);
src\libraries\Common\src\System\Security\Cryptography\MLKem.cs (12)
1668byte[] encapsulationKeyBuffer = CryptoPool.Rent(encapsulationKeySize); 1695CryptoPool.Return(encapsulationKeyBuffer, clearSize: 0); // SPKI is public info, skip clear. 1759byte[] rent = CryptoPool.Rent(decapsulationKeySize); 1782CryptoPool.Return(rent, decapsulationKeySize); 1804byte[] rented = CryptoPool.Rent(initialSize); 1809CryptoPool.Return(rented, 0); 1810rented = CryptoPool.Rent(rented.Length * 2); 1823CryptoPool.Return(rented, written); 1834byte[] buffer = CryptoPool.Rent(size); // Only passed out as span, callees can't keep a reference to it 1839CryptoPool.Return(buffer); 1841buffer = CryptoPool.Rent(size); 1852CryptoPool.Return(buffer, written);
src\libraries\Common\src\System\Security\Cryptography\MLKemImplementation.cs (2)
22byte[] rented = CryptoPool.Rent(alg.DecapsulationKeySizeInBytes); 41CryptoPool.Return(rented, size);
src\libraries\Common\src\System\Security\Cryptography\MLKemPkcs8.cs (3)
33rented = CryptoPool.Rent(seedSize); 42rented = CryptoPool.Rent(decapsulationKeySize); 68CryptoPool.Return(rented, written);
src\libraries\Common\src\System\Security\Cryptography\PasswordBasedEncryption.cs (10)
188rented = CryptoPool.Rent(byteCount); 223CryptoPool.Return(rented, clearSize: 0); 326byte[] sourceRent = CryptoPool.Rent(sourceLength); 443CryptoPool.Return(sourceRent, sourceLength); 473rented = CryptoPool.Rent(byteCount); 504CryptoPool.Return(rented, buf.Length); 925byte[] rentedEncryptedData = CryptoPool.Rent(encryptedData.Length); 926byte[] rentedDestination = CryptoPool.Rent(destination.Length); 971CryptoPool.Return(rentedEncryptedData, encryptedData.Length); 972CryptoPool.Return(rentedDestination, destination.Length);
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\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\libraries\Common\src\System\Security\Cryptography\Pkcs\Pkcs12SafeContents.cs (2)
371byte[] encryptedRent = CryptoPool.Rent(contentsWriter.GetEncodedLength() + cipherBlockBytes); 426CryptoPool.Return(encryptedRent, clearSize: 0);
src\libraries\Common\src\System\Security\Cryptography\Pkcs\Pkcs8PrivateKeyInfo.cs (2)
200CryptoPool.Return(decrypted); 231CryptoPool.Return(decrypted);
src\libraries\Common\src\System\Security\Cryptography\Pkcs12Kdf.cs (2)
154IRented = CryptoPool.Rent(ILen); 229CryptoPool.Return(IRented, clearSize: 0);
src\libraries\Common\src\System\Security\Cryptography\RSAKeyFormatHelper.cs (2)
145byte[] rented = CryptoPool.Rent(pkcs1PublicKey.GetEncodedLength()); 156CryptoPool.Return(rented, clearSize: 0);
src\libraries\Common\src\System\Security\Cryptography\RSAOpenSsl.cs (12)
91byte[] buf = CryptoPool.Rent(rsaSize); 103CryptoPool.Return(buf, clearSize: 0); 131rent = CryptoPool.Rent(keySizeBytes); 157CryptoPool.Return(rent, clearSize: 0); 296CryptoPool.Return(p8); 315CryptoPool.Return(p8); 332CryptoPool.Return(spki); 359CryptoPool.Return(spki); 464CryptoPool.Return(pkcs8); 478CryptoPool.Return(spki); 512CryptoPool.Return(spki); 628CryptoPool.Return(pkcs8);
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\libraries\Common\src\System\Security\Cryptography\SlhDsa.cs (4)
1958byte[] buffer = CryptoPool.Rent(size); 1963CryptoPool.Return(buffer); 1965buffer = CryptoPool.Rent(size); 1981CryptoPool.Return(buffer, written);
src\libraries\Common\src\System\Security\Cryptography\Utf8DataEncoding.cs (2)
20(_rented = CryptoPool.Rent(maxLength)); 34CryptoPool.Return(_rented, clearSize: 0);
src\libraries\Common\src\System\Security\Cryptography\X509Certificates\X509CertificateLoader.cs (2)
578CryptoPool.Return(rented, length); 650byte[] rented = CryptoPool.Rent(totalLength);
src\libraries\Common\src\System\Security\Cryptography\X509Certificates\X509CertificateLoader.Pkcs12.cs (8)
936CryptoPool.Return(_decryptBuffer, _decryptBufferOffset); 941CryptoPool.Return(_keyDecryptBuffer, _keyDecryptBufferOffset); 972_decryptBuffer = CryptoPool.Rent(upperBound); 1095_keyDecryptBuffer = CryptoPool.Rent(spaceRequired); 1123CryptoPool.Return(decrypted); 1151CryptoPool.Return(decrypted); 1178CryptoPool.Return(decrypted); 1318byte[] 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(inputCount); 204transformBuffer = transformBufferArray = CryptoPool.Rent(inputCount); 321CryptoPool.Return(array, clearSize);
System\Security\Cryptography\EccKeyFormatHelper.cs (4)
777basePointBytes = rented = CryptoPool.Rent(basePointLength); 789CryptoPool.Return(rented, clearSize: 0); 805publicKeyBytes = rented = CryptoPool.Rent(publicKeyLength); 817CryptoPool.Return(rented, clearSize: 0);
System\Security\Cryptography\Helpers.cs (2)
538? (rented = CryptoPool.Rent(messageLength)) 566CryptoPool.Return(rented);
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\OpenSslCipherLite.cs (4)
66byte[] rented = CryptoPool.Rent(input.Length); 80CryptoPool.Return(rented, clearSize: written); 106byte[] tmp = CryptoPool.Rent(input.Length); 118CryptoPool.Return(tmp, written);
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\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\X509Certificates\CertificateRequest.cs (3)
1103CryptoPool.Return(normalizedSerial); 1114newSerialNumber = CryptoPool.Rent(serialNumber.Length + 1); 1128newSerialNumber = CryptoPool.Rent(contentLength);
System\Security\Cryptography\X509Certificates\OpenSslCrlCache.cs (1)
377CryptoPool.Return(crlDistributionPoints.Array, clearSize: 0);
System\Security\Cryptography\X509Certificates\OpenSslX509ChainProcessor.cs (5)
258CryptoPool.Return(authorityInformationAccess.Array!, clearSize: 0); 290tempChainRent = CryptoPool.Rent(targetSize); 329CryptoPool.Return(tempChainRent); 786CryptoPool.Return(encoded.Array!, clearSize: 0); 1214CryptoPool.Return(authorityInformationAccess.Array!, clearSize: 0);
System\Security\Cryptography\X509Certificates\X509Certificate2.cs (2)
1561byte[] certBytes = CryptoPool.Rent(fields.DecodedDataLength); 1586CryptoPool.Return(certBytes, clearSize: 0);
System\Security\Cryptography\X509Certificates\X509CertificateLoader.Unix.cs (6)
176CryptoPool.Return(rented, length); 511byte[] buf = CryptoPool.Rent(sizeHint); 517CryptoPool.Return(buf); 518buf = CryptoPool.Rent(sizeHint); 591internal void TrackArray(byte[]? rented, int clearSize = CryptoPool.ClearAll) 606CryptoPool.Return(rented, _clearSize);