1. How to Use Capicom to read a digital certificate
I. Using javascript:
Other references: http://www.yyable.com/zll? P = 37
Http://blog.csdn.net/PKI_CA/article/details/2340261
Ii. use Cryptography Objects:
See http://msdn.microsoft.com/en-us/library/aa380254 (v = VS.85). aspx
Http://msdn.microsoft.com/en-us/library/ms867087
SDK download: http://www.microsoft.com/download/en/details.aspx? Displaylang = en id = 25281
Note the MSDN pro
This problem may not occur in the new version of Vs, and the environment may already contain CAPICOM. dll of the later version. I encountered this problem when I released a small test project in 2005. The approximate prompt is: "signtool error: signtool requires CAPICOM version 2.1.0.1 or higher. please copy the latest version of CAPICOM. DLL into the directory t
I was planning to write it myself, but it would be hard to get rid of complicated algorithm descriptions. Forget it. If there are ready-made COM Object calls, why bother with algorithms? Just use them directly. If the following example code prompts that an object cannot be created, you need to download the CAPICOM component and register it.
Copy codeThe Code is as follows: Const CAPICOM_HASH_ALGORITHM_MD2 = 1
Const CAPICOM_HASH_ALGORITHM_MD4 = 2
Const
Originally intended to write their own, but see the complexity of the algorithm described on the shrink. Forget it, there are ready-made COM object calls, why to care about the algorithm, directly to use on the line. If the following example code prompts you not to create an object, you need to download the CAPICOM component and register it.
Copy Code code as follows:
Const CAPICOM_HASH_ALGORITHM_MD2 = 1
Const CAPICOM_HASH_ALGORITHM_
Using system;Using system. collections;Using system. Security. cryptography. x509certificates;Using InterOP. CAPICOM;
Namespace capicomwrapper{/// /// Provides methods to interact with Windows certificate stores./// Public class certificatemanager{/// /// Searches for and returns a participant X509 Certificate./// /// /// Public static x509certificate get (string searchstring){String storename = "my"; // "my" indicates the. Default storeStoreclass os
Important objects in CAPICOM are used as follows, and only these objects are used:
CAPICOM. Store // certificate library object
CAPICOM. Certificates // certificate set object
CAPICOM. Certificate // a single certificate object
CAPICOM. Signer // recipient
eax, [esp + var_xx]MoV [ECx], eaxHere, we copy the return value address to ECx, which can be another register, copy a local variable to eax, and then write it to the corresponding location of ECx. This also explains why a common function will return values in eax even if it has a specified return value. Okay. Change this var_xx to var_return. This is good. "Two-side attack" makes it easier to look at the code in the middle.7. This time, the OD came out. Follow this function in a single step wit
the MD5 algorithm and learned about hash input through viewing the output, your number will become completely predictable immediately. Most experts believe that this analysis is not feasible in terms of computing. However, it is still considered that/dev/urandom is "insecure" than/dev/random (and usually suspect ).
No/dev/random is available in Windows, but you can use the capicom. Utilities object provided by Microsoft "
without giving enough time to refill the entropy pool, you will no longer be able to reap the benefits of entropy sharing from various sources; however, you can still obtain a very good random number from the MD5 hash of the entropy pool! The problem with this method is that if anyone has cracked the MD5 Algorithm and learned about hash input through viewing the output, your number will become completely predictable immediately. Most experts believe that this analysis is not feasible in terms o
, this replacement device always returns a random number. If you retrieve a majority without giving enough time to refill the entropy pool, you will no longer be able to reap the benefits of entropy sharing from various sources; however, you can still obtain a very good random number from the MD5 hash of the entropy pool! The problem with this method is that if anyone has cracked the MD5 algorithm and learned about hash input through viewing the output, your number will become completely predict
1,python common methods for string encryption:[Python]View Plaincopy
"340592" snippet_file_name="blog_20140512_1_2282504" name="code" class= "Python" >1. The simplest way is to use base64:
Import Base64
S1 = base64.encodestring (' Hello World ')
S2 = base64.decodestring (S1)
Print S1,s2
# agvsbg8gd29ybgq=n
# Hello World
Note: This is the simplest method, but not enough insurance, because if someone else gets your ciphertext, you can decrypt it yourself to get t
This article mainly introduces three methods to encrypt and decrypt python strings, including base64 and win32com. client and self-written encryption and decryption algorithms. for details, refer to. 1. the simplest method is to use base64:
The code is as follows:
Import base64
S1 = base64.encodestring ('Hello World ')S2 = base64.decodestring (s1)Print s1, s2
# AGVsbG8gd29ybGQ = \ n# Hello world
Note: This is the simplest method, but it is not safe enough, because if someone else gets your c
1. The simplest method is to use base64:
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->
Import
Base64 S1=Base64.encodestring ('Hello World')S2=Base64.decodestring (S1)PrintS1, S2 #Agvsbg8gd29ybgq = \ n#Hello World Note:This is the simplest method, but it is not safe enough, because if someone else gets your ciphertext, they can decrypt it to obtain the plaintext. 2. The second method is to use win32com. Client
Code highlighting pro
Recent related backup more frequently, in order to verify the integrity of the file, always open a file hash check tool, more trouble, and wrote this dongdong, the file is a little slow to calculate, the file's MD5 value saved in the Clipboard! Effect as shown:
How to use:
1. Import the Getmd5.reg file into the registry first to add a right-click menu, Getmd5.reg the following code:
Copy Code code as follows:
Windows Registry Editor Version 5.00
[Hkey_classes_root\*
Copy codeThe Code is as follows: Function md5_file (filename, raw_output)
Dim HashedData, Utility, Stream
Set HashedData = CreateObject ("CAPICOM. HashedData ")
Set Utility = CreateObject ("CAPICOM. Utilities ")
Set Stream = CreateObject ("ADODB. Stream ")
HashedData. Algorithm = 3
Stream. Type = 1
Stream. Open
Stream. LoadFromFile filename
Do Until Stream. EOS
HashedData. Hash Stream. Read (1, 10
1. The simplest method is to use base64:
Copy the Code code as follows:
Import Base64
S1 = base64.encodestring (' Hello World ')S2 = base64.decodestring (S1)Print S1,s2
# agvsbg8gd29ybgq=\n# Hello World
Note: This is the simplest way, but not enough insurance, because if someone else gets your ciphertext, you can decrypt it yourself to get the plaintext.
2. The second method is to use the Win32com.client
Copy the Code code as follows:
Import Win32com.client
def encrypt (key,content): # key: K
is not worth the time to do it on your own. Use your time to build a good, strong database, instead of re-inventing the wheel.
So what is a good way to encrypt data?
For beginners, Microsoft provides its own encryption solution, CryptoAPI. For lightweight encryption, military-Level Security is beyond consideration. It has the advantage of relatively easy implementation: the administrator can install an ActiveX control named CAPICOM, it provides Cry
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.