summaryrefslogtreecommitdiffstats
path: root/src/tests/data/test_key_validity
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/data/test_key_validity')
-rw-r--r--src/tests/data/test_key_validity/CMakeLists.txt25
-rw-r--r--src/tests/data/test_key_validity/alice-cert.pgpbin0 -> 146 bytes
-rw-r--r--src/tests/data/test_key_validity/alice-expired-claus-cert.asc12
-rw-r--r--src/tests/data/test_key_validity/alice-pub.asc9
-rw-r--r--src/tests/data/test_key_validity/alice-rev.pgp8
-rw-r--r--src/tests/data/test_key_validity/alice-revoker-sig.asc8
-rw-r--r--src/tests/data/test_key_validity/alice-revoker-sig.pgpbin0 -> 146 bytes
-rw-r--r--src/tests/data/test_key_validity/alice-revoker.pgpbin0 -> 868 bytes
-rw-r--r--src/tests/data/test_key_validity/alice-sec.asc11
-rw-r--r--src/tests/data/test_key_validity/alice-sign-sub-exp-pub.asc14
-rw-r--r--src/tests/data/test_key_validity/alice-sign-sub-exp-sec.asc17
-rw-r--r--src/tests/data/test_key_validity/alice-sign-sub-pub.pgpbin0 -> 540 bytes
-rw-r--r--src/tests/data/test_key_validity/alice-sign-sub-sec.pgpbin0 -> 706 bytes
-rw-r--r--src/tests/data/test_key_validity/alice-sigs-malf.pgpbin0 -> 268 bytes
-rw-r--r--src/tests/data/test_key_validity/alice-sigs.asc16
-rw-r--r--src/tests/data/test_key_validity/alice-sigs.pgpbin0 -> 268 bytes
-rw-r--r--src/tests/data/test_key_validity/alice-sub-pub.pgpbin0 -> 429 bytes
-rw-r--r--src/tests/data/test_key_validity/alice-sub-sec.pgpbin0 -> 595 bytes
-rw-r--r--src/tests/data/test_key_validity/basil-pub.asc10
-rw-r--r--src/tests/data/test_key_validity/basil-sec.asc11
-rw-r--r--src/tests/data/test_key_validity/case1/pubring.gpgbin0 -> 337 bytes
-rw-r--r--src/tests/data/test_key_validity/case10/pubring.gpgbin0 -> 554 bytes
-rw-r--r--src/tests/data/test_key_validity/case11/pubring.gpgbin0 -> 701 bytes
-rw-r--r--src/tests/data/test_key_validity/case12/pubring.gpgbin0 -> 701 bytes
-rw-r--r--src/tests/data/test_key_validity/case13/pubring.gpgbin0 -> 701 bytes
-rw-r--r--src/tests/data/test_key_validity/case14/pubring.gpgbin0 -> 695 bytes
-rw-r--r--src/tests/data/test_key_validity/case15/pubring.gpgbin0 -> 525 bytes
-rw-r--r--src/tests/data/test_key_validity/case2/pubring.gpgbin0 -> 705 bytes
-rw-r--r--src/tests/data/test_key_validity/case3/pubring.gpgbin0 -> 559 bytes
-rw-r--r--src/tests/data/test_key_validity/case4/pubring.gpgbin0 -> 429 bytes
-rw-r--r--src/tests/data/test_key_validity/case5/CMakeLists.txt38
-rw-r--r--src/tests/data/test_key_validity/case5/generate.cpp160
-rw-r--r--src/tests/data/test_key_validity/case5/pubring.gpgbin0 -> 678 bytes
-rw-r--r--src/tests/data/test_key_validity/case6/pubring.gpgbin0 -> 551 bytes
-rw-r--r--src/tests/data/test_key_validity/case7/pubring.gpgbin0 -> 569 bytes
-rw-r--r--src/tests/data/test_key_validity/case8/message.txt3
-rw-r--r--src/tests/data/test_key_validity/case8/message.txt.asc17
-rw-r--r--src/tests/data/test_key_validity/case8/primary.pgpbin0 -> 53 bytes
-rw-r--r--src/tests/data/test_key_validity/case8/pubring.gpgbin0 -> 375 bytes
-rw-r--r--src/tests/data/test_key_validity/case8/subkey-no-sig.pgpbin0 -> 81 bytes
-rw-r--r--src/tests/data/test_key_validity/case8/subkey.pgpbin0 -> 322 bytes
-rw-r--r--src/tests/data/test_key_validity/case9/pubring.gpgbin0 -> 581 bytes
-rw-r--r--src/tests/data/test_key_validity/cases.txt77
-rw-r--r--src/tests/data/test_key_validity/claus-pub.asc10
-rw-r--r--src/tests/data/test_key_validity/claus-sec.asc11
-rw-r--r--src/tests/data/test_key_validity/encrypting-primary.pgp41
-rw-r--r--src/tests/data/test_key_validity/rsa_key_small_sig-pub.asc26
-rw-r--r--src/tests/data/test_key_validity/rsa_key_small_sig-sec.asc48
48 files changed, 572 insertions, 0 deletions
diff --git a/src/tests/data/test_key_validity/CMakeLists.txt b/src/tests/data/test_key_validity/CMakeLists.txt
new file mode 100644
index 0000000..553173c
--- /dev/null
+++ b/src/tests/data/test_key_validity/CMakeLists.txt
@@ -0,0 +1,25 @@
+# Copyright (c) 2020 Ribose Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+add_subdirectory(case5)
diff --git a/src/tests/data/test_key_validity/alice-cert.pgp b/src/tests/data/test_key_validity/alice-cert.pgp
new file mode 100644
index 0000000..998f246
--- /dev/null
+++ b/src/tests/data/test_key_validity/alice-cert.pgp
Binary files differ
diff --git a/src/tests/data/test_key_validity/alice-expired-claus-cert.asc b/src/tests/data/test_key_validity/alice-expired-claus-cert.asc
new file mode 100644
index 0000000..0240748
--- /dev/null
+++ b/src/tests/data/test_key_validity/alice-expired-claus-cert.asc
@@ -0,0 +1,12 @@
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+
+mDMEXgS/LxYJKwYBBAHaRw8BAQdAJ/BnDcmcOCED/rW3y1zPHSX6lABI7G19R6mP
+hgfIgj+0EUFsaWNlIDxhbGljZUBybnA+iJAEExYIADgWIQRz7cyRGa/I4tu9zeUE
+UUCWaf/ePAUCXgS/LwIbAwULCQgHAgYVCgkICwIEFgIDAQIeAQIXgAAKCRAEUUCW
+af/ePCSdAP9OWq8uOk5B5LUtPvFnxqGkrZlAHt+tgR271QSggRV3MAEAvtL/ru5o
+ss9jx26EqYj2GUgHGtsYqsz8j1y97S5lMQqIewQQEwgAIxYhBK3nrEqPSa2yNPp9
+APei/UoD3soZBQJf1LOoBYMAAVGAAAoJEPei/UoD3soZiyEA/0fH6Yhr+/dlHY7G
+B74bdzDz2ILpzzy3oJWyO1vnVXQ/APwIaIzQQFJegqUJvWIwXJnkvZnbPujEgCT5
+rHi9CFqIgA==
+=Wl6/
+-----END PGP PUBLIC KEY BLOCK-----
diff --git a/src/tests/data/test_key_validity/alice-pub.asc b/src/tests/data/test_key_validity/alice-pub.asc
new file mode 100644
index 0000000..9f37298
--- /dev/null
+++ b/src/tests/data/test_key_validity/alice-pub.asc
@@ -0,0 +1,9 @@
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+
+mDMEXgS/LxYJKwYBBAHaRw8BAQdAJ/BnDcmcOCED/rW3y1zPHSX6lABI7G19R6mP
+hgfIgj+0EUFsaWNlIDxhbGljZUBybnA+iJAEExYIADgWIQRz7cyRGa/I4tu9zeUE
+UUCWaf/ePAUCXgS/LwIbAwULCQgHAgYVCgkICwIEFgIDAQIeAQIXgAAKCRAEUUCW
+af/ePCSdAP9OWq8uOk5B5LUtPvFnxqGkrZlAHt+tgR271QSggRV3MAEAvtL/ru5o
+ss9jx26EqYj2GUgHGtsYqsz8j1y97S5lMQo=
+=H16D
+-----END PGP PUBLIC KEY BLOCK-----
diff --git a/src/tests/data/test_key_validity/alice-rev.pgp b/src/tests/data/test_key_validity/alice-rev.pgp
new file mode 100644
index 0000000..283bc61
--- /dev/null
+++ b/src/tests/data/test_key_validity/alice-rev.pgp
@@ -0,0 +1,8 @@
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Comment: This is a revocation certificate
+
+iHgEIBYIACAWIQRz7cyRGa/I4tu9zeUEUUCWaf/ePAUCXhh87wIdAQAKCRAEUUCW
+af/ePGfNAP95upN+yGiVOmXKRakzQyaj1Anv/PWTEA+95vZgWhgHVwD/UMhzdqs0
+TvlnxEVh21Ni1tjTIucTbMNX4sGIehebrgw=
+=//kr
+-----END PGP PUBLIC KEY BLOCK-----
diff --git a/src/tests/data/test_key_validity/alice-revoker-sig.asc b/src/tests/data/test_key_validity/alice-revoker-sig.asc
new file mode 100644
index 0000000..27cb9b6
--- /dev/null
+++ b/src/tests/data/test_key_validity/alice-revoker-sig.asc
@@ -0,0 +1,8 @@
+-----BEGIN PGP SIGNATURE-----
+Version: rnp 0.9.0+git20200116.640.e602d4f
+
+iJAEHxYIADgWIQRz7cyRGa/I4tu9zeUEUUCWaf/ePAUCXhiX/hcMgBPRQ4EZc7heJrE0t6ALKwn3
+1+puDgIHAAAKCRAEUUCWaf/ePEXhAP96sFjJDa5KKzVANFOxWMMZfctszuYAfgTXiYAeb9u39AEA
+mkTmfIbXZyihRvL+8QI+/+RbzfPbLSvCxHzYPFQDhAw=
+=kROR
+-----END PGP SIGNATURE-----
diff --git a/src/tests/data/test_key_validity/alice-revoker-sig.pgp b/src/tests/data/test_key_validity/alice-revoker-sig.pgp
new file mode 100644
index 0000000..f97423b
--- /dev/null
+++ b/src/tests/data/test_key_validity/alice-revoker-sig.pgp
Binary files differ
diff --git a/src/tests/data/test_key_validity/alice-revoker.pgp b/src/tests/data/test_key_validity/alice-revoker.pgp
new file mode 100644
index 0000000..cae63eb
--- /dev/null
+++ b/src/tests/data/test_key_validity/alice-revoker.pgp
Binary files differ
diff --git a/src/tests/data/test_key_validity/alice-sec.asc b/src/tests/data/test_key_validity/alice-sec.asc
new file mode 100644
index 0000000..fcf6e7d
--- /dev/null
+++ b/src/tests/data/test_key_validity/alice-sec.asc
@@ -0,0 +1,11 @@
+-----BEGIN PGP PRIVATE KEY BLOCK-----
+
+lIYEXgS/LxYJKwYBBAHaRw8BAQdAJ/BnDcmcOCED/rW3y1zPHSX6lABI7G19R6mP
+hgfIgj/+BwMChdoHsOumkbDkVpYuDIt3rxOge9ceSDfswEZVXfw/91Vqzbkis8DT
+iVIsodBlVvaZCvnEyn/aGwRrteXjoUwrZwtVqcjAAGMp3YKPnt5/cbQRQWxpY2Ug
+PGFsaWNlQHJucD6IkAQTFggAOBYhBHPtzJEZr8ji273N5QRRQJZp/948BQJeBL8v
+AhsDBQsJCAcCBhUKCQgLAgQWAgMBAh4BAheAAAoJEARRQJZp/948JJ0A/05ary46
+TkHktS0+8WfGoaStmUAe362BHbvVBKCBFXcwAQC+0v+u7miyz2PHboSpiPYZSAca
+2xiqzPyPXL3tLmUxCg==
+=iU19
+-----END PGP PRIVATE KEY BLOCK-----
diff --git a/src/tests/data/test_key_validity/alice-sign-sub-exp-pub.asc b/src/tests/data/test_key_validity/alice-sign-sub-exp-pub.asc
new file mode 100644
index 0000000..9397850
--- /dev/null
+++ b/src/tests/data/test_key_validity/alice-sign-sub-exp-pub.asc
@@ -0,0 +1,14 @@
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+
+xjMEXgS/LxYJKwYBBAHaRw8BAQdAJ/BnDcmcOCED/rW3y1zPHSX6lABI7G19R6mPhgfIgj/NEUFs
+aWNlIDxhbGljZUBybnA+wpYEExYIAD4WIQRz7cyRGa/I4tu9zeUEUUCWaf/ePAUCXv3VBAIbAwUL
+CQgHAgYVCgkICwIEFgIDAQIeAQIXgAUJAPkV1wAKCRAEUUCWaf/ePP4FAQCNXznY8KJThLGqXU34
+2JyGobV2qEb/XN0yf50sLQ02KgEAzpkPMaVArBKi3y3jBvNGnGhuBtW4eqbDoZ5XRi3p0QTOTwRe
+mYNBEwUrgQQACgIDBFPE8ItgY9glqERWNtvK+Nn1nizHiqOcbhFuW6zK4FfsQcnbodf/CfRjKbe3
+XnGpi58+s7xjZdrpYp9JdzZaTmHCwB4EGBYIACYWIQRz7cyRGa/I4tu9zeUEUUCWaf/ePAUCXv3V
+BQIbAgUJAGRRxwBqCRAEUUCWaf/ePF8gBBkTCAAGBQJe/dUGAAoJECLzohfA5DnL088A/2o3wWzo
+oEzmQXLOdH/WeqeC2s7GxYwYM8mPpWZwZHd/AQDMXPj4HX0p8Qvwk+1Gj7utGLjDb1t8816mO8an
+B2MTIb2CAQCTLUSN21aCiEdcCstPza6EGff8QfmmTUDkztcv9MXODwEAloWl4Es42VubkI9G+yOC
+mHD+4wEM7QAx5MtV/5d1lwU=
+=AXHJ
+-----END PGP PUBLIC KEY BLOCK-----
diff --git a/src/tests/data/test_key_validity/alice-sign-sub-exp-sec.asc b/src/tests/data/test_key_validity/alice-sign-sub-exp-sec.asc
new file mode 100644
index 0000000..9cb88f8
--- /dev/null
+++ b/src/tests/data/test_key_validity/alice-sign-sub-exp-sec.asc
@@ -0,0 +1,17 @@
+-----BEGIN PGP PRIVATE KEY BLOCK-----
+
+xYYEXgS/LxYJKwYBBAHaRw8BAQdAJ/BnDcmcOCED/rW3y1zPHSX6lABI7G19R6mPhgfIgj/+BwMC
+Tty9b5Ilu0Ljpjxw8rMT7GLc1MvcD+MxmlIjudT5ZQKX6jSH0VhxvX3cvgsazWZ2Rhu4S1QkNaHa
+3PUstbe2HT4n6Igr/pXWkKH4moHJzs0RQWxpY2UgPGFsaWNlQHJucD7ClgQTFggAPhYhBHPtzJEZ
+r8ji273N5QRRQJZp/948BQJe/dUEAhsDBQsJCAcCBhUKCQgLAgQWAgMBAh4BAheABQkA+RXXAAoJ
+EARRQJZp/948/gUBAI1fOdjwolOEsapdTfjYnIahtXaoRv9c3TJ/nSwtDTYqAQDOmQ8xpUCsEqLf
+LeMG80acaG4G1bh6psOhnldGLenRBMeiBF6Zg0ETBSuBBAAKAgMEU8Twi2Bj2CWoRFY228r42fWe
+LMeKo5xuEW5brMrgV+xByduh1/8J9GMpt7decamLnz6zvGNl2ulin0l3NlpOYf4HAwKlLd08tunp
+b+M8yaWryRt1ixLVhitlej6Ytg/H7gjqpHUSOECgKqJQRrRiDzjqFShgenbGVKvSghp0ZokveXao
+rYpSu9GNEUdYnARGszpEwsAeBBgWCAAmFiEEc+3MkRmvyOLbvc3lBFFAlmn/3jwFAl791QUCGwIF
+CQBkUccAagkQBFFAlmn/3jxfIAQZEwgABgUCXv3VBgAKCRAi86IXwOQ5y9PPAP9qN8Fs6KBM5kFy
+znR/1nqngtrOxsWMGDPJj6VmcGR3fwEAzFz4+B19KfEL8JPtRo+7rRi4w29bfPNepjvGpwdjEyG9
+ggEAky1EjdtWgohHXArLT82uhBn3/EH5pk1A5M7XL/TFzg8BAJaFpeBLONlbm5CPRvsjgphw/uMB
+DO0AMeTLVf+XdZcF
+=O2AD
+-----END PGP PRIVATE KEY BLOCK-----
diff --git a/src/tests/data/test_key_validity/alice-sign-sub-pub.pgp b/src/tests/data/test_key_validity/alice-sign-sub-pub.pgp
new file mode 100644
index 0000000..e6c7827
--- /dev/null
+++ b/src/tests/data/test_key_validity/alice-sign-sub-pub.pgp
Binary files differ
diff --git a/src/tests/data/test_key_validity/alice-sign-sub-sec.pgp b/src/tests/data/test_key_validity/alice-sign-sub-sec.pgp
new file mode 100644
index 0000000..a0adab1
--- /dev/null
+++ b/src/tests/data/test_key_validity/alice-sign-sub-sec.pgp
Binary files differ
diff --git a/src/tests/data/test_key_validity/alice-sigs-malf.pgp b/src/tests/data/test_key_validity/alice-sigs-malf.pgp
new file mode 100644
index 0000000..d6e0339
--- /dev/null
+++ b/src/tests/data/test_key_validity/alice-sigs-malf.pgp
Binary files differ
diff --git a/src/tests/data/test_key_validity/alice-sigs.asc b/src/tests/data/test_key_validity/alice-sigs.asc
new file mode 100644
index 0000000..334519b
--- /dev/null
+++ b/src/tests/data/test_key_validity/alice-sigs.asc
@@ -0,0 +1,16 @@
+-----BEGIN PGP SIGNATURE-----
+Version: rnp 0.9.0+git20200116.640.e602d4f
+
+iHgEIBYIACAWIQRz7cyRGa/I4tu9zeUEUUCWaf/ePAUCXhh87wIdAQAKCRAEUUCWaf/ePGfNAP95
+upN+yGiVOmXKRakzQyaj1Anv/PWTEA+95vZgWhgHVwD/UMhzdqs0TvlnxEVh21Ni1tjTIucTbMNX
+4sGIehebrgw=
+=//kr
+-----END PGP SIGNATURE-----
+-----BEGIN PGP SIGNATURE-----
+Version: rnp 0.9.0+git20200116.640.e602d4f
+
+iJAEHxYIADgWIQRz7cyRGa/I4tu9zeUEUUCWaf/ePAUCXhiX/hcMgBPRQ4EZc7heJrE0t6ALKwn3
+1+puDgIHAAAKCRAEUUCWaf/ePEXhAP96sFjJDa5KKzVANFOxWMMZfctszuYAfgTXiYAeb9u39AEA
+mkTmfIbXZyihRvL+8QI+/+RbzfPbLSvCxHzYPFQDhAw=
+=kROR
+-----END PGP SIGNATURE-----
diff --git a/src/tests/data/test_key_validity/alice-sigs.pgp b/src/tests/data/test_key_validity/alice-sigs.pgp
new file mode 100644
index 0000000..ddda00b
--- /dev/null
+++ b/src/tests/data/test_key_validity/alice-sigs.pgp
Binary files differ
diff --git a/src/tests/data/test_key_validity/alice-sub-pub.pgp b/src/tests/data/test_key_validity/alice-sub-pub.pgp
new file mode 100644
index 0000000..e62dd28
--- /dev/null
+++ b/src/tests/data/test_key_validity/alice-sub-pub.pgp
Binary files differ
diff --git a/src/tests/data/test_key_validity/alice-sub-sec.pgp b/src/tests/data/test_key_validity/alice-sub-sec.pgp
new file mode 100644
index 0000000..109ea74
--- /dev/null
+++ b/src/tests/data/test_key_validity/alice-sub-sec.pgp
Binary files differ
diff --git a/src/tests/data/test_key_validity/basil-pub.asc b/src/tests/data/test_key_validity/basil-pub.asc
new file mode 100644
index 0000000..e552056
--- /dev/null
+++ b/src/tests/data/test_key_validity/basil-pub.asc
@@ -0,0 +1,10 @@
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+
+mFIEXgTAUBMIKoZIzj0DAQcCAwQGEAe84kNby6xYoyQGYRhcCmaDqhIMie+Ne1yQ
+Pw9rIlX30geA4COxsX63fEfe96tiO5rz4CB6/JDk2EiWckeetBFCYXNpbCA8YmFz
+aWxAcm5wPoiQBBMTCAA4FiEE0UOBGXO4XiaxNLegCysJ99fqbg4FAl4EwFACGwMF
+CwkIBwIGFQoJCAsCBBYCAwECHgECF4AACgkQCysJ99fqbg6DhwD+NTrtmafXQrL5
+jUib/zflc63nONVb5sGzZkYxETEQJx0A/1dP48zqju0qcfEO4FYDqIYRZPOvWoq1
+l5BhDsxz6OOB
+=BfO6
+-----END PGP PUBLIC KEY BLOCK-----
diff --git a/src/tests/data/test_key_validity/basil-sec.asc b/src/tests/data/test_key_validity/basil-sec.asc
new file mode 100644
index 0000000..5051701
--- /dev/null
+++ b/src/tests/data/test_key_validity/basil-sec.asc
@@ -0,0 +1,11 @@
+-----BEGIN PGP PRIVATE KEY BLOCK-----
+
+lKUEXgTAUBMIKoZIzj0DAQcCAwQGEAe84kNby6xYoyQGYRhcCmaDqhIMie+Ne1yQ
+Pw9rIlX30geA4COxsX63fEfe96tiO5rz4CB6/JDk2EiWckee/gcDAqtPKpVvPTRt
+5POnlu3HMr4AXfkf4Pc+KgGq2yZJqJBLySOEZsxWBRXkDgaceJn3m5hu95bGTTsu
+1mBOR8V0e9iRpNdNuZoulJdkvSxpSBa0EUJhc2lsIDxiYXNpbEBybnA+iJAEExMI
+ADgWIQTRQ4EZc7heJrE0t6ALKwn31+puDgUCXgTAUAIbAwULCQgHAgYVCgkICwIE
+FgIDAQIeAQIXgAAKCRALKwn31+puDoOHAP41Ou2Zp9dCsvmNSJv/N+Vzrec41Vvm
+wbNmRjERMRAnHQD/V0/jzOqO7Spx8Q7gVgOohhFk869airWXkGEOzHPo44E=
+=Ymbv
+-----END PGP PRIVATE KEY BLOCK-----
diff --git a/src/tests/data/test_key_validity/case1/pubring.gpg b/src/tests/data/test_key_validity/case1/pubring.gpg
new file mode 100644
index 0000000..f03864d
--- /dev/null
+++ b/src/tests/data/test_key_validity/case1/pubring.gpg
Binary files differ
diff --git a/src/tests/data/test_key_validity/case10/pubring.gpg b/src/tests/data/test_key_validity/case10/pubring.gpg
new file mode 100644
index 0000000..aa04e1e
--- /dev/null
+++ b/src/tests/data/test_key_validity/case10/pubring.gpg
Binary files differ
diff --git a/src/tests/data/test_key_validity/case11/pubring.gpg b/src/tests/data/test_key_validity/case11/pubring.gpg
new file mode 100644
index 0000000..ed9e689
--- /dev/null
+++ b/src/tests/data/test_key_validity/case11/pubring.gpg
Binary files differ
diff --git a/src/tests/data/test_key_validity/case12/pubring.gpg b/src/tests/data/test_key_validity/case12/pubring.gpg
new file mode 100644
index 0000000..d8fae2b
--- /dev/null
+++ b/src/tests/data/test_key_validity/case12/pubring.gpg
Binary files differ
diff --git a/src/tests/data/test_key_validity/case13/pubring.gpg b/src/tests/data/test_key_validity/case13/pubring.gpg
new file mode 100644
index 0000000..b63390c
--- /dev/null
+++ b/src/tests/data/test_key_validity/case13/pubring.gpg
Binary files differ
diff --git a/src/tests/data/test_key_validity/case14/pubring.gpg b/src/tests/data/test_key_validity/case14/pubring.gpg
new file mode 100644
index 0000000..e91d70c
--- /dev/null
+++ b/src/tests/data/test_key_validity/case14/pubring.gpg
Binary files differ
diff --git a/src/tests/data/test_key_validity/case15/pubring.gpg b/src/tests/data/test_key_validity/case15/pubring.gpg
new file mode 100644
index 0000000..960bb8d
--- /dev/null
+++ b/src/tests/data/test_key_validity/case15/pubring.gpg
Binary files differ
diff --git a/src/tests/data/test_key_validity/case2/pubring.gpg b/src/tests/data/test_key_validity/case2/pubring.gpg
new file mode 100644
index 0000000..9d28bfe
--- /dev/null
+++ b/src/tests/data/test_key_validity/case2/pubring.gpg
Binary files differ
diff --git a/src/tests/data/test_key_validity/case3/pubring.gpg b/src/tests/data/test_key_validity/case3/pubring.gpg
new file mode 100644
index 0000000..0505f1d
--- /dev/null
+++ b/src/tests/data/test_key_validity/case3/pubring.gpg
Binary files differ
diff --git a/src/tests/data/test_key_validity/case4/pubring.gpg b/src/tests/data/test_key_validity/case4/pubring.gpg
new file mode 100644
index 0000000..5cef0b3
--- /dev/null
+++ b/src/tests/data/test_key_validity/case4/pubring.gpg
Binary files differ
diff --git a/src/tests/data/test_key_validity/case5/CMakeLists.txt b/src/tests/data/test_key_validity/case5/CMakeLists.txt
new file mode 100644
index 0000000..ea91155
--- /dev/null
+++ b/src/tests/data/test_key_validity/case5/CMakeLists.txt
@@ -0,0 +1,38 @@
+# Copyright (c) 202 Ribose Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+add_executable(tkv_case5_generate generate.cpp)
+
+set_target_properties(tkv_case5_generate PROPERTIES OUTPUT_NAME "generate")
+
+target_include_directories(tkv_case5_generate
+ PRIVATE
+ "${PROJECT_SOURCE_DIR}/src"
+ "${PROJECT_SOURCE_DIR}/src/lib"
+)
+
+target_link_libraries(tkv_case5_generate
+ PRIVATE
+ librnp
+)
diff --git a/src/tests/data/test_key_validity/case5/generate.cpp b/src/tests/data/test_key_validity/case5/generate.cpp
new file mode 100644
index 0000000..23735f4
--- /dev/null
+++ b/src/tests/data/test_key_validity/case5/generate.cpp
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 2020 [Ribose Inc](https://www.ribose.com).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <iostream>
+#include <cstdint>
+#include "librepgp/stream-key.h"
+#include "librepgp/stream-packet.h"
+#include "fingerprint.h"
+#include "pgp-key.h"
+#include "crypto/signatures.h"
+
+static bool
+load_transferable_key(pgp_transferable_key_t *key, const char *fname)
+{
+ pgp_source_t src = {};
+ bool res = !init_file_src(&src, fname) && !process_pgp_key(src, key, false);
+ src_close(&src);
+ return res;
+}
+
+bool calculate_primary_binding(const pgp_key_pkt_t &key,
+ const pgp_key_pkt_t &subkey,
+ pgp_hash_alg_t halg,
+ pgp_signature_t & sig,
+ rnp::Hash & hash,
+ rnp::RNG & rng);
+
+int
+main(int argc, char **argv)
+{
+ if (argc < 3) {
+ std::cout << "Generate test file with subkey, signed by the other key.\n Usage: "
+ "./generate ../alice-sub-sec.asc ../basil-sec.asc\n";
+ return 1;
+ }
+
+ pgp_transferable_key_t tpkey = {};
+ pgp_transferable_key_t tskey = {};
+
+ if (!load_transferable_key(&tpkey, argv[1])) {
+ std::cout << "Failed to load first key.\n";
+ return 1;
+ }
+
+ if (!load_transferable_key(&tskey, argv[2])) {
+ std::cout << "Failed to load second key.\n";
+ return 1;
+ }
+
+ pgp_transferable_subkey_t *subkey =
+ (pgp_transferable_subkey_t *) list_front(tpkey.subkeys);
+ pgp_signature_t *binding = (pgp_signature_t *) list_front(subkey->signatures);
+
+ if (decrypt_secret_key(&tskey.key, "password")) {
+ RNP_LOG("Failed to decrypt secret key");
+ return 1;
+ }
+ if (decrypt_secret_key(&subkey->subkey, "password")) {
+ RNP_LOG("Failed to decrypt secret subkey");
+ return 1;
+ }
+
+ /* now let's rebuild binding using the other key */
+ uint8_t keyid[PGP_KEY_ID_SIZE];
+ pgp_fingerprint_t keyfp;
+
+ free(binding->hashed_data);
+ binding->hashed_data = NULL;
+ binding->hashed_len = 0;
+
+ pgp_keyid(keyid, sizeof(keyid), tskey.key);
+ pgp_fingerprint(&keyfp, tskey.key);
+
+ binding->halg = pgp_hash_adjust_alg_to_key(binding->halg, &tskey.key);
+ binding->palg = tskey.key.alg;
+ binding->set_keyfp(keyfp);
+
+ /* This requires transition to rnp::Hash once will be used */
+ rnp::Hash hash;
+ rnp::Hash hashcp;
+
+ binding->fill_hashed_data();
+ if (!signature_hash_binding(binding, &tpkey.key, &subkey->subkey, &hash) ||
+ !pgp_hash_copy(&hashcp, &hash)) {
+ RNP_LOG("failed to hash signature");
+ return 1;
+ }
+
+ rnp::RNG rng(rnp::RNG::Type::System);
+ if (signature_calculate(binding, &tskey.key.material, &hash, &rng)) {
+ RNP_LOG("failed to calculate signature");
+ return 1;
+ }
+
+ pgp_key_flags_t realkf = (pgp_key_flags_t) binding.key_flags();
+ if (!realkf) {
+ realkf = pgp_pk_alg_capabilities(subkey->subkey.alg);
+ }
+ if (realkf & PGP_KF_SIGN) {
+ pgp_signature_t embsig = {};
+ bool embres;
+
+ if (!calculate_primary_binding(
+ &tpkey.key, &subkey->subkey, binding->halg, &embsig, &hashcp, &rng)) {
+ RNP_LOG("failed to calculate primary key binding signature");
+ return 1;
+ }
+ embres = signature_set_embedded_sig(binding, &embsig);
+ free_signature(&embsig);
+ if (!embres) {
+ RNP_LOG("failed to add primary key binding signature");
+ return 1;
+ }
+ }
+
+ try {
+ binding->set_keyid(keyid);
+ } catch (const std::exception &e) {
+ RNP_LOG("failed to set issuer key id: %s", e.what());
+ return 1;
+ }
+
+ if (!transferable_key_to_public(&tpkey)) {
+ RNP_LOG("Failed to extract public key part.");
+ return 1;
+ }
+
+ pgp_dest_t dst = {};
+ init_stdout_dest(&dst);
+ write_transferable_key(tpkey, dst, true);
+ dst_close(&dst, false);
+
+ transferable_key_destroy(&tpkey);
+ transferable_key_destroy(&tskey);
+
+ return 0;
+} \ No newline at end of file
diff --git a/src/tests/data/test_key_validity/case5/pubring.gpg b/src/tests/data/test_key_validity/case5/pubring.gpg
new file mode 100644
index 0000000..fd35e11
--- /dev/null
+++ b/src/tests/data/test_key_validity/case5/pubring.gpg
Binary files differ
diff --git a/src/tests/data/test_key_validity/case6/pubring.gpg b/src/tests/data/test_key_validity/case6/pubring.gpg
new file mode 100644
index 0000000..a5d412b
--- /dev/null
+++ b/src/tests/data/test_key_validity/case6/pubring.gpg
Binary files differ
diff --git a/src/tests/data/test_key_validity/case7/pubring.gpg b/src/tests/data/test_key_validity/case7/pubring.gpg
new file mode 100644
index 0000000..f6b346d
--- /dev/null
+++ b/src/tests/data/test_key_validity/case7/pubring.gpg
Binary files differ
diff --git a/src/tests/data/test_key_validity/case8/message.txt b/src/tests/data/test_key_validity/case8/message.txt
new file mode 100644
index 0000000..0382ea8
--- /dev/null
+++ b/src/tests/data/test_key_validity/case8/message.txt
@@ -0,0 +1,3 @@
+Hello, world!
+
+
diff --git a/src/tests/data/test_key_validity/case8/message.txt.asc b/src/tests/data/test_key_validity/case8/message.txt.asc
new file mode 100644
index 0000000..fc304e8
--- /dev/null
+++ b/src/tests/data/test_key_validity/case8/message.txt.asc
@@ -0,0 +1,17 @@
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA256
+
+Hello, world!
+
+
+
+-----BEGIN PGP SIGNATURE-----
+Version: rnp 0.9.0+git20200420.739.148391d
+
+wnsEARYIACMWIQRz7cyRGa/I4tu9zeUEUUCWaf/ePAUCXqBD+QUDAAAAAAAKCRAEUUCWaf/ePAA4
+AQCab1d6mRcCdEmsIuipCsNHdpEI5Pxcz4DtnOx6GQLL3AD+JlsN4VDfzZiOXY5cDCGmkBgcxMYA
+ERpgLB46Y2iCKgbCewQBEwgAIxYhBM/lsBS+5D2dJPPvOCLzohfA5DnLBQJeoEP5BQMAAAAAAAoJ
+ECLzohfA5DnLSzAA/A/oRyERJXtKiFiZ6hq4esWMcM7eShnhW2cFaT1Og/NAAQDcU5vOxpu3LNdH
+wgpXa7eh2M1O04RHfFrsgO1Pvw8UJg==
+=BeZD
+-----END PGP SIGNATURE-----
diff --git a/src/tests/data/test_key_validity/case8/primary.pgp b/src/tests/data/test_key_validity/case8/primary.pgp
new file mode 100644
index 0000000..5570060
--- /dev/null
+++ b/src/tests/data/test_key_validity/case8/primary.pgp
Binary files differ
diff --git a/src/tests/data/test_key_validity/case8/pubring.gpg b/src/tests/data/test_key_validity/case8/pubring.gpg
new file mode 100644
index 0000000..cde37a4
--- /dev/null
+++ b/src/tests/data/test_key_validity/case8/pubring.gpg
Binary files differ
diff --git a/src/tests/data/test_key_validity/case8/subkey-no-sig.pgp b/src/tests/data/test_key_validity/case8/subkey-no-sig.pgp
new file mode 100644
index 0000000..ac79d77
--- /dev/null
+++ b/src/tests/data/test_key_validity/case8/subkey-no-sig.pgp
Binary files differ
diff --git a/src/tests/data/test_key_validity/case8/subkey.pgp b/src/tests/data/test_key_validity/case8/subkey.pgp
new file mode 100644
index 0000000..64a06f4
--- /dev/null
+++ b/src/tests/data/test_key_validity/case8/subkey.pgp
Binary files differ
diff --git a/src/tests/data/test_key_validity/case9/pubring.gpg b/src/tests/data/test_key_validity/case9/pubring.gpg
new file mode 100644
index 0000000..9b6e63d
--- /dev/null
+++ b/src/tests/data/test_key_validity/case9/pubring.gpg
Binary files differ
diff --git a/src/tests/data/test_key_validity/cases.txt b/src/tests/data/test_key_validity/cases.txt
new file mode 100644
index 0000000..fae0a9f
--- /dev/null
+++ b/src/tests/data/test_key_validity/cases.txt
@@ -0,0 +1,77 @@
+This folder contains keys with misc edge cases related to key signature validation.
+Main keys are Alice, Basil and Claus.
+
+Case1:
+Keys: Alice [pub]
+Alice is signed by Basil, but without the Basil's key.
+Result: Alice [valid]
+
+Case2:
+Keys: Alice [pub], Basil [pub]
+Alice is signed by Basil, Basil is signed by Alice, but Alice's self-signature is corrupted.
+Result: Alice [invalid], Basil [valid]
+
+Case3:
+Keys: Alice [pub], Basil [pub]
+Alice is signed by Basil, but doesn't have self-signature
+Result: Alice [invalid]
+
+Case4:
+Keys Alice [pub, sub]
+Alice subkey has invalid binding signature
+Result: Alice [valid], Alice sub [invalid]
+
+Case5:
+Keys Alice [pub, sub], Basil [pub]
+Alice subkey has valid binding signature, but from the key Basil
+Result: Alice [valid], Alice sub [invalid]
+
+Case6:
+Keys Alice [pub, sub]
+Key Alice has revocation signature by Alice, and subkey doesn't
+Result: Alice [invalid], Alice sub [invalid]
+
+Case7:
+Keys Alice [pub, sub]
+Alice subkey has revocation signature by Alice
+Result: Alice [valid], Alice sub [invalid]
+
+Case8:
+Keys Alice [pub, sub]
+Userid is stripped from the key, but it still has valid subkey binding
+Result: Alice [valid], Alice sub[valid]
+
+Case9:
+Keys Alice [pub, sub]
+Alice key has two self-signatures, one which expires key and second without key expiration.
+Result: Alice [valid], Alice sub[valid]
+
+Case10:
+Keys Alice [pub, sub]
+Alice key has expiring direct-key signature and non-expiring self-certification.
+Result: Alice [invalid], Alice sub[invalid]
+
+Case11:
+Keys Alice [pub, sub]
+Alice key has expiring direct-key signature, non-expiring self-certification and expiring
+primary userid certification. Result: Alice [invalid], Alice sub[invalid]
+
+Case12:
+Keys Alice [pub, sub]
+Alice key has non-expiring direct-key signature, non-expiring self-certification and expiring
+primary userid certification. Result: Alice [invalid], Alice sub[invalid]
+
+Case13:
+Keys Alice [pub, sub]
+Alice key has expiring direct-key signature, non-expiring self-certification and non-expiring
+primary userid certification. Result: Alice [invalid], Alice sub[invalid]
+
+Case14:
+Keys Alice [pub, sub]
+Alice key has expiring direct-key signature, non-expiring self-certification and non-expiring
+primary userid certification (with 0 key expiration subpacket). Result: Alice [invalid], Alice sub[invalid]
+
+Case15:
+Keys [pub, sub]
+Signing subkey has expired primary-key signature embedded into the subkey binding.
+Result: primary [valid], sub[invalid]
diff --git a/src/tests/data/test_key_validity/claus-pub.asc b/src/tests/data/test_key_validity/claus-pub.asc
new file mode 100644
index 0000000..2e147c6
--- /dev/null
+++ b/src/tests/data/test_key_validity/claus-pub.asc
@@ -0,0 +1,10 @@
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+
+mE8EXgTAxhMFK4EEAAoCAwR3wkOvTiag9w8Goe03997l0yBrJ2vc6qghSlP7iMtA
+SnhhRXSv6jUpnWBjw6O+eA/0oqD9NQfwr3xb/ayP5mFNtBFDbGF1cyA8Y2xhdXNA
+cm5wPoiQBBMTCAA4FiEEreesSo9JrbI0+n0A96L9SgPeyhkFAl4EwMYCGwMFCwkI
+BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ96L9SgPeyhnudAEA/pagJBknFEPbI5Xt
+2tRfcoyzaArPC2YPXwXxLjDlDEoA/217MbgglQMbN2sazFyhoEMhilg80TLIbRc1
+jrxz06Fv
+=CPnm
+-----END PGP PUBLIC KEY BLOCK-----
diff --git a/src/tests/data/test_key_validity/claus-sec.asc b/src/tests/data/test_key_validity/claus-sec.asc
new file mode 100644
index 0000000..c4677e6
--- /dev/null
+++ b/src/tests/data/test_key_validity/claus-sec.asc
@@ -0,0 +1,11 @@
+-----BEGIN PGP PRIVATE KEY BLOCK-----
+
+lKIEXgTAxhMFK4EEAAoCAwR3wkOvTiag9w8Goe03997l0yBrJ2vc6qghSlP7iMtA
+SnhhRXSv6jUpnWBjw6O+eA/0oqD9NQfwr3xb/ayP5mFN/gcDAkcNOGGfhODC5JpB
+I5WoxzQBnS1FdI+fgPgE38q6dkbbDun3Vl8APQFGna5FxgguvxA8r+zeVllkGOuo
+V5Y4nckIpJjEJxIA0Yen6M7fdiG0EUNsYXVzIDxjbGF1c0BybnA+iJAEExMIADgW
+IQSt56xKj0mtsjT6fQD3ov1KA97KGQUCXgTAxgIbAwULCQgHAgYVCgkICwIEFgID
+AQIeAQIXgAAKCRD3ov1KA97KGe50AQD+lqAkGScUQ9sjle3a1F9yjLNoCs8LZg9f
+BfEuMOUMSgD/bXsxuCCVAxs3axrMXKGgQyGKWDzRMshtFzWOvHPToW8=
+=oZiR
+-----END PGP PRIVATE KEY BLOCK-----
diff --git a/src/tests/data/test_key_validity/encrypting-primary.pgp b/src/tests/data/test_key_validity/encrypting-primary.pgp
new file mode 100644
index 0000000..d69d6b1
--- /dev/null
+++ b/src/tests/data/test_key_validity/encrypting-primary.pgp
@@ -0,0 +1,41 @@
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+
+mQGNBGDUsqQBDADSxTW6yR9XcSuXwWtuXo3JbzVL6gSaoiQOY568IlR3T0lJINp7
+7AG3VSunLma2Qmi0DcWwKFCvYrIJ6raAeXJCNxDzlKfzZn5kBfPwZbfu/VtbMZed
+CGGvwZwQ67YUlFXaPo05gYym7Te2dki+IaYVLs7zy7o6cDdDeFM3/w8Nr/Efl73Q
++MTCakWB5XJZaYuOPVMZy3g+fby2sF5K5KoeSDpcaze5t/JuIbLPrnEL1pkRbAJW
+Z9yNE2X3KY6BfKlYFGeJY0pg8SFq/1FtbV1QUnHZ9dGAa8gSurTaYOIUkt+fF6vC
+7j8kZrnrTsDaBo8GGPIkWW1gXg4VHQ/DLStsRQCOfrtwyEEGy9hM8yNCl7ILzfx8
+qvvuUxl9/myWm5wNZ0dEa9t6Z8VdPdYt0N3egjq6noKaXylOTdP0a+iAiGG3mdZX
+jvadZ2CCSnmQBgiQjyyLWM3PAEaLCuFZghXhvfzw7RybzIqkP6l+ljD34nqw41VD
+33eRAy6BFFKEx20AEQEAAbQrZW5jcnlwdGluZyBwcmltYXJ5IDxlbmNyeXB0aW5n
+X3ByaW1hcnlAcm5wPokBzgQTAQgAOBYhBECAnSfYP5m+QuNKZ5IJG3t2xQAXBQJg
+1LKkAhsvBQsJCAcCBhUKCQgLAgQWAgMBAh4BAheAAAoJEJIJG3t2xQAXVfcMAINs
+iAjy7qVIGOcu2d+sluX0SHts6bnR+a5QFYXatoh7XYHI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C
+YNSzkwIbDAAKCRCSCRt7dsUAF0T3DADI8qfuOX9gU4+cc02JebjiDKOaPcmwPfp1
+wRjz1leIISGr/tyMvwBITtYPkJsz4EXJmwJDqDps8Yn5HY0A33dwiW5CuASbgBen
+jEzBqfAXE1E5PmHllsCRcto39wIQw9Q//5hpdxb63tuz39LGjMsT9eGQKOgLC0Gw
+n+EmwdAWVsN6eGEMplt+yZ9/eEpCZl9lHmX5hWFF0AxizFWkTQGCWMoDWlFyGjlZ
+IoX2IBm7TbHB0fJ5QTJobupvsHxLtY9olX8lFJgbbmZWuEIPlf2wPK1jCp1sg8L/
+eSvQRwDlDzle/3PTcCnG9m6ry0XwAoOtuL/QK+s4p7JJdB/ATJmDep4g9AIwF8HI
+Pj8AA+qk/jn7MaMQ0ylDJPVte/qby55j2o6e1ZADUh65eHsYmbo824m6IdkjNmI2
+5HRc6pc3PpVY6poOteujJQW4FDIrWNUq9IcZGYY3syrNYk6D497YAUlz1xDHlFsm
+1B1z1Lv6KkBX3Z2n/iDgZGPLxhs9YFA=
+=TiK1
+-----END PGP PUBLIC KEY BLOCK-----
diff --git a/src/tests/data/test_key_validity/rsa_key_small_sig-pub.asc b/src/tests/data/test_key_validity/rsa_key_small_sig-pub.asc
new file mode 100644
index 0000000..357cd5f
--- /dev/null
+++ b/src/tests/data/test_key_validity/rsa_key_small_sig-pub.asc
@@ -0,0 +1,26 @@
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+
+xsBNBGDN004BCAC36d974nRKfeDqUjRL2DcTyKpc/MJGoGsBsAKPUayra23a0PZliH4jvfDLXU0w
+fsUmf9jEMi47j9/mIR3+A+wcanR6/VFahaA2OikakLfjQCJsIW649QJxyBWlDgl4ZZwVwomgRk58
+dmbODA7XTdjUP5YOs+Jweqe4fjUyggkjbJ7YtEOOw8DgUallMvb/XwjimCiM72mYrW2yS2uLdeet
+nrpI81nLZ7I8KXamN+KOUqRQBDYJ4TfPW0yUm39onAPvInb8ufg0soakVNkdu+zw7VOr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oFKOg/GAD5mJoT3H
+10E2Q75begS63YVKtahN2BeEm6AhqrOT8mOJvO1GJVMAY69uni8K64Pmb1DNERMdTK4S48jc3Qi3
+CzeaKC/DfqnoqQalfYsJEIJUk/SXekZM01yQjpNTgQpXFbHQoilXhILU1mWzQsHobfTTdysGBAp8
+RsyBysCJTrDc9SyCj2oPXKrgQODfEY4HCuM/T4a4lANjn2HQ7F/jAcGuL6F4is6qCWYcRUaj1Mpa
+WoOBvSDo
+=SEyg
+-----END PGP PUBLIC KEY BLOCK-----
diff --git a/src/tests/data/test_key_validity/rsa_key_small_sig-sec.asc b/src/tests/data/test_key_validity/rsa_key_small_sig-sec.asc
new file mode 100644
index 0000000..01c6761
--- /dev/null
+++ b/src/tests/data/test_key_validity/rsa_key_small_sig-sec.asc
@@ -0,0 +1,48 @@
+-----BEGIN PGP PRIVATE KEY BLOCK-----
+
+xcLYBGDN004BCAC36d974nRKfeDqUjRL2DcTyKpc/MJGoGsBsAKPUayra23a0PZliH4jvfDLXU0w
+fsUmf9jEMi47j9/mIR3+A+wcanR6/VFahaA2OikakLfjQCJsIW649QJxyBWlDgl4ZZwVwomgRk58
+dmbODA7XTdjUP5YOs+Jweqe4fjUyggkjbJ7YtEOOw8DgUallMvb/XwjimCiM72mYrW2yS2uLdeet
+nrpI81nLZ7I8KXamN+KOUqRQBDYJ4TfPW0yUm39onAPvInb8ufg0soakVNkdu+zw7VOrkcmf5lLz
+1Cy7CWlkQXHeiJXCRBJgCDDO2OdXX9CQBTWEPJUJijALHAz6WSVdABEBAAEAB/sE7MtiSucoU4Sh
+YcAqw8h9zCLbyJz/PS6AZhE7e0lvcboIYQ4oG+ac2GpJV99ITCzFYikQ3/Mi/zBUvlBKTBqXjDZA
+UOZL0UZADYCqSHPULxR85sxLQaxmFaCWwfB4++eZIZOD6j4R0S3hmKsREvGahXVkQWbv8ijppN+R
+0a+i9ir/nN3DRtyE/5UNpY8BOtyd3Bi1+gKxxubAztRoe+Y5ewiXh6XtjaIe4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