FMUSER Wirless Transmit Video And Audio More Easier !

[email protected] WhatsApp +8618078869184
Language

    rsa encryption and decryption process to resolve

     

    "RSA algorithm RSA public key cryptosystem. The so-called public key cryptosystem is to use different encryption keys and decryption keys. It is a cryptosystem that "it is computationally infeasible to deduce the decryption key from the known encryption key". In the public key cryptosystem, the encryption key (i.e. public key) PK is public information, while the decryption key (i.e. secret key) sk needs to be kept confidential. Encryption algorithm E and decryption algorithm D are also public. Although the decryption key SK is determined by the public key PK, SK cannot be calculated according to the PK. Based on this theory, the famous RSA algorithm appeared in 1978. It is usually a pair of RSA keys, one of which is the secret key, which is saved by the user; The other is a public key, which can be disclosed to the public or even registered in the network server. In order to improve the security strength, the RSA key is at least 500 bits long, and 1024 bits are generally recommended. This makes the computation of encryption very large. In order to reduce the amount of calculation, the combination of traditional encryption method and public key encryption method is often used when transmitting information, that is, the information is encrypted with an improved des or idea conversation key, and then the conversation key and information summary are encrypted with RSA key. After receiving the information, the other party decrypts it with different keys and can check the information summary. RSA algorithm is the first algorithm that can be used for encryption and digital signature at the same time. It is also easy to understand and operate. RSA is the most widely studied public key algorithm. In more than 30 years from its proposal to today, it has experienced the test of various attacks and gradually accepted by people. By 2017, it is generally considered to be one of the best public key schemes. Encryption process: A extracts the message digest H (m) of message M, encrypts the digest H (m) with its own private key, and generates a signature s A encrypts the signature s and message m with B's public key, generates ciphertext C, and sends it to B. Decryption process: B receives ciphertext C and decrypts C with its own private key to obtain plaintext m and digital signature s B decrypts the digital signature s using a's public key to obtain H (m). B uses the same method to extract the message summary H (m) of message M B compare two message summaries. If it is the same, the verification is successful; The verification fails if it is different. RSA encryption process overview When a and B carry out encrypted communication, B must first generate a pair of keys. One is the public key. A and B own the private key. A uses B's public key to encrypt the content to be sent, and then B decrypts the content through its own private key. The function of digital signature is to ensure data integrity, confidentiality and non repudiation of the sender's role Suppose a wants to send a message to B, a will first calculate the message summary of the message, then encrypt the summary with its own private key, and finally send the encrypted message summary and the message to B. the encrypted message summary is "signature". After receiving the message, B will also use the same method as a to extract the message summary, then decrypt the message sent by a with a's public key to sign, and compare it with the message summary calculated by itself. If the message is the same, it means that a sent the message to B. at the same time, a cannot deny the fact that it sent the message to B. Among them, a encrypts the message digest with its own private key to become a "signature"; The process by which B decrypts the signature file using a's public key is called "signature verification". RSA encryption and decryption code /// 《summary》 ///RSA public key encryption /// 《/summary》 ///Param name = "content" / param ///Param name = "publickey" / param /// 《returns》《/returns》 public staTIc string EncryptByPublicKey(string content, string publickey) { byte[] s = Convert.FromBase64String(publickey); AsymmetricKeyParameter publicKey = PublicKeyFactory.CreateKey(s); IBufferedCipher c = CipherUTIliTIes.GetCipher(“RSA/ECB/PKCS1Padding”); //Public key encryption c.Init(true, publicKey); byte[] byteData = Encoding.UTF8.GetBytes(content); byteData = c.DoFinal(byteData, 0, byteData.Length); return Convert.ToBase64String(byteData); } /// 《summary》 ///RSA encryption /// 《/summary》 ///Param name = "content" encrypted plaintext / param ///Param name = "privatekey" / param ///Returns returns ciphertext / returns public staTIc string RSAEncry(string content, string privatekey) { AsymmetricKeyParameter privateKey = PrivateKeyFactory.CreateKey(Convert.FromBase64String(privatekey)); IBufferedCipher c = CipherUtilities.GetCipher(“RSA/ECB/PKCS1Padding”); //Private key encryption c.Init(true, privateKey); byte[] byteData = Encoding.UTF8.GetBytes(content); byteData = c.DoFinal(byteData, 0, byteData.Length); return Convert.ToBase64String(byteData); } /// 《summary》 ///RSA decryption /// 《/summary》 ///Param name = "content" ciphertext / param ///Param name = "privatekey" / param ///Returns plaintext / returns public static string RSADeEncry(string content, string privatekey) { try { MemoryStream bufferStream = new MemoryStream(); byte[] bytData = Convert.FromBase64String(content); int inputLength = bytData.Length; AsymmetricKeyParameter privateKey = PrivateKeyFactory.CreateKey(Convert.FromBase64String(privatekey)); IBufferedCipher cipher = CipherUtilities.GetCipher(“RSA/ECB/PKCS1Padding”); cipher.Init(false, privateKey); int offSet = 0; byte[] cache; int i = 0; while (inputLength - offSet 》 0) { if (inputLength - offSet 》 128) { cache = cipher.DoFinal(bytData, offSet, 128); } else { cache = cipher.DoFinal(bytData, offSet, inputLength - offSet); } bufferStream.Write(cache, 0, cache.Length); i++; offSet = i * 128; } byte[] decryptedData = bufferStream.ToArray(); bufferStream.Close(); return Encoding.UTF8.GetString(bufferStream.ToArray()); } catch (Exception e) { return e.Message; } }, read the full text, technical section Ma Huateng proposed the "Tencent Dingdang ecological Partnership Plan" to build a digital ecological community Can enterprises rely on artificial intelligence to interact with humans? What elements of mobile phone photography have been changed by artificial intelligence? After splitting windows, can Microsoft really return as the king? Huichun Technology: show major breakthroughs in IOT and artificial intelligence, and push gesture recognition“

     

     

     

     

    List all Question

    Nickname

    Email

    Questions

    Our other product:

    Professional FM Radio Station Equipment Package

     



     

    Hotel IPTV Solution

     


      Enter email  to get a surprise

      fmuser.org

      es.fmuser.org
      it.fmuser.org
      fr.fmuser.org
      de.fmuser.org
      af.fmuser.org ->Afrikaans
      sq.fmuser.org ->Albanian
      ar.fmuser.org ->Arabic
      hy.fmuser.org ->Armenian
      az.fmuser.org ->Azerbaijani
      eu.fmuser.org ->Basque
      be.fmuser.org ->Belarusian
      bg.fmuser.org ->Bulgarian
      ca.fmuser.org ->Catalan
      zh-CN.fmuser.org ->Chinese (Simplified)
      zh-TW.fmuser.org ->Chinese (Traditional)
      hr.fmuser.org ->Croatian
      cs.fmuser.org ->Czech
      da.fmuser.org ->Danish
      nl.fmuser.org ->Dutch
      et.fmuser.org ->Estonian
      tl.fmuser.org ->Filipino
      fi.fmuser.org ->Finnish
      fr.fmuser.org ->French
      gl.fmuser.org ->Galician
      ka.fmuser.org ->Georgian
      de.fmuser.org ->German
      el.fmuser.org ->Greek
      ht.fmuser.org ->Haitian Creole
      iw.fmuser.org ->Hebrew
      hi.fmuser.org ->Hindi
      hu.fmuser.org ->Hungarian
      is.fmuser.org ->Icelandic
      id.fmuser.org ->Indonesian
      ga.fmuser.org ->Irish
      it.fmuser.org ->Italian
      ja.fmuser.org ->Japanese
      ko.fmuser.org ->Korean
      lv.fmuser.org ->Latvian
      lt.fmuser.org ->Lithuanian
      mk.fmuser.org ->Macedonian
      ms.fmuser.org ->Malay
      mt.fmuser.org ->Maltese
      no.fmuser.org ->Norwegian
      fa.fmuser.org ->Persian
      pl.fmuser.org ->Polish
      pt.fmuser.org ->Portuguese
      ro.fmuser.org ->Romanian
      ru.fmuser.org ->Russian
      sr.fmuser.org ->Serbian
      sk.fmuser.org ->Slovak
      sl.fmuser.org ->Slovenian
      es.fmuser.org ->Spanish
      sw.fmuser.org ->Swahili
      sv.fmuser.org ->Swedish
      th.fmuser.org ->Thai
      tr.fmuser.org ->Turkish
      uk.fmuser.org ->Ukrainian
      ur.fmuser.org ->Urdu
      vi.fmuser.org ->Vietnamese
      cy.fmuser.org ->Welsh
      yi.fmuser.org ->Yiddish

       
  •  

    FMUSER Wirless Transmit Video And Audio More Easier !

  • Contact

    Address:
    No.305 Room HuiLan Building No.273 Huanpu Road Guangzhou China 510620

    E-mail:
    [email protected]

    Tel / WhatApps:
    +8618078869184

  • Categories

  • Newsletter

    FIRST OR FULL NAME

    E-mail

  • paypal solution  Western UnionBank OF China
    E-mail:[email protected]   WhatsApp:+8618078869184   Skype:sky198710021 Chat with me
    Copyright 2006-2020 Powered By www.fmuser.org

    Contact Us