The Self-Signed Certificate Generator is a Java application that allows you to generate a self-signed X.509 certificate and corresponding private key using the Java security API and Bouncy Castle provider. This is useful for testing and development purposes when you need to create a self-signed certificate for SSL/TLS encryption.
- Java Development Kit (JDK) 8 or higher
- Bouncy Castle Provider Library (bcprov-jdk15on-1.69.jar)
- Download and install the Java Development Kit (JDK) if you don't have it already.
- Download the Bouncy Castle Provider Library (
bcprov-jdk15on-1.69.jar
) from the Bouncy Castle website and add it to your classpath. - Compile the Java source file
SelfSignedCertificateGenerator.java
:javac SelfSignedCertificateGenerator.java
- Run the
SelfSignedCertificateGenerator
class to generate the self-signed certificate and private key:java SelfSignedCertificateGenerator
- The application will generate a self-signed X.509 certificate (
certificate.cert
) and the corresponding private key (key.pem
) in the current directory.
Modify the following parameters in the SelfSignedCertificateGenerator
class if needed:
keySize
: The key size used for generating the RSA key pair. The default is 2048 bits.validityDays
: The number of days the generated certificate will be valid. The default is 365 days.certificateFileName
: The name of the output file for the generated certificate. The default iscertificate.cert
.privateKeyFileName
: The name of the output file for the generated private key. The default iskey.pem
.
The self-signed certificate generated by this tool is not issued by a trusted certificate authority (CA) and should not be used in a production environment. It is intended for testing and development purposes only.
This project is licensed under the MIT License.
Contributions are welcome! If you have any suggestions, bug reports, or feature requests, please open an issue or submit a pull request.
This application utilizes the Bouncy Castle cryptographic library for generating the self-signed certificate.
This tool is provided as-is without any warranty. Use it at your own risk.
Feel free to customize and enhance the README file based on your specific requirements and project details.