Win OS / Preparing Public Key from command Line

Batch

Sample DOS Batch file for importing partner public key, creating self public key, and exporting created key

Code


setlocal

	set "_folderBin=F:\PGP Corporation\PGP Command Line"
	set "_fileBin=pgp.exe"

	set "_folderKeyPublic=pgpkeys"
	set "%_fileKeyPublicPartner=Partner PGP key_PROD_public.asc"
	set "%_fileKeyPublicSelf=Self_PGP_Keys_Prod_public.asc"

	set "_privateKeyRealID=Self_PGP_Keys_Prod "
	set "_privateKeyType=RSA"
	set "_privateKeySize=2048"
	set "_privateKeyPassphrase=lovejones"

	REM Import Public Key Partner
	"%_folderBin%"\%_fileBin% --import "%_folderKeyPublic%\%_fileKeyPublicPartner%"

	REM List Keys
	"%_folderBin%"\%_fileBin%  --list-keys

	REM Generate Key
	"%_folderBin%"\%_fileBin% --gen-key "%_privateKeyRealID%" --key-type %_privateKeyType% --bits %_privateKeySize% --passphrase %_privateKeyPassphrase%

	REM Export Public Key Self
	"%_folderBin%"\%_fileBin% --export "%_privateKeyRealID%" --output "%_folderKeyPublic%\%_fileKeyPublicSelf%"

endlocal

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s