我必须在C#中使用BouncyCastle创建CSR 我需要的主题如下:
“ CN =数据, O =数据 OU =数据, title =数据, C = BO, dnQualifier = CI, uidNumber = 1234567 , uid = LP, serialNumber = 1234567018, emailAddress=test@mail.com“
这两个值是自定义的:“ title”和“ uidNumber” 并具有以下OID
title = 2.5.4.12 uidNumber = 1.3.6.1.1.1.1.0
在Net Core上使用BouncyCastle,我创建了主题:
DerObjectIdentifier uidNumber = new DerObjectIdentifier("1.3.6.1.1.1.1.0"); // My Try
IDictionary attrs = new Hashtable();
attrs[X509Name.CN] = "Name";
attrs[X509Name.O] = "Data";
attrs[X509Name.OU] = "IT";
attrs[X509Name.T] = "Data";
attrs[X509Name.C] = "XX";
attrs[X509Name.DnQualifier] = "CI";
attrs[X509Name.UID] = "PT";
attrs[X509Name.SerialNumber] = "123423222";
attrs[X509Name.EmailAddress] = "test@mail.com";
attrs[uidNumber] = "6572301"; //The custom attrib
IList ord = new ArrayList();
ord.Add(X509Name.CN);
ord.Add(X509Name.O);
ord.Add(X509Name.OU);
ord.Add(X509Name.T);
ord.Add(X509Name.C);
ord.Add(X509Name.DnQualifier);
ord.Add(X509Name.UID);
ord.Add(X509Name.SerialNumber);
ord.Add(X509Name.EmailAddress);
ord.Add(uidNumber); //Custom attrib
var subject = new X509Name(ord, attrs);
调试代码时,我看到:
{CN =名称,O =数据,OU = IT,T =数据,C = XX,DN = CI,UID = PT,SERIALNUMBER = 123423222,E = test @ mail.com, 1.3.6.1 .1.1.1.0 = 6572301 }
我的问题是,如何创建具有正确名称的自定义属性(包括其自己的OID的值)的主题