# gemato: OpenPGP key data for tests
# (c) 2017-2023 Michał Górny
# SPDX-License-Identifier: GPL-2.0-or-later

import base64


def break_sig(sig):
    """Return signature packet mangled to mismatch the signed key"""
    return sig[:-1] + b'\x55'


PUBLIC_KEY = base64.b64decode(b'''
mQENBFnwXJMBCACgaTVz+d10TGL9zR920sb0GBFsitAJ5ZFzO4E0cg3SHhwI+reMJQ6LLKmH
owY/E1dl5FBbnJoRMxXP7/eScQ7HlhYj1gMPN5XiS2pkPwVkmJKBDV42DLwoytC+ot0frRTJ
vSdEPCX81BNMgFiBSpkeZfXqb9XmU03bh6mFnrdd4CsHpTQGcsVXHK8QKhaxuqmHTALdpSzK
Cb/r0N/Z3sQExZhfLcBf/9UUVXj44Nwc6ooqZLRizHydxwQdxNu0aOFGEBn9WTi8Slf7MfR/
pF0dI8rs9w6zMzVEq0lhDPpKFGDveoGfg/+TpvBNXZ7DWH23GM4kID3pk4LLMc24U1PhABEB
AAE=
''')

SECRET_KEY = base64.b64decode(b'''
lQOYBFnwXJMBCACgaTVz+d10TGL9zR920sb0GBFsitAJ5ZFzO4E0cg3SHhwI+reMJQ6LLKmH
owY/E1dl5FBbnJoRMxXP7/eScQ7HlhYj1gMPN5XiS2pkPwVkmJKBDV42DLwoytC+ot0frRTJ
vSdEPCX81BNMgFiBSpkeZfXqb9XmU03bh6mFnrdd4CsHpTQGcsVXHK8QKhaxuqmHTALdpSzK
Cb/r0N/Z3sQExZhfLcBf/9UUVXj44Nwc6ooqZLRizHydxwQdxNu0aOFGEBn9WTi8Slf7MfR/
pF0dI8rs9w6zMzVEq0lhDPpKFGDveoGfg/+TpvBNXZ7DWH23GM4kID3pk4LLMc24U1PhABEB
AAEAB/sEgeBMIXW9ClZvvj9HlfWcLz7yF1ZwKMC1BbOENz43LLxp7i2RJQtrErayxnxq8k6u
4ML3SAe2OwK+ZIZG2aFqL0fw+tb8KvotsSPMrE6o/HaFZMxEZYg19zj1WlsvRCxE3OlJDA2f
NJBUQnj6LQ/vYDsQOtM+VRHnfMDhLcwGObZnNPMwtmwkHLKWTgyTwAGnLObSheVutVbdyU6+
wI3UXwAoilW2e+9pKtwaODjqT7pQ2maVSCY4MPGdLQpbPy61COstdpK/hRdI3liLuwszdlnT
1QhiLsOTHPt4JjYdv2jgDjQobbe/ziKNzFp1eoMHDkbjzAh7oD2FxJcZEYLnBADE5oryW+9G
lyYQe3x74QD5BGTZfvJctvEOgUg8BsoIfXJgBzwnEwOD0XBgJcl5qgt3IBH9Fn3JnYMpw12S
EG2W4N8VCIBxIkDEBABVJfp1Q7HAJ8GSmzENnvt1iaAZPUscaFVpMyuajsCDmyK92NMymGiN
Ab1H5MU4gaFGaEaajwQA0I7gglsehQA2MSyJD0Uj+0b6n9KtiUzjyWEOcITXn4buf4O8Llor
8gU0BWuv3hmIcvNsuJfmgXavVxq2UHtiGaO7T9Vk4Sr8MKS9EYrLNbK41Lyb+tjxk3jYjEyF
qCDNEtWKIZR4ENdRjo5gYKBtuqv1AYYSkflOTeaRlv/kIo8D/jVcyjmO19tNJM8lQE1xCvhp
5maXOoSk1UoUmDprsKA2Em47J83sVivrIwBySB2n9srQynnV+8I47mX7YzYtNQ6uXdL3p/5e
FRW+yfqVCShhSfyQdOmJ978UyQEwY0+0hhK372KatmaL9KEkKSuXgsqshv3XiB9yu3Su1jw5
y2IQNP0=
''')

PUBLIC_SUBKEY = base64.b64decode(b'''
uI0EX0UFkQEEALU4+b/dzg0XLBByu3//Oo/E9eA6evMIzV39ktdXLZr2WiSEaK1lXNpInsmE
8oJg/iF6p2X6bz37WmfgFJtq8z4oPvmD1HYk7e5C8/axM71/K8/QO8W7G4lZdbLBGxyJoySb
2Rpj2B/w44AMBDABYmlzyhM3vdF74V08fYYmUWMTABEBAAE=
''')

UID = base64.b64decode(b'''
tCRnZW1hdG8gdGVzdCBrZXkgPGdlbWF0b0BleGFtcGxlLmNvbT4=
''')

UID_NOEMAIL = base64.b64decode(b'''
tA9nZW1hdG8gdGVzdCBrZXk=
''')

UID_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AgQWAgMBAh4BAheAFiEEgeEsFr2NzWC+GAhFE2iA
5yp7E4QFAl9Hj+wACgkQE2iA5yp7E4Rwcwf+On5SUfpLVZXrDkE9ETSUsGJSvfQxUVbO+qql
Zm/MPSTWnadQbgcF2/3xRq0NoQJeK74d6yxqVRWIOPxLB+S9dplxgxZ3IdrxepomNKtX7e9o
osz/Xrbsz042rfFmthW9gFsrxdWZTi/Iny1mp11JL0RCQdG7qDSffgdRtqla40CXp72GLwX/
Yp/6PW+SlL5drIOi45vfRbRvGMiirQVolbb4FzUL5fYROrp6Rt/UCBTpK1xnoTbOtzyTLSq2
Wq7iapS3DqitGoDRtKyPXeSFDpWsgcAYzghFMI265fqeBebTeKtz7mtYUw4DrBlYXSBPpRte
T1oNst52zSr1Wzuc9w==
''')

SECOND_SECRET_KEY = base64.b64decode(b"""
lFgEY8wUwRYJKwYBBAHaRw8BAQdAQ9Y36mOHda8FHRNM/sXEpvzGKJiC733H2OgQtvVrYNsA
AQCS5w1GsElAdtNFCbpDq5LWp8hNq2jVSH3foz3+CYo1+hCV
""")

SECOND_PUBLIC_KEY = base64.b64decode(b"""
mDMEY8wUwRYJKwYBBAHaRw8BAQdAQ9Y36mOHda8FHRNM/sXEpvzGKJiC733H2OgQtvVrYNs=
""")

SECOND_UID = base64.b64decode(b"""
tDBTZWNvbmQgZ2VtYXRvIHRlc3QgaWRlbnRpdHkgPHNlY29uZEBleGFtcGxlLmNvbT4=
""")

SECOND_KEY_SIG = base64.b64decode(b"""
iJMEExYKADsWIQR1jj6cjPscaH2bJCVTcI9ps0i0zAUCY8wUwQIbAwULCQgHAgIiAgYVCgkI
CwIEFgIDAQIeBwIXgAAKCRBTcI9ps0i0zEWCAQDEpFQFHMubpdSIdtrFPztMM64Xg4Vkdk+k
30HoYvFwKwD/aNSymTkZS4R8Ld0mxEJhFml7EAPUf//LjQYEIbe83gQ=
""")

VALID_PUBLIC_KEY = PUBLIC_KEY + UID + PUBLIC_KEY_SIG
EXPIRED_PUBLIC_KEY = PUBLIC_KEY + UID + EXPIRED_KEY_SIG
REVOKED_PUBLIC_KEY = PUBLIC_KEY + REVOCATION_SIG + UID + PUBLIC_KEY_SIG
OLD_UNEXPIRE_PUBLIC_KEY = PUBLIC_KEY + UID + PUBLIC_KEY_SIG
UNEXPIRE_PUBLIC_KEY = PUBLIC_KEY + UID + UNEXPIRE_SIG

PRIVATE_KEY = SECRET_KEY + UID + PUBLIC_KEY_SIG
PRIVATE_KEY_ID = b'0x136880E72A7B1384'

KEY_FINGERPRINT = '81E12C16BD8DCD60BE180845136880E72A7B1384'

OTHER_VALID_PUBLIC_KEY = (OTHER_PUBLIC_KEY + OTHER_PUBLIC_KEY_UID +
                          OTHER_PUBLIC_KEY_SIG)
OTHER_KEY_FINGERPRINT = '4B8349B90C56EE7F054D52871822F5424EB6DA81'

VALID_KEY_NOEMAIL = PUBLIC_KEY + UID_NOEMAIL + PUBLIC_KEY_NOEMAIL_SIG
VALID_KEY_NONUTF = PUBLIC_KEY + UID_NONUTF + PUBLIC_KEY_NONUTF_SIG

VALID_KEY_SUBKEY = (PUBLIC_KEY + UID + PUBLIC_KEY_SIG + PUBLIC_SUBKEY +
                    PUBLIC_SUBKEY_SIG)
SUBKEY_FINGERPRINT = '7E9DDE3CBE47E437418DF74038B9D2F76CC833CC'

FORGED_PUBLIC_KEY = PUBLIC_KEY + UID + break_sig(PUBLIC_KEY_SIG)
FORGED_SUBKEY = (PUBLIC_KEY + UID + PUBLIC_KEY_SIG + PUBLIC_SUBKEY +
                 break_sig(PUBLIC_SUBKEY_SIG))
FORGED_UNEXPIRE_KEY = (PUBLIC_KEY + UID + EXPIRED_KEY_SIG +
                       break_sig(UNEXPIRE_SIG))

UNSIGNED_PUBLIC_KEY = PUBLIC_KEY + UID
UNSIGNED_SUBKEY = PUBLIC_KEY + UID + PUBLIC_KEY_SIG + PUBLIC_SUBKEY

COMBINED_PUBLIC_KEYS = OTHER_VALID_PUBLIC_KEY + VALID_PUBLIC_KEY

SECOND_VALID_PUBLIC_KEY = SECOND_PUBLIC_KEY + SECOND_UID + SECOND_KEY_SIG
SECOND_KEY_FINGERPRINT = "758E3E9C8CFB1C687D9B242553708F69B348B4CC"

TWO_SIGNATURE_PUBLIC_KEYS = VALID_PUBLIC_KEY + SECOND_VALID_PUBLIC_KEY
TWO_KEYS_ONE_EXPIRED = EXPIRED_PUBLIC_KEY + SECOND_VALID_PUBLIC_KEY


if __name__ == "__main__":
    import argparse
    import sys

    argp = argparse.ArgumentParser()
    argp.add_argument("variable",
                      nargs="+",
                      choices=sorted(x for x in globals() if x[0].isupper()),
                      help="Variables to print")
    args = argp.parse_args()

    sys.stdout.buffer.write(b"".join(globals()[x] for x in args.variable))
