src\libraries\Common\src\System\Security\Cryptography\MLDsa.cs (23)
117SR.Format(SR.Argument_DestinationImprecise, signatureSizeInBytes),
126SR.Argument_SignatureContextTooLong255);
209SR.Argument_SignatureContextTooLong255);
824SR.Format(SR.Argument_DestinationImprecise, publicKeySizeInBytes),
874SR.Format(SR.Argument_DestinationImprecise, secretKeySizeInBytes),
921SR.Format(SR.Argument_DestinationImprecise, privateSeedSizeInBytes),
1006throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
1443throw new ArgumentException(SR.Cryptography_KeyWrongSizeForAlgorithm, nameof(source));
1493throw new ArgumentException(SR.Cryptography_KeyWrongSizeForAlgorithm, nameof(source));
1543throw new ArgumentException(SR.Cryptography_KeyWrongSizeForAlgorithm, nameof(source));
1777throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
1786throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
1798throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
1815throw new CryptographicException(SR.Cryptography_MLDsaPkcs8KeyMismatch);
1830throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
1838SR.Format(SR.Cryptography_UnknownAlgorithmIdentifier, identifier.Algorithm));
1854throw new PlatformNotSupportedException(SR.Format(SR.Cryptography_AlgorithmNotSupported, nameof(MLDsa)));
src\libraries\Common\src\System\Security\Cryptography\MLKem.cs (28)
116SR.Format(SR.Argument_DestinationImprecise, Algorithm.CiphertextSizeInBytes),
123SR.Format(SR.Argument_DestinationImprecise, Algorithm.SharedSecretSizeInBytes),
129throw new CryptographicException(SR.Cryptography_OverlappingBuffers);
199throw new ArgumentException(SR.Argument_KemInvalidCiphertextLength, nameof(ciphertext));
205SR.Format(SR.Argument_DestinationImprecise, Algorithm.SharedSecretSizeInBytes),
237throw new ArgumentException(SR.Argument_KemInvalidCiphertextLength, nameof(ciphertext));
280SR.Format(SR.Argument_DestinationImprecise, Algorithm.PrivateSeedSizeInBytes),
341throw new ArgumentException(SR.Argument_KemInvalidSeedLength, nameof(source));
400throw new ArgumentException(SR.Argument_KemInvalidDecapsulationKeyLength, nameof(source));
457throw new ArgumentException(SR.Argument_KemInvalidEncapsulationKeyLength, nameof(source));
511SR.Format(SR.Argument_DestinationImprecise, Algorithm.DecapsulationKeySizeInBytes),
565SR.Format(SR.Argument_DestinationImprecise, Algorithm.EncapsulationKeySizeInBytes),
1184throw new CryptographicException(SR.Argument_KemInvalidEncapsulationKeyLength);
1659throw new PlatformNotSupportedException(SR.Format(SR.Cryptography_AlgorithmNotSupported, nameof(MLKem)));
1690throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
1699throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
1711throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
1728throw new CryptographicException(SR.Cryptography_KemPkcs8KeyMismatch);
1743throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
1816throw new CryptographicException(SR.Cryptography_PqcNoSeed);
1824throw new CryptographicException(SR.Cryptography_KemNoDecapsulationKey);
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)));
src\libraries\Common\src\System\Security\Cryptography\SlhDsa.cs (20)
135SR.Format(SR.Argument_DestinationImprecise, signatureSizeInBytes),
144SR.Argument_SignatureContextTooLong255);
221SR.Argument_SignatureContextTooLong255);
319SR.Format(SR.Argument_DestinationImprecise, Algorithm.SignatureSizeInBytes),
328SR.Argument_SignatureContextTooLong255);
426SR.Argument_SignatureContextTooLong255);
1080SR.Format(SR.Argument_DestinationImprecise, publicKeySizeInBytes),
1131SR.Format(SR.Argument_DestinationImprecise, secretKeySizeInBytes),
1233throw new CryptographicException(SR.Argument_PublicKeyWrongSizeForAlgorithm);
1296throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
1685throw new ArgumentException(SR.Argument_PublicKeyWrongSizeForAlgorithm, nameof(source));
1735throw new ArgumentException(SR.Argument_SecretKeyWrongSizeForAlgorithm, nameof(source));
2019throw new CryptographicException(SR.Cryptography_HashLengthMismatch);
2035throw new CryptographicException(SR.Cryptography_HashLengthMismatch, ae);
2044throw new PlatformNotSupportedException(SR.Format(SR.Cryptography_AlgorithmNotSupported, nameof(SlhDsa)));
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));
974throw new ArgumentException(SR.Cryptography_PrivateKey_DoesNotMatch, nameof(privateKey));
1047throw new InvalidOperationException(SR.Cryptography_Cert_AlreadyHasPrivateKey);
1053throw new ArgumentException(SR.Cryptography_PrivateKey_WrongAlgorithm);
1058throw new ArgumentException(SR.Cryptography_PrivateKey_DoesNotMatch, nameof(privateKey));
1066throw new ArgumentException(SR.Cryptography_PrivateKey_DoesNotMatch, nameof(privateKey));
1294_ => throw new CryptographicException(SR.Format(SR.Cryptography_UnknownKeyAlgorithm, keyAlgorithm)),
1393_ => throw new CryptographicException(SR.Format(SR.Cryptography_UnknownKeyAlgorithm, keyAlgorithm)),
1450throw new CryptographicException(SR.Cryptography_X509_NoPemCertificate);
1464throw new CryptographicException(SR.Cryptography_X509_NoPemCertificate);
1474throw new CryptographicException(SR.Cryptography_X509_NoPemCertificate);
1631SR.Argument_InvalidHostnameOrIPAddress,
1648throw new CryptographicException(SR.Cryptography_X509_TooManySANs);
1823throw new CryptographicException(SR.Cryptography_X509_NoOrMismatchedPemKey, ae);
1830throw new CryptographicException(SR.Cryptography_X509_NoOrMismatchedPemKey);
1853throw new CryptographicException(SR.Cryptography_X509_NoOrMismatchedPemKey, ae);
1859throw new CryptographicException(SR.Cryptography_X509_NoOrMismatchedPemKey);