39 references to Assert
Microsoft.AspNetCore.Cryptography.Internal (9)
Cng\BCRYPT_KEY_LENGTHS_STRUCT.cs (1)
27CryptoUtil.Assert(keyLengthInBits % 8 == 0, "keyLengthInBits % 8 == 0");
CryptoUtil.cs (2)
32Assert(safeHandle != null && !safeHandle.IsInvalid, "Safe handle is invalid."); 98Assert(bufA.Length == bufB.Length, "countA == countB");
SafeHandles\BCryptAlgorithmHandle.cs (6)
72CryptoUtil.Assert(byteLengthOfNameWithTerminatingNull % sizeof(char) == 0 && byteLengthOfNameWithTerminatingNull > sizeof(char) && byteLengthOfNameWithTerminatingNull <= StackAllocCharSize * sizeof(char), "byteLengthOfNameWithTerminatingNull % sizeof(char) == 0 && byteLengthOfNameWithTerminatingNull > sizeof(char) && byteLengthOfNameWithTerminatingNull <= StackAllocCharSize * sizeof(char)"); 82CryptoUtil.Assert(numBytesCopied == byteLengthOfNameWithTerminatingNull, "numBytesCopied == byteLengthOfNameWithTerminatingNull"); 93CryptoUtil.Assert(numBytesCopied == sizeof(uint), "numBytesCopied == sizeof(uint)"); 104CryptoUtil.Assert(numBytesCopied == sizeof(uint), "numBytesCopied == sizeof(uint)"); 115CryptoUtil.Assert(numBytesCopied == sizeof(BCRYPT_KEY_LENGTHS_STRUCT), "numBytesCopied == sizeof(BCRYPT_KEY_LENGTHS_STRUCT)"); 126CryptoUtil.Assert(numBytesCopied == sizeof(uint), "numBytesCopied == sizeof(uint)");
Microsoft.AspNetCore.Cryptography.KeyDerivation (2)
PBKDF2\Win8Pbkdf2Provider.cs (2)
136CryptoUtil.Assert(cbPasswordDigest > 0, "cbPasswordDigest > 0"); 192CryptoUtil.Assert(numBytesDerived == cbDerivedBytes, "numBytesDerived == cbDerivedBytes");
Microsoft.AspNetCore.DataProtection (28)
AuthenticatedEncryption\AuthenticatedEncryptorExtensions.cs (1)
51CryptoUtil.Assert(roundTrippedData != null && roundTrippedData.Length == plaintextAsBytes.Length && plaintextAsGuid == new Guid(roundTrippedData),
AuthenticatedEncryption\CngGcmAuthenticatedEncryptorFactory.cs (1)
97CryptoUtil.Assert(algorithmHandle.GetCipherBlockLength() == 128 / 8, "GCM requires a block cipher algorithm with a 128-bit block size.");
Cng\CbcAuthenticatedEncryptor.cs (4)
243CryptoUtil.Assert(dwEncryptedBytes == cbOutput, "dwEncryptedBytes == cbOutput"); 347CryptoUtil.Assert(dwActualCiphertextSize == dwCiphertextSize, "dwActualCiphertextSize == dwCiphertextSize"); 400CryptoUtil.Assert(resultSpan.Length == outputSize, "writtenSpan length should equal calculated outputSize"); 573CryptoUtil.Assert(ptr - pbRetVal == retVal.Length, "ptr - pbRetVal == retVal.Length");
Cng\CngGcmAuthenticatedEncryptor.cs (5)
49CryptoUtil.Assert(symmetricAlgorithmHandle.GetCipherBlockLength() == 128 / 8, "GCM requires a block cipher algorithm with a 128-bit block size."); 127CryptoUtil.Assert(cbDecryptedBytesWritten == plaintextLength, "cbDecryptedBytesWritten == plaintextLength"); 214CryptoUtil.Assert(cbResult == cbPlaintextData, "cbResult == cbPlaintextData"); 319CryptoUtil.Assert(resultSpan.Length == outputSize, "writtenSpan length should equal calculated outputSize"); 406CryptoUtil.Assert(ptr - pbRetVal == retVal.Length, "ptr - pbRetVal == retVal.Length");
KeyManagement\KeyRingBasedDataProtector.cs (2)
107CryptoUtil.Assert(defaultEncryptorInstance != null, "defaultEncryptorInstance != null"); 124CryptoUtil.Assert(retVal != null && retVal.Length >= sizeof(uint) + sizeof(Guid), "retVal != null && retVal.Length >= sizeof(uint) + sizeof(Guid)");
KeyManagement\KeyRingBasedSpanDataProtector.cs (1)
36CryptoUtil.Assert(defaultEncryptor != null, "DefaultAuthenticatedEncryptor != null");
KeyManagement\KeyRingProvider.cs (1)
126CryptoUtil.Assert(defaultKey != null, "Expected to see a default key.");
Managed\AesGcmAuthenticatedEncryptor.cs (1)
203CryptoUtil.Assert(refPooledBuffer.WrittenSpan.Length == outputSize, "writtenSpan length should equal calculated outputSize");
Managed\HashAlgorithmExtensions.cs (1)
14CryptoUtil.Assert(hashSizeInBits >= 0 && hashSizeInBits % 8 == 0, "hashSizeInBits >= 0 && hashSizeInBits % 8 == 0");
Managed\ManagedAuthenticatedEncryptor.cs (6)
300CryptoUtil.Assert(refPooledBuffer.WrittenSpan.Length == outputSize, "bytesWritten == size"); 642CryptoUtil.Assert(ciphertext != null && ciphertext.Length == _symmetricAlgorithmBlockSizeInBytes, "ciphertext != null && ciphertext.Length == _symmetricAlgorithmBlockSizeInBytes"); 653CryptoUtil.Assert(digest != null && digest.Length == _validationAlgorithmDigestLengthInBytes, "digest != null && digest.Length == _validationAlgorithmDigestLengthInBytes"); 658CryptoUtil.Assert(idx == retVal.Length, "idx == retVal.Length"); 667CryptoUtil.Assert(retVal != null, "retVal != null"); 678CryptoUtil.Assert(retVal != null, "retVal != null");
Managed\SymmetricAlgorithmExtensions.cs (1)
14CryptoUtil.Assert(blockSizeInBits >= 0 && blockSizeInBits % 8 == 0, "blockSizeInBits >= 0 && blockSizeInBits % 8 == 0");
Secret.cs (1)
147CryptoUtil.Assert(numTotalBytesToAllocate % CRYPTPROTECTMEMORY_BLOCK_SIZE == 0, "numTotalBytesToAllocate % CRYPTPROTECTMEMORY_BLOCK_SIZE == 0");
SP800_108\ManagedSP800_108_CTR_HMACSHA512.cs (1)
111CryptoUtil.Assert(prfOutputSizeInBytes == prfOutput.Length, "prfOutputSizeInBytes == prfOutput.Length");
SP800_108\Win8SP800_108_CTR_HMACSHA512Provider.cs (1)
65CryptoUtil.Assert(numBytesDerived == cbDerivedKey, "numBytesDerived == cbDerivedKey");
XmlEncryption\XmlEncryptionExtensions.cs (1)
133CryptoUtil.Assert(encryptedXmlInfo != null, "IXmlEncryptor.Encrypt returned null.");