Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement X500DistinguishedNameBuilder #66509

Merged
merged 15 commits into from
Mar 15, 2022
6 changes: 6 additions & 0 deletions src/libraries/Common/src/System/Security/Cryptography/Oids.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ internal static partial class Oids

// X500 Names
internal const string CommonName = "2.5.4.3";
internal const string CountryOrRegionName = "2.5.4.6";
internal const string LocalityName = "2.5.4.7";
internal const string StateOrProvinceName = "2.5.4.8";
internal const string Organization = "2.5.4.10";
internal const string OrganizationalUnit = "2.5.4.11";
internal const string EmailAddress = "1.2.840.113549.1.9.1";
Expand Down Expand Up @@ -151,5 +154,8 @@ internal static partial class Oids
internal const string secp256r1 = "1.2.840.10045.3.1.7";
internal const string secp384r1 = "1.3.132.0.34";
internal const string secp521r1 = "1.3.132.0.35";

// LDAP
internal const string DomainComponent = "0.9.2342.19200300.100.1.25";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2525,6 +2525,21 @@ public X500DistinguishedName(string distinguishedName, System.Security.Cryptogra
public string Decode(System.Security.Cryptography.X509Certificates.X500DistinguishedNameFlags flag) { throw null; }
public override string Format(bool multiLine) { throw null; }
}
public sealed partial class X500DistinguishedNameBuilder
{
public X500DistinguishedNameBuilder() { }
public void Add(System.Security.Cryptography.Oid oid, string value, System.Formats.Asn1.UniversalTagNumber? stringEncodingType = default(System.Formats.Asn1.UniversalTagNumber?)) { }
public void Add(string oidValue, string value, System.Formats.Asn1.UniversalTagNumber? stringEncodingType = default(System.Formats.Asn1.UniversalTagNumber?)) { }
public void AddCommonName(string commonName) { }
public void AddCountryOrRegion(string twoLetterCode) { }
public void AddDomainComponent(string domainComponent) { }
public void AddEmailAddress(string emailAddress) { }
public void AddLocalityName(string localityName) { }
public void AddOrganizationalUnitName(string organizationalUnitName) { }
public void AddOrganizationName(string organizationName) { }
public void AddStateOrProvinceName(string stateOrProvinceName) { }
public System.Security.Cryptography.X509Certificates.X500DistinguishedName Build() { throw null; }
}
[System.FlagsAttribute]
public enum X500DistinguishedNameFlags
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\System.Collections.NonGeneric\ref\System.Collections.NonGeneric.csproj" />
<ProjectReference Include="..\..\System.Formats.Asn1\ref\System.Formats.Asn1.csproj" />
<ProjectReference Include="..\..\System.Net.Primitives\ref\System.Net.Primitives.csproj" />
<ProjectReference Include="..\..\System.Runtime\ref\System.Runtime.csproj" />
<ProjectReference Include="..\..\System.Security.SecureString\ref\System.Security.SecureString.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@
<data name="Arg_RankMultiDimNotSupported" xml:space="preserve">
<value>Only single dimensional arrays are supported for the requested action.</value>
</data>
<data name="Argument_Asn1_InvalidCharacterString" xml:space="preserve">
<value>The specified UniversalTagNumber must be a string type.</value>
</data>
<data name="Argument_Asn1_InvalidStringContents" xml:space="preserve">
<value>The contents of the string are not valid for the '{0}' ASN.1 encoding.</value>
</data>
<data name="Argument_DestinationTooShort" xml:space="preserve">
<value>Destination is too short.</value>
</data>
Expand Down Expand Up @@ -132,6 +138,12 @@
<data name="Argument_PemImport_EncryptedPem" xml:space="preserve">
<value>An encrypted key was found, but no password was provided. Use ImportFromEncryptedPem to import this key.</value>
</data>
<data name="Argument_X500_EmailTooLong" xml:space="preserve">
<value>The email address cannot exceed 255 characters.</value>
</data>
<data name="Argument_X500_InvalidCountryOrRegion" xml:space="preserve">
<value>The country or region code must be exactly two characters and contain characters between A through Z, inclusive.</value>
</data>
<data name="ArgumentOutOfRange_Index" xml:space="preserve">
<value>Index was out of range. Must be non-negative and less than the size of the collection.</value>
</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@
<Compile Include="System\Security\Cryptography\X509Certificates\StorePal.cs" />
<Compile Include="System\Security\Cryptography\X509Certificates\SubjectAlternativeNameBuilder.cs" />
<Compile Include="System\Security\Cryptography\X509Certificates\X500DistinguishedName.cs" />
<Compile Include="System\Security\Cryptography\X509Certificates\X500DistinguishedNameBuilder.cs" />
<Compile Include="System\Security\Cryptography\X509Certificates\X500DistinguishedNameFlags.cs" />
<Compile Include="System\Security\Cryptography\X509Certificates\X501Attribute.cs" />
<Compile Include="System\Security\Cryptography\X509Certificates\X509BasicConstraintsExtension.cs" />
Expand Down
Loading