I have been studying about how to use digital certificate in B4J for 1 week and still unclear what I was doing is correct.
I have read a lot of articles but none giving me a clear picture.
Before I purchase an expensive digital certificate which valid for 1 year or getting a trial certificate valid for 1 month, I want to know:
how to retrieve any information from the certificate?
what information I need to retrieve or could I retrieve?
I think I need serial number, issuer, subject, cert in base64, cert digest and validity from the certificate
can I use JavaObject only without calling/exporting the certificate with keytool or openssl?
if #3 above is no, meaning I must export them from DER format to .cer, .crt or .pem file?
is there any method to read the properties of a certificate using JavaObject?
If no then meaning I need to "trim" the unwanted text from the plain .pem file?
can I use keytool and/or openssl to create a selfsigned certificate that valid for signing a document?
I notice that the output certificate doesn't contain information such as Organization identifier and Emailas required.
I need to create a PKCS#12 (.p12 or .pfx file) is it a keystore or is it also a digital certificate?
I think it is a certificate which embeded with a keystore inside it, am i right?
does this certificate store public and private keys?
how to retrieve any information from the certificate?
what information I need to retrieve or could I retrieve?
I think I need serial number, issuer, subject, cert in base64, cert digest and validity from the certificate
I created an example. https://www.b4x.com/android/forum/threads/create-and-read-pkcs12-keystore.163171/ It works in Debug and Release but if I call the jar in command prompt, I get errors. C:\Users\aeric\Desktop\readp12\Objects>C:\Java\jdk-19.0.2\bin\java -jar readp12.jar MyPassword...
I have written a code snippet: Create and Read PKCS12 Keystore and have better understanding now.
If I am wrong, please point to me. Thanks.
how to retrieve any information from the certificate?
answer: code snippet
what information I need to retrieve or could I retrieve?
I think I need serial number, issuer, subject, cert in base64, cert digest and validity from the certificate
answer: code snippet
can I use JavaObject only without calling/exporting the certificate with keytool or openssl?
answer: yes, except for creating the keystore file, I need to use keytool
if #3 above is no, meaning I must export them from DER format to .cer, .crt or .pem file?
answer: no
is there any method to read the properties of a certificate using JavaObject?
If no then meaning I need to "trim" the unwanted text from the plain .pem file?
answer: yes, there are many methods that can be used as listed in the link in first post of the code snippet
can I use keytool and/or openssl to create a selfsigned certificate that valid for signing a document?
I notice that the output certificate doesn't contain information such as Organization identifier and Emailas required.
answer: yes, but the additional information mentioned above are not available. I think still need to refer to local CA.
I need to create a PKCS#12 (.p12 or .pfx file) is it a keystore or is it also a digital certificate?
I think it is a certificate which embeded with a keystore inside it, am i right?
answer: It seems this keystore file contains a combination of keypair and certificate.
does this certificate store public and private keys?
answer: yes
if #7 above is yes, how do I retrieve them?
answer: it can be retrieved using JavaObject calling methods getPublicKey and getKey