https://github.com/rocwong-cn/react-native-aes-kit
AES-CBC-PKCS5Padding
https://github.com/rocwong-cn/react-native-aes-kit
aes cbc crypto encrypt pkcs5 react-native-aes
Last synced: 3 months ago
JSON representation
AES-CBC-PKCS5Padding
- Host: GitHub
- URL: https://github.com/rocwong-cn/react-native-aes-kit
- Owner: rocwong-cn
- Created: 2017-08-15T08:56:16.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-06-22T14:36:26.000Z (over 7 years ago)
- Last Synced: 2024-10-28T15:59:22.344Z (11 months ago)
- Topics: aes, cbc, crypto, encrypt, pkcs5, react-native-aes
- Language: Objective-C
- Homepage:
- Size: 89.8 KB
- Stars: 18
- Watchers: 3
- Forks: 16
- Open Issues: 7
-
Metadata Files:
- Readme: README.MD
Awesome Lists containing this project
README
# react-native-aes-kit
> AES-CBC-PKCS5Padding
## Install
```
npm i --S react-native-aes-kitreact-native link react-native-aes-kit
```## 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
```js
import AesCrypto from 'react-native-aes-kit';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);
});
```