Learning about big query on google app engine and wanted to try out this library that also required me to know about Converting the service account credential to other formats. I have tried the command
# Convert the key from pkcs12 to pkcs1 (PEM).
$ cat /path/to/xxxx-privatekey.p12 | openssl pkcs12 -nodes -nocerts -passin pass:notasecret | openssl rsa > /path/to/secret.pem
on the command line but I get
'cat' is not recognized as an internal or external command,
operable program or batch file.
How do I resolve this?
Use windows powershell. WIndows 7 afterwards, it comes along with the windows.
Use 'Windows PowerShell' to the 'cat' Command, It'll work.
Related
My requirement is to create RSA private key file from certificate file (.crt extention file). Openssl installed in my system and I also set the environment variable in "PATH". Unfortunately, while I am executing the command in CMD it's not working... The response getting in the CMD is
The command I am executing in CMD
openssl pkcs12 -in myfile.crt -nocerts -out keyFile.key
The response is
pkcs12: Use -help for summary.
I am not familiar with Openssl, Not found a correct solution yet. If any help, it will be appreciated.
Thanks in advance.
This command fails on one Windows machine in git bash session, while on the other machine it work fine.
auser#pc MINGW64 /c/Developer/TEMP/openssltest
$ echo "Hi Alice!" | openssl rsautl -encrypt -inkey /c/Developer/TEMP/openssltest/pub2.pem --pubin
Can't open /c/Developer/TEMP/openssltest/pub2.pem for reading, No such file or directory
15844:error:02001003:system library:fopen:No such process:../openssl-1.1.1k/crypto/bio/bss_file.c:69:fopen('/c/Developer/TEMP/openssltest/pub2.pem','r')
15844:error:2006D080:BIO routines:BIO_new_file:no such file:../openssl-1.1.1k/crypto/bio/bss_file.c:76:
unable to load Public Key
auser#pc
This command work on a machine where it fails
$ echo "Hi Alice!" | openssl rsautl -encrypt -inkey ./pub2.pem --pubin
I do not have any issues on another machine. Where to look?
I would look into:
difference in openssl version
read access: cat /c/Developer/TEMP/openssltest/pub2.pem (or cat /c/Developer/TEMP/anyOtherFile)
difference in user for the shell session (env|grep -i user)
If you are running that test with a user account which does not have the right to read that TEMP folder, you would get that error.
I am using windows openssl version 3.0.1 14. The issue is when the file name has non-English character, it failed to encrypt the file with below error:
C:\Users\XXX\Desktop>openssl aes-256-cbc -e -salt -in "C:\Users\XXX\Desktop\test\试试.txt" -out "C:\Users\XXX\Desktop\test\ENCRYPTING.txt" -k 12230000000000000000000000000000 -iv F1230000000000000000000000000000
Can't open "C:\Users\XXX\Desktop\test\??.txt" for reading, Invalid argument
B8280000:error:8000007B:system library:BIO_new_file:Unknown error:crypto\bio\bss_file.c:67:calling fopen(C:\Users\lishi\Desktop\test\??.txt, rb)
B8280000:error:10080002:BIO routines:BIO_new_file:system lib:crypto\bio\bss_file.c:77:
The terminal I use is Windows command prompt, I verified that this Chinese file can be opened successfully in cmd using issuing:
C:\Users\XXX\Desktop>notepad C:\Users\XXX\Desktop\test\试试.txt
Any configuration things I need to do in openssl side to support utf8?
I have been trying multiple different ways to decrypt using a Windows batch file. Moving the options around will a) cause the passphrase prompt to pop up or b) the batch file simply failing with a message that the passphrase was not found. There is lots of info online but most of them are old and no longer applicable to the newer version of GPG.
When I do get prompted for the passphrase the files decrypt just fine
Using GPG 2.2.19
Below is the line from the batch file. Can anyone see what is wrong? I understand putting the --password string in the batch-file is not good practice but there only 2 trusted admins on this Windows machine (Win 2012 R2) and we both need the decryption tasks automated.
Batch file:
CD "C:\Program Files (x86)\GnuPG\bin\"
GPG echo PASSPHRASE|gpg --batch --pinentry-mode loopback -o X:\OUTPUTDIRECTORY\FILENAME.CSV --passphrase-fd 0 -d X:\ENCRYPTEDFILEDIRECTORY\FILENAME.gpg
The correct answer is below. Note the quotes, absence of --batch, elimination of echo and PASSPHRASE|gpg. The placement of the options must be exactly like that. I have tested this numerous times and set up windows task scheduler to execute the batch file, everything runs perfect.
gpg --pinentry-mode=loopback --passphrase "YOURPASSPHRASE" -d -o "X:\OUTPUT DIRECTORY\FILENAME.csv" "X:\ENCRYPTEDFILEDIRECTORY\FILENAME.gpg"
I'm trying to convert a bash script for Linux to run in Windows batch as well. Amongst several commands, there is also an OpenSSL command which reads a certificate from an https server and stores it in a variable. The bash command is:
openssl s_client -showcerts -connect $SERVER_IP:443/login </dev/null 2>/dev/null|openssl x509 -outform PEM > mycertfile.pem
I've installed OpenSSL in my Windows machine from here. I prefered the "Win64 OpenSSL v1.1.0e Light" version of OpenSSL.
How is this command transferred to Windows logic? Any ideas?