如何访问HashedAuthenticationCode的代码(作为字符串)?

时间:2019-12-18 18:38:06

标签: swift ios13 apple-cryptokit

给出以下HashedAuthenticationCode

import CryptoKit
let key = SymmetricKey(size: .bits256)
let message = "Hello world!".data(using: .utf8)!
let authenticationCode = HMAC<SHA256>.authenticationCode(for: message, using: key)
print(authenticationCode) // "HMAC with SHA256: c818a1400a9995d5faafbb5d41cc88a6701b5d1a4ded8ac169498319a2597e2a"

如何访问c818a1400a9995d5faafbb5d41cc88a6701b5d1a4ded8ac169498319a2597e2a值?显然,这必须通过URLSession进行编码和序列化,但是我认为获取HAC的“代码”部分没有明显的属性!

0 个答案:

没有答案