0.1.11 • Published 5 years ago

encrypt-magic-master v0.1.11

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

Encrypt Magic Master

Introduction This library acts as an encryption and decryption toolkit, both symmetric (AES) and asymmetric (RSA). Does not use hybrid methods (RSA + AES) for JavaScript, it allows them to work separately, to decide what to encrypt symmetrically and asymmetrically.

Includes automatic and persistent password management in React Native.

It combines RSA and AES encryption algorithms that make it possible to efficiently encrypt and decrypt large messages. This multiplatform library is based on Forge.

Includes diacritical normalization strategies to solve characters that can not be decrypted with normalize NFD or with node util decode utf-8. This solution was implemented due

Documentation

Starting

Introduction Documentation Installation Features

Initialization Encryption Decoded Firms Verifying RSA key pairs React with the management of native keys. Installation

npm install encrypt-magic-master Importer Node.js

var RSA = require ('encrypt-magic-master'). RSA; var Crypt = require ('encrypt-magic-master'). crypt React native

amount {Crypt, RSA} from 'encrypt-magic-master'; Web

Initialization

// Basic initialization var crypt = new Crypt (); var rsa = new RSA ();

// Increase the amount of entropy var entropy = "Random, integer or floating string"; var crypt = new Crypt ({entropy: entropy}); var rsa = new RSA ({entropy: entropy}); Encryption

Encrypt Magic Master grants the possibility of encrypting a key with a public key after having used it to symmetrically encrypt with AES a JSON chain.

 message var = 'Hello world! ';

// Encryption with a public RSA key encrypted var = crypt. encrypt (publicKey, message); Pretty printed sample output

{     "data": "HJGjhg654Jjhg6546587JFjfsd66584fshgFgkjHK64f66fd54sdf9687sf ==", // Current package version     "IV": "CmtyaZTyzoAp1mTNUTztic0v1 ...", // Initialization vector     "key": // Public Keys generated in memory to encrypt in RSA server         "----- PUBLIC KEY -----" }

Decoded

Deciphering the message with Encrypt Magic Master is as easy as encrypting. The decryption function can decrypt any message that has been encrypted with the public key in its key of the key pair in memory. The decrypted message is generated as a resolved JSON object.

var encrypted = '{"data": "jKHkjh786", "iv": "564SA65D4A", "key": "ASD654654dsf654a"}';

// Decrypt encrypted message with private RSA key var decrypted = crypt. decrypt (privateKey, encrypted);

// Get decrypted message  var = decrypted message message; Sample output

{     items: "{" parameter1 ":" value1 "," parameter2 ":" value2 "}", // actual decrypted message     count: "1" }

Firms

Encrypt Magic Master provides a simple message signature of 2048 bytes. When the sender signs a message, the receiver of the message can be sure of the sender of the message, in the same way with the signatures generated in memory, it is guaranteed that the sending server can only be read by the client receiving the response.

 message var = 'Hello world! ';

// Create a signature with the private RSA key of ISSUER  signature var = crypt. signature (issuerPrivateKey, message);

// Encrypt message with RSA public key RECEIVERS and attach the signature encrypted var = crypt. encrypt (message, signature); Verifying

The message receiver must have a public RSA key of the message sender to verify the sender of the message.

RSA key pairs

The key generation function is based on the generation function of Forge key pairs. As a difference, Encrypt Magic Master returns the pair of keys in PEM format.

// Initialize RSA class var rsa = new RSA ();

// Generate RSA key pair, 2048 bit key defaults RSA. generateKeypair (function (keypair) {

    // The callback function receives a new pair of keys as the first argument     var PublicKey = pair of keys. publicKey;     var privateKey = pair of keys. privateKey; });

0.1.11

5 years ago

0.1.10

5 years ago

0.1.9

5 years ago

0.1.8

5 years ago

0.1.7

5 years ago

0.1.6

5 years ago