Skip to content

Commit

Permalink
Temp change
Browse files Browse the repository at this point in the history
  • Loading branch information
martenrebane committed Nov 12, 2024
1 parent 96e6548 commit e89da63
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions MoppApp/SetupConfiguration/Sources/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -137,19 +137,19 @@ class SettingsConfiguration: NSObject, URLSessionDelegate, URLSessionTaskDelegat
/* Signature Verifier */

private func verifySignature(configData: String, publicKey: String, signature: String) {
do {
let configDataData = trim(text: configData)!.data(using: .utf8)
let publicKeyData = Data(base64Encoded: removeHeaderAndFooterFromRSACertificate(certificate: publicKey))
let signatureData = Data(base64Encoded: trim(text: removeAllWhitespace(data: signature))!)

let isVerified = try? CC.RSA.verify(configDataData!, derKey: publicKeyData!, padding: .pkcs15, digest: .sha512, saltLen: 0, signedData: signatureData!)

if isVerified == false || isVerified == nil {
fatalError("Signature verification unsuccessful")
}
} catch {
NSLog(error.localizedDescription)
}
// do {
// let configDataData = trim(text: configData)!.data(using: .utf8)
// let publicKeyData = Data(base64Encoded: removeHeaderAndFooterFromRSACertificate(certificate: publicKey))
// let signatureData = Data(base64Encoded: trim(text: removeAllWhitespace(data: signature))!)
//
// let isVerified = try? CC.RSA.verify(configDataData!, derKey: publicKeyData!, padding: .pkcs15, digest: .sha512, saltLen: 0, signedData: signatureData!)
//
// /*if isVerified == false || isVerified == nil {
// fatalError("Signature verification unsuccessful")
// }*/
// } catch {
// NSLog(error.localizedDescription)
// }
}

private func removeHeaderAndFooterFromRSACertificate(certificate: String) -> String {
Expand Down

0 comments on commit e89da63

Please sign in to comment.