Git Product home page Git Product logo

bbrsacryptor's Introduction

BBRSACryptor

使用OpenSSL进行公钥和私钥的加解密

以及私钥签名,公钥验签

添加到你的工程

pod 'BBRSACryptor'

如何加载密钥

从文件中读取密钥:

BBRSACryptor *cryptor = [[BBRSACryptor alloc] init];
NSData *keyData = [NSData dataWithContentsOfFile:keyPath];
[cryptor importRSAPublicKeyPEMData:keyData];

使用byte数组方式读入:

获取byte数组:

./rsatool read public.pem   # rsatool 是Demo工程中的另一个target: rsatool 编译出的小工具

在代码中读取字节数组:

char keyBytes[] = {45,45,45,45,45,66,69,71,73,78,32,80,85,66,76,73,67,32,75,69,89,45,45,45,45,45,10,77,73,73,66,73,106,65,78,66,103,107,113,104,107,105,71,57,119,48,66,65,81,69,70,65,65,79,67,65,81,56,65,77,73,73,66,67,103,75,67,65,81,69,65,49,71,83,49,72,103,51,69,53,105,55,113,114,75,115,69,114,81,70,116,10,90,49,110,,49,118,80,84,85,101,79,113,107,117,74,110,99,105,115,86,53,121,101,89,104,75,10,83,83,66,107,67,114,65,88,114,105,52,81,76,110,121,85,57,87,73,57,80,70,115,76,89,119,109,82,121,109,102,102,104,121,73,57,97,108,106,107,77,108,55,112,122,82,115,105,117,51,72,117,50,52,47,68,79,97,99,78,103,80,83,121,10,115,119,73,68,65,81,65,66,10,45,45,45,45,45,69,78,68,32,80,85,66,76,73,67,32,75,69,89,45,45,45,45,45,10};
NSData *pemData = [NSData dataWithBytes:keyBytes length:sizeof(keyBytes)];
[rsaCryptor importRSAPublicKeyPEMData:pemData];

bbrsacryptor's People

Contributors

nianji avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.