Building on @ScottyB's answer:
openssl req -new -newkey rsa:2048 -days 3650 -nodes -x509 -subj "/C=US/ST=Oklahoma/L=Stillwater/O=My Company/OU=Engineering/CN=test.com" -keyout ca.key -out ca.crt
openssl genrsa -out "test.key" 2048
openssl req -new -key test.key -out test.csr -config openssl.cnf
openssl x509 -req -days 3650 -in test.csr -CA ca.crt -CAkey ca.key -CAcreateserial -extensions v3_req -extfile openssl.cnf -out test.crt
The error gives a hint on how to fix. If you combine the certificate and private key generated above into a single file, Android will accept it:
openssl pkcs12 -export -in test.crt -inkey test.key -out test-combined.p12
Transfer the .p12 file to your Android phone, then use Install From Device Storage. Give it a nice human-readable name and the CA certificate can now be used with services like web servers that use the ca.key & ca.crt.
Here's an Nginx config snippet to refuse all connections except those that present a certificate signed by the above ca cert:
# within server block, eg. under the ssl_certificate config
ssl_client_certificate /etc/ssl/ca/ca.crt;
ssl_trusted_certificate /etc/ssl/ca/ca.crt;
ssl_verify_client optional_no_ca;
if ($ssl_client_verify != SUCCESS) { return 403; }
When your Android browser now visits this website, it will only let you in further if you present a signed certificate.