Position: Home page » Currency » The difference between private key and public key of digital cur

The difference between private key and public key of digital cur

Publish: 2021-05-20 10:06:11
1.

Many small white just admission, was the private key, public key, address, and other relations confused. Some of them even lost their private key. They had money on the address, but they just couldn't get it out. Today, Xiao will try to figure out the relationship between the private key, the public key and the address

The relationship among

private key, public key and address is as follows:

the private key is converted into (generated) public key, and then converted into address. If there is bitcoin or integrity coin on an address, you can use the private key converted into this address to spend the above integrity coin. The generation of public key and address depends on private key, so private key is the most important

The same is true for mobile phone wallet, but the file management method of mobile phone is not as convenient as that of computer. Therefore, the general mobile wallet will provide a function called or similar to "export private key". Through this function, the private key can be exported in various forms

for example, bitcoin mobile wallet can be exported as a two-dimensional code, which can be printed or scanned on paper. When replacing a mobile phone, install a bitcoin wallet and scan the QR code to migrate bitcoin. Bitcoin mobile wallet and trustcoin mobile wallet can be exported as a clear text string and printed on paper - this is paper wallet

paper wallet allows users to spend your bitcoin or trustcoin at any terminal with bitcoin or trustcoin wallet

the loss or damage of the wallet will lead to the loss of the private key, thus completely losing the transfer right of the digital currency. To prevent such tragedies, you should always back up the data in your wallet. In addition to the address, all the private keys are saved ring the backup

summary

1, the private key should be well protected to prevent loss and forgetting. When the mobile phone clears the information, it is best to it by hand, but do not disclose it

2, you should prevent your wallet from being lost or damaged, resulting in the loss of your private key and the right to transfer in digital currency. Otherwise, you can't take out more than one currency, which is not useless

2. 1. First of all, we need to distinguish the two basic concepts of encryption and authentication
encryption is to encrypt data, so that even if illegal users get encrypted data, they can not get the correct data content, so data encryption can protect data and prevent monitoring attacks. It focuses on the security of data. Identity authentication is used to judge the authenticity of an identity. After the identity is confirmed, the system can give different permissions according to different identities. It focuses on the authenticity of users. The emphasis of the two is different< Secondly, we need to understand the concept and function of public key and private key
in the modern cryptosystem, encryption and decryption use different keys (public key), that is, asymmetric key cryptosystem. Each communication party needs two keys, namely public key and private key, which can be used to encrypt and decrypt each other. The public key is public and does not need to be kept secret, while the private key is held by the indivial himself and must be kept and kept secret. Principle of public key and private key: one public key corresponds to one private key. Key pair, let everyone know is the public key, do not tell you, only their own know, is the private key. If one of the keys is used to encrypt data, only the corresponding key can be decrypted. If one of the keys can be used to decrypt data, the data must be encrypted by the corresponding key.
3.

First of all, cracking RSA means ciphertext - & gt; The process of plaintext

Suppose plaintext m, ciphertext C, private key D, public key e, RSA encryption process is as follows:

1, two large mutually unequal prime numbers P and Q

2, n = P * q

3, FN = (P - 1) * (Q - 1)

4, e and FN are mutually prime, and 1 & lt; e < FN

5, D satisfies de% FN = 1

6, encryption and decryption:

C = (m ^ E)% n

m = (C ^ D)% n

the above formula can be understood as encryption by public key and decryption by private key

the first case : the plaintext and public key are known to get the ciphertext encrypted by the private key. This is the encryption process, which has little to do with the private key D. the encryption process mainly depends on the value of n

suppose that there are countless kinds of plaintext m, public key e, private key D and ciphertext C

in the second case, : the private key is obtained by knowing the plaintext ciphertext and public key

given plaintext m, ciphertext C and public key e, find private key D, and insert the secondary formula: C = (m ^ E)% N, the value of n is not unique, so the value of private key D is not unique


when there are correct answers for comparison, I feel that the second situation is easier to find out

personal opinions, welcome to discuss

4. A password is a character that you can enter on the keyboard, but a key is a kind of hardware, often called a dog, or dog for short. The key is connected to the back of the computer host and decrypted by hardware. Public key and private key, or asymmetric key and symmetric key, are two ways of cryptosystem. Private key system means that the encryption and decryption keys are the same or easy to be derived, so the encryption and decryption keys are confidential. Public key system means that the encryption and decryption keys cannot be pushed out from each other, the public key is public, and the private key is secret
it can be seen from the above definition that public key and private key are two different cryptosystems, not two different applications or two different keys. Therefore, public key and private key can be used in encryption and signature applications.
5. The private key requires you to enter a personal password before you can access it. In general, online banking and the like can be used
the public key does not require a password, which has been set by default. Generally, there are some websites or shared resources with low security requirements, such as LAN
certificate is a kind of website encryption browsing mode, which can only be accessed if it is allowed. Generally, it is a website with high security, such as online banking; It can stop hackers from stealing customer information.
6. The private key is kept by itself, and the public key is open to the public. Because the private key is unique and only you know it, it can be used as an identity, so it can be used for signature.
7. 1 Symmetric cryptography
symmetric encryption is the fastest and simplest encryption method. Encryption and decryption use the same secret key. This method is called symmetric encryption algorithm in cryptography. There are many kinds of symmetric encryption algorithms, because of its high efficiency, it is widely used in the core of many encryption protocols
symmetric encryption usually uses a relatively small key, usually less than 256 bits. Because the larger the key, the stronger the encryption, but the slower the encryption and decryption process. If you only use 1 bit to do this key, hackers can try to decrypt it with 0 first, otherwise they can use 1 solution again; But if your key is 1 MB, hackers may never be able to crack it, but the process of encryption and decryption takes a long time. The size of the key should consider both security and efficiency, which is a trade-off
on October 2, 2000, the National Institute of standards and Technology (NIST) selected Rijndael algorithm as the new advanced encryption standard Net contains the Rijndael algorithm. The class name is rijndaelmanaged. Here is an example
encryption process:

private string mydata = & quot; hello";< br />private string myPassword = " OpenSesame";< br />private byte[] cipherText;< br />private byte[] salt = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x5, 0x4, 0x3, 0x2, 0x1, 0x0 };< br />
private void mnuSymmetricEncryption_ Click(object sender, RoutedEventArgs e)
{
var key = new Rfc2898DeriveBytes(myPassword, salt);< br />// Encrypt the data.
var algorithm = new RijndaelManaged();< br />algorithm.Key = key.GetBytes(16);< br />algorithm.IV = key.GetBytes(16);< br />var sourceBytes = new System.Text.UnicodeEncoding().GetBytes(myData);< br />using (var sourceStream = new MemoryStream(sourceBytes))
using (var destinationStream = new MemoryStream())
using (var crypto = new CryptoStream(sourceStream, algorithm.CreateEncryptor(), CryptoStreamMode.Read))
{
moveBytes(crypto, destinationStream);< br />cipherText = destinationStream.ToArray();< br />}
MessageBox.Show(String.Format(" Data:{0}{1}Encrypted and Encoded:{2}", myData, Environment.NewLine, Convert.ToBase64String(cipherText)));< br />}
private void moveBytes(Stream source, Stream dest)
{
byte[] bytes = new byte[2048];< br />var count = source.Read(bytes, 0, bytes.Length);< br />while (0 != count)
{
dest.Write(bytes, 0, count);< br />count = source.Read(bytes, 0, bytes.Length);<
}
}

decryption process:

private void MNU symmetric decryption_ Click(object sender, RoutedEventArgs e)
{
if (cipherText == null)
{
MessageBox.Show(" Encrypt Data First!& quot;);< br />return;< br />}
var key = new Rfc2898DeriveBytes(myPassword, salt);< br />// Try to decrypt, thus showing it can be round-tripped.
var algorithm = new RijndaelManaged();< br />algorithm.Key = key.GetBytes(16);< br />algorithm.IV = key.GetBytes(16);< br />using (var sourceStream = new MemoryStream(cipherText))
using (var destinationStream = new MemoryStream())
using (var crypto = new CryptoStream(sourceStream, algorithm.CreateDecryptor(), CryptoStreamMode.Read))
{
moveBytes(crypto, destinationStream);< br />var decryptedBytes = destinationStream.ToArray();< br />var decryptedMessage = new UnicodeEncoding().GetString(
decryptedBytes);< br />MessageBox.Show(decryptedMessage);< In other words, how to send the key to the person who needs to decrypt your message is a problem. In the process of sending the key, there is a great risk that the key will be intercepted by hackers. In reality, the usual way is to asymmetrically encrypt the symmetric encryption key, and then send it to the people who need it< In 1976, American scholars dime and Henman proposed a new key exchange protocol to solve the problems of information public transmission and key management, which allows the two sides of communication to exchange information on the insecure media and reach an agreed key safely. This is called "public key system". Compared with symmetric encryption algorithm, this method is also called asymmetric encryption algorithm
asymmetric encryption provides a very secure method for data encryption and decryption. It uses a pair of keys, public key and private key. The private key can only be kept by one party and can not be leaked, while the public key can be sent to anyone who requests it. Asymmetric encryption uses one of these keys to encrypt, while decryption requires another key. For example, if you ask the bank for the public key, the bank will send you the public key, and you use the public key to encrypt the message, then only the holder of the private key, the bank, can decrypt your message. Different from symmetric encryption, the bank does not need to send the private key through the network, so the security is greatly improved
at present, the most commonly used asymmetric encryption algorithm is RSA algorithm, which was invented by Rivest, Shamir and Adleman in 1978. They were all at MIT at that time Net also has RSA algorithm, please see the following example:
encryption process:

private byte [] rsaciphertext< br />private void mnuAsymmetricEncryption_ Click(object sender, RoutedEventArgs e)
{
var rsa = 1;< br />// Encrypt the data.
var cspParms = new CspParameters(rsa);< br />cspParms.Flags = CspProviderFlags.UseMachineKeyStore;< br />cspParms.KeyContainerName = " My Keys";< br />var algorithm = new RSACryptoServiceProvider(cspParms);< br />var sourceBytes = new UnicodeEncoding().GetBytes(myData);< br />rsaCipherText = algorithm.Encrypt(sourceBytes, true);< br />MessageBox.Show(String.Format(" Data: {0}{1}Encrypted and Encoded: {2}",< br />myData, Environment.NewLine,
Convert.ToBase64String(rsaCipherText)));<
}

decryption process:

private void MNU asymmetric decryption_ Click(object sender, RoutedEventArgs e)
{
if(rsaCipherText==null)
{
MessageBox.Show(" Encrypt First!& quot;);< br />return;< br />}
var rsa = 1;< br />// decrypt the data.
var cspParms = new CspParameters(rsa);< br />cspParms.Flags = CspProviderFlags.UseMachineKeyStore;< br />cspParms.KeyContainerName = " My Keys";< br />var algorithm = new RSACryptoServiceProvider(cspParms);< br />var unencrypted = algorithm.Decrypt(rsaCipherText, true);< br />MessageBox.Show(new UnicodeEncoding().GetString(unencrypted));
}

although asymmetric encryption is very secure, it is very slow compared with symmetric encryption, so we still need to use symmetric encryption to transmit messages, but the key used by symmetric encryption can be sent out by asymmetric encryption. To explain this process, please look at the following example:
(1) Alice needs to make a transaction on the bank's website. Her browser first generates a random number as the symmetric key
(2) Alice's browser requests the public key from the bank's website
(3) the bank sends the public key to Alice
(4) Alice's browser uses the bank's public key to encrypt her symmetric key
(5) Alice's browser sends the encrypted symmetric key to the bank
(6) the bank uses the private key to decrypt the symmetric key of Alice browser
(7) Alice and the bank can use the symmetric key to encrypt and decrypt the communication content

(3) summary
(1) symmetric encryption and decryption use the same key, so the speed is fast, but because the key needs to be transmitted on the network, the security is not high
(2) asymmetric encryption uses a pair of keys, public key and private key, so the security is high, but the speed of encryption and decryption is slow
(3) the solution is to encrypt the symmetric key with the asymmetric public key, and then send it out. The receiver decrypts it with the private key to get the symmetric key, and then the two sides can communicate with each other using symmetric encryption.
8. Public key and private key, or asymmetric key and symmetric key, are two ways of cryptosystem. Private key system means that the encryption and decryption keys are the same or easy to be derived, so the encryption and decryption keys are confidential. Public key system means that the encryption and decryption keys cannot be pushed out from each other, the public key is public, and the private key is secret
it can be seen from the above definition that public key and private key are two different cryptosystems, not two different applications or two different keys. Therefore, public key and private key can be used in encryption and signature applications.
9. Public and private keys, also known as asymmetric keys, appear in pairs and can only be mutually reversible. A pair of public and private keys can be integrated into a digital certificate
Hot content
Inn digger Publish: 2021-05-29 20:04:36 Views: 341
Purchase of virtual currency in trust contract dispute Publish: 2021-05-29 20:04:33 Views: 942
Blockchain trust machine Publish: 2021-05-29 20:04:26 Views: 720
Brief introduction of ant mine Publish: 2021-05-29 20:04:25 Views: 848
Will digital currency open in November Publish: 2021-05-29 19:56:16 Views: 861
Global digital currency asset exchange Publish: 2021-05-29 19:54:29 Views: 603
Mining chip machine S11 Publish: 2021-05-29 19:54:26 Views: 945
Ethereum algorithm Sha3 Publish: 2021-05-29 19:52:40 Views: 643
Talking about blockchain is not reliable Publish: 2021-05-29 19:52:26 Views: 754
Mining machine node query Publish: 2021-05-29 19:36:37 Views: 750