How do you convert .cer file to pfx format in Windows? - windows

We currently have the following command that converts a .cer certificate file to .pfx format:
certutil -f -p "somepw,somepw" -mergepfx "c:\temp\stage_cert.cer" "c:\temp\stage.pfx"
This works fine when run in our ci/cd pipeline server.
I am trying to do the same thing on my local machine, but I keep getting this error:
CertUtil: -MergePFX command FAILED: 0x80070002 (WIN32: 2 ERROR_FILE_NOT_FOUND)
CertUtil: The system cannot find the file specified.
The .cer file is in that temp folder. What is it not finding?

Related

identify file not accessible ssh

My OS is Ubuntu16 in virtualbox.
I'm trying to write a script to transfer multiple files(filename:t01,t02,t03) with scp.
This is my code:
vim scriptname
#!/bin/bash
for a in {01..03}
do scp -i ~/home/username/.ssh/id_rsa -r t$a
username#xx.xx.xx.xxx:/home/username/Desktop
done
And when I typed this in the terminal
./scriptname
I got this
Warning: Identity file /home/ian/home/ian/.ssh/id_rsa not accessible: No
such file or directory.
t01: No such file or directory
Warning: Identity file /home/ian/home/ian/.ssh/id_rsa not accessible: No
such file or directory.
t02: No such file or directory
Warning: Identity file /home/ian/home/ian/.ssh/id_rsa not accessible: No
such file or directory.
t03: No such file or directory
One thing I couldn't understand is that I actually wrote "/home/ian/.ssh/id_rsa" in the script. But the error message showed "/home/ian/home/ian/.ssh/id_rsa". I have tried to type my ssh_key directory in different ways, such as "/.ssh/id_rsa" but still couldn't work.
What did I do wrong?
Thank you!
t01: No such file or directory
Told you that it cannot access the file
Because the dictionary you run the bash script is not the same to where the files are.
If you want to put files not in the same dictionary, you have to give the full path for all of them.

How to generate encrypted doc using gnupg via command line?

I need some assistance to generate encrypted documents using https://www.gnupg.org/ software.
They have provided the command line as per following.
alice% gpg --output doc.gpg --encrypt --recipient blake#cyb.org doc
But I am not getting as per my file structure how I am suppose to do same.
Please check the following file structure.
Public Key : C:\Encryption\PB_Key.asc
File need to encrypt : C:\Encryption\Test.txt
Bat file : C:\Encryption\Test.bat
gpg.exe : C:\Program Files (x86)\GnuPG\bin\gpg.exe
UserName : Test
I did some research and found few links
Batch encrypt with public key using Gpg4win command line
Need assistance to incorporate above.
Try this one.
#echo off
CD "C:\Program Files (x86)\GnuPG\bin\gpg.exe"
gpg --import PB_Key.asc
gpg -r "Test" -e "C:\Encryption\Test.txt"
We can create a batch file as following.
#echo off
"C:\Program Files (x86)\GnuPG\bin\gpg.exe" --import PB_Key.asc
"C:\Program Files (x86)\GnuPG\bin\gpg.exe" -r "Test" -e "C:\Encryption\Test.txt"

Extracting .gz after download through command line ftp

I'm trying to download a large number of files with the extension ".seq.gz" (1907 to be exact), so I'm using 'mget' on my windows command line ftp shell. When trying to unzip the files using WinZip I keep getting this error:
Extracting to "C:\Users\AljanahiA\AppData\Local\Temp\wz1a02\"
Use Path: yes Overlay Files: yes
Extracting gbvrt7.seq
Severe Error: CRC of extracted file does not match stored value.
Of course the same thing happens when I use 'get' and download a single file. BUT, when I manually download the files from the ftp webpage, it unzips perfectly fine.
Thoughts?

zip error: Could not create output file <was replacing the original zip file>

I have a Task Scheduler that runs WinSCP.exe that takes the zip file from the Desktop and sends it to Linux box.
I get following error if I try to replace the old zip file with a new one, since I want the data to be updated daily.
>pushd C:\Users\Desktop\ct
>zip -9 -m -r XML.zip zipfolder\*.xml
zip warning: new zip file left as: zia06608
zip warning: Permission denied
zip error: Could not create output file <was replacing the original zip file>
>popd
I cannot even manually delete this zip folder. It says:
The action cannot be completed because the folder is open in WinSCP.exe
I don't know what to do.
Did you find any running WINSCP process in windows task manager/processes tab ? If yes then end that task & try zipping again.

Linux / Windows Shell Scripting to Unlock PGP File

I have a sequence of scripts which downloads PGP files from a FTP server. I then unzip these files with a private key using PGPKeys. The unzipped files are then picked up by a SQL Server job which appends the data onto our database. I'd like to automate the entire process. Is there anyway to unzip a PGP locked file using shell scripting (either Linux or Windows)?
That's a perfect task to automize, I can help you in Linux.
First you can use wget to download a file
wget ftp://website.com/yourpgparchive.zip
If your ftp website requires authenticated access use
wget --ftp-user=USER --ftp-password=PASSWORD ftp://ftp.site/archive.zip.pgp
Then you need gpg (the open source PGP implementation) to decrypt the file
gpg -o file.zip -d file.zip.gpg
(If you need some suggestion on how to import keys and get started with gpg check here)
Then you can just unzip the file with
unzip file.zip
You may need to install gnupg and unzip from your package manager.
Yes, GPG. In your case, it's just gpg -d filename (or just gpg -d to read from stdin).
And, what you probably wanted to say is decrypt instead of unzip and encrypted instead of locked.

Resources