C#向ldap导入证书
来源:互联网 发布:java abstract class 编辑:程序博客网 时间:2024/06/05 11:59
1.将证书文件使用流读入,存放在byte[]中
FileStream fs = new FileStream("c://cert//client.der", FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fs);
byte[] Certbyte = br.ReadBytes((int)fs.Length);
fs.Close();
2.将byte[]转为sbyte[] CertSbyte(详见上篇文章)
3.使用novell的ldap-c#类库,将带有证书的条目导入ldap
LdapAttributeSet attributeSet = new LdapAttributeSet();
attributeSet.Add(new LdapAttribute( "objectclass", "inetOrgPerson"));
attributeSet.Add(new LdapAttribute("cn", new string[] { "James Smith", "Jim Smith", "Jimmy mith" }));
attributeSet.Add(new LdapAttribute("userCertificate;Binary",CertSbyte));
string dn = "cn=Jim Smith," + containerName;
LdapEntry newEntry = new LdapEntry(dn, attributeSet);
LdapConnection conn = new LdapConnection();
Console.WriteLine("Connecting to:" + ldapHost);
conn.Connect(ldapHost, ldapPort);
conn.Bind(loginDN, password);
conn.Add(newEntry);
Console.WriteLine("Entry:" + dn + " Added Successfully");
conn.Disconnect();
- C#向ldap导入证书
- C#向ldap导入证书
- 向USBKey中导入证书私钥
- 向USBKey中导入证书私钥
- C#开发快速导入ssl安全证书
- Ubuntu下向open jdk导入SSL证书
- LDAP用户导入Ambari
- 证书导入
- 导入证书
- 使用WSE时,客户端通过c#导入证书
- LDAP C#验证用户名
- C# LDAP认证登录
- c# LDAP 验证
- C# LDAP认证登录
- C# LDAP认证登录
- C#用QueryTable向excel批量导入数据
- Ldap 修改用户密码及安装证书
- 毕业设计之LDAP存储X509证书
- Hello CSDN
- linux中的硬链接和符号链接
- 关于GridBagLayout网络上一篇很好的文章
- 遇到的 Grid
- Struts 2中的OGNL
- C#向ldap导入证书
- Qt下的Log记录库 log4qt
- Windows SDK与Platform SDK的区别
- DirectShow SDK下载
- 浓缩大学生活的顶级精华
- ASP使用SQL语句
- 我的存储之路
- oracle的常用命令
- 今天做的一个页面(数组显示)