大多数涉及Yubikey智能卡功能的教程都使用插槽。
然而,也有可用的插槽82-95(退休密钥管理):
这些插槽仅在YubiKey 4& 5上可用,它们用于先前使用的密钥管理密钥,以便能够解密先前加密的文档或电子邮件。在YubiKey 4&5中,所有20个都可供使用。
我想使用多个插槽进行数字签名,因此,我将使用插槽9c,例如,84个用于两个不同的证书。
我的问题是:
openssl ca从插槽84用密钥/证书对数据进行签名?发布于 2022-12-28 03:33:33
提示:通常YubiKey与gpg一起使用,并使用pgp格式,它支持各种铃铛和哨音。YubiKey PIV插槽使用原始的RSA or ECC key and cert0。
此外,虽然公共的4个pgp插槽支持4096位密钥,但是PIV时隙是规格化的1,最多可达2048位。
puttygen或任何其他工具来代替。openssl genrsa -out secret.pem 2048
openssl rsa -in secret.pem -pubout -out public.pem
YubiKey SDK、yubico-piv-tool或YubiKey Manager CLI将密钥上载到PIV插槽:ykman piv keys import --pin 123456 --pin-policy NEVER --touch-policy ALWAYS 95 secret.pem
echo "hello world" | openssl rsautl -inkey public.pem -pubin -encrypt -oaep -out msg.encrypted
using Yubico.YubiKey;
using Yubico.YubiKey.Piv;
using Yubico.YubiKey.Cryptography;
var msg_encrypted = File.ReadAllBytes("msg.encrypted");
var device = YubiKeyDevice.FindAll().First();
using (var piv = new PivSession(device))
{
var decrypted_raw = piv.Decrypt(0x95, msg_encrypted);
byte[] output;
RsaFormat.TryParsePkcs1Oaep(decrypted_raw, RsaFormat.Sha1, out output);
Console.WriteLine(System.Text.Encoding.UTF8.GetString(output)); // "hello world"
};如果您只对签名感兴趣,则可能不需要SDK2。
https://security.stackexchange.com/questions/258518
复制相似问题