How to use a certificate for encryption in java se -
i've code app in java let user write text , use certificate encrypt string , show (encrypted) in textfield. coded graphical interface i've searched how use certificate encrypt/decrypt variable in java , didn't find case ! help.
your certificate can exported file (eg.: "mycert.cer"). use api provided jca (java cryptography architecture) manipulate it.
for instance, read certificate, use
fileinputstream fis = new fileinputstream("mycert.cer"); certificatefactory cf = certificatefactory.getinstance("x509"); x509certificate crt = (x509certificate) cf.generatecertificate(fis);
from public key of x509certificate
object, encrypt text. need here , here.
Comments
Post a Comment