Commands
  • About
  • Software Development
    • Glossary
    • System Design
      • CAP Theorem
      • Data Migration
      • EAV Model
      • ETL Process
      • Event Sourcing
      • Outbox Pattern
      • SOLID Principles
    • Standards
      • Character Encoding
      • Twirp
    • Elixir
      • IEx
      • Mix
      • Libraries
      • Code Snippets
    • Node.js
      • TypeScript
  • Commands
    • Bookmarks
    • AWS
      • Athena
      • ECS
    • Docker
      • Manage Images
      • Manage Containers
    • File System
      • Grep
      • Search Files
      • Miscellaneous
    • Git
      • Setup New Project
      • Manage Remotes
      • Release Project
    • GPG
    • Kafka
      • Quick Start
    • Kubernetes
    • OpenShift
      • Manage Roles and Bindings
    • PostgreSQL
    • SSL / TLS
      • Common OpenSSL Commands
      • Create Self-signed Certificate
      • Java Truststore and Keystore
    • SSH
      • Key Management
      • Port Forwarding
    • YUM
      • List Repositories
      • List Packages
    • Miscellaneous
      • Network
Powered by GitBook
On this page
  1. Commands
  2. SSL / TLS

Java Truststore and Keystore

PreviousCreate Self-signed CertificateNextSSH

Last updated 3 years ago

Import The Key-pair Into Java Keystore

  1. Convert the key-pair into PKCS12 keystore.

    openssl pkcs12 -export -in server.crt -inkey server.key -out server.p12 -passout env:KEYPAIR_PWD -name server-name

    -passout: env:<VAR_NAME> / file:<PATH> / fd:<NUM> / stdin

  2. Import the PKCS12 keystore into the Java keystore.

    keytool -importkeystore -noprompt -srckeystore server.p12 -srcstoretype pkcs12 -srcstorepass <KEYPAIR_PWD> -destkeystore server.jks -deststoretype JKS -deststorepass <KEYSTORE_PWD>

    Reference: https://www.ssl.com/how-to/create-a-pfx-p12-certificate-file-using-openssl/

  3. Check-out for the list of the most common Java keytool commands.

here