RingSig 1.1.0

RingSig 1.1.0

测试已测试
语言语言 SwiftSwift
证书 MIT
发布最新发布2017年11月
SwiftSwift 版本4.0.2
SPM支持 SPM

Fabio Tacke 维护。



 
依赖项目
BigInt>= 0
CryptoSwift>= 0
 

RingSig 1.1.0

该库在 Swift 中实现了一种环签名方案。算法基于 Rivest 等人于 2001 年发表的 "如何泄露秘密"。

什么是环签名方案?

在使用 RSA 进行消息认证时,消息作者使用其私钥创建签名。验证器获得签名者的公钥并检查收到的消息是否与签名匹配。因此,验证者知道只有能够访问签名者私钥的人才能创建签名。

环签名允许签名者创建一个不泄露其身份的签名。更精确地说,签名者会将他们的公钥与完全无关实体的公钥捆绑在一起,并使用它们来创建签名。该签名随后向验证者证明相应的消息是由公钥的所有者之一签名的。尽管如此,验证者仍然无法确定谁是实际的签名者。

安装

Swift Package Manager

.Package(url: "https://github.com/FabioTacke/RingSig.git", majorVersion: 1)

使用

import RingSig

// Generate the signer's RSA keypair
let signerKeyPair = RSA.generateKeyPair()
    
// Generate keypairs for the other participants in the ring signature scheme (i.e. the non-signers)
let nonSignerKeyPairs = [RSA.generateKeyPair(), RSA.generateKeyPair(), RSA.generateKeyPair()]
let nonSignersPublicKeys = nonSignerKeyPairs.map { $0.publicKey }
    
// The message to be signed
let message = "Hello, World!"
    
// Sign the message
let signature = RingSig.ringSign(message: message.data(using: .utf8)!, nonSignersPublicKeys: nonSignersPublicKeys, signerKeyPair: signerKeyPair)
    
// Everybody can now verify that the message was signed by someone of those whose public keys were included in the signature. Still the verifier is not able to tell who of them is the actual signer.
let verified = RingSig.ringSigVerify(message: message.data(using: .utf8)!, signature: signature)
assert(verified)

免责声明

该库使用一个非常基本的 RSA 实现,因此不应被视为提供高加密安全。此外,性能也不是创建库时的设计目标。