Databases Reference
In-Depth Information
Figure 3-5. Obtaining a certificate's thumbprint
You can select the thumbprint and copy it into a string variable. The following code shows a new private variable
and a new method in the Encryption class you saw earlier. Line 1 contains the thumbprint as seen in Figure 3-5 ,
line 13 opens the root certificate store on LocalMachine , and line 17 instantiates an X.509 object by searching the
thumbprint. Note that the Find method returns a collection; you're interested in the first certificate because only one
will match this thumbprint. On line 24, you create the RSA encryption object and call its Encrypt method on line
27. Because encrypting with RSA automatically incorporates a vector, there is no need to keep track of it, and so the
CipherText vector variable is set to 0:
1. private string _THUMBPRINT_ =
2. "01 71 11 17 0a b4 96 7b ca 1f f3 e5 bc 0f 68 9d c6 c0 3b 7b";
3.
4. /// <summary>
5. /// Encrypts a string value using a self-signed certificate
6. /// </summary>
7. /// <param name="value">The value to encrypt</param>
 
Search WWH ::




Custom Search