Вопрос

I have a system that receives requests encoded with 2 different public keys and which I have to decipher with the respective private keys that I have in the Java keystore.

How can I know which one of the private keys in my JKS I should use to decipher? Preferably better than test-and-fail till I find the correct key?

Это было полезно?

Решение

Most of encryption standards (like CMS, XML Encrpyption, GPG...) require the inclusion of an unambiguous way to determine the public key used to encrypt. It could be a reference to the public key (i.e. a hash) or a certificate. With this indication it is possible to select the correct private key.

Unfortunately if the system you are using does not provide that kind of indication I don't think there is no other way than try-and-fail.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top