[Mono.Security] Added Encode to AuthorityKeyIdentifierExtension and SubjectKeyIdentif...
authorLex Li <support@lextm.com>
Sun, 25 May 2014 12:02:57 +0000 (12:02 +0000)
committerLex Li <support@lextm.com>
Sun, 25 May 2014 12:25:08 +0000 (12:25 +0000)
mcs/class/Mono.Security/Mono.Security.X509.Extensions/AuthorityKeyIdentifierExtension.cs
mcs/class/Mono.Security/Mono.Security.X509.Extensions/SubjectKeyIdentifierExtension.cs

index c42a63343ffd9307fcebad252fd39ffa861e0932..ab426542dbcd01288dd4e2dbf0acb3749f4a5a66 100644 (file)
@@ -82,6 +82,18 @@ namespace Mono.Security.X509.Extensions {
                        }
                }
 
+               protected override void Encode ()
+               {
+                       ASN1 seq = new ASN1 (0x30);
+                       if (Identifier == null) {
+                               throw new ArgumentException ("Invalid AuthorityKeyIdentifier extension");
+                       }
+
+                       seq.Add (new ASN1 (0x80, aki));
+                       extnValue = new ASN1 (0x04);
+                       extnValue.Add (seq);
+               }
+
                public override string Name {
                        get { return "Authority Key Identifier"; }
                }
@@ -92,6 +104,7 @@ namespace Mono.Security.X509.Extensions {
                                        return null;
                                return (byte[]) aki.Clone (); 
                        }
+                       set { aki = value; }
                }
 
                public override string ToString () 
index 945111675e3b95e3169422f01a56d1c099bba9a7..c4b3105635712bf62d2736ea45fdd0443e7e9f2d 100644 (file)
@@ -75,6 +75,17 @@ namespace Mono.Security.X509.Extensions {
                        ski = sequence.Value;
                }
 
+               protected override void Encode ()
+               {
+                       if (Identifier == null) {
+                               throw new ArgumentException ("Invalid SubjectKeyIdentifier extension");
+                       }
+
+                       var seq = new ASN1 (0x04, ski);
+                       extnValue = new ASN1 (0x04);
+                       extnValue.Add (seq);
+               }
+
                public override string Name {
                        get { return "Subject Key Identifier"; }
                }
@@ -85,6 +96,7 @@ namespace Mono.Security.X509.Extensions {
                                        return null;
                                return (byte[]) ski.Clone (); 
                        }
+                       set { ski = value; }
                }
 
                public override string ToString ()