gpt4 book ai didi

php - 在 PHP、linux openssl 或其他任何工具上验证 x509 签名文本

转载 作者:行者123 更新时间:2023-11-29 22:32:42 25 4
gpt4 key购买 nike

我刚开始介绍 X509 协议(protocol)、电子 token 和数字签名。我可以对文本进行数字签名。

问题是,我如何验证已签名的文本?在 linux 上,使用 openssl 还是 PHP?

例如,我有一个文本“Veridiane”,这是用 javascript 和 capicom 制作的数字签名的结果。

--bof--
MIIQ+QYJKoZIhvcNAQcCoIIQ6jCCEOYCAQExCzAJBgUrDgMCGgUAMAsGCSqGSIb3
DQEHAaCCD1MwggQ9MIIDJaADAgECAgEMMA0GCSqGSIb3DQEBBQUAMIGXMQswCQYD
VQQGEwJCUjETMBEGA1UEChMKSUNQLUJyYXNpbDE9MDsGA1UECxM0SW5zdGl0dXRv
IE5hY2lvbmFsIGRlIFRlY25vbG9naWEgZGEgSW5mb3JtYWNhbyAtIElUSTE0MDIG
A1UEAxMrQXV0b3JpZGFkZSBDZXJ0aWZpY2Fkb3JhIFJhaXogQnJhc2lsZWlyYSB2
MTAeFw0xMDEyMjMxNzUzNDRaFw0xNDEyMzEyMzU5NTlaMG4xCzAJBgNVBAYTAkJS
MRMwEQYDVQQKEwpJQ1AtQnJhc2lsMTQwMgYDVQQLEytBdXRvcmlkYWRlIENlcnRp
ZmljYWRvcmEgUmFpeiBCcmFzaWxlaXJhIHYxMRQwEgYDVQQDEwtBQyBDQUlYQSB2
MTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ8LTiZlgB3un4bBJ2hP
BkKJKLAv5IGj+CCHdgo4bX+7RG94G9Acx0HNk4KdpnUhuoW8Q26c4+BmV2YGCFgd
EH6YI2IZ+7YUEUDzuxF3r2GxVJQqznDYz6uls4wkV5tjw3G39heZ44J8u+L67Wku
DZxXq8fCE6eLRtr+qaB4Kvi52WJ6p6qusYxzHMOyAa2gPKkkLcElpmFwbMLGYLMK
SJTJsSNhgSabJO4VAl/KBTj0mVKnZWj3KEu0ijMK2f4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C/Km1ZkETIf0OZh+aLHZ57QJXVQiz7Qkywzon5YSJFgX32tDsj
6nsk2q0eBdBZ3Z4MAQrmEvADUkQbm19c5Y8cNG1Y7utfxTz4ZjTwV6mCHkRPpCCA
nyPQz2j7yNNoWrr/nLSQyo7o97rAdQSIR0jw/vkPQND7fmsmh6chyXL46EUWiXSv
X9L/iiDKG832DO1HRWYaUQsMrBO3Ld0WHO3FcF2S4Ybua/ycWvBO7lBBuzFxJ/XK
UzcKeM5whwPhoDc0KOhcU2JfBJbHI7rR+QcWIiCkJlqU69KDqcYPhXTiDzGCAW4w
ggFqAgEBMGkwXTELMAkGA1UEBhMCQlIxEzARBgNVBAoMCklDUC1CcmFzaWwxIDAe
BgNVBAsMF0NhaXhhIEVjb25vbWljYSBGZWRlcmFsMRcwFQYDVQQDDA5BQyBDQUlY
QSBQRiB2MQIIHyzpBxgWpQ0wCQYFKw4DAhoFAKBdMBgGCSqGSIb3DQEJAzELBgkq
hkiG9w0BBwEwHAYJKoZIhvcNAQkFMQ8XDTExMDYxNzA5MjMxNFowIwYJKoZIhvcN
AQkEMRYEFCm/wZ4YKPeROqe+YHGjJHAch4XqMA0GCSqGSIb3DQEBAQUABIGAv5Gg
H+8151ryCX7BvPQUHU6ve2PZuDcMNuTI2YypMycnkOXhJf9L6/3OVRp6mMla4Hz0
7LMUlT5jiCkpqOgvlqEPM0ZoIA2TC5rqU/s7mcet1uaKleGnzpAB7jnkfHHrFnOf
94BxEoInO7WHCaSSvzPgVbIiO20YQCh9iq8+MaU=
--eof--

提前致谢...

最佳答案

当然是用 openssl。您可以使用命令行版本,或者如果已编译则使用相应的 PHP API。看起来 openssl_verify()是你需要的。看看 examples .

如果您说显示的 blob 是 x509 格式,那么您可能需要查看 openssl_x509_read()也是。

关于php - 在 PHP、linux openssl 或其他任何工具上验证 x509 签名文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6385738/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com