/* Makecert.exe-n "cn = microshaoft X509 test-a"-sky exchange-pe-sv. PVK a.cerpvk2pfx.exe-pvk. PVK-spc. cer-pfx. pfx-F-po 123makecert.exe-n "cn = microshaoft X509 test-B"-sky exchange-pe-sv B. PVK B .cerpvk2pfx.exe-pvk B. PVK-spc B. cer-pfx B. pfx-F-po ABC */namespace consoleapplication {using system; using system. io; using system. text; using system. threading; using system. security. cryptography; using system. security. cryptography. x509certificates; public class class1 {static void main (string [] ARGs) {encryptorprivatekeypfxprovider = encryptorprivatekeypfx. privatekey as rsacryptoserviceprovider; encryptorpublickeycerprovider = encryptorpublickeycer. publickey. key as rsacryptoserviceprovider; decryptorpublickeycerprovider = decryptorpublickeycer. publickey. key as rsacryptoserviceprovider; decryptorprivatekeypfxprovider = decryptorprivatekeypfx. privatekey as rsacryptoserviceprovider; For (INT I = 0; I <2000; I ++) {threadstart Ts = new threadstart (run); thread t = new thread (TS); T. name = _ threadid. tostring (); _ threadid ++; T. start (); // run () ;}} Private Static volatile int _ threadid = 0; Private Static object _ synclockobject = new object (); private Static x509certificate2 encryptorprivatekeypfx = new x509certificate2 (@ ". pfx "," 123 "); Private Static x509certificate2 encryptorpublickeycer = new x509certificate2 (@". CER "); Private Static x509certificate2 decryptorpublickeycer = new x509certificate2 (@" B. CER "); Private Static x509certificate2 decryptorprivatekeypfx = new x509certificate2 (@" B. pfx "," ABC "); Private Static rsacryptoserviceprovider identifier = NULL; Private Static rsacryptoserviceprovider encryptorpublickeycerprovider = NULL; Private Static rsacryptoserviceprovider identifier = NULL; static void run () {// todo: addCode To start the application Program // String S = "original plaintext"; byte [] DATA = encoding. utf8.getbytes (s); byte [] signature; bool dooaepadding = false; bool verifyed = false; // specify Signature = NULL; // x509certificate2 encryptorpublickeycer = NULL; /// x509certificate2 decryptorpublickeycer = NULL; // x509certificate2 decryptorprivatekeypfx = NULL; try {// encryptorprivatekeypfx = new x509cer Tificate2 (@ ". pfx "," 123 "); // encryptorpublickeycer = new x509certificate2 (@". CER "); // decryptorpublickeycer = new x509certificate2 (@" B. CER "); // decryptorprivatekeypfx = new x509certificate2 (@" B. pfx "," ABC "); // using (rsacryptoserviceprovider decryptorpublickeycerprovider = decryptorpublickeycer. publickey. key as rsacryptoserviceprovider) {// encrypted data = decryptorpublickeycerprovider. encrypt (Data, Dooaepadding);} byte [] hash = new sha1cryptoserviceprovider (). computehash (data); // using (rsacryptoserviceprovider encryptorprivatekeypfxprovider = encryptorprivatekeypfx. privatekey as rsacryptoserviceprovider) {// signature Signature = encryptorprivatekeypfxprovider. signhash (hash, "sha1");} // using (rsacryptoserviceprovider encryptorpublickeycerprovider = encryptorpublickeycer. publickey. key as rsacr Yptoserviceprovider) {// verifyed = encryptorpublickeycerprovider. verifyhash (hash, "sha1", signature);} // using (rsacryptoserviceprovider decryptorprivatekeypfxprovider = decryptorprivatekeypfx. privatekey as rsacryptoserviceprovider) {// decrypt data = decryptorprivatekeypfxprovider. decrypt (data, dooaepadding);} s = encoding. utf8.getstring (data); console. writeline ("{0}, {1}, {2}", thread. currentthre Ad. Name, verifyed, S);} catch (exception e) {console. writeline (E. tostring ();} finally {// If (encryptorprivatekeypfx! = NULL) // {// encryptorprivatekeypfx. Reset (); //} // If (encryptorpublickeycer! = NULL) // {// encryptorpublickeycer. Reset (); //} // If (decryptorpublickeycer! = NULL) // {// decryptorpublickeycer. Reset ();///}}}}}