forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use the managed codec for basic constraints and remove entire X.509 e…
…xtension PAL
- Loading branch information
Showing
19 changed files
with
121 additions
and
236 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...stem/Security/Cryptography/X509Certificates/LegacyBasicConstraintsDecoder.NotSupported.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
namespace System.Security.Cryptography.X509Certificates | ||
{ | ||
internal static class LegacyBasicConstraintsDecoder | ||
{ | ||
internal static bool IsSupported => false; | ||
|
||
internal static void DecodeX509BasicConstraintsExtension( | ||
byte[] encoded, | ||
out bool certificateAuthority, | ||
out bool hasPathLengthConstraint, | ||
out int pathLengthConstraint) | ||
{ | ||
// No RFC nor ITU document describes the layout of the 2.5.29.10 structure, | ||
// and OpenSSL doesn't have a decoder for it, either. | ||
// | ||
// Since it was never published as a standard (2.5.29.19 replaced it before publication) | ||
// there shouldn't be too many people upset that we can't decode it for them on Unix. | ||
throw new PlatformNotSupportedException(SR.NotSupported_LegacyBasicConstraints); | ||
} | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...rc/System/Security/Cryptography/X509Certificates/LegacyBasicConstraintsDecoder.Windows.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.Diagnostics; | ||
using System.Runtime.InteropServices; | ||
using Internal.Cryptography; | ||
|
||
namespace System.Security.Cryptography.X509Certificates | ||
{ | ||
internal static class LegacyBasicConstraintsDecoder | ||
{ | ||
internal static bool IsSupported => true; | ||
|
||
internal static void DecodeX509BasicConstraintsExtension( | ||
byte[] encoded, | ||
out bool certificateAuthority, | ||
out bool hasPathLengthConstraint, | ||
out int pathLengthConstraint) | ||
{ | ||
unsafe | ||
{ | ||
(certificateAuthority, hasPathLengthConstraint, pathLengthConstraint) = encoded.DecodeObject( | ||
CryptDecodeObjectStructType.X509_BASIC_CONSTRAINTS, | ||
static delegate (void* pvDecoded, int cbDecoded) | ||
{ | ||
Debug.Assert(cbDecoded >= sizeof(CERT_BASIC_CONSTRAINTS_INFO)); | ||
CERT_BASIC_CONSTRAINTS_INFO* pBasicConstraints = (CERT_BASIC_CONSTRAINTS_INFO*)pvDecoded; | ||
return ((Marshal.ReadByte(pBasicConstraints->SubjectType.pbData) & CERT_BASIC_CONSTRAINTS_INFO.CERT_CA_SUBJECT_FLAG) != 0, | ||
pBasicConstraints->fPathLenConstraint != 0, | ||
pBasicConstraints->dwPathLenConstraint); | ||
}); | ||
} | ||
} | ||
} | ||
} |
57 changes: 0 additions & 57 deletions
57
...graphy/src/System/Security/Cryptography/X509Certificates/ManagedX509ExtensionProcessor.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.