【文件属性】:
文件名称:SwCrypt:RSA公有私钥生成,RSA,AES加密解密,RSA在Swift中使用iOS和OS X中的CommonCrypto进行签名验证
文件大小:41KB
文件格式:ZIP
更新时间:2021-02-02 17:20:51
swift mac ios apple aes
密码
以DER格式创建公共和私有RSA密钥
let (privateKey, publicKey) = try! CC.RSA.generateKeyPair(2048)
将它们转换为PEM格式
let privateKeyPEM = try SwKeyConvert.PrivateKey.derToPKCS1PEM(privateKey)
let publicKeyPEM = SwKeyConvert.PublicKey.derToPKCS8PEM(publicKey)
或从带有PEM数据的字符串中读取它们
let privateKeyDER = SwKeyConvert.PrivateKey.pemToPKCS1DER(privateKeyPEM)
let publicKeyDER = SwKeyConvert.PublicKey.pemToPKCS1DER(publicKeyPEM)
或加密,解密私钥(与OpenSSL兼容)
try SwKeyConvert.PrivateKey.encryptPEM(privateKeyPEM, passphrase: "longpasswo
【文件预览】:
SwCrypt-master
----SwCrypt.xcodeproj()
--------xcshareddata()
--------project.xcworkspace()
--------project.pbxproj(39KB)
----SwCrypt.podspec(718B)
----LICENSE.md(1KB)
----dummyTestApp()
--------ViewController.swift(326B)
--------dummyTestApp.entitlements(304B)
--------Info.plist(1KB)
--------AppDelegate.swift(2KB)
--------Base.lproj()
--------Assets.xcassets()
----README.md(6KB)
----SwCrypt()
--------SwCrypt.swift(72KB)
--------SwCrypt.h(362B)
--------Info.plist(806B)
----Package.swift(343B)
----.gitignore(318B)
----SwCryptTests()
--------Info.plist(8KB)
--------SwCryptTests.swift(13KB)
网友评论
- 照搬GitHub 源码有意思吗你[face]emoji:012.png[/face]