-1

如何在 C# App 中从 lDAP 服务器获取 CLR 文件?java中的相同代码是这样的://创建LDAP URL

String urlStr =  "ldap://ldap.signatur.rtr.at/CN=Telekom-Control-"+
  "Kommission%20Top%201,O=Telekom-Control-Kommission,"+
  "C=AT?caCertificate;binary";
URL url = new URL(urlStr);
// open connection
URLConnection con = url.openConnection();
// get a stream and read the certificate
InputStream is = con.getInputStream();
X509Certificate cert = new X509Certificate(is); 
4

1 回答 1

1

将 URL 分成两部分,LDAP 路径和目标属性。

小路:ldap://ldap.signatur.rtr.at/CN=Telekom-Kommission%20Top%201,O=Telekom-Control-Kommission,C=AT

属性:caCertificate

然后,将 ldap:// 大写,去掉 HTML 转义,得到二进制证书:

using System.DirectoryServices;

DirectoryEntry de = new DirectoryEntry("LDAP://ldap.signatur.rtr.at/" + 
  "CN=Telekom-Kommission Top 1,O=Telekom-Control-Kommission,C=AT");
byte[] binaryCertificate = (byte[])de.Properties["caCertificate"].Value;
于 2013-06-13T03:16:57.237 回答