Create and use Digital Sign with Java

xiaoxiao2021-03-06  138

Digital signatures are often used to verify software and software manufacturers to ensure that the software code is not tarnished any way. --- or popular, using digital signatures to ensure that software's "cleaning" and "authentic", that is, software from its manufacturer or publisher until the end user is not tampered with others. ---- This article briefly reviews the relevant concepts of digital signatures, gives a specific method of creating and using digital signatures with Java. I. Digital Signature and Its Features ---- Digital Signing Algorithm (DSA) is one of the "Public Key Endess Algorithm", so let's take a quick review from the "private key / public key". ---- 1. Private key encryption and its limitations --- Private key encryption system encrypts and decrypts the unique key (i.e., private key). This key must be shared by the sender and the recipient. That is, if the armor is to be encrypted to the B, the information is encrypted with a key; after the acceptance of the message, the same key must be decrypted. ---- This method obviously has very serious disadvantages. For example, the reception must have the same key, which must have a secure protocol to ensure the reliability of the key transfer; second, when an emergency encryption message needs to be sent, it may not be completed due to the receiver without a key. Transfer; third, to send messages to many different groups, you need to correspond to each group, maintain many different keys. ---- In order to overcome these weaknesses of the private key encryption system, people introduced the public key encryption system. ---- 2. Public key encryption ---- Public key encryption does not require a sender and recipient of one message know the client's key, you can access the encrypted information. ---- Public key encryption system uses a key pair (public key and private key) to encrypt and decrypt information. Its encryption is very simple: the information encrypted with the public key can only be unwaffected by the corresponding private key; and the information encrypted with private key can be used, anyone who has the corresponding public key can be unbearable. . Therefore, private keys are always personal storage without having to pass through, and public keys can be authorized to use them without damaging security, and there is always one-on-one relationship between the public key and private key. Specifically: ---- First, if the information is encrypted with the public key of the recipient, only people who should receive this message can decrypt it (ie, there is only a private key corresponding to the public key. The talent of the key can be decrypted). For example, the armor is to send an encrypted email from B, and the armor must be encrypted with the public key of B. ---- Second, if the information is encrypted with the sender's private key, any recipient with the sender's common key can decrypt the information, thereby determining that the information is indeed from the sender, and The information content has not been damaged by any unintentional or malicious destruction. ---- The second point described above is the meaning of digital signature. ---- 3. Digital signature features ---- a digital signature is a fixed length binary digital stream, which is attached to the signed data. It can be used with any type of digital data, except for the most ordinary code software. Also available in passwords, email, and electronic documents. The main features of digital signatures are: preventing the original document from being contaminated or changed; preventing other people from using others to spread fraudulent news; and providing the evidence of the original author of the document, and so on. Second, create and use the digital signature with Java ---- In addition to the functions mentioned above, do digital signatures with Java also have more realism. The most common is: Application Digital Signature can break through some of the browser in security. For example, your browser generally refuses the online Java program to read and write the files of your local hard drive or get your local information (such as your user name, etc.), even if you confirm that the Java program is "reliable" (in fact you don't It may be fully confirmed that a program from the Internet is really "reliable").

... ---- Now, we finally saw the long-awaited results: the browser played "Your Name Has Been Written to File "; and the file "test.txt" is indeed Created, and its content is the name when the user logs in WIN95 / 98: Y o U R n a m E: m a w e n q i a n

转载请注明原文地址:https://www.9cbs.com/read-126995.html

New Post(0)