Skip to content

Commit

Permalink
Print errors; Change key to public.
Browse files Browse the repository at this point in the history
  • Loading branch information
yspreen committed Apr 13, 2021
1 parent db108dd commit 465461f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion PatientScannerDemo/EC256.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ struct EC256 {
}
else {
print("Verify Failed!")
print(error.debugDescription)
print(error?.takeUnretainedValue().localizedDescription ?? "Something went wrong")
return false
}
}
Expand Down
7 changes: 5 additions & 2 deletions PatientScannerDemo/JWK.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,17 @@ struct JWK {
keyData.append(yBytes)
let attributes: [String: Any] = [
kSecAttrKeyType as String: kSecAttrKeyTypeEC,
kSecAttrKeyClass as String: kSecAttrKeyClassPrivate,
kSecAttrKeyClass as String: kSecAttrKeyClassPublic,
kSecAttrKeySizeInBits as String: 256,
kSecAttrIsPermanent as String: false
]
var error: Unmanaged<CFError>?
guard
let keyReference = SecKeyCreateWithData(keyData as CFData, attributes as CFDictionary, &error)
else { return nil }
else {
print(error?.takeUnretainedValue().localizedDescription ?? "Something went wrong")
return nil
}

return keyReference
}
Expand Down

0 comments on commit 465461f

Please sign in to comment.