CCCrypt wrapper class
=============================
FBEncryptor is enabled to encrypt/decrypt a message. Supported encryption algorithm is AES 256 bit only. Additionally BASE64 encode/decode is supported.
Usage
-----
(1) Encrypt/decrypt plain text message with Base64 encoding
Encrypt)
NSString* encrypted = [FBEncryptorAES encryptBase64String:@"Hello"
keyString:@"somekey"
separateLines:NO];
The output string is encoded with Base64.
example)
message: @"Hello"
output : @"gT2IUF9Jzmn7wglXk3XC3w=="
if 'separateLines:' is NO, no CR/LF characters will be added.
Otherwise a CR/LF pair will be added every 64 encoded chars.
Decrypt)
NSString* decrypted = [FBEncryptorAES decryptBase64String:encrypted
keyString:key];
(2) Encrypt/decrypt binary data
NSData* encryptedData = [FBEncryptorAES encryptData:data
keyData:key
iv:iv];
NSData* decryptedData = [FBEncryptorAES decryptData:encryptData
keyData:key
iv:iv];
The iv is called 'initailization vector' for CBC mode. it is abled to be set nil.
(3) Generate iv
NSData* iv = [FBEncryptorAES generateIv];
It generates a 16 bytes random binary value. You can use this value for +encryptData:keyData:iv:.
(4) Utiities
NSData* iv = [FBEncryptorAES generateIv];
NSString* hexString = [FBEncryptorAES hexStringForData:iv];
example: @"b20cd8d972e65762824cc3190040388c"
NSData* bin = [FBEncryptorAES dataForHexString:hexString];
Features
--------
- Only support AES256/CBC/PKCS7padding
- Base64 encoding is suported
Customize
---------
It is able to change below constants:
FBEncryptor.h
#define FBENCRYPT_KEY_SIZE kCCKeySizeAES256
If you want to use AES 128 bit key, you can set the constant like below:
#define FBENCRYPT_KEY_SIZE kCCKeySizeAES128
NOTE: If you change the constant, the testcase will be failed (it is made for AES 256 bit key).
Installation
-----------
You should copy below files to your projects.
FBEncryptor.h
FBEncryptor.m
NSData+Base64.h
NSData+Base64.m
Etc
-------
Special thanks for Matt Gallagher (author of NSData+Base64 code).
"Cocoa with Love: Base64 encoding options on the Mac and iPhone"
http://cocoawithlove.com/2009/06/base64-encoding-options-on-mac-and.html
License
-------
(1) FBEncryptorAES.m/FBEncryptorAES.h
MIT
Copyright (c) 2011 Hiroshi Hashiguchi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
(2) NSData+Base64.m/NSData+Base64.h
Created by Matt Gallagher on 2009/06/03.
Copyright 2009 Matt Gallagher. All rights reserved.
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software. Permission is granted to anyone to
use this software for any purpose, including commercial applications, and to
alter it and redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
没有合适的资源?快使用搜索试试~ 我知道了~
【框架】AES加密数据.zipIOS应用例子源码下载
共30个文件
m:6个
h:5个
plist:3个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 157 浏览量
2022-03-05
23:57:38
上传
评论
收藏 87KB ZIP 举报
温馨提示
【框架】AES加密数据.zipIOS应用例子源码下载【框架】AES加密数据.zipIOS应用例子源码下载 1.适合学生学习研究参考 2.适合个人学习研究参考 3.适合公司开发项目技术参考
资源推荐
资源详情
资源评论
收起资源包目录
【框架】AES加密数据.zip (30个子文件)
【框架】AES加密数据
dev5tec-FBEncryptor-3c739f1.zip 29KB
dev5tec-FBEncryptor-3c739f1
NSData+Base64.m 9KB
FBEncryptorAES.m 6KB
Default-568h@2x.png 18KB
FBEncryptor.xcodeproj
project.xcworkspace
contents.xcworkspacedata 156B
xcuserdata
lanou3g.xcuserdatad
WorkspaceSettings.xcsettings 332B
UserInterfaceState.xcuserstate 11KB
project.pbxproj 22KB
xcuserdata
lanou3g.xcuserdatad
xcschemes
FBEncryptor.xcscheme 4KB
xcschememanagement.plist 573B
FBEncrypt
main.m 364B
FBEncryptViewController.h 2KB
FBEncryptor-Info.plist 1KB
FBEncryptViewController.m 3KB
FBEncryptAppDelegate.m 3KB
en.lproj
FBEncryptViewController.xib 26KB
InfoPlist.strings 45B
MainWindow.xib 20KB
FBEncryptor-Prefix.pch 324B
FBEncryptAppDelegate.h 1KB
FBEncryptTests
FBEncryptTests.m 3KB
FBEncryptorTests-Prefix.pch 159B
FBEncryptorTests-Info.plist 687B
FBEncryptTests.h 262B
en.lproj
InfoPlist.strings 45B
FBEncryptorAES.h 2KB
README.md 4KB
NSData+Base64.h 1KB
readme.docx 19KB
Readme_Dev-data.taobao.com.txt 707B
共 30 条
- 1
资源评论
yxkfw
- 粉丝: 76
- 资源: 2万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功