Reputation: 19
after creating a self-signed CA file and private keys, I was wondering how to add this ca and key file into an android phone? so far, I have not found a way to import on the phone.
please help me!
Upvotes: 0
Views: 3859
Reputation: 1
You need use a special certificate from auhority certification (AC). This certificate can sign anoter. Otherwise Android refuse and ask a key (on Android version 14)
First generate AC certificate request + private key in one commad
openssl req -new -sha256 -nodes -newkey rsa:4096 -keyout CA.key -out CA.csr
Create AC certificate:
openssl x509 -req -sha256 -extfile x509.ext -extensions ca -in CA.csr -signkey CA.key -days 1095 -out CA.pem
Observ that you need create before extension file x509.ext containing some parameters [ca] for your AC certifcate :
[ ca ]
# X509 extensions for a ca
keyUsage = critical, cRLSign, keyCertSign
basicConstraints = CA:TRUE, pathlen:0
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid:always,issuer:always
[ server ]
# X509 extensions for a server
keyUsage = critical,digitalSignature,keyEncipherment
extendedKeyUsage = serverAuth,clientAuth
basicConstraints = critical,CA:FALSE
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid,issuer:always
And now server side, you need a new create certificate with your AC certificate:
Request:
openssl req -new -sha256 -nodes -newkey rsa:4096 -keyout www.example.com.key -out www.example.com.csr
Certification generation, using [server] options in your x509.ext file:
openssl x509 -req -sha256 -CA CA.pem -CAkey CA.key -days 730 -CAcreateserial -CAserial CA.srl -extfile x509.ext -extensions server -in www.example.com.csr -out www.example.com.pem
Upvotes: -1
Reputation: 193
Upvotes: 3