Skip to content

Commit 799ea08

Browse files
authored
Revert "Show CRL and OCSP URLs in verify output (#7181)" (#7220)
This reverts commit e0311a9.
1 parent 15dafc4 commit 799ea08

17 files changed

Lines changed: 13 additions & 377 deletions

File tree

src/NuGet.Core/NuGet.Packaging/Signing/Utility/CertificateUtility.cs

Lines changed: 0 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,6 @@ internal static IReadOnlyList<SignatureLog> X509Certificate2ToLogMessages(X509Ce
5656
issues.Add(SignatureLog.InformationLog($"{indentation}{string.Format(CultureInfo.CurrentCulture, Strings.CertUtilityCertificateIssuer, cert.IssuerName.Name)}"));
5757
issues.Add(SignatureLog.MinimalLog($"{indentation}{string.Format(CultureInfo.CurrentCulture, Strings.CertUtilityCertificateValidity, cert.NotBefore, cert.NotAfter)}"));
5858

59-
foreach (string url in GetCrlDistributionPointUrls(cert))
60-
{
61-
issues.Add(SignatureLog.InformationLog($"{indentation}{string.Format(CultureInfo.CurrentCulture, Strings.CertUtilityCertificateCrlUrl, url)}"));
62-
}
63-
64-
foreach (string url in GetOcspUrls(cert))
65-
{
66-
issues.Add(SignatureLog.InformationLog($"{indentation}{string.Format(CultureInfo.CurrentCulture, Strings.CertUtilityCertificateOcspUrl, url)}"));
67-
}
68-
6959
return issues;
7060
}
7161

@@ -78,16 +68,6 @@ private static void X509Certificate2ToString(X509Certificate2 cert, StringBuilde
7868
certStringBuilder.AppendLine(indentation + string.Format(CultureInfo.CurrentCulture, Strings.CertUtilityCertificateHash, fingerprintAlgorithm.ToString(), certificateFingerprint));
7969
certStringBuilder.AppendLine(indentation + string.Format(CultureInfo.CurrentCulture, Strings.CertUtilityCertificateIssuer, cert.IssuerName.Name));
8070
certStringBuilder.AppendLine(indentation + string.Format(CultureInfo.CurrentCulture, Strings.CertUtilityCertificateValidity, cert.NotBefore, cert.NotAfter));
81-
82-
foreach (string url in GetCrlDistributionPointUrls(cert))
83-
{
84-
certStringBuilder.AppendLine(indentation + string.Format(CultureInfo.CurrentCulture, Strings.CertUtilityCertificateCrlUrl, url));
85-
}
86-
87-
foreach (string url in GetOcspUrls(cert))
88-
{
89-
certStringBuilder.AppendLine(indentation + string.Format(CultureInfo.CurrentCulture, Strings.CertUtilityCertificateOcspUrl, url));
90-
}
9171
}
9272

9373
/// <summary>
@@ -467,117 +447,5 @@ private static bool IsHex(string certificateFingerprint)
467447

468448
return true;
469449
}
470-
471-
/// <summary>
472-
/// Extracts CRL Distribution Point URLs from the certificate's CRL Distribution Points extension (OID 2.5.29.31).
473-
/// </summary>
474-
internal static IReadOnlyList<string> GetCrlDistributionPointUrls(X509Certificate2 cert)
475-
{
476-
const string CrlDistributionPointsOid = "2.5.29.31";
477-
// context-specific primitive tag [6] for uniformResourceIdentifier in GeneralName
478-
const byte GeneralNameUriTag = 0x86;
479-
480-
var urls = new List<string>();
481-
var extension = cert.Extensions[CrlDistributionPointsOid];
482-
483-
if (extension == null)
484-
{
485-
return urls;
486-
}
487-
488-
try
489-
{
490-
// CRLDistributionPoints ::= SEQUENCE OF DistributionPoint
491-
var reader = new DerEncoding.DerSequenceReader(extension.RawData);
492-
493-
while (reader.HasData)
494-
{
495-
// DistributionPoint ::= SEQUENCE { distributionPoint [0] ... }
496-
var dpReader = reader.ReadSequence();
497-
498-
if (dpReader.HasData && dpReader.HasTag(DerEncoding.DerSequenceReader.ContextSpecificConstructedTag0))
499-
{
500-
// distributionPoint [0] CONSTRUCTED
501-
byte[] dpNameData = dpReader.ReadValue((DerEncoding.DerSequenceReader.DerTag)DerEncoding.DerSequenceReader.ContextSpecificConstructedTag0);
502-
var dpNameReader = DerEncoding.DerSequenceReader.CreateForPayload(dpNameData);
503-
504-
if (dpNameReader.HasData && dpNameReader.HasTag(DerEncoding.DerSequenceReader.ContextSpecificConstructedTag0))
505-
{
506-
// fullName [0] CONSTRUCTED = GeneralNames
507-
byte[] fullNameData = dpNameReader.ReadValue((DerEncoding.DerSequenceReader.DerTag)DerEncoding.DerSequenceReader.ContextSpecificConstructedTag0);
508-
var gnReader = DerEncoding.DerSequenceReader.CreateForPayload(fullNameData);
509-
510-
while (gnReader.HasData)
511-
{
512-
byte tag = gnReader.PeekTag();
513-
514-
if (tag == GeneralNameUriTag)
515-
{
516-
byte[] uriBytes = gnReader.ReadValue((DerEncoding.DerSequenceReader.DerTag)GeneralNameUriTag);
517-
urls.Add(Encoding.ASCII.GetString(uriBytes));
518-
}
519-
else
520-
{
521-
gnReader.SkipValue();
522-
}
523-
}
524-
}
525-
}
526-
}
527-
}
528-
catch (System.Security.Cryptography.CryptographicException)
529-
{
530-
}
531-
532-
return urls;
533-
}
534-
535-
/// <summary>
536-
/// Extracts OCSP responder URLs from the certificate's Authority Information Access extension (OID 1.3.6.1.5.5.7.1.1).
537-
/// </summary>
538-
internal static IReadOnlyList<string> GetOcspUrls(X509Certificate2 cert)
539-
{
540-
const string AuthorityInfoAccessOid = "1.3.6.1.5.5.7.1.1";
541-
const string OcspAccessMethodOid = "1.3.6.1.5.5.7.48.1";
542-
// context-specific primitive tag [6] for uniformResourceIdentifier in GeneralName
543-
const byte GeneralNameUriTag = 0x86;
544-
545-
var urls = new List<string>();
546-
var extension = cert.Extensions[AuthorityInfoAccessOid];
547-
548-
if (extension == null)
549-
{
550-
return urls;
551-
}
552-
553-
try
554-
{
555-
// AuthorityInfoAccessSyntax ::= SEQUENCE OF AccessDescription
556-
var reader = new DerEncoding.DerSequenceReader(extension.RawData);
557-
558-
while (reader.HasData)
559-
{
560-
// AccessDescription ::= SEQUENCE { accessMethod OID, accessLocation GeneralName }
561-
var adReader = reader.ReadSequence();
562-
string oid = adReader.ReadOidAsString();
563-
564-
if (string.Equals(oid, OcspAccessMethodOid, StringComparison.Ordinal) && adReader.HasData)
565-
{
566-
byte tag = adReader.PeekTag();
567-
568-
if (tag == GeneralNameUriTag)
569-
{
570-
byte[] uriBytes = adReader.ReadValue((DerEncoding.DerSequenceReader.DerTag)GeneralNameUriTag);
571-
urls.Add(Encoding.ASCII.GetString(uriBytes));
572-
}
573-
}
574-
}
575-
}
576-
catch (System.Security.Cryptography.CryptographicException)
577-
{
578-
}
579-
580-
return urls;
581-
}
582450
}
583451
}

src/NuGet.Core/NuGet.Packaging/Strings.Designer.cs

Lines changed: 0 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/NuGet.Core/NuGet.Packaging/Strings.resx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -271,14 +271,6 @@
271271
<comment>0 - start date
272272
1 - end date</comment>
273273
</data>
274-
<data name="CertUtilityCertificateCrlUrl" xml:space="preserve">
275-
<value>CRL URL: {0}</value>
276-
<comment>0 - CRL distribution point URL</comment>
277-
</data>
278-
<data name="CertUtilityCertificateOcspUrl" xml:space="preserve">
279-
<value>OCSP URL: {0}</value>
280-
<comment>0 - OCSP responder URL</comment>
281-
</data>
282274
<data name="CertUtilityMultipleCertificatesFooter" xml:space="preserve">
283275
<value>... {0} more.</value>
284276
<comment>0 - number of certificates left</comment>

src/NuGet.Core/NuGet.Packaging/xlf/Strings.cs.xlf

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,6 @@
4444
<note>0 - start date
4545
1 - end date</note>
4646
</trans-unit>
47-
<trans-unit id="CertUtilityCertificateCrlUrl">
48-
<source>CRL URL: {0}</source>
49-
<target state="translated">Adresa URL seznamu CRL: {0}</target>
50-
<note>0 - CRL distribution point URL</note>
51-
</trans-unit>
52-
<trans-unit id="CertUtilityCertificateOcspUrl">
53-
<source>OCSP URL: {0}</source>
54-
<target state="translated">Adresa URL protokolu OCSP: {0}</target>
55-
<note>0 - OCSP responder URL</note>
56-
</trans-unit>
5747
<trans-unit id="CertUtilityMultipleCertificatesFooter">
5848
<source>... {0} more.</source>
5949
<target state="translated">... dalších {0}.</target>
@@ -1146,4 +1136,4 @@ Valid from:</note>
11461136
</trans-unit>
11471137
</body>
11481138
</file>
1149-
</xliff>
1139+
</xliff>

src/NuGet.Core/NuGet.Packaging/xlf/Strings.de.xlf

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,6 @@
4444
<note>0 - start date
4545
1 - end date</note>
4646
</trans-unit>
47-
<trans-unit id="CertUtilityCertificateCrlUrl">
48-
<source>CRL URL: {0}</source>
49-
<target state="translated">CRL-URL: {0}</target>
50-
<note>0 - CRL distribution point URL</note>
51-
</trans-unit>
52-
<trans-unit id="CertUtilityCertificateOcspUrl">
53-
<source>OCSP URL: {0}</source>
54-
<target state="translated">OCSP-URL: {0}</target>
55-
<note>0 - OCSP responder URL</note>
56-
</trans-unit>
5747
<trans-unit id="CertUtilityMultipleCertificatesFooter">
5848
<source>... {0} more.</source>
5949
<target state="translated">... {0} weitere.</target>
@@ -1146,4 +1136,4 @@ Valid from:</note>
11461136
</trans-unit>
11471137
</body>
11481138
</file>
1149-
</xliff>
1139+
</xliff>

src/NuGet.Core/NuGet.Packaging/xlf/Strings.es.xlf

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,6 @@
4444
<note>0 - start date
4545
1 - end date</note>
4646
</trans-unit>
47-
<trans-unit id="CertUtilityCertificateCrlUrl">
48-
<source>CRL URL: {0}</source>
49-
<target state="translated">DIRECCIÓN URL DE CRL: {0}</target>
50-
<note>0 - CRL distribution point URL</note>
51-
</trans-unit>
52-
<trans-unit id="CertUtilityCertificateOcspUrl">
53-
<source>OCSP URL: {0}</source>
54-
<target state="translated">DIRECCIÓN URL DE OCSP: {0}</target>
55-
<note>0 - OCSP responder URL</note>
56-
</trans-unit>
5747
<trans-unit id="CertUtilityMultipleCertificatesFooter">
5848
<source>... {0} more.</source>
5949
<target state="translated">... {0} más.</target>
@@ -1146,4 +1136,4 @@ Valid from:</note>
11461136
</trans-unit>
11471137
</body>
11481138
</file>
1149-
</xliff>
1139+
</xliff>

src/NuGet.Core/NuGet.Packaging/xlf/Strings.fr.xlf

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,6 @@
4444
<note>0 - start date
4545
1 - end date</note>
4646
</trans-unit>
47-
<trans-unit id="CertUtilityCertificateCrlUrl">
48-
<source>CRL URL: {0}</source>
49-
<target state="translated">URL de la liste de révocation des certificats (CRL) : {0}</target>
50-
<note>0 - CRL distribution point URL</note>
51-
</trans-unit>
52-
<trans-unit id="CertUtilityCertificateOcspUrl">
53-
<source>OCSP URL: {0}</source>
54-
<target state="translated">URL du serveur OCSP : {0}</target>
55-
<note>0 - OCSP responder URL</note>
56-
</trans-unit>
5747
<trans-unit id="CertUtilityMultipleCertificatesFooter">
5848
<source>... {0} more.</source>
5949
<target state="translated">... {0} de plus.</target>
@@ -1146,4 +1136,4 @@ Valid from:</note>
11461136
</trans-unit>
11471137
</body>
11481138
</file>
1149-
</xliff>
1139+
</xliff>

src/NuGet.Core/NuGet.Packaging/xlf/Strings.it.xlf

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,6 @@
4444
<note>0 - start date
4545
1 - end date</note>
4646
</trans-unit>
47-
<trans-unit id="CertUtilityCertificateCrlUrl">
48-
<source>CRL URL: {0}</source>
49-
<target state="translated">URL CRL: {0}</target>
50-
<note>0 - CRL distribution point URL</note>
51-
</trans-unit>
52-
<trans-unit id="CertUtilityCertificateOcspUrl">
53-
<source>OCSP URL: {0}</source>
54-
<target state="translated">URL OCSP: {0}</target>
55-
<note>0 - OCSP responder URL</note>
56-
</trans-unit>
5747
<trans-unit id="CertUtilityMultipleCertificatesFooter">
5848
<source>... {0} more.</source>
5949
<target state="translated">... altri {0}.</target>
@@ -1146,4 +1136,4 @@ Valid from:</note>
11461136
</trans-unit>
11471137
</body>
11481138
</file>
1149-
</xliff>
1139+
</xliff>

src/NuGet.Core/NuGet.Packaging/xlf/Strings.ja.xlf

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,6 @@
4444
<note>0 - start date
4545
1 - end date</note>
4646
</trans-unit>
47-
<trans-unit id="CertUtilityCertificateCrlUrl">
48-
<source>CRL URL: {0}</source>
49-
<target state="translated">CRL URL: {0}</target>
50-
<note>0 - CRL distribution point URL</note>
51-
</trans-unit>
52-
<trans-unit id="CertUtilityCertificateOcspUrl">
53-
<source>OCSP URL: {0}</source>
54-
<target state="translated">OCSP URL: {0}</target>
55-
<note>0 - OCSP responder URL</note>
56-
</trans-unit>
5747
<trans-unit id="CertUtilityMultipleCertificatesFooter">
5848
<source>... {0} more.</source>
5949
<target state="translated">... さらに {0}。</target>
@@ -1147,4 +1137,4 @@ Valid from:</note>
11471137
</trans-unit>
11481138
</body>
11491139
</file>
1150-
</xliff>
1140+
</xliff>

src/NuGet.Core/NuGet.Packaging/xlf/Strings.ko.xlf

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,6 @@
4444
<note>0 - start date
4545
1 - end date</note>
4646
</trans-unit>
47-
<trans-unit id="CertUtilityCertificateCrlUrl">
48-
<source>CRL URL: {0}</source>
49-
<target state="translated">CRL URL: {0}</target>
50-
<note>0 - CRL distribution point URL</note>
51-
</trans-unit>
52-
<trans-unit id="CertUtilityCertificateOcspUrl">
53-
<source>OCSP URL: {0}</source>
54-
<target state="translated">OCSP URL: {0}</target>
55-
<note>0 - OCSP responder URL</note>
56-
</trans-unit>
5747
<trans-unit id="CertUtilityMultipleCertificatesFooter">
5848
<source>... {0} more.</source>
5949
<target state="translated">...기타 {0}개.</target>
@@ -1146,4 +1136,4 @@ Valid from:</note>
11461136
</trans-unit>
11471137
</body>
11481138
</file>
1149-
</xliff>
1139+
</xliff>

0 commit comments

Comments
 (0)