trend Posted October 9, 2005 Posted October 9, 2005 I have this function: Dim Cert As X509Certificate = X509Certificate.CreateFromCertFile("C:\cert.crt") Instead of grabbing the contents of the file, I would rather have it grab actual data from within the program... example: Dim certificatevalue As string = "this would be the contents of cert.crt" then.. Dim Cert as x509certificate = x509certificate.createformcertfile(certificatevalue) basically i don't want the user to have access to the crt file.. thanks for any help! Quote
IngisKahn Posted October 9, 2005 Posted October 9, 2005 Object Browser is your friend. There's a constructor that takes a byte[] Quote "Who is John Galt?"
trend Posted October 9, 2005 Author Posted October 9, 2005 Hhmm.. I understand the structure of Object Browser, but clueless how to interpret the data. Any good tutorials on using OB? (yes I have googled.. and it appears like there is tons of information.. much not applicable) Quote
Leaders snarfblam Posted October 9, 2005 Leaders Posted October 9, 2005 Here is your complete, comprehensive instruction manual/tutorial on the object browser. (1)Browsing In the tree on the left, expand a library, expand namespaces within that library, and finally, select a class/structure. In the list on the right the members of the class will be listed. Click a member to see detailed information about it on the bottom. (2)Searching Click the search icon, select the search options you would like, enter the name of the class or class member you want to find. Click search. Results are displayed in a new window. Click a result to view it in the object browser. (3)From the code editor When you click "View Definition" in the code editor, if source is not available for the object you selected, the object will be shown in the code editor. If there is still any confusion, then here: Google gave me this. Quote [sIGPIC]e[/sIGPIC]
trend Posted October 12, 2005 Author Posted October 12, 2005 Marble Eater... Nice, I didn't know you could do (3), that is very nice! Quote
trend Posted October 12, 2005 Author Posted October 12, 2005 Hmm.. now how to get the certificate to output in byte format (so I can input it later).. I see this code on MS website: Imports System Imports System.Security.Cryptography.X509Certificates Module X509 Sub Main() ' The path to the certificate. Dim Certificate As String = "test.pfx" ' Load the certificate into an X509Certificate object. Dim cert As New X509Certificate(Certificate) Dim certData As Byte() = cert.Export(X509ContentType.Cert) Dim newCert As New X509Certificate(certData) ' Get the value. Dim resultsTrue As String = newCert.ToString(True) ' Display the value to the console. Console.WriteLine(resultsTrue) ' Get the value. Dim resultsFalse As String = newCert.ToString(False) ' Display the value to the console. Console.WriteLine(resultsFalse) End Sub End Module But this products 2or3errors during compile Here is my resource: http://msdn2.microsoft.com/en-us/library/5128sby8(en-US,VS.80).aspx Any ideas why this MS code gives me errors? It says: .NET Framework Supported in: 2.0, 1.1, 1.0 thanks! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.