您如何测试公共/私有 DSA 密钥对? [英] How do you test a public/private DSA keypair?

查看:20
本文介绍了您如何测试公共/私有 DSA 密钥对?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种简单的方法可以验证给定的私钥是否与给定的公钥匹配?我有几个 *.pub 和几个 *.key 文件,我需要检查哪个和哪个一起使用.

Is there an easy way to verify that a given private key matches a given public key? I have a few *.puband a few *.key files, and I need to check which go with which.

同样,这些是发布/密钥文件,DSA.

Again, these are pub/key files, DSA.

我真的更喜欢某种单衬......

I would really prefer a one-liner of some sort...

推荐答案

我找到了一种似乎更适合我的方法:

I found a way that seems to work better for me:

ssh-keygen -y -f <private key file>

该命令将输出给定私钥的公钥,因此只需将输出与每个 *.pub 文件进行比较即可.

That command will output the public key for the given private key, so then just compare the output to each *.pub file.

这篇关于您如何测试公共/私有 DSA 密钥对?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆