Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用AES.GCM.seal(textData, using: retrievedKey), 来加密一些信息。我需要encrypted.nonce作为数据访问。我如何实现这一目标?
AES.GCM.seal(textData, using: retrievedKey)
encrypted.nonce
该Data类型有一个初始化器,它接受任何符合Sequence协议的类型。您可以使用它来初始化Datafrom,AES.GCM.Nonce因为 的定义AES.GCM.Nonce表明它符合Sequence协议:
Data
Sequence
AES.GCM.Nonce
public struct Nonce : ContiguousBytes, Sequence
所以你可以很容易地做到这一点:
let nonceData = Data(encrypted.nonce)
你会Data从你的AES.GCM.Nonce.