Skip to content

Commit

Permalink
Add test case for s2k_fo SRP autentication
Browse files Browse the repository at this point in the history
  • Loading branch information
sebsto committed Nov 6, 2024
1 parent be0df53 commit b015d79
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions Tests/xcodeinstallTests/API/SRPTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ struct SRPKeysTestCase {

}

@Test func pbkdf2() throws {
@Test("PBKDF2 for S2K and S2K_FO authentication protocol", arguments: [
SRPProtocol.s2k, SRPProtocol.s2k_fo
])
func pbkdf2(srpProtocol: SRPProtocol) throws {

// given
let password = "password"
Expand All @@ -96,13 +99,20 @@ struct SRPKeysTestCase {
salt: [UInt8](saltData),
iterations: iterations,
keyLength: keyLength,
srpProtocol: .s2k
srpProtocol: srpProtocol
)
// print(derivedKey.hexdigest().lowercased())

// then
let fastlaneHexResult = "d7ff78163a0183db1e635ba5beaf4a45f7984b00aafec95e6a044fda331bbd45"
#expect(derivedKey.hexdigest().lowercased() == fastlaneHexResult)
let hexResult: String
switch srpProtocol {
case .s2k:
hexResult = "d7ff78163a0183db1e635ba5beaf4a45f7984b00aafec95e6a044fda331bbd45"
case .s2k_fo:
// TODO: verify this result is correct
hexResult = "858f8ba24e48af6f9cd5c8d4738827eb91340b6901fc5e47ee0d73e3346b502a"
}
#expect(derivedKey.hexdigest().lowercased() == hexResult)
}
}

Expand Down

0 comments on commit b015d79

Please sign in to comment.