MakeCert - is it possible to change the key size? - certificate

When I generate a certificate using MakeCert.exe, I want to change the key size from 1024 to 2048.
Is this possible? Or do I need to setup a certificate authority (CA)?

Here the following syntax is used:
makecert -pe -ss MY -$ individual -n "CN=your name here" -len 2048 -r
Sorry I cannot test it, since I don't have Makecert.

A description of Makecert options can be found at MSDN, but I didn't see an explicit one for setting the key length.

Related

Base64 encoding is adding a new line

I'm trying to encode a database string using base64 on the command line in linux.
Once I do I add the value to a secret in kubernetes but my application is failing to connect to the database due to the db string not being accepted. There seems to be a newline getting added when I check the value in lens and this is not there in a similar cluster in the same secret
jdbc:postgresql://test.xxxxxxxx.eu-west-2.rds.amazonaws.com/test
deirdre$ echo jdbc:postgresql://test.xxxxxxxx.eu-west-2.rds.amazonaws.com/test | base64 | tr -d "\n"
amRiYzpwb3N0Z3Jlc3FsOi8vdGVzdC54eHh4eHh4eC5ldS13ZXN0LTIucmRzLmFtYXpvbmF3cy5jb20vdGVzdAo=
Is there something I am doing wrong? or is there an issue with the /?
You can fix those easy with
echo -n "string" | base64
"echo -n" removes the trailing newline character.
You can also see my last answer i gave to following Question
Kubernetes secrets as environment variable add space character
the problem is that base64 adds the newline in order to be compatible with older systems that have a maximum line width. you can add the -w 0 option to the base64 command to change the behavior so that it no longer adds new lines.
in your example this would be
echo "jdbc:postgresql://test.xxxxxxxx.eu-west-2.rds.amazonaws.com/test" | base64 -w 0
which results in
amRiYzpwb3N0Z3Jlc3FsOi8vdGVzdC54eHh4eHh4eC5ldS13ZXN0LTIucmRzLmFtYXpvbmF3cy5jb20vdGVzdAo=
edit:
printf "%s" jdbc:postgresql://test.xxxxxxxx.eu-west-2.rds.amazonaws.com/test | base64 -w 0
produces the correct output which adds an additional newline in the base64 encoded string which is apparently required for the url to be recognized as properly ended

Why would OpenSSL be returning a different SHA1 hash output in my terminal?

I'm trying to hash a fairly small value using SHA1 for a university excercise.
I'm running OpenSSL 1.1.1 11 Sep 2018. Operating System is Ubuntu 18.04.1, running through Windows Subsystem for Linux 1.
Running any of the following;
echo "361448504617" | openssl dgst -SHA1
echo 361448504617 | openssl dgst -SHA1
openssl dgst -sha1 hash.txt
openssl SHA1 hash.txt
Returns:
(stdin)= f98a0e600cd960f6c414343748a8dabc5ae9ec0a
(stdin)= f98a0e600cd960f6c414343748a8dabc5ae9ec0a
SHA1(hash.txt)= f98a0e600cd960f6c414343748a8dabc5ae9ec0a
SHA1(hash.txt)= f98a0e600cd960f6c414343748a8dabc5ae9ec0a
If I go to an online SHA1 hash generator, such as https://passwordsgenerator.net/sha1-hash-generator/, it returns:
A599EBBA6735313C848118F6EDB63012163D7581
Which is also the answer to the worksheet, and also what the labratory instructors terminal returns.
Can anyone give me a hand in troubleshooting this?
Annnd, I figured it out.
OpenSSL was hashing the newline character also, pretty easy to solve using the -n argument for echo.
echo -n 361448504617 | openssl SHA1
Also, when OpenSSL was reading from file, I got the same error because vim was saving with an end of line character. Fixed by running the following commands inside vim:
:set binary
:set noeol
:wq

Using wget (for windows) to download all MIDI files

I've been trying to use wget to download all midi files from a website (http://cyberhymnal.org/) using:
wget64 -r -l1 H -t1 -nd -N -np -A.mid -erobots=off http://cyberhymnal.org/
I got the syntax from various sites which all suggest the same thing, but it doesn't download anything. I've tried various variations on the theme, such as different values for '-l' etc.
Does anybody have any suggestions as to what I am doing wrong? Is it the fact that I am using Windows?
Thanks in advance.
I don't know much about all the parameters you are using like H, -t1, -N etc though we can find it online. But I also had to download files from a url matching a wildcard. So command that worked for me:
wget -r -l1 -nH --cut-dirs=100 -np "$url" -P "${newLocalLib/$tokenFind}" -A "com.iontrading.arcreporting.*.jar"
after -P you specify the path where you wanna save the files to and after -A you provide the wild card token. Like in your case that would be "*.mid".
-A means Accept. So here we provide the files to accept from the provided URL. Similarly -R for reject list.
You may have better luck (at least, you'll get more MIDI files), if you try the actual Cyber Hymnal™, which moved over 10 years ago. The current URL is now http://www.hymntime.com/tch/.

Perl Program to search for a string over a set of files over SSH

I have a perl script which can be used to ssh into a remote server using Net::SSH2, i need to search for a particular string over the files in a given directory in the remote system and print the given files in which the string occurs . Any ideas /sample codes on how i can go about this ?
Thanks
Solution proposed and accepted in the comments:
ssh <user>#<host> grep -d recurse -l <string> <directories>

Best Blowfish command line tool?

Our application needs to encrypt/decrypt files using (for instance) Blowfish encryption algorithm. We know bcrypt could be a good choice, but it cannot be called directly from our application (as it prompts for key phrase).
Which is the best existing option?
We prefer a Windows tool, though Linux would be good as well.
http://www.openssl.org/docs/crypto/blowfish.html programming interface
http://www.openssl.org/docs/apps/enc.html command line interface
Example:
openssl enc -base64 -e -bf-cbc -in <infile> -out <outfile> -kfile <passphrase file>
(replace -e with -d to decrypt)
I coudln't find one I liked; so I wrote one in Go. Here it is: https://prologic.github.io/fish/
Example:
$ echo 'Hello World' | fish -e -k mysecret -
Pretty easy to install with:
$ go get github.com/prologic/fish
Also supports both Blowfish and the newer Twofish