android - How to verify X.509 certificate format? -
i have ssl certificate (a certificate chain starting root of server) seems okay. can open certificate on windows & import using windows wizard.
but when try convert keystore through following command (using bouncycastle) :
keytool -importcert -v -trustcacerts -file "test.crt" -alias ca -keystore "test.bks" -provider org.bouncycastle.jce.provider.bouncycastleprovider -providerpath "bcprov-ext-jdk15on-1.46.jar" -storetype bks -storepass testtest
i below error:
keytool error: java.lang.exception: input not x.509 certificate java.lang.exception: input not x.509 certificate @ sun.security.tools.keytool.addtrustedcert(unknown source) @ sun.security.tools.keytool.docommands(unknown source) @ sun.security.tools.keytool.run(unknown source) @ sun.security.tools.keytool.main(unknown source)
i'm developing android application need call rest based api through https.
is there web based tool (or otherwise) through can validate certificate ?
it appears test.crt not x.509 format. typically if it's pem-encoded x.509 certificate start line:
-----begin certificate----- mii...
or
-----begin trusted certificate----- mii...
a der-endcoded x.509 certificate appear random binary data you, can decode such der-encoded files openssl
command line:
openssl asn1parse -inform d -in test.crt -i
the beginning oid in output tell if it's x.509 certificate or else pkcs#7 bag.
Comments
Post a Comment