This repository has been archived by the owner on Jan 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Feature/gh 4 encryption
- Loading branch information
Showing
13 changed files
with
295 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,5 @@ | |
Crypt-* | ||
.tidyall.d | ||
Changes | ||
*.der | ||
author/tokens |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
|
||
# This generates the softhsm2 tokens. It requires softhsm2-util, pkcs11-tool from OpenSC and openssl commands | ||
# WARNING: It is destructive! | ||
set -e | ||
|
||
export SOFTHSM2_CONF="author/softhsm2.conf" | ||
|
||
TOKEN_DIR="tokens"; | ||
PKCS11TOOL_CMD="pkcs11-tool --module /usr/lib64/pkcs11/libsofthsm2.so --login --pin 1234 -v" | ||
|
||
rm -rfv $TOKEN_DIR && mkdir $TOKEN_DIR | ||
|
||
softhsm2-util --init-token --pin 1234 --so-pin 123456 --slot 0 --label test_keys_1 | ||
|
||
# add an RSA 1024 private key just for signing and the public key for verifying | ||
openssl rsa -in t/keys/1024_sign.pem -outform DER -out t/keys/1024_sign.der | ||
$PKCS11TOOL_CMD --usage-sign --write-object t/keys/1024_sign.der -y privkey --label 'signing_key' --id 0001 | ||
|
||
openssl rsa -pubin -in t/keys/1024_sign_pub.pem -outform DER -out t/keys/1024_sign_pub.der | ||
$PKCS11TOOL_CMD --usage-sign --write-object t/keys/1024_sign_pub.der -y pubkey --label 'signing_key' --id 0001 | ||
|
||
|
||
|
||
# add a RSA 1024 private and public keys for encryption/decryption | ||
openssl rsa -in t/keys/1024_enc.pem -outform DER -out t/keys/1024_enc.der | ||
$PKCS11TOOL_CMD --usage-decrypt --write-object t/keys/1024_enc.der -y privkey --label 'encryption_key' --id 0002 | ||
|
||
openssl rsa -pubin -in t/keys/1024_enc_pub.pem -outform DER -out t/keys/1024_enc_pub.der | ||
$PKCS11TOOL_CMD --usage-decrypt --write-object t/keys/1024_enc_pub.der -y pubkey --label 'encryption_key' --id 0002 | ||
|
||
echo -e "\n ****** Listing objects ******\n" | ||
|
||
$PKCS11TOOL_CMD --list-slots | ||
$PKCS11TOOL_CMD --list-objects | ||
|
||
# $PKCS11TOOL_CMD -t | ||
|
||
cd author; tar -cvzf ../t/data/tokens.tar.gz tokens |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
directories.tokendir = author/tokens | ||
objectstore.backend = file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
P�AbxX�ޢ�}�Df�P�v���+r��l���$���d�«0"�80�\�'���v���O��a3� |
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
-----BEGIN RSA PRIVATE KEY----- | ||
MIICXQIBAAKBgQCsvMNNhewFhhGfD1Dtzf1Y399LDelqyi9BcUTeEeZd7Gtj/IpT | ||
4d1SVLCWHuI9z6uB18pbtnVnehllSEEcuIudjPE/tkTzlIt+r8d5nPuAbFNEd1bf | ||
GAgaez/4HbUC7qM5/zpZSr20vzXo8xUhvWF1LARKiWMPhJnwE1JHc1k20wIDAQAB | ||
AoGBAKE9hnT72KgDULmP+3QvfxiRyQZvUv4rAtdsmuNMBCSSRmBL4PeR8x0iDr/i | ||
zj7ydd67Bpp7g7X2pHQFcToVDcSWalklIdJglRZzxYBtLAouHkgHJknwEzew65EM | ||
gbkECxD2XnEPRSM6Ow2Swc04wMDQqIQH/aQVyEVb+Z6o+HaRAkEA4+oU6tw4tlwX | ||
8hllaCm5szm2AHTB6moZd89brS4BrZR9mDWObhzgMPirR1XatvRCCGddY02HJbEk | ||
rDKNLThVSwJBAMIGCPJSqn7gVc1Ch+kw+Q9yAQkyQ3M4jx4Q76Gj4JOgN7L2FNPw | ||
oGZkJJFMVxI4HUBW9Y7UNGxu0ExEOm69l5kCQQDU3BKdJwBwkKJsoftrxUyCbyvk | ||
USeq31zZ4PgmTgmTLFQAjERx4tYf5p9RCIY0yPvDDYbS792A/mjZyny/9xTxAkAX | ||
hvnQwJtyFSvyXu3yJgEdkVp0zgaF00bvg2g7do7F9/ipF9QAuz4IDH6uq84nJGzP | ||
n3vZXPwaZfmWNfPL9+uJAkB5ou9YpX4gqdu7HCq8llHRetDWUSkVurfAtVoRFrbw | ||
Aop4kutRFgCuxmreYVPeHbnvIZMk1vptIDzJY4fJbdAa | ||
-----END RSA PRIVATE KEY----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
-----BEGIN PUBLIC KEY----- | ||
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCsvMNNhewFhhGfD1Dtzf1Y399L | ||
Delqyi9BcUTeEeZd7Gtj/IpT4d1SVLCWHuI9z6uB18pbtnVnehllSEEcuIudjPE/ | ||
tkTzlIt+r8d5nPuAbFNEd1bfGAgaez/4HbUC7qM5/zpZSr20vzXo8xUhvWF1LARK | ||
iWMPhJnwE1JHc1k20wIDAQAB | ||
-----END PUBLIC KEY----- |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
-----BEGIN PUBLIC KEY----- | ||
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDO8asskS/X4TRPdQCH3b9aUT0Y | ||
SYMrIu2EKH92YA90OZQUzc2Hcu8WQ/KRK/9UMSTAtaVBKKfiO7MkSwh0wuG2LWWS | ||
mZH0EhWKONoCYuKWGMrUFsLFTyNQWRC1+R4Wbfk53uKEI3TxYzylKwLLNBB4R7Hz | ||
fu1YNf0MgNEpHP8KVwIDAQAB | ||
-----END PUBLIC KEY----- |
Oops, something went wrong.