src\libraries\Common\src\System\Security\Cryptography\MLKem.cs (29)
118SR.Format(SR.Argument_DestinationImprecise, Algorithm.CiphertextSizeInBytes),
125SR.Format(SR.Argument_DestinationImprecise, Algorithm.SharedSecretSizeInBytes),
131throw new CryptographicException(SR.Cryptography_OverlappingBuffers);
201throw new ArgumentException(SR.Argument_KemInvalidCiphertextLength, nameof(ciphertext));
207SR.Format(SR.Argument_DestinationImprecise, Algorithm.SharedSecretSizeInBytes),
239throw new ArgumentException(SR.Argument_KemInvalidCiphertextLength, nameof(ciphertext));
282SR.Format(SR.Argument_DestinationImprecise, Algorithm.PrivateSeedSizeInBytes),
343throw new ArgumentException(SR.Argument_KemInvalidSeedLength, nameof(source));
402throw new ArgumentException(SR.Argument_KemInvalidDecapsulationKeyLength, nameof(source));
459throw new ArgumentException(SR.Argument_KemInvalidEncapsulationKeyLength, nameof(source));
513SR.Format(SR.Argument_DestinationImprecise, Algorithm.DecapsulationKeySizeInBytes),
567SR.Format(SR.Argument_DestinationImprecise, Algorithm.EncapsulationKeySizeInBytes),
1189throw new CryptographicException(SR.Argument_KemInvalidEncapsulationKeyLength);
1666throw new PlatformNotSupportedException(SR.Format(SR.Cryptography_AlgorithmNotSupported, nameof(MLKem)));
1674SR.Format(SR.Cryptography_UnknownAlgorithmIdentifier, identifier.Algorithm));
1698throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
1707throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
1719throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
1736throw new CryptographicException(SR.Cryptography_KemPkcs8KeyMismatch);
1751throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
1764throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
src\libraries\Common\src\System\Security\Cryptography\PasswordBasedEncryption.cs (42)
20return new CryptographicException(SR.Cryptography_AlgKdfRequiresChars, algId);
47SR.Cryptography_UnknownHashAlgorithm,
62SR.Cryptography_UnknownAlgorithmIdentifier,
80SR.Format(
81SR.Cryptography_UnknownAlgorithmIdentifier,
143SR.Format(
144SR.Cryptography_UnknownAlgorithmIdentifier,
243SR.Format(
244SR.Cryptography_UnknownAlgorithmIdentifier,
275SR.Format(
276SR.Cryptography_UnknownAlgorithmIdentifier,
301throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm, prf.Name);
517throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
525SR.Format(
526SR.Cryptography_UnknownAlgorithmIdentifier,
574SR.Format(SR.Cryptography_AlgorithmNotSupported, algId));
602throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
622throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
637throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
644throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
654throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
673throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
682throw new CryptographicException(SR.Cryptography_UnknownAlgorithmIdentifier, algId);
692throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
708throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
715throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding, e);
727throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
737SR.Format(
738SR.Cryptography_UnknownAlgorithmIdentifier,
745throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
755SR.Format(
756SR.Cryptography_UnknownAlgorithmIdentifier,
765throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
793throw new CryptographicException(SR.Argument_InvalidValue, e);
816throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
823throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
828throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
867throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
1095throw new CryptographicException(SR.Argument_InvalidValue);
1106throw new PlatformNotSupportedException(SR.Format(SR.Cryptography_AlgorithmNotSupported, nameof(RC2)));
System\Security\Cryptography\DSACryptoServiceProvider.Unix.cs (22)
60throw new PlatformNotSupportedException(SR.Format(SR.Cryptography_CAPI_Required, nameof(CspParameters)));
66throw new PlatformNotSupportedException(SR.Format(SR.Cryptography_CAPI_Required, nameof(CspParameters)));
78get { throw new PlatformNotSupportedException(SR.Format(SR.Cryptography_CAPI_Required, nameof(CspKeyContainerInfo))); }
104throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm, hashAlgorithm.Name);
112throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm, hashAlgorithm.Name);
120throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm, hashAlgorithm.Name);
135throw new CryptographicException(SR.Argument_InvalidValue);
167throw new CryptographicException(SR.Cryptography_InvalidKeySize);
206throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm, hashAlgorithm.Name);
214throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm, hashAlgorithm.Name);
222throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm, hashAlgorithm.Name);
233throw new CryptographicException(SR.Cryptography_CSP_NoPrivateKey);
235throw new CryptographicException(SR.Format(SR.Cryptography_InvalidHashSize, "SHA1", SHA1_HASHSIZE));
239throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm, str);
256throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm, str);
264throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm, hashAlgorithm.Name);
272throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm, hashAlgorithm.Name);
280throw 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\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)
400throw new InvalidOperationException(SR.Cryptography_CertReq_NoKeyProvided);
464throw new InvalidOperationException(SR.Cryptography_CertReq_NoHashAlgorithmProvided);
482SR.Format(SR.Cryptography_CertReq_NullValueInCollection, nameof(OtherRequestAttributes)));
488SR.Format(SR.Cryptography_CertReq_MissingOidInCollection, nameof(OtherRequestAttributes)));
493throw new InvalidOperationException(SR.Cryptography_CertReq_ExtensionRequestInOtherAttributes);
634throw new ArgumentException(SR.Cryptography_CertReq_DatesReversed);
636throw new InvalidOperationException(SR.Cryptography_CertReq_NoKeyProvided);
781throw new ArgumentException(SR.Cryptography_CertReq_IssuerRequiresPrivateKey, nameof(issuerCertificate));
783throw new ArgumentException(SR.Cryptography_CertReq_DatesReversed);
785throw new ArgumentException(SR.Arg_EmptyOrNullArray, nameof(serialNumber));
790SR.Format(
791SR.Cryptography_CertReq_AlgorithmMustMatch,
801SR.Format(
802SR.Cryptography_CertReq_NotBeforeNotNested,
821SR.Format(
822SR.Cryptography_CertReq_NotAfterNotNested,
837throw new ArgumentException(SR.Cryptography_CertReq_BasicConstraintsRequired, nameof(issuerCertificate));
839throw new ArgumentException(SR.Cryptography_CertReq_IssuerBasicConstraintsInvalid, nameof(issuerCertificate));
841throw new ArgumentException(SR.Cryptography_CertReq_IssuerKeyUsageInvalid, nameof(issuerCertificate));
854throw new InvalidOperationException(SR.Cryptography_CertReq_RSAPaddingRequired);
868SR.Format(SR.Cryptography_UnknownKeyAlgorithm, keyAlgorithm),
969throw new ArgumentException(SR.Cryptography_CertReq_DatesReversed);
971throw new ArgumentException(SR.Arg_EmptyOrNullArray, nameof(serialNumber));
976throw new InvalidOperationException(SR.Cryptography_CertReq_NoHashAlgorithmProvided);
1025SR.Format(SR.Cryptography_CertReq_DuplicateExtension, extension.Oid.Value));
System\Security\Cryptography\X509Certificates\X509Certificate2.cs (31)
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));
854throw new InvalidOperationException(SR.Cryptography_Cert_AlreadyHasPrivateKey);
860throw new ArgumentException(SR.Cryptography_PrivateKey_WrongAlgorithm);
865throw new ArgumentException(SR.Cryptography_PrivateKey_DoesNotMatch, nameof(privateKey));
873throw new ArgumentException(SR.Cryptography_PrivateKey_DoesNotMatch, nameof(privateKey));
955throw new InvalidOperationException(SR.Cryptography_Cert_AlreadyHasPrivateKey);
961throw new ArgumentException(SR.Cryptography_PrivateKey_WrongAlgorithm);
966throw new ArgumentException(SR.Cryptography_PrivateKey_DoesNotMatch, nameof(privateKey));
977throw new ArgumentException(SR.Cryptography_PrivateKey_DoesNotMatch, nameof(privateKey));
1050throw new InvalidOperationException(SR.Cryptography_Cert_AlreadyHasPrivateKey);
1056throw new ArgumentException(SR.Cryptography_PrivateKey_WrongAlgorithm);
1061throw new ArgumentException(SR.Cryptography_PrivateKey_DoesNotMatch, nameof(privateKey));
1069throw new ArgumentException(SR.Cryptography_PrivateKey_DoesNotMatch, nameof(privateKey));
1291_ => throw new CryptographicException(SR.Format(SR.Cryptography_UnknownKeyAlgorithm, keyAlgorithm)),
1384_ => throw new CryptographicException(SR.Format(SR.Cryptography_UnknownKeyAlgorithm, keyAlgorithm)),
1441throw new CryptographicException(SR.Cryptography_X509_NoPemCertificate);
1455throw new CryptographicException(SR.Cryptography_X509_NoPemCertificate);
1465throw new CryptographicException(SR.Cryptography_X509_NoPemCertificate);
1622SR.Argument_InvalidHostnameOrIPAddress,
1639throw new CryptographicException(SR.Cryptography_X509_TooManySANs);
1814throw new CryptographicException(SR.Cryptography_X509_NoOrMismatchedPemKey, ae);
1821throw new CryptographicException(SR.Cryptography_X509_NoOrMismatchedPemKey);
1844throw new CryptographicException(SR.Cryptography_X509_NoOrMismatchedPemKey, ae);
1850throw new CryptographicException(SR.Cryptography_X509_NoOrMismatchedPemKey);