美文网首页
OpenSSL命令生成椭圆曲线密钥

OpenSSL命令生成椭圆曲线密钥

作者: redexpress | 来源:发表于2020-06-30 10:37 被阅读0次

    使用OpenSSL生成椭圆曲线密钥

    生成secp256k1椭圆曲线参数

    openssl ecparam -out demo.param -name secp256k1
    

    输出类似

    -----BEGIN EC PARAMETERS-----
    BgUrgQQACg==
    -----END EC PARAMETERS-----
    

    生成椭圆曲线密钥

    openssl genpkey -paramfile demo.param -out demo.pem
    

    输出类似

    -----BEGIN PRIVATE KEY-----
    MIGEAgEAMBAGByqGSM49AgEGBSuBBAAKBG0wawIBAQQgQ3w1tYqM23IWEBlIJRNA
    /s9297Kt30Cn3eFkkWbUitKhRANCAARPu3+IOeXERFQY0jEU2i5gd79LieyxPU4x
    a9uB274kutATCn0hX0OXBwKeZ8/OKnmEy61zGWtbtWLaxRnSkDeg
    -----END PRIVATE KEY-----
    

    解析密钥文件

    openssl ec -in demo.pem -text -noout
    

    输出类似

    read EC key
    Private-Key: (256 bit)
    priv:
        43:7c:35:b5:8a:8c:db:72:16:10:19:48:25:13:40:
        fe:cf:76:f7:b2:ad:df:40:a7:dd:e1:64:91:66:d4:
        8a:d2
    pub:
        04:4f:bb:7f:88:39:e5:c4:44:54:18:d2:31:14:da:
        2e:60:77:bf:4b:89:ec:b1:3d:4e:31:6b:db:81:db:
        be:24:ba:d0:13:0a:7d:21:5f:43:97:07:02:9e:67:
        cf:ce:2a:79:84:cb:ad:73:19:6b:5b:b5:62:da:c5:
        19:d2:90:37:a0
    ASN1 OID: secp256k1
    

    相关文章

      网友评论

          本文标题:OpenSSL命令生成椭圆曲线密钥

          本文链接:https://www.haomeiwen.com/subject/txtnzhtx.html