Пример #1
0
 /// <summary>
 /// Calls X509V3_EXT_conf_nid()
 /// </summary>
 /// <param name="issuer"></param>
 /// <param name="subject"></param>
 /// <param name="name"></param>
 /// <param name="critical"></param>
 /// <param name="value"></param>
 public X509Extension(X509Certificate issuer, X509Certificate subject, string name, bool critical, string value)
     : base(IntPtr.Zero, true)
 {
     using (X509V3Context ctx = new X509V3Context(issuer, subject, null))
     {
         this.ptr = Native.ExpectNonNull(Native.X509V3_EXT_conf_nid(IntPtr.Zero, ctx.Handle, Native.TextToNID(name), value));
     }
 }
Пример #2
0
 /// <summary>
 /// Creates a X509v3Context(), calls X509V3_set_ctx() on it, then calls
 /// X509V3_EXT_add_nconf()
 /// </summary>
 /// <param name="section"></param>
 /// <param name="issuer"></param>
 /// <param name="subject"></param>
 /// <param name="request"></param>
 public void ApplyExtensions(
     string section,
     X509Certificate issuer,
     X509Certificate subject,
     X509Request request)
 {
     using (X509V3Context ctx = new X509V3Context(issuer, subject, request))
     {
         ctx.SetConfiguration(this);
         Native.ExpectSuccess(Native.X509V3_EXT_add_nconf(
                                  this.ptr,
                                  ctx.Handle,
                                  Encoding.ASCII.GetBytes(section),
                                  subject.Handle));
     }
 }