There are two main types of encryption (also known as cryptography) symmetric (ok symmetric-key encryption) and public/private key encryption. The third topic this guide will cover is how both of these encryption methodologies are used in parallel to do large document and data encryption securely in the Integra ecosystem. The guide will dive deeper into both types of cryptography and how they are used in the Integra Ecosystem. They both have unique uses and are both important to understand the concepts before developing a blockchain authentication layer on top of an existing application.
In the decentralized world of blockchain and in the case of data transfer, data flowing between applications in a public network environment can flow across any number of nodes or networks and is viewable to anyone on the network. Cryptography ensures that even though these nodes can see the data, they cannot understand the data. This is where encryption becomes critical in data transfer and storing secure data, like the private key or other sensitive data.
Symmetric encryption is highly effective for large amounts of data, requires less processing power to produce the cipher and the overall algorithm is inexpensive in regards to cycles consumed. The preferred algorithm that is used in the Integra ecosystem for symmetric encryption is AES. AES works really well for large amounts of data in terms of processing power and speed. AES encryption uses the same secret key (passphrase) to both encrypt and decrypt the data. There are two values that can be used for AES encryption/cryptography, they are the key and IV. The key is always the passphrase that the user generates and can be used alone to encrypt and decrypt the information. The IV, also known as the initialization vector, provides randomization for the key along with the AES algorithm to produce more secure encryption. The IV is typically required to be random or pseudorandom, but sometimes an IV only needs to be unpredictable or unique. Below is the flow of symmetric encryption.
For encryption of the Integra Smart Identity Document private key, for any user on the Integra blockchain, AES with only a key-value (which is referred to as the passphrase) is used for the encryption of the private key. Other types of Integra documents are also encrypted in this manner and the AES key is auto-generated and sent to the user's phone while the document is sent to the email, this way the only way to decrypt the document is to have access to both the email and phone. When looking at the private key in an Integra Smart Identity Document, it looks like the following data in Figure 1, versus a typical RSA private key shown in Figure 2.
Figure 1: AES encryption of RSA private key in Integra Smart Identity Document
"private_key": "-----BEGIN RSA PRIVATE KEY----- MIICXAIBAAKBgQCqGKukO1De7zhZj6+H0qtjTkVxwTCpvKe4eCZ0FPqri0cb2JZfXJ/DgYSF6vUp wmJG8wVQZKjeGcjDOL5UlsuusFncCzWBQ7RKNUSesmQRMSGkVb1/3j+skZ6UtW+5u09lHNsj6tQ5 1s1SPrCBkedbNf0Tp0GbMJDyR4e9T04ZZwIDAQABAoGAFijko56+qGyN8M0RVyaRAXz++xTqHBLh 3tx4VgMtrQ+WEgCjhoTwo23KMBAuJGSYnRmoBZM3lMfTKevIkAidPExvYCdm5dYq3XToLkkLv5L2 pIIVOFMDG+KESnAFV7l2c+cnzRMW0+b6f8mR1CJzZuxVLL6Q02fvLi55/mbSYxECQQDeAw6fiIQX GukBI4eMZZt4nscy2o12KyYner3VpoeE+Np2q+Z3pvAMd/aNzQ/W9WaI+NRfcxUJrmfPwIGm63il AkEAxCL5HQb2bQr4ByorcMWm/hEP2MZzROV73yF41hPsRC9m66KrheO9HPTJuo3/9s5p+sqGxOlF L0NDt4SkosjgGwJAFklyR1uZ/wPJjj611cdBcztlPdqoxssQGnh85BzCj/u3WqBpE2vjvyyvyI5k X6zk7S0ljKtt2jny2+00VsBerQJBAJGC1Mg5Oydo5NwD6BiROrPxGo2bpTbu/fhrT8ebHkTz2epl U9VQQSQzY1oZMVX8i1m5WUTLPz2yLJIBQVdXqhMCQBGoiuSoSjafUhV7i1cEGpb88h5NBYZzWXGZ 37sJ5QsW+sJyoNde3xH8vdXhzU7eT82D6X/scw9RZz+/6rCJ4p0= -----END RSA PRIVATE KEY-----"
Figure 2: RSA private key example. Note this RSA private key does not match the example from Figure 1
Later in this guide AES encryption with both Key and IV will be discussed in the section Encrypting Data below.
The recommended public key pair encryption algorithm for the Integra ecosystem, for small amounts of data, is RSA (Rivest-Shamir-Adelman). The important distinction between RSA and Symmetric encryption is that in public key pair encryption there is a public encryption key that is distinct from the decryption key. The downside of public key pair encryption is that it requires more calculations (using two large prime numbers and an auxiliary value) and is therefore a relatively slow algorithm. Due to the slowness of the algorithm, it is not appropriate to encrypt large amounts of data with this type of encryption. Below in figure 2 is how public key pair encryption works.
Public key pair encryption is very useful for encrypting data like messaging or codes that are used for Symmetric encryption. When it comes to encrypting an entire PDF file, this method carries too much overhead, and speed, to make it an acceptable solution. When encrypting messages or data, the first step is looking up the recipient's public key by using their IntegraId in order to look up their public key by using the KeyForOwner API call. The call takes in an IntegraId and returns an RSA public key. The format for the public key is shown below.
-----BEGIN RSA PUBLIC KEY----- MIIBCgKCAQEA+xGZ/wcz9ugFpP07Nspo6U17l0YhFiFpxxU4pTk3Lifz9R3zsIsu ERwta7+fWIfxOo208ett/jhskiVodSEt3QBGh4XBipyWopKwZ93HHaDVZAALi/2A +xTBtWdEo7XGUujKDvC2/aZKukfjpOiUI8AhLAfjmlcD/UZ1QPh0mHsglRNCmpCw mwSXA9VNmhz+PiB+Dml4WWnKW/VHo2ujTXxq7+efMU4H2fny3Se3KYOsFPFGZ1TN QSYlFuShWrHPtiLmUdPoP6CV2mML1tk+l7DIIqXrQhLUKDACeM5roMx0kLhUWB8P +0uj1CNlNN4JRZlC7xFfqiMbFRU9Z4N6YwIDAQAB -----END RSA PUBLIC KEY-----
The ciphertext that is created from RSA encryption can only be decrypted by the corresponding private key that was associated with the public key that encrypted the data. The communications using this type of encryption are suited for the public domain such as the Internet. This type of encryption only works if the private key remains in possession of the owner of the key. The possession of the private key is essential for the Integra ecosystem, this includes tokens, digital signatures, encrypted files, and other items, without the private key none of these others are valid. This works very much in the same way as the private key in every cryptocurrency.
The Integra ecosystem deals with large amounts of data in the form of documents so neither of these forms of encryption, on their own, work perfectly and or securely for the distributed network. Using the strengths of both encryption methodologies, Integra encrypts documents using both forms of encryption. Dealing with the large documents that are hashed on the network, AES encryption is used to encrypt the document itself, with a generated IV and key for the encryption of the document. The key and IV are then encrypted using the RSA encryption with the public key of the recipient. The public key encrypts this key and IV so only the holder of the corresponding private key will be able to decrypt the key and IV which will then allow the decryption of the original document using AES encryption. The speed and security of this method is ideal for the Integra ecosystem. Figure 3 below shows the metadata contained within an Integra Smart Encryption Document.
Updated 8 months ago