kurtbrose/pyjks

Exception: Not a JKS or JCEKS keystore (magic number wrong; expected FEEDFEED or CECECECE)

Closed this issue · 4 comments

I followed these steps to generate jks file:
openssl pkcs12 -export -in private.crt -inkey server.key -out ik.p12

keytool -importkeystore -deststorepass mks@1 -destkeystore msnew.jks -srckeystore ik.p12 -srcstoretype PKCS12

And on importing this jks file in python it is throwing I do not understand it's reason.

You've created a PKCS12 file (.p12), not a JKS. Seems like that's the emerging recommendation, but you'll need a different library (pyjks only supports jks). See also #49 for a bit more info.

@mahmoud The source is PKCS12 file and it is being converted to jks file. If this is the incorrect way please tell in what way will I get a jks file from certificate and private key.

Depends on the version of keytool, I guess. I think the default destination keystore type changed to p12 lately. You probably need a flag like -deststoretype jks, which I notice is missing from your command. Give that a shot.

Yes I already tried that too, but that's again throwing the same error. I don't understand what's the issue with it.