Avatar of jamie_lynn
jamie_lynn

asked on 

How do I generate a self-signed certificate and import it into the truststore using apis?

Hi,
How do I generate a self-signed certificate and import it programatically using apis?

Would CertificateFactory.getInstance("X.509").generateCertificate() generate the certificate?

How do I import the generated certificate into the trust store via api?
I cannot use the commandline tool keytool.
But the commandline equivalent would be
keytool -import -v -trustcacerts -alias serveralias -file server.cer -keystore cacerts.jks -keypass changeit -storepass changeit

Thanks
Jamie
Java

Avatar of undefined
Last Comment
jamie_lynn
ASKER CERTIFIED SOLUTION
Avatar of girionis
girionis
Flag of Greece image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of jamie_lynn
jamie_lynn

ASKER

Yeah.. i don't think I get generate and load to trust store programatically.
Thanks!
Java
Java

Java is a platform-independent, object-oriented programming language and run-time environment, designed to have as few implementation dependencies as possible such that developers can write one set of code across all platforms using libraries. Most devices will not run Java natively, and require a run-time component to be installed in order to execute a Java program.

102K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo