From a0f2aff23d406539320a3d03d78d628e27a29dc0 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Wed, 18 Jan 2017 21:51:05 +0100 Subject: [PATCH] SSL folder #1 --- ssl/check | 7 +++++++ ssl/decrypt | 8 ++++++++ ssl/encrypt | 8 ++++++++ ssl/keygen | 8 ++++++++ ssl/keys/key | 5 +++++ ssl/keys/key.pub | 4 ++++ ssl/sign | 7 +++++++ 7 files changed, 47 insertions(+) create mode 100755 ssl/check create mode 100755 ssl/decrypt create mode 100755 ssl/encrypt create mode 100755 ssl/keygen create mode 100644 ssl/keys/key create mode 100644 ssl/keys/key.pub create mode 100755 ssl/sign diff --git a/ssl/check b/ssl/check new file mode 100755 index 0000000..9488c5f --- /dev/null +++ b/ssl/check @@ -0,0 +1,7 @@ +#!/bin/sh + +if [ $# -lt 2 ]; then + echo "missing arguments {in_file} {in_signature}" && exit; +fi; + +openssl dgst -sha512 -verify ./keys/key.pub -signature $2 $1; diff --git a/ssl/decrypt b/ssl/decrypt new file mode 100755 index 0000000..cca9f7f --- /dev/null +++ b/ssl/decrypt @@ -0,0 +1,8 @@ +#!/bin/sh + +if [ $# -lt 2 ]; then + echo "missing arguments {in_encrypted} {out_decrypted}" && exit; +fi; + + +openssl enc -aes-256-cbc -d -in $1 -out $2; diff --git a/ssl/encrypt b/ssl/encrypt new file mode 100755 index 0000000..6deddef --- /dev/null +++ b/ssl/encrypt @@ -0,0 +1,8 @@ +#!/bin/sh + +if [ $# -lt 2 ]; then + echo "missing arguments {in_file} {out_encrypted}" && exit; +fi; + + +openssl enc -aes-256-cbc -in $1 -out $2; diff --git a/ssl/keygen b/ssl/keygen new file mode 100755 index 0000000..339fe77 --- /dev/null +++ b/ssl/keygen @@ -0,0 +1,8 @@ +#!/bin/sh + + +# create private key (ecdsa:521) +openssl ecparam -genkey -name secp256k1 -noout -out ./keys/key; + +# generate public key +openssl ec -in ./keys/key -pubout -out ./keys/key.pub; diff --git a/ssl/keys/key b/ssl/keys/key new file mode 100644 index 0000000..2578811 --- /dev/null +++ b/ssl/keys/key @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHQCAQEEIG41CO5zSQGJhe+Ft/r8VEZud7baXI7FiQgoSy7cM+1NoAcGBSuBBAAK +oUQDQgAE6ACA5jxI8MXDuFGsXBaslk7vOR4Jq3m2qaYGkFM7o8bEhpil2CgCFOPW +ACOFlMiQEkVU7T/KphK78dyosClHIA== +-----END EC PRIVATE KEY----- diff --git a/ssl/keys/key.pub b/ssl/keys/key.pub new file mode 100644 index 0000000..0edecf4 --- /dev/null +++ b/ssl/keys/key.pub @@ -0,0 +1,4 @@ +-----BEGIN PUBLIC KEY----- +MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAE6ACA5jxI8MXDuFGsXBaslk7vOR4Jq3m2 +qaYGkFM7o8bEhpil2CgCFOPWACOFlMiQEkVU7T/KphK78dyosClHIA== +-----END PUBLIC KEY----- diff --git a/ssl/sign b/ssl/sign new file mode 100755 index 0000000..6982012 --- /dev/null +++ b/ssl/sign @@ -0,0 +1,7 @@ +#!/bin/sh + +if [ $# -lt 2 ]; then + echo "missing arguments {in_file} {out_signature}" && exit; +fi; + +openssl dgst -sha512 -sign ./keys/key -out $2 $1;