Skip to content

itsam/react-native-aes-pack

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-native-aes-pack

AES-CBC-PKCS5Padding

Install for version >= 0.6,it will auto link library

npm i --S react-native-aes-pack

For iOS run pod install

Install for version <0.6

npm i --S react-native-aes-pack

react native link react-native-aes-pack

methods

  • encrypt
Name Type Note
sourceText string plaintxt
secretKey string secret key,max 16 bytes
iv string initialization vector,max 16 bytes
  • decrypt
Name Type Note
sourceText string cipher txt
secretKey string secret key,max 16 bytes
iv string initialization vector,max 16 bytes

Usage

import AesCrypto from 'react-native-aes-pack';

const plaintxt = 'test';
const secretKey = '0102030405060708';
const iv = '1112131415161718';

AesCrypto.encrypt(plaintxt,secretKey,iv).then(cipher=>{
    console.log(cipher);// return a string type cipher
    this.setState({ cipher });
}).catch(err=>{
    console.log(err);
});

AesCrypto.decrypt(this.state.cipher,secretKey,iv).then(plaintxt=>{
    console.log(plaintxt);// return a string type plaintxt
}).catch(err=>{
    console.log(err);
});

About

AES-CBC-PKCS5Padding

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 90.6%
  • Java 7.2%
  • JavaScript 1.1%
  • Ruby 1.1%