Click here to Skip to main content
15,896,063 members

Comments by Korathu123 (Top 9 by date)

Korathu123 29-Dec-15 2:47am View    
The above solution worked. But if the output in case is not alphanumeric (I mean simply varchar) there will be casting error.
Korathu123 15-Dec-15 7:37am View    
I need a regular expression suiting the same need
Korathu123 18-Nov-15 8:35am View    
Deleted
I want to set the same code wise.
Korathu123 2-Nov-15 9:15am View    
i tried the same but I am not getting error Index out of range. In mine I have root node say Test7 and child nodes are cn=OrgPerson,cn=Person,o=oid etc. I want to fetch them.


I tried with
searchRoot = new DirectoryEntry("LDAP://" + "nestit-283" + ":" + "389" + "/" + "dc=maxcrc,dc=com", "cn=Manager,dc=maxcrc,dc=com", "secret", AuthenticationTypes.None);
domain = new DirectoryEntry("LDAP://" + searchRoot.Properties["defaultNamingContext"][0]);
Korathu123 30-Oct-15 6:02am View    
I want to fetch all user certificate values in all the nodes if any
foreach (SearchResult r in result)
{
string CertificateAttributeType="userCertificate:binary";
if (r.Properties.Contains(CertificateAttributeType))
{
Common.WriteEFTSLog("EFTS:Has "+CertificateAttributeType+" ");
if (r.Properties[CertificateAttributeType].Count > 0)
{
Common.WriteEFTSLog("EFTS:Certificate Exists there");
for (int m = 0; m < r.Properties[CertificateAttributeType].Count; m++)
{
Byte[] b = (Byte[])r.Properties[CertificateAttributeType][m];
//Convert byte data of User Certificate Fetched to the Certificate file and add it to the Certificate Store

//Set a certificate file Path configured in App.config to which fetched Byte array is passed
string cerFilePath = ConfigurationSettings.AppSettings["CertFilePath"].ToString();
//Create the Certificate File from Byte Array data
bool CertFileCreation = ByteArrayToFile(cerFilePath, b);
if (CertFileCreation == true)
{
Common.WriteEFTSLog("EFTS:Certificate File Created from Byte Array");
// Convert the Filename to an X509 Certificate
X509Certificate2 cert = new X509Certificate2(cerFilePath);
// Get the server certificate store and pass to Personal Certificate Store(Check with Certmgr.msc in Run)
X509Store store = new X509Store(StoreName.My, StoreLocation.CurrentUser);
store.Open(OpenFlags.ReadWrite);
//Add the Certificate File to Windows Cetificate Store
store.Add(new X509Certificate2(X509Certificate2.CreateFromCertFile(cerFilePath)));
store.Close();
Common.WriteEFTSLog("EFTS:Certificate File Added to the Store");

}
}

}
else
{
Common.WriteEFTSLog("EFTS:No Certificate Exists");
}

}