Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilip Navara <filip.navara@gmail.com>2018-07-09 18:49:27 +0300
committerMarek Safar <marek.safar@gmail.com>2018-07-09 18:49:27 +0300
commit5bc264ad33aad652549a282578419319eca55141 (patch)
tree79bf3387b5e1a813ca7b2192f521c598ee10d121 /mcs/class/Mono.Security
parent6e4419a0635ba4e5a1a9cbc4f8cd1db322f94c83 (diff)
System.Security: Fix unit tests to use SERIALNUMBER instead of OID.2.5.4.5. (#9453)
* Fix unit tests to use SERIALNUMBER instead of OID.2.5.4.5 in X.500 names. Modify the code to pass the tests. * Add SERIALNUMBER for BTLS implementation. * Fix one more place where SERIALNUMBER was not handled.
Diffstat (limited to 'mcs/class/Mono.Security')
-rw-r--r--mcs/class/Mono.Security/Mono.Security.X509/X501Name.cs6
-rw-r--r--mcs/class/Mono.Security/Test/Mono.Security.X509/X501NameTest.cs4
2 files changed, 7 insertions, 3 deletions
diff --git a/mcs/class/Mono.Security/Mono.Security.X509/X501Name.cs b/mcs/class/Mono.Security/Mono.Security.X509/X501Name.cs
index 1c2a7b476aa..8c9dad7da21 100644
--- a/mcs/class/Mono.Security/Mono.Security.X509/X501Name.cs
+++ b/mcs/class/Mono.Security/Mono.Security.X509/X501Name.cs
@@ -63,7 +63,7 @@ namespace Mono.Security.X509 {
static byte[] localityName = { 0x55, 0x04, 0x07 };
static byte[] stateOrProvinceName = { 0x55, 0x04, 0x08 };
static byte[] streetAddress = { 0x55, 0x04, 0x09 };
- //static byte[] serialNumber = { 0x55, 0x04, 0x05 };
+ static byte[] serialNumber = { 0x55, 0x04, 0x05 };
static byte[] domainComponent = { 0x09, 0x92, 0x26, 0x89, 0x93, 0xF2, 0x2C, 0x64, 0x01, 0x19 };
static byte[] userid = { 0x09, 0x92, 0x26, 0x89, 0x93, 0xF2, 0x2C, 0x64, 0x01, 0x01 };
static byte[] email = { 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x01 };
@@ -160,6 +160,8 @@ namespace Mono.Security.X509 {
sb.Append ("G=");
else if (poid.CompareValue (initial))
sb.Append ("I=");
+ else if (poid.CompareValue (serialNumber))
+ sb.Append ("SERIALNUMBER=");
else {
// unknown OID
sb.Append ("OID."); // NOTE: Not present as RFC2253
@@ -234,6 +236,8 @@ namespace Mono.Security.X509 {
return new X520.GivenName ();
case "I":
return new X520.Initial ();
+ case "SERIALNUMBER":
+ return new X520.SerialNumber ();
default:
if (s.StartsWith ("OID.")) {
// MUST support it but it OID may be without it
diff --git a/mcs/class/Mono.Security/Test/Mono.Security.X509/X501NameTest.cs b/mcs/class/Mono.Security/Test/Mono.Security.X509/X501NameTest.cs
index 1aa64f0b8d5..4899923edbd 100644
--- a/mcs/class/Mono.Security/Test/Mono.Security.X509/X501NameTest.cs
+++ b/mcs/class/Mono.Security/Test/Mono.Security.X509/X501NameTest.cs
@@ -213,8 +213,8 @@ namespace MonoTests.Mono.Security.X509 {
0x13, 0x1D, 0x43, 0x56, 0x52, 0x3A, 0x31, 0x33, 0x34, 0x37, 0x31, 0x39, 0x36, 0x37, 0x2D, 0x55, 0x49, 0x44, 0x3A, 0x31, 0x32, 0x31,
0x32, 0x31, 0x32, 0x31, 0x32, 0x31, 0x32, 0x31, 0x32 };
ASN1 asn = new ASN1 (sn);
- Assert.AreEqual ("C=DK, O=Hedeby's Møbelhandel // CVR:13471967, CN=Hedeby's Møbelhandel - Salgsafdelingen, E=vhm@use.test.dk, OID.2.5.4.5=CVR:13471967-UID:121212121212", X501.ToString (asn), "ToString-1");
- Assert.AreEqual ("OID.2.5.4.5=CVR:13471967-UID:121212121212, E=vhm@use.test.dk, CN=Hedeby's Møbelhandel - Salgsafdelingen, O=Hedeby's Møbelhandel // CVR:13471967, C=DK", X501.ToString (asn, true, ", ", false), "ToString-2");
+ Assert.AreEqual ("C=DK, O=Hedeby's Møbelhandel // CVR:13471967, CN=Hedeby's Møbelhandel - Salgsafdelingen, E=vhm@use.test.dk, SERIALNUMBER=CVR:13471967-UID:121212121212", X501.ToString (asn), "ToString-1");
+ Assert.AreEqual ("SERIALNUMBER=CVR:13471967-UID:121212121212, E=vhm@use.test.dk, CN=Hedeby's Møbelhandel - Salgsafdelingen, O=Hedeby's Møbelhandel // CVR:13471967, C=DK", X501.ToString (asn, true, ", ", false), "ToString-2");
}
[Test]