bugfix in encryption key computing, added new feature: derived public keys

This commit is contained in:
TLINDEN
2013-11-02 11:02:36 +01:00
parent c93f9c6cdd
commit bf5556e1ec
29 changed files with 514 additions and 242 deletions

View File

@@ -77,10 +77,13 @@ dxmorg@florida.cops.gov
#
# encryption tests
idbobby = 0x68832D215AFB2440
idalicia = 0xE2942C2B6C96F6CC
idbobby = 0xCE20289DFB268A3D
idalicia = 0x44713DD4E010C582
mailbobby = bobby@local
mailalicia = alicia@local
md5msg = 66b8c4ca9e5d2a7e3c0559c3cdea3d50
<test check-crypto-alicia-init>
# alicias part
prepare = echo ${md5msg} > testmessage
<test check-crypto-alicia-import-secret>
cmd = $pcp -V va -S -I key-alicia-sec -x a
@@ -104,6 +107,7 @@ md5msg = 66b8c4ca9e5d2a7e3c0559c3cdea3d50
</test>
<test check-crypto-bobby-init>
# bobbys part
<test check-crypto-bobby-import-secret>
cmd = $pcp -V vb -S -I key-bobby-sec -x b
expect = /${idbobby}/
@@ -125,6 +129,52 @@ md5msg = 66b8c4ca9e5d2a7e3c0559c3cdea3d50
</test>
</test>
#
# same, now with derived keys, keypairs:
# alicia bobby
# secret: derived for bobby secret:primary
# bobby's public: primary alicia's public: derived for him
#
# derived by name
<test check-dcrypto-init>
<test check-dcrypto-alicia-export-derived-byname>
cmd = $pcp -V va -p -R Bobby -x a -O testpub-forbobby-name
expect-file = testpub-forbobby-name
</test>
<test check-dcrypto-bobby-import-byname>
cmd = $pcp -V vb -P -I testpub-forbobby-name
expect = /added/
</test>
<test check-dcrypto-bobby-encrypt-byname>
id = grep Key-ID testpub-forbobby-name | sed 's/^ //g' | cut -d' ' -f2
cmd = $pcp -V vb -e -i %{id} -I testmessage -O testencrypted-name -x b
expect = /success/
</test>
<test check-dcrypto-alicia-decrypt-byname>
cmd = $pcp -V va -d -I testencrypted-name -x a
expect = /success/
</test>
# repeat, but now use derived keys in both directions
<test check-dcrypto-bobby-export-derived-byname>
cmd = $pcp -V vb -p -R Alicia -x b -O testpub-foralicia-name
expect-file = testpub-foralicia-name
</test>
<test check-dcrypto-alicia-import-byname>
cmd = $pcp -V va -P -I testpub-foralicia-name
expect = /added/
</test>
<test check-dcrypto-bobby-encrypt-byname-both>
id = grep Key-ID testpub-forbobby-name | sed 's/^ //g' | cut -d' ' -f2
cmd = $pcp -V vb -e -i %{id} -I testmessage -O testencrypted-name -x b -R Alicia
expect = /success/
</test>
<test check-dcrypto-alicia-decrypt-byname-both>
cmd = $pcp -V va -d -I testencrypted-name -x a
expect = /success/
</test>
</test>
#
# negative tests, check for error handling
@@ -206,7 +256,7 @@ md5msg = 66b8c4ca9e5d2a7e3c0559c3cdea3d50
</test>
<test check-if-catch-missing-newlines>
prepare = jot 5000 | while read ignore; do echo -n X; done > testfile-toolong
prepare = ./jot 5000 | while read ignore; do echo -n X; done > testfile-toolong
cmd = $pcp -V $vault -P -I testfile-toolong
expect = /line is too long/
</test>
@@ -216,7 +266,7 @@ md5msg = 66b8c4ca9e5d2a7e3c0559c3cdea3d50
* catch invalid z85, it only checks the input length and not the actual
* encoding. Re-enable, once that bug is fixed.
<test check-if-catch-invalid-z85>
prepare = jot 30 | while read ignore; do \
prepare = ./jot 30 | while read ignore; do \
echo XXXXXXXXXXXXXXXXXX; done > testfile-noz85
cmd = $pcp -V $vault -P -I testfile-noz85
expect = /could not decode input/
@@ -224,7 +274,7 @@ md5msg = 66b8c4ca9e5d2a7e3c0559c3cdea3d50
*/
<test check-if-catch-nokey-behind-z85>
prepare = jot 30 | while read ignore; do echo XXXXX; done \
prepare = ./jot 30 | while read ignore; do echo XXXXX; done \
| $pcp -z > testfile-nokey
cmd = $pcp -V $vault -P -I testfile-nokey
expect = /result to a proper sized key/
@@ -306,12 +356,7 @@ md5msg = 66b8c4ca9e5d2a7e3c0559c3cdea3d50
cmd = $pcp -V testvault-invalidversion -l
expect = /Unexpected vault file format/
</test>
/*
<test check-vault-invalid-itemsize>
cmd = $pcp -V testvault-invaliditemsize -l
expect = /invalid key item header size/
</test>
*/
<test check-vault-invalid-itemtype>
cmd = $pcp -V testvault-invaliditemtype -l
expect = /invalid key type/
@@ -321,3 +366,16 @@ md5msg = 66b8c4ca9e5d2a7e3c0559c3cdea3d50
cmd = $pcp -V testvault-invalidkeytype -l
expect = /contain any keys so far./
</test>
<test check-encryptionkeys-dont-collide>
cmd = ./pwhashes
expect = /ok/
</test>
#
# input handling tests
<test check-large-meta>
cmd = (./jot 300 | while read m; do echo -n m; done; echo xxx) \
| $pcp -V $vault -k -x $passwd
expect = /Generated new secret key/
</test>