【发布时间】:2020-09-01 20:01:37
【问题描述】:
我正在尝试为氧化钠 PublicKey 和 SecretKey 设置更通用的类型。
这取决于我们使用box_ 还是sign:
type PubCryptoSecretKey = sodiumoxide::crypto::box_::curve25519xsalsa20poly1305::SecretKey;
我想设置一个与氧化钠键类型兼容的PublicKey 类型或结构,例如struct PubKey(pub [u8; ?])。
SecretKey(或任意键)的来源是:
new_type! {
/// `SecretKey` for asymmetric authenticated encryption
///
/// When a `SecretKey` goes out of scope its contents
/// will be zeroed out
secret SecretKey(SECRETKEYBYTES);
}
其中SECRETKEYBYTES 的类型为usize
我找不到有关此new_type! 宏的任何信息。这里发生了什么,我该如何走得更远?
【问题讨论】: