src\libraries\Common\src\System\Security\Cryptography\MLKem.cs (28)
114SR.Format(SR.Argument_DestinationImprecise, Algorithm.CiphertextSizeInBytes),
121SR.Format(SR.Argument_DestinationImprecise, Algorithm.SharedSecretSizeInBytes),
127throw new CryptographicException(SR.Cryptography_OverlappingBuffers);
205throw new ArgumentException(SR.Argument_KemInvalidCiphertextLength, nameof(ciphertext));
211SR.Format(SR.Argument_DestinationImprecise, Algorithm.SharedSecretSizeInBytes),
251throw new ArgumentException(SR.Argument_KemInvalidCiphertextLength, nameof(ciphertext));
294SR.Format(SR.Argument_DestinationImprecise, Algorithm.PrivateSeedSizeInBytes),
355throw new ArgumentException(SR.Argument_KemInvalidSeedLength, nameof(source));
414throw new ArgumentException(SR.Argument_KemInvalidDecapsulationKeyLength, nameof(source));
471throw new ArgumentException(SR.Argument_KemInvalidEncapsulationKeyLength, nameof(source));
525SR.Format(SR.Argument_DestinationImprecise, Algorithm.DecapsulationKeySizeInBytes),
579SR.Format(SR.Argument_DestinationImprecise, Algorithm.EncapsulationKeySizeInBytes),
1198throw new CryptographicException(SR.Argument_KemInvalidEncapsulationKeyLength);
1673throw new PlatformNotSupportedException(SR.Format(SR.Cryptography_AlgorithmNotSupported, nameof(MLKem)));
1702throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
1711throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
1723throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
1740throw new CryptographicException(SR.Cryptography_KemPkcs8KeyMismatch);
1755throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
1828throw new CryptographicException(SR.Cryptography_PqcNoSeed);
1836throw new CryptographicException(SR.Cryptography_KemNoDecapsulationKey);
src\libraries\Common\src\System\Security\Cryptography\PasswordBasedEncryption.cs (42)
33return new CryptographicException(SR.Cryptography_AlgKdfRequiresChars, algId);
60SR.Cryptography_UnknownHashAlgorithm,
75SR.Cryptography_UnknownAlgorithmIdentifier,
108SR.Format(
109SR.Cryptography_UnknownAlgorithmIdentifier,
171SR.Format(
172SR.Cryptography_UnknownAlgorithmIdentifier,
271SR.Format(
272SR.Cryptography_UnknownAlgorithmIdentifier,
303SR.Format(
304SR.Cryptography_UnknownAlgorithmIdentifier,
329throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm, prf.Name);
545throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
553SR.Format(
554SR.Cryptography_UnknownAlgorithmIdentifier,
605SR.Format(SR.Cryptography_AlgorithmNotSupported, algId));
633throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
656throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
674throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
681throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
692throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
711throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
723throw new CryptographicException(SR.Cryptography_UnknownAlgorithmIdentifier, algId);
733throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
749throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
756throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding, e);
768throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
778SR.Format(
779SR.Cryptography_UnknownAlgorithmIdentifier,
786throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
796SR.Format(
797SR.Cryptography_UnknownAlgorithmIdentifier,
806throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
834throw new CryptographicException(SR.Argument_InvalidValue, e);
857throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
864throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
869throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
908throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
1137throw new CryptographicException(SR.Argument_InvalidValue);
1148throw new PlatformNotSupportedException(SR.Format(SR.Cryptography_AlgorithmNotSupported, nameof(RC2)));
src\libraries\Common\src\System\Security\Cryptography\SlhDsa.cs (18)
137SR.Format(SR.Argument_DestinationImprecise, signatureSizeInBytes),
146SR.Argument_SignatureContextTooLong255);
223SR.Argument_SignatureContextTooLong255);
321SR.Format(SR.Argument_DestinationImprecise, Algorithm.SignatureSizeInBytes),
330SR.Argument_SignatureContextTooLong255);
428SR.Argument_SignatureContextTooLong255);
1082SR.Format(SR.Argument_DestinationImprecise, publicKeySizeInBytes),
1133SR.Format(SR.Argument_DestinationImprecise, privateKeySizeInBytes),
1235throw new CryptographicException(SR.Argument_PublicKeyWrongSizeForAlgorithm);
1297throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
1686throw new ArgumentException(SR.Argument_PublicKeyWrongSizeForAlgorithm, nameof(source));
1736throw new ArgumentException(SR.Argument_PrivateKeyWrongSizeForAlgorithm, nameof(source));
2001throw new PlatformNotSupportedException(SR.Format(SR.Cryptography_AlgorithmNotSupported, nameof(SlhDsa)));
System\Security\Cryptography\CryptographicOperations.cs (12)
153throw new ArgumentException(SR.Argument_DestinationTooShort, nameof(destination));
462throw new ArgumentException(SR.Argument_DestinationTooShort, nameof(destination));
799throw new ArgumentException(SR.Format(SR.Argument_HashImprecise, hashSizeInBytes), nameof(hash));
890throw new ArgumentException(SR.Format(SR.Argument_HashImprecise, hashSizeInBytes), nameof(hash));
985throw new ArgumentException(SR.Format(SR.Argument_HashImprecise, hashSizeInBytes), nameof(hash));
1052throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source));
1096throw new CryptographicException(SR.Format(SR.Cryptography_UnknownHashAlgorithm, hashAlgorithm.Name));
1104throw new ArgumentException(SR.Argument_DestinationTooShort, "destination");
System\Security\Cryptography\DSACryptoServiceProvider.Unix.cs (22)
59throw new PlatformNotSupportedException(SR.Format(SR.Cryptography_CAPI_Required, nameof(CspParameters)));
65throw new PlatformNotSupportedException(SR.Format(SR.Cryptography_CAPI_Required, nameof(CspParameters)));
77get { throw new PlatformNotSupportedException(SR.Format(SR.Cryptography_CAPI_Required, nameof(CspKeyContainerInfo))); }
103throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm, hashAlgorithm.Name);
111throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm, hashAlgorithm.Name);
119throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm, hashAlgorithm.Name);
134throw new CryptographicException(SR.Argument_InvalidValue);
166throw new CryptographicException(SR.Cryptography_InvalidKeySize);
205throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm, hashAlgorithm.Name);
213throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm, hashAlgorithm.Name);
221throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm, hashAlgorithm.Name);
232throw new CryptographicException(SR.Cryptography_CSP_NoPrivateKey);
234throw new CryptographicException(SR.Format(SR.Cryptography_InvalidHashSize, "SHA1", SHA1_HASHSIZE));
238throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm, str);
255throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm, str);
263throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm, hashAlgorithm.Name);
271throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm, hashAlgorithm.Name);
279throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm, hashAlgorithm.Name);
System\Security\Cryptography\HKDF.cs (16)
57throw new ArgumentException(SR.Format(SR.Cryptography_Prk_TooSmall, hashLength), nameof(prk));
92throw new ArgumentException(SR.Format(SR.Cryptography_Prk_TooSmall, hashLength), nameof(prk));
98throw new ArgumentOutOfRangeException(nameof(outputLength), SR.Format(SR.Cryptography_Okm_TooLarge, maxOkmLength));
123throw new ArgumentException(SR.Argument_DestinationTooShort, nameof(output));
126throw new ArgumentException(SR.Format(SR.Cryptography_Prk_TooSmall, hashLength), nameof(prk));
131throw new ArgumentException(SR.Format(SR.Cryptography_Okm_TooLarge, maxOkmLength), nameof(output));
159throw new ArgumentOutOfRangeException(nameof(outputLength), SR.Format(SR.Cryptography_Okm_TooLarge, maxOkmLength));
180throw new ArgumentException(SR.Argument_DestinationTooShort, nameof(output));
185throw new ArgumentException(SR.Format(SR.Cryptography_Okm_TooLarge, maxOkmLength), nameof(output));
System\Security\Cryptography\HMACStatic.cs (15)
27throw new ArgumentException(SR.Format(SR.Argument_HashImprecise, THMAC.HashSizeInBytes), nameof(hash));
63throw new ArgumentException(SR.Argument_DestinationTooShort, nameof(destination));
90throw new ArgumentException(SR.Argument_DestinationTooShort, nameof(destination));
93throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source));
104throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source));
125throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source));
147throw new ArgumentException(SR.Argument_DestinationTooShort, nameof(destination));
150throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source));
175throw new ArgumentException(SR.Format(SR.Argument_HashImprecise, THMAC.HashSizeInBytes), nameof(hash));
178throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source));
208throw new ArgumentException(SR.Format(SR.Argument_HashImprecise, THMAC.HashSizeInBytes), nameof(hash));
211throw new ArgumentException(SR.Argument_StreamNotReadable, nameof(source));
System\Security\Cryptography\SymmetricAlgorithm.cs (41)
20throw new PlatformNotSupportedException(SR.Cryptography_DefaultAlgorithm_NotSupported);
36throw new CryptographicException(SR.Cryptography_InvalidFeedbackSize);
52throw new CryptographicException(SR.Cryptography_InvalidBlockSize);
76throw new CryptographicException(SR.Cryptography_InvalidIVSize);
97throw new CryptographicException(SR.Cryptography_InvalidKeySize);
115throw new CryptographicException(SR.Cryptography_InvalidKeySize);
150throw new CryptographicException(SR.Cryptography_InvalidCipherMode);
166throw new CryptographicException(SR.Cryptography_InvalidPaddingMode);
232throw new CryptographicException(SR.Cryptography_InvalidKeySize);
369throw new InvalidOperationException(SR.InvalidOperation_UnsupportedBlockSize);
377throw new ArgumentException(SR.Cryptography_MatchBlockSize, nameof(plaintextLength));
387throw new ArgumentOutOfRangeException(nameof(plaintextLength), SR.Cryptography_PlaintextTooLarge);
392throw new ArgumentOutOfRangeException(nameof(paddingMode), SR.Cryptography_InvalidPaddingMode);
448throw new ArgumentException(SR.Argument_BitsMustBeWholeBytes, nameof(feedbackSizeInBits));
456throw new ArgumentException(SR.Cryptography_MatchFeedbackSize, nameof(plaintextLength));
466throw new ArgumentOutOfRangeException(nameof(plaintextLength), SR.Cryptography_PlaintextTooLarge);
471throw new ArgumentOutOfRangeException(nameof(paddingMode), SR.Cryptography_InvalidPaddingMode);
531throw new CryptographicException(SR.Argument_DestinationTooShort);
564throw new ArgumentException(SR.Argument_DestinationTooShort, nameof(destination));
651throw new CryptographicException(SR.Format(SR.Cryptography_EncryptedIncorrectLength, nameof(TryEncryptEcbCore)));
682throw new ArgumentException(SR.Argument_DestinationTooShort, nameof(destination));
781throw new CryptographicException(SR.Argument_DestinationTooShort);
826throw new ArgumentException(SR.Argument_DestinationTooShort, nameof(destination));
938throw new CryptographicException(SR.Format(SR.Cryptography_EncryptedIncorrectLength, nameof(TryEncryptCbcCore)));
979throw new ArgumentException(SR.Argument_DestinationTooShort, nameof(destination));
1132throw new CryptographicException(SR.Argument_DestinationTooShort);
1200throw new ArgumentException(SR.Argument_DestinationTooShort, nameof(destination));
1374throw new CryptographicException(SR.Format(SR.Cryptography_EncryptedIncorrectLength, nameof(TryEncryptCfbCore)));
1432throw new ArgumentException(SR.Argument_DestinationTooShort, nameof(destination));
1519throw new NotSupportedException(SR.NotSupported_SubclassOverride);
1543throw new NotSupportedException(SR.NotSupported_SubclassOverride);
1574throw new NotSupportedException(SR.NotSupported_SubclassOverride);
1600throw new NotSupportedException(SR.NotSupported_SubclassOverride);
1629throw new NotSupportedException(SR.NotSupported_SubclassOverride);
1662throw new NotSupportedException(SR.NotSupported_SubclassOverride);
1668throw new ArgumentOutOfRangeException(nameof(paddingMode), SR.Cryptography_InvalidPaddingMode);
1674throw new ArgumentException(SR.Cryptography_InvalidIVSize, nameof(iv));
1681throw new ArgumentException(SR.Cryptography_InvalidFeedbackSize, nameof(feedbackSizeInBits));
System\Security\Cryptography\X509Certificates\CertificateRequest.cs (29)
448throw new InvalidOperationException(SR.Cryptography_CertReq_NoKeyProvided);
512throw new InvalidOperationException(SR.Cryptography_CertReq_NoHashAlgorithmProvided);
530SR.Format(SR.Cryptography_CertReq_NullValueInCollection, nameof(OtherRequestAttributes)));
536SR.Format(SR.Cryptography_CertReq_MissingOidInCollection, nameof(OtherRequestAttributes)));
541throw new InvalidOperationException(SR.Cryptography_CertReq_ExtensionRequestInOtherAttributes);
682throw new ArgumentException(SR.Cryptography_CertReq_DatesReversed);
684throw new InvalidOperationException(SR.Cryptography_CertReq_NoKeyProvided);
829throw new ArgumentException(SR.Cryptography_CertReq_IssuerRequiresPrivateKey, nameof(issuerCertificate));
831throw new ArgumentException(SR.Cryptography_CertReq_DatesReversed);
833throw new ArgumentException(SR.Arg_EmptyOrNullArray, nameof(serialNumber));
838SR.Format(
839SR.Cryptography_CertReq_AlgorithmMustMatch,
849SR.Format(
850SR.Cryptography_CertReq_NotBeforeNotNested,
869SR.Format(
870SR.Cryptography_CertReq_NotAfterNotNested,
885throw new ArgumentException(SR.Cryptography_CertReq_BasicConstraintsRequired, nameof(issuerCertificate));
887throw new ArgumentException(SR.Cryptography_CertReq_IssuerBasicConstraintsInvalid, nameof(issuerCertificate));
889throw new ArgumentException(SR.Cryptography_CertReq_IssuerKeyUsageInvalid, nameof(issuerCertificate));
902throw new InvalidOperationException(SR.Cryptography_CertReq_RSAPaddingRequired);
916SR.Format(SR.Cryptography_UnknownKeyAlgorithm, keyAlgorithm),
1017throw new ArgumentException(SR.Cryptography_CertReq_DatesReversed);
1019throw new ArgumentException(SR.Arg_EmptyOrNullArray, nameof(serialNumber));
1024throw new InvalidOperationException(SR.Cryptography_CertReq_NoHashAlgorithmProvided);
1073SR.Format(SR.Cryptography_CertReq_DuplicateExtension, extension.Oid.Value));
System\Security\Cryptography\X509Certificates\X509Certificate2.cs (40)
287_ => throw new NotSupportedException(SR.NotSupported_KeyAlgorithm),
395throw new ArgumentException(SR.Arg_EmptyOrNullArray, nameof(rawData));
413throw new ArgumentException(SR.Arg_EmptyOrNullArray, nameof(rawData));
763throw new InvalidOperationException(SR.Cryptography_Cert_AlreadyHasPrivateKey);
769throw new ArgumentException(SR.Cryptography_PrivateKey_WrongAlgorithm);
774throw new ArgumentException(SR.Cryptography_PrivateKey_DoesNotMatch, nameof(privateKey));
851throw new InvalidOperationException(SR.Cryptography_Cert_AlreadyHasPrivateKey);
857throw new ArgumentException(SR.Cryptography_PrivateKey_WrongAlgorithm);
862throw new ArgumentException(SR.Cryptography_PrivateKey_DoesNotMatch, nameof(privateKey));
873throw new ArgumentException(SR.Cryptography_PrivateKey_DoesNotMatch, nameof(privateKey));
953throw new InvalidOperationException(SR.Cryptography_Cert_AlreadyHasPrivateKey);
959throw new ArgumentException(SR.Cryptography_PrivateKey_WrongAlgorithm);
964throw new ArgumentException(SR.Cryptography_PrivateKey_DoesNotMatch, nameof(privateKey));
975throw new ArgumentException(SR.Cryptography_PrivateKey_DoesNotMatch, nameof(privateKey));
1049throw new InvalidOperationException(SR.Cryptography_Cert_AlreadyHasPrivateKey);
1055throw new ArgumentException(SR.Cryptography_PrivateKey_WrongAlgorithm);
1060throw new ArgumentException(SR.Cryptography_PrivateKey_DoesNotMatch, nameof(privateKey));
1075throw new ArgumentException(SR.Cryptography_PrivateKey_DoesNotMatch, nameof(privateKey));
1159throw new InvalidOperationException(SR.Cryptography_Cert_AlreadyHasPrivateKey);
1165throw new ArgumentException(SR.Cryptography_PrivateKey_WrongAlgorithm);
1170throw new ArgumentException(SR.Cryptography_PrivateKey_DoesNotMatch, nameof(privateKey));
1178throw new ArgumentException(SR.Cryptography_PrivateKey_DoesNotMatch, nameof(privateKey));
1394_ => throw new CryptographicException(SR.Format(SR.Cryptography_UnknownKeyAlgorithm, keyAlgorithm)),
1482_ => throw new CryptographicException(SR.Format(SR.Cryptography_UnknownKeyAlgorithm, keyAlgorithm)),
1539throw new CryptographicException(SR.Cryptography_X509_NoPemCertificate);
1553throw new CryptographicException(SR.Cryptography_X509_NoPemCertificate);
1563throw new CryptographicException(SR.Cryptography_X509_NoPemCertificate);
1720SR.Argument_InvalidHostnameOrIPAddress,
1737throw new CryptographicException(SR.Cryptography_X509_TooManySANs);
1909throw new CryptographicException(SR.Cryptography_X509_NoOrMismatchedPemKey);
1925throw new CryptographicException(SR.Cryptography_X509_NoOrMismatchedPemKey, ae);
1950throw new CryptographicException(SR.Cryptography_X509_NoOrMismatchedPemKey, ae);
1956throw new CryptographicException(SR.Cryptography_X509_NoOrMismatchedPemKey);
2044throw new CryptographicException(SR.Cryptography_X509_NoOrMismatchedPemKey, ce);
2057throw new CryptographicException(SR.Cryptography_X509_NoOrMismatchedPemKey);
2127throw new CryptographicException(SR.Cryptography_X509_NoOrMismatchedPemKey, ce);
2135throw new CryptographicException(SR.Cryptography_X509_NoOrMismatchedPemKey);
2220throw new CryptographicException(SR.Cryptography_X509_NoOrMismatchedPemKey);