In SoftHsm (v2.4.0) I noticed that you cannot extract a self-signed certificate if you don't have its corresponding private key in the same token. I generated the certificate with OpenSSL, and then imported it using softhsm2-util --import.
I am using Java to interact with SoftHSM, and calling KeyStore.getCertificate(label) returns null if the private key is not present. Is this a bug or a normal cryptography thing? I tried to look online but didn't find anything...