Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8208957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T09:33:07+00:00 2026-06-07T09:33:07+00:00

I am implementing a shell script which will create a new self signed certificate

  • 0

I am implementing a shell script which will create a new self signed certificate using keytool command. Below is the command that I use to create the certificate

    echo "# Creating key and Self Signed Certificate"
    keytool -genkey -alias cert -keyalg RSA -storepass "${KEYSTORE_PASS}" -keypass         "${KEY_PASS}" -keystore cert/keystore.jks -validity 3650 -keysize 1024 -dname "C=${CNTRY}, ST=${ST}, L=${LOC}, O=${ORG}, OU=Certificates, CN=${ORG} SEURAT Certificate Authority"

exit_on_error $?

For password and other subject information I am getting input from user. Now this command fails if alias name already exists. I can delete the alias using

    keytool -delete -alias 1 -keystore cert/keystore.jks

But the above command fails if alias name doesnt present. So how can I check in shell script if alias name present then delete the certificate and create new in its name , or just create it ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T09:33:10+00:00Added an answer on June 7, 2026 at 9:33 am

    Maybe you can list the existing aliases first:

    [ -z keytool -list -alias cert ] && keytool -genkey -alias cert -keyalg RSA -storepass "${KEYSTORE_PASS}" -keypass
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am implementing a shell-like program where user types command (defined by me). Just
I am writing my own shell program. I am currently implementing the cd command
I'm working on an install script for Mac OSX and am using a shell
I am implementing my own shell. But to supprt for command history, I need
I made shell extension (implementing IContextMenu , IShellExtInit , IExtractIcon & IPersistFile ) using
I'm implementing the perror() equivalent to an API that I'm using. The perror() ISO
I am implementing a simple version of a linux shell in c. I have
I am implementing view controllers that shall have different behaviour. They have a common
implementing publishActivity in PHP using the REST API using this code: $activity = array(
Implementing a custom membership provider, there are certain properties such as MinRequiredPasswordLength that only

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.