SSH 评论参数
作者: DoctorD90创建于 2026年8月19日更新于 2026年8月20日
目前,SSH 格式没有机会添加类似于“对应”的 openSSH 命令的注释:
ssh-keygen -t ed25519 -C "[email protected]" -N "MySecretPassword" -f id_ed25519_key
在当前版本中,SSH 密钥的生成方式如下:
key_bytes = key.private_bytes(
encoding=serialization.Encoding.PEM,
format=serialization.PrivateFormat.OpenSSH,
encryption_algorithm=serialization.BestAvailableEncryption("MySecretPassword".encode('utf-8')),
)但没有 ssh_comment 参数可用于将“[email protected]”添加到私钥中。
内容来源: pyca/cryptography