How to replace "cry key generate rsa" when one key is already in place

Answered Question
Oct 23rd, 2009
User Badges:

Folks, I need to paste this config/templace on switches. When there is no cry key gen rsa already in place in the switch, the command works accordingly. If there is a key already in place, then I get prompted for "yes/no" and then I need to enter "800" to select the length I want.


Question: is there any way to force the command below to input "YES" and "800" when I get such prompt?


(...)

!-This one works well if no cry key is in place.

cry key generate rsa

[pick 800] ssh_rsa_verify: RSA modulus too small: 512 < minimum 768 bits

(...)



!- As you can see, if pasted onto a switch which already has the key it hangs there waiting for a command prompt input.


myswitch(config)#cry key generate rsa

% You already have RSA keys defined named domain.c

% Do you really want to replace them? [yes/no]: yes

Choose the size of the key modulus in the range of 360 to 2048 for your

General Purpose Keys. Choosing a key modulus greater than 512 may take

a few minutes.


How many bits in the modulus [512]: 800


(...)

Correct Answer by Joe Clarke about 7 years 7 months ago

Enter the whole command in one shot:


crypto key generate rsa general-keys modulus 800


  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 5 (1 ratings)
Loading.
Correct Answer
Joe Clarke Fri, 10/23/2009 - 13:15
User Badges:
  • Cisco Employee,
  • Hall of Fame,

    Founding Member

Enter the whole command in one shot:


crypto key generate rsa general-keys modulus 800


Correct Answer
Joe Clarke Fri, 10/23/2009 - 13:15
User Badges:
  • Cisco Employee,
  • Hall of Fame,

    Founding Member

Enter the whole command in one shot:


crypto key generate rsa general-keys modulus 800


Actions

This Discussion