Giter Site home page Giter Site logo

ringsig's Introduction

RingSig

The library implements a ring signature scheme in Swift. The algorithm is based on "How to leak a secret" (2001) by Rivest et al.

What is a ring signature scheme?

When using RSA for message authentication the author of the message creates a signature using their private key. The verifier obtains the signer's public key and checks whether the received message matches the signature. Thus the verifier knows that only someone witch access to the signer's private key could have been creating the signature.

Ring signatures enable the signer to create a signature that doesn't reveal their identity. More precisely the signer bundles their public key alongside the public keys of entities that are not involved at all and uses them for creating the signature. The signature then proves the the verifier that the corresponding message was signed by one of the owners of the public keys. Nevertheless the virifier is not able to tell who exactly is the signer.

Installation

Swift Package Manager

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

CocoaPods

pod 'RingSig', '~> 1.0'

Usage

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)

Disclaimer

The library uses a very basic RSA implementation and therefore shouldn't be considered to offer high crypto security. Furthermore performance was not a design goal when creating the library.

ringsig's People

Watchers

 avatar  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.