将多个证书存储在LDAP服务器中(1.3.6.1.4.1.1466.115.121.1.8_Certificate) [英] Store mmultiple certificates in LDAP server in (1.3.6.1.4.1.1466.115.121.1.8_Certificate)
问题描述
我想使用c#代码在LDAP服务器上传多个证书。我有代码来读取多个证书字节,但我无法存储多个证书。
请问我如何将数据传递到LDAP服务器以存储多个证书用于从ldap服务器读取数据的代码。
string test =" LDAP://" + ldapserver +" /" + ldapbasedn;
using(DirectoryEntry entry = new DirectoryEntry(" LDAP://" + ldapserver +" /" + ldapbasedn,ldapuser,ldappassword,AuthenticationTypes.None))
{
DirectorySearcher ds = new DirectorySearcher(entry);
ds.SearchScope = SearchScope.Subtree;
// ds.Filter = string.Format(ldapfilter,user);
SearchResultCollection result = ds.FindAll();
int i = 0;
foreach(结果中的SearchResult r)
{
// string s = r.Properties [" objectClass"] [i] .ToString();
// string s1 = r.Properties [" adspath"] [i] .ToString();
// string s2 = r.Properties [" dc"] [i] .ToString();
if(r.Properties.Contains(" usercertificate; binary"))
{
字节[] b =(字节[])r.Properties [" usercertificate; binary"] [i];
}
}
谢谢你可以在这里发帖。
根据我的搜索,我只找到有关如何在C#中添加不能执行此操作的证书的TechNet文档。
我会继续搜索,如果我有新的东西。我会反馈。
最好的问候,
Wendy
Hi,
I want to upload the multiple certificate in LDAP server using c# code. I have the code to read the multple certificatre bytes but I am not able to store the multple certificates.
Could you help me please how I pass the data to LDAP server for storing the multiple certificate bytes.
Code for reading the data from ldap server.
string test = "LDAP://" + ldapserver + "/" + ldapbasedn;
using (DirectoryEntry entry = new DirectoryEntry("LDAP://" + ldapserver + "/" + ldapbasedn, ldapuser, ldappassword, AuthenticationTypes.None))
{
DirectorySearcher ds = new DirectorySearcher(entry);
ds.SearchScope = SearchScope.Subtree;
//ds.Filter = string.Format(ldapfilter, user);
SearchResultCollection result = ds.FindAll();
int i = 0;
foreach (SearchResult r in result)
{
//string s = r.Properties["objectClass"][i].ToString();
//string s1 = r.Properties["adspath"][i].ToString();
//string s2 = r.Properties["dc"][i].ToString();
if (r.Properties.Contains("usercertificate;binary"))
{
Byte[] b = (Byte[])r.Properties["usercertificate;binary"][i];
}
}
Hi,
Thank you for posting here.
Based on my search, I only find the TechNet document about how to add certificates which not do this in C#.
I will keep on search, if I have something new. I will feedback.
Best Regards,
Wendy
这篇关于将多个证书存储在LDAP服务器中(1.3.6.1.4.1.1466.115.121.1.8_Certificate)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!