Replace public key in key pair entry with trusted certificate, keystore
- 我有.der / .cer文件
I've done something wrong but I'm not quite sure what I did. Currently, I have a key pair that has the correct private key but the wrong public key. I have no idea what I did wrong to get this. Anyways I have a trusted certificate with the correct SHA-1 code I need. What I'm trying to accomplish is to replace the public key, on the key pair with the correct details from the trusted certificate. Obviously I don't know a ton about how these keys work so any help is appreciated. Thanks
Things I've tried:
- delete just the public key (ends up deleting the whole pair)
- extracting the private key and public key separately and rebuilding a key pair
- extract each part and try to combine separate
- I have the .der / .cer file
A public and private key pair are inseparable. You can't verify the private key without the public key.
It seems you are saying you have a key pair, and a public certificate that can be verified with the private key in the key pair, but doesn't match the public key in the key pair. I don't know how this is possible, but if that is the case, you should have no auth issue.
If this is not the case, you need to generate a new key. The whole point of key auth is to prevent reverse-engineering.