Skip to content

Secure Remote Password SRP-6a implementation by swift

License

Notifications You must be signed in to change notification settings

kingekinge/Thinbus-SRP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Thinbus-SRP

CI Status Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

ios >= 13.0
swift >= 5.1

Installation

Thinbus-SRP is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'Thinbus-SRP'

Step 0: Generate a new verifier v for the user identity I and password P with salt s.

//register s and v send to server

let srp = Client.init(config: Config(prime: N, generator: g, key: key, algorithm: .sha256))

let verifier = client.enroll(identity: _identity, password: _password, salt: salt)

Step 1: Generates a one-time client key A encoded as a hexadecimal.

let userA = client.identify(identity: _identity, password: _password, salt: salt)

Step 2: Create challenge response to server's public key challenge B with a proof of password M1.

let message = try! srp.challenge(B: userB, salt: salt)

//confirm server's proof of shared key message M2 against
srp.confirm(proof: serverPoof)

//calc 256 bit share key
srp.session()

License

Thinbus-SRP is available under the MIT license. See the LICENSE file for more info.