nativescript-crossplatform-aes
Simple Cross platform 256bit AES encryption / decryption based on Cross-Platform-AES
Note: I am not an expert of neigher iOS nor Android. So, please contribute if you think something you can do better :)
## Platforms supported
- iOS
- Android
- NodeJS
Features:
-
Cross platform support. Encryption-Decryption works across iOS, Android and Node.js.
-
Automatically RandomIV is added while encryption and remove first randomized blocks while decryption.
-
Support for Random IV (initialization vector) for encryption and decryption. Randomization is crucial for encryption schemes to achieve semantic security, a property whereby repeated usage of the scheme under the same key does not allow an attacker to infer relationships between segments of the encrypted message.
-
Support for SHA-256 for hashing the key. Never use plain text as encryption key. Always hash the plain text key and then use for encryption. AES permits the use of 256-bit keys. Breaking a symmetric 256-bit key by brute force requires 2^128 times more computational power than a 128-bit key. A device that could check a billion billion (10^18) AES keys per second would in theory require about 3×10^51 years to exhaust the 256-bit key space.
Installation
tns plugin add nativescript-crossplatform-aes
Simple Usage in NativeScript
; let cryptLib = ;let plainText = "this is my plain text"let key = "your key" let cipherText = cryptLib;console; let decryptedString = cryptLibconsole;
Other Custom Methods
;;;
NodeJS
Install the library
npm install @skavinvarnan/cryptlib --save
Then use it
const cryptLib = ; const plainText = "this is my plain text";const key = "your key"; const cipherText = cryptLib;console; const decryptedString = cryptLib;console;