1
0
mirror of https://gitea.tendokyu.moe/Dniel97/segatools.git synced 2024-11-23 21:10:57 +01:00

Add reference PKI

This commit is contained in:
Tau 2019-11-06 21:02:49 -05:00
parent 7f05295b2e
commit 0cb804d5ca
8 changed files with 197 additions and 0 deletions

88
initpki Executable file
View File

@ -0,0 +1,88 @@
#!/bin/sh
# This shell script documents the process that was used to generate our fake
# P-Ras PKI. It should not need to be run again under normal circumstances.
set -e
D=`dirname $0`
DAYS=36524
pushd "$D"
mkdir -p pki
# Generate CA
openssl genpkey \
-algorithm RSA \
-out pki/ca.key \
-pkeyopt rsa_keygen_bits:2048 \
openssl req \
-new \
-key pki/ca.key \
-extensions v3_ca \
-batch \
-out /tmp/ca.csr \
-utf8 \
-subj "/CN=DummyCA/O=DummyPKI" \
openssl req \
-x509 \
-sha256 \
-key pki/ca.key \
-in /tmp/ca.csr \
-out pki/ca.pem \
-days $DAYS \
# Convert PEM cert to DER form for emulated keychip.
# DER must fit in 1024 bytes so it must be small.
openssl x509 \
-in pki/ca.pem \
-out pki/ca.crt \
-outform der \
# Generate server key
openssl genpkey \
-algorithm RSA \
-out pki/server.key \
-pkeyopt rsa_keygen_bits:2048 \
openssl req \
-new \
-key pki/server.key \
-extensions v3_ca \
-batch \
-out /tmp/server.csr \
-utf8 \
-subj "/CN=ib.naominet.jp" \
openssl x509 \
-req \
-sha256 \
-days $DAYS \
-in /tmp/server.csr \
-CAkey pki/ca.key \
-CA pki/ca.pem \
-set_serial 0 \
-out pki/server.pem \
# Generate billing key pair
openssl genpkey \
-algorithm RSA \
-out pki/billing.key \
-pkeyopt rsa_keygen_bits:1024 \
openssl rsa \
-pubout \
-outform der \
-in pki/billing.key \
-out pki/billing.pub \
# Clean up
rm -f /tmp/ca.csr
rm -f /tmp/server.csr

16
pki/billing.key Normal file
View File

@ -0,0 +1,16 @@
-----BEGIN PRIVATE KEY-----
MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAML2GPUuzv2N4bYC
xtc5bZSzolHFWdCUbP+whjr3K98FOLnYeoi7mtUSUUYOW8wIqy6WM3c4c0Bp7FcQ
LnZ0zWMm1TfLGHZzZmk5n7Iv6HDPr3ehDgbWLnOpRrVqZDxpAGD2vQb4p2DW4I2x
GUqnqDa++C8dH/0lXqE6cqwGXNGtAgMBAAECgYEAizgPhG4Dk55QkpeTBDfXH3vT
Ko9B3qdO2ptkjxDX/C8PXe7POXq2SvcEoIE6Xg3Gp8LMR5NBAbth8J32f9JSov3P
SiGCGno4k2i2s3jRuVg76FGLDsZH/N1dt4h78VnW0VlInwaM6bQv3zp0u8rXVk/P
wpYh9AGmquBJS3VYUcECQQD0PDRe28SrhollygGZSO321rYbYhoTIstDXZWyQ/y/
PWKNwNHcYTHIVGmTrJx2AJUyr1tJhwjiOwlsI5Y1Q4/9AkEAzFpFPcs1r/xgSFxB
eYrcNseWYbVajtVxG9t57sayaEQbH2UMNA2vqSYK/nU6oJhj5eLRIsPHlA5ZbIiZ
rvc/cQJAKS0RQ0DX+ncXKQMSm+4wuGHgl+NFNB60mCnp+AEAVpmZyP5OI1J7myOo
HQ6H3lkgzkfEIzRR6ho773BcfaRjXQJAfS4nEE11G9ML4AezjBLGB0CIHF6NlMWn
PhtaPCy3iSt/OeIacaCYpJNLVMjXGx1+xIoG9rbbgRSxLs0W55lJ4QJBALOUVcNw
GKEJdxhIkA8iuUlEyGpKluAgHUNOOKvC3ogRoB0OyH+If/9o8wWDfxgexgM0zGBc
u178W9XDW+IijDA=
-----END PRIVATE KEY-----

BIN
pki/billing.pub Normal file

Binary file not shown.

BIN
pki/ca.crt Normal file

Binary file not shown.

28
pki/ca.key Normal file
View File

@ -0,0 +1,28 @@
-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDeHEJ2L+FXrcdW
G8LNZ/WknTzE9lsB4I1Gb7LcrXi/Yq+rEnF8iru2h4j1icmDSuwLBS//qENO2LfE
+iU1zmtlhjAfG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VjlK53dwjKYg67BUI8qLNbUW1NPhyotc/9GklP
qiNTkUeKcHOlZqOzP0zPquFk2lSfJuuGrMgElZPcEFLsAWRqnjRGp5iP05nk5OQh
foY7svzPedFk/t3eFcOyrPo=
-----END PRIVATE KEY-----

17
pki/server.pem Normal file
View File

@ -0,0 +1,17 @@
-----BEGIN CERTIFICATE-----
MIICtDCCAZwCAQAwDQYJKoZIhvcNAQELBQAwJTEQMA4GA1UEAwwHRHVtbXlDQTER
MA8GA1UECgwIRHVtbXlQS0kwIBcNMTgxMDE1MTkzMDUxWhgPMjExODEwMTUxOTMw
NTFaMBkxFzAVBgNVBAMMDmliLm5hb21pbmV0LmpwMIIBIjANBgkqhkiG9w0BAQEF
AAOCAQ8AMIIBCgKCAQEA4Ncb4/CS7eJw6q0UDhswsrNGw9lXRkZ0P02At3s4NMIW
G0EQ+21HZDUJtSnjTpY/Mq/JI899LMCGOulH8PNqhh9EI7Jm0jky69dwfStaIHdd
WjMRK71Z8bTQTpLsLcyi/mW9Q/fY78V9LntHSLAXLqI3psqM+ojW1O1kjbWyBXkB
a/jJWboxyL9B4++jGMmQKjathdzrtUnblZMPgHKJfCs034iCN/Im2XD/iDYCumL5
6ya8Ww2fjV8LFznoNMv72e4XNodZOcE9xMVqMjA/2751ayk53kH8DiPbOLN6QeqN
YRnlBkYT76SdtPhRjhPCyEcwRIsQypfNkxutw1aDCQIDAQABMA0GCSqGSIb3DQEB
CwUAA4IBAQANOqFqjnGf80vvwYEkUsfOWp8rNVat+8rdXl0BShGBXiDItzMOU79K
YkPObniQ5RLBMhrvqlCsSk0Np+ZgvV12J4Wtmf/znLa5ZKyeI4N1FCefU9cl4xpB
08Fv8YWbYV7SMNr54ZkURdho4FVR1pAnpuittpAEjMT4R4ubbOH8UEbMTbVgxXdn
086IAlfsYn0gnOlf76RkJFLe4UlWaZB75SaaXnNavBPN9iFnqXLckg6tsFUJnNMC
esq5aHQ9sXWs4oKpJi8SXxt/zNRmgTnQK2ONM38NeZpLmlWPkyNxzsRNlYWo+kWP
C98jVFe1+3K88ISk0DSN4XOQQnrIvn68
-----END CERTIFICATE-----