Skip to content

Commit d15948f

Browse files
committed
Made SRPClient.calculateSharedSecret, SRP.calculateU public
1 parent b79acfd commit d15948f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Sources/SRP/client.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public struct SRPClient<H: HashFunction> {
5858
/// - serverPublicKey: server public key
5959
/// - Throws: `nullServerKey`
6060
/// - Returns: shared secret
61-
func calculateSharedSecret(username: String, password: String, salt: [UInt8], clientKeys: SRPKeyPair, serverPublicKey: SRPKey) throws -> SRPKey {
61+
public func calculateSharedSecret(username: String, password: String, salt: [UInt8], clientKeys: SRPKeyPair, serverPublicKey: SRPKey) throws -> SRPKey {
6262
let message = [UInt8]("\(username):\(password)".utf8)
6363
let sharedSecret = try calculateSharedSecret(message: message, salt: salt, clientKeys: clientKeys, serverPublicKey: serverPublicKey)
6464
return SRPKey(sharedSecret)

Sources/SRP/srp.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import BigNum
22
import Crypto
33

44
/// Contains common code used by both client and server SRP code
5-
struct SRP<H: HashFunction> {
5+
public struct SRP<H: HashFunction> {
66

77
/// pad to a certain size by prefixing with zeros
88
static func pad(_ data: [UInt8], to size: Int) -> [UInt8] {
@@ -14,7 +14,7 @@ struct SRP<H: HashFunction> {
1414
}
1515

1616
/// calculate u = H(clientPublicKey | serverPublicKey)
17-
static func calculateU(clientPublicKey: [UInt8], serverPublicKey: [UInt8], pad: Int) -> BigNum {
17+
public static func calculateU(clientPublicKey: [UInt8], serverPublicKey: [UInt8], pad: Int) -> BigNum {
1818
BigNum(bytes: [UInt8].init(H.hash(data: SRP<H>.pad(clientPublicKey, to: pad) + SRP<H>.pad(serverPublicKey, to: pad))))
1919
}
2020

0 commit comments

Comments
 (0)