2using System.Collections.Generic;
13 private string commonName =
null;
14 private string surname =
null;
15 private string serialNumber =
null;
16 private string country =
null;
17 private string locality =
null;
18 private string stateOrProvince =
null;
19 private string streetAddress =
null;
20 private string organization =
null;
21 private string organizationalUnit =
null;
22 private string title =
null;
23 private string description =
null;
24 private string postalAddress =
null;
25 private string postalCode =
null;
26 private string postOfficeBox =
null;
27 private string physicalDeliveryOfficeName =
null;
28 private string telephoneNumber =
null;
29 private string registeredAddress =
null;
30 private string presentationAddress =
null;
31 private string name =
null;
32 private string givenName =
null;
33 private string initials =
null;
34 private string distinguishedName =
null;
35 private string houseIdentifier =
null;
36 private string[] subjectAlternativeNames =
null;
37 private string emailAddress =
null;
58 get => this.commonName;
59 set => this.commonName = value;
68 set => this.surname = value;
76 get => this.serialNumber;
77 set => this.serialNumber = value;
86 set => this.country = value;
95 set => this.locality = value;
103 get => this.stateOrProvince;
104 set => this.stateOrProvince = value;
112 get => this.streetAddress;
113 set => this.streetAddress = value;
121 get => this.organization;
122 set => this.organization = value;
130 get => this.organizationalUnit;
131 set => this.organizationalUnit = value;
140 set => this.title = value;
148 get => this.description;
149 set => this.description = value;
157 get => this.postalAddress;
158 set => this.postalAddress = value;
166 get => this.postalCode;
167 set => this.postalCode = value;
175 get => this.postOfficeBox;
176 set => this.postOfficeBox = value;
184 get => this.physicalDeliveryOfficeName;
185 set => this.physicalDeliveryOfficeName = value;
193 get => this.telephoneNumber;
194 set => this.telephoneNumber = value;
202 get => this.registeredAddress;
203 set => this.registeredAddress = value;
211 get => this.presentationAddress;
212 set => this.presentationAddress = value;
221 set => this.name = value;
229 get => this.givenName;
230 set => this.givenName = value;
238 get => this.initials;
239 set => this.initials = value;
247 get => this.distinguishedName;
248 set => this.distinguishedName = value;
256 get => this.houseIdentifier;
257 set => this.houseIdentifier = value;
265 get => this.subjectAlternativeNames;
266 set => this.subjectAlternativeNames = value;
274 get => this.emailAddress;
275 set => this.emailAddress = value;
290 this.EncodeIfDefined(DER,
"2.5.4.3", this.commonName);
291 this.EncodeIfDefined(DER,
"2.5.4.4", this.surname);
292 this.EncodeIfDefined(DER,
"2.5.4.5", this.serialNumber);
293 this.EncodeIfDefined(DER,
"2.5.4.6", this.country);
294 this.EncodeIfDefined(DER,
"2.5.4.7", this.locality);
295 this.EncodeIfDefined(DER,
"2.5.4.8", this.stateOrProvince);
296 this.EncodeIfDefined(DER,
"2.5.4.9", this.streetAddress);
297 this.EncodeIfDefined(DER,
"2.5.4.10", this.organization);
298 this.EncodeIfDefined(DER,
"2.5.4.11", this.organizationalUnit);
299 this.EncodeIfDefined(DER,
"2.5.4.12", this.title);
300 this.EncodeIfDefined(DER,
"2.5.4.13", this.description);
301 this.EncodeIfDefined(DER,
"2.5.4.16", this.postalAddress);
302 this.EncodeIfDefined(DER,
"2.5.4.17", this.postalCode);
303 this.EncodeIfDefined(DER,
"2.5.4.18", this.postOfficeBox);
304 this.EncodeIfDefined(DER,
"2.5.4.19", this.physicalDeliveryOfficeName);
305 this.EncodeIfDefined(DER,
"2.5.4.20", this.telephoneNumber);
306 this.EncodeIfDefined(DER,
"2.5.4.26", this.registeredAddress);
307 this.EncodeIfDefined(DER,
"2.5.4.29", this.presentationAddress);
308 this.EncodeIfDefined(DER,
"2.5.4.41", this.name);
309 this.EncodeIfDefined(DER,
"2.5.4.42", this.givenName);
310 this.EncodeIfDefined(DER,
"2.5.4.43", this.initials);
311 this.EncodeIfDefined(DER,
"2.5.4.49", this.distinguishedName);
312 this.EncodeIfDefined(DER,
"2.5.4.51", this.houseIdentifier);
313 this.EncodeIfDefined(DER,
"1.2.840.113549.1.9.1", this.emailAddress);
323 this.signatureAlgorithm.ExportPublicKey(DER);
330 if (!(this.subjectAlternativeNames is
null) && this.subjectAlternativeNames.Length > 0)
341 foreach (
string s
in this.subjectAlternativeNames)
359 byte[] CertificationRequestInfo = DER.
ToArray();
363 DER.
Raw(CertificationRequestInfo);
370 DER.
BITSTRING(this.signatureAlgorithm.Sign(CertificationRequestInfo));
377 private void EncodeIfDefined(
DerEncoder DER,
string OID,
string Value)
379 if (!(Value is
null))
Contains information about a Certificate Signing Request (CSR).
string DistinguishedName
Distinguished name (OID 2.5.4.49)
SignatureAlgorithm SignatureAlgorithm
Signature algorithm.
string PostalAddress
Postal Address (OID 2.5.4.16)
string TelephoneNumber
Telephone number (OID 2.5.4.20)
string StateOrProvince
Country Name (OID 2.5.4.8)
string PostOfficeBox
Post Office Box (OID 2.5.4.18)
string StreetAddress
Street Address (OID 2.5.4.9)
string PostalCode
Postal Code (OID 2.5.4.17)
string SerialNumber
Serial Number (OID 2.5.4.5)
string EMailAddress
e-Mail Address (OID 1.2.840.113549.1.9.1)
string PresentationAddress
Presentation Address (OID 2.5.4.29)
byte[] BuildCSR()
Building a Certificate Signing Request (CSR) in accordance with RFC 2986
string CommonName
Common Name (OID 2.5.4.3)
string GivenName
Given Name (OID 2.5.4.42)
string[] SubjectAlternativeNames
Subject Alternative Names (OID 2.5.29.17)
string Country
Country Name (OID 2.5.4.6)
string HouseIdentifier
House identifier (OID 2.5.4.51)
string Surname
Surname (OID 2.5.4.4)
string OrganizationalUnit
Organizational Unit Name (OID 2.5.4.11)
string Title
Title (OID 2.5.4.12)
string Organization
Organization Name (OID 2.5.4.10)
string Name
Name (OID 2.5.4.41)
string PhysicalDeliveryOfficeName
Physical Delivery Office Name (OID 2.5.4.19)
string Description
Description (OID 2.5.4.13)
string Locality
Locality Name (OID 2.5.4.7)
string Initials
Initials (OID 2.5.4.43)
string RegisteredAddress
Registered Address (OID 2.5.4.26)
CertificateRequest(SignatureAlgorithm SignatureAlgorithm)
Contains information about a Certificate Signing Request (CSR).
Encodes data using the Distinguished Encoding Rules (DER), as defined in X.690
void Raw(byte[] DerEncodedBytes)
Adds DER-encoded bytes to the output.
byte[] ToArray()
Converts the generated output to a byte arary.
void Clear()
Clears the output buffer.
void EndSET()
Ends the current SET.
void StartOCTET_STRING()
Starts a OCTET_STRING.
void StartBITSTRING()
Starts a BITSTRING.
void EndSEQUENCE()
Ends the current SEQUENCE.
void EndContent(Asn1TypeClass Class)
Ends the current Content section.
static bool IsPrintable(string Value)
Checks if a string is a printable string.
void OBJECT_IDENTIFIER(string OID)
Encodes an OBJECT IDENTIFIER value.
void NULL()
Encodes an NULL value.
void EndOCTET_STRING()
Ends the current OCTET_STRING.
void IA5_STRING(string Value)
Encodes an IA5 STRING value.
void BITSTRING(BitArray Bits)
Encodes an BITSTRING value.
void StartContent(Asn1TypeClass Class)
Starts a content section.
int Position
Current output position.
void INTEGER(long Value)
Encodes an INTEGER value.
void EndBITSTRING()
Ends the current BITSTRING.
void PRINTABLE_STRING(string Value)
Encodes an PRINTABLE STRING value.
void StartSET()
Starts a SET.
void StartSEQUENCE()
Starts a SEQUENCE.
Abstract base class for signature algorithms