Skip to content

Commit e8c7cc8

Browse files
bartonjsmairaw
authored andcommitted
Add notice that MD5 and SHA-1 are not supported for CertificateRequest (#3812)
* Add notice that MD5 and SHA-1 are not supported for CertificateRequest * Fix bad copy/paste in CreateSigningRequest remark
1 parent f22b76d commit e8c7cc8

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

xml/System.Security.Cryptography.X509Certificates/CertificateRequest.xml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,16 @@
348348
<param name="serialNumber">The serial number to use for the new certificate. This value should be unique per issuer. The value is interpreted as an unsigned integer of arbitrary size in big-endian byte ordering. <see href="https://tools.ietf.org/html/rfc3280#section-4.1.2.2">RFC 3280</see> recommends confining it to 20 bytes or less.</param>
349349
<summary>Creates a certificate using the established subject, key, and optional extensions using the specified certificate as the issuer.</summary>
350350
<returns>An <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> object with the specified values. The returned object won't assert <see cref="P:System.Security.Cryptography.X509Certificates.X509Certificate2.HasPrivateKey" />.</returns>
351-
<remarks>To be added.</remarks>
351+
<remarks>
352+
<format type="text/markdown"><![CDATA[
353+
354+
## Remarks
355+
356+
This method does not support using MD5 or SHA-1 as the hash algorithm for the certificate signature.
357+
If you need an MD5 or SHA-1 based certificate signature, you need to implement a custom <xref:System.Security.Cryptography.X509Certificates.X509SignatureGenerator> and call <xref:System.Security.Cryptography.X509Certificates.CertificateRequest.Create(System.Security.Cryptography.X509Certificates.X500DistinguishedName,System.Security.Cryptography.X509Certificates.X509SignatureGenerator,System.DateTimeOffset,System.DateTimeOffset,System.Byte[])>.
358+
359+
]]></format>
360+
</remarks>
352361
<exception cref="T:System.ArgumentNullException">
353362
<paramref name="issuerCertificate" /> is <see langword="null" />.</exception>
354363
<exception cref="T:System.ArgumentException">The <paramref name="issuerCertificate" /> doesn't contain a private key.
@@ -370,6 +379,7 @@ The type of signing key represented by <paramref name="issuerCertificate" /> cou
370379
<paramref name="issuerCertificate" /> has a different key algorithm than the requested certificate.</exception>
371380
<exception cref="T:System.InvalidOperationException">
372381
<paramref name="issuerCertificate" /> is an RSA certificate and the current object was created using a constructor that doesn't accept a <paramref name="padding" /> parameter.</exception>
382+
<exception cref="T:System.ArgumentOutOfRangeException">The <see cref="P:System.Security.Cryptography.X509Certificates.CertificateRequest.HashAlgorithm"/> property value is not supported.</exception>
373383
</Docs>
374384
</Member>
375385
<Member MemberName="Create">
@@ -462,11 +472,21 @@ The type of signing key represented by <paramref name="issuerCertificate" /> cou
462472
<param name="notAfter">The date and time when this certificate is no longer considered valid.</param>
463473
<summary>Creates a self-signed certificate using the established subject, key, and optional extensions.</summary>
464474
<returns>An <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> object with the specified values. The returned object will assert <see cref="P:System.Security.Cryptography.X509Certificates.X509Certificate2.HasPrivateKey" />.</returns>
465-
<remarks>To be added.</remarks>
475+
<remarks>
476+
<format type="text/markdown"><![CDATA[
477+
478+
## Remarks
479+
480+
This method does not support using MD5 or SHA-1 as the hash algorithm for the certificate signature.
481+
If you need an MD5 or SHA-1 based certificate signature, you need to implement a custom <xref:System.Security.Cryptography.X509Certificates.X509SignatureGenerator> and call <xref:System.Security.Cryptography.X509Certificates.CertificateRequest.Create(System.Security.Cryptography.X509Certificates.X500DistinguishedName,System.Security.Cryptography.X509Certificates.X509SignatureGenerator,System.DateTimeOffset,System.DateTimeOffset,System.Byte[])>.
482+
483+
]]></format>
484+
</remarks>
466485
<exception cref="T:System.ArgumentException">
467486
<paramref name="notAfter" /> represents a date and time that happens earlier than <paramref name="notBefore" />.</exception>
468487
<exception cref="T:System.InvalidOperationException">The current object was created using a constructor that doesn't accept a signing key.</exception>
469488
<exception cref="T:System.Security.Cryptography.CryptographicException">An error occurs during the certificate creation process.</exception>
489+
<exception cref="T:System.ArgumentOutOfRangeException">The <see cref="P:System.Security.Cryptography.X509Certificates.CertificateRequest.HashAlgorithm"/> property value is not supported.</exception>
470490
</Docs>
471491
</Member>
472492
<MemberGroup MemberName="CreateSigningRequest">
@@ -511,6 +531,9 @@ The type of signing key represented by <paramref name="issuerCertificate" /> cou
511531
512532
## Remarks
513533
534+
This method does not support using MD5 or SHA-1 as the hash algorithm for the signing request signature.
535+
If you need an MD5 or SHA-1 based signing request, you need to implement a custom <xref:System.Security.Cryptography.X509Certificates.X509SignatureGenerator> and call <xref:System.Security.Cryptography.X509Certificates.CertificateRequest.CreateSigningRequest(System.Security.Cryptography.X509Certificates.X509SignatureGenerator)>.
536+
514537
When submitting a certificate signing request via a web browser, or other graphical or textual
515538
interface, the input is frequently expected to be in the Privacy Enhanced Mail (PEM) format,
516539
instead of the DER binary format. To convert the return value to PEM format, make a string
@@ -546,6 +569,7 @@ public static string PemEncodeSigningRequest(CertificateRequest request, PkcsSig
546569
]]></format>
547570
</remarks>
548571
<exception cref="T:System.InvalidOperationException">The current object was created using a constructor that doesn't accept a signing key.</exception>
572+
<exception cref="T:System.ArgumentOutOfRangeException">The <see cref="P:System.Security.Cryptography.X509Certificates.CertificateRequest.HashAlgorithm"/> property value is not supported.</exception>
549573
</Docs>
550574
</Member>
551575
<Member MemberName="CreateSigningRequest">

0 commit comments

Comments
 (0)