Funktionierender Prototyp des Serious Games zur Vermittlung von Wissen zu Software-Engineering-Arbeitsmodellen.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

server.pem 4.4KB

1 year ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. # coding: utf-8
  2. from inspect import getsource
  3. from datetime import datetime
  4. from OpenSSL.crypto import FILETYPE_PEM, TYPE_RSA, X509, PKey, dump_privatekey, dump_certificate
  5. key = PKey()
  6. key.generate_key(TYPE_RSA, 2048)
  7. cert = X509()
  8. issuer = cert.get_issuer()
  9. subject = cert.get_subject()
  10. for dn in [issuer, subject]:
  11. dn.C = b"TR"
  12. dn.ST = "Çorum".encode("utf-8")
  13. dn.L = "Başmakçı".encode("utf-8")
  14. dn.CN = b"localhost"
  15. dn.O = b"Twisted Matrix Labs"
  16. dn.OU = b"Automated Testing Authority"
  17. dn.emailAddress = b"security@twistedmatrix.com"
  18. cert.set_serial_number(datetime.now().toordinal())
  19. cert.gmtime_adj_notBefore(0)
  20. cert.gmtime_adj_notAfter(60 * 60 * 24 * 365 * 100)
  21. cert.set_pubkey(key)
  22. cert.sign(key, "sha256")
  23. import __main__
  24. source = getsource(__main__)
  25. source = source.split("\n" + "-" * 5)[0].rsplit("\n", 1)[0]
  26. with open("server.pem", "w") as fObj:
  27. fObj.write(source)
  28. fObj.write("\n")
  29. fObj.write("'''\n")
  30. fObj.write(dump_privatekey(FILETYPE_PEM, key).decode("ascii"))
  31. fObj.write(dump_certificate(FILETYPE_PEM, cert).decode("ascii"))
  32. fObj.write("'''\n")
  33. with open(b"key.pem.no_trailing_newline", "w") as fObj:
  34. fObj.write(dump_privatekey(FILETYPE_PEM, key).decode("ascii").rstrip('\n'))
  35. with open(b"cert.pem.no_trailing_newline", "w") as fObj:
  36. fObj.write(dump_certificate(FILETYPE_PEM, cert).decode("ascii").rstrip('\n'))
  37. '''
  38. -----BEGIN PRIVATE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Hyfb7BSKwwIyYRgxSjGU/
  55. wqcmv0V/mSY7N4eCDaXqEjdovaZ76d3L60FPH5rJbn7yHZBYWaSqXgk0HDYUmQwg
  56. huPLNu8bUwKBgQCH/rGohbAwY9/mhRlaXva1u7C59czAUlW3zZFAf8pyhpDcp2p6
  57. xIxSn5+0I5bFcFpJgWJrTgihc5qioReUZTn20dMIOWQv8U6RtXELoHeLMPNgaDrx
  58. jgcL+r32BhifaJfk5UNoYcRG5rAHDQk16Gj3nQLOUC1iKIPafHWO7GJG7QKBgQCj
  59. yVfOhY6xP17K6S14zRjAyISCQorlAFyyjxai3rgIv7Zt8hFucAJJ5Vs0DAU7w2Ak
  60. cgZ7N93ydtOdO6l24uYqky3FUwfK+PPX0lhPoDse8elxF6S5BIeliervLBUJtUUj
  61. VxIX9QoI+do9zmRNPXkIdQhrOuMe96Qjaj5aXKrjDQKBgBS2LGghCFgqaxtHeIpl
  62. RLOnpxLaiitGH412O6VKHkkXaNYEOlbtFVlPuE1zHeyIvLQb666lW/w0+HMmfMTU
  63. SQI2gIndUb6pMzLjZUrCyYz618EoAmhx6+VnbRSY+iSEIdYqx6VBl0HY9RWJa18H
  64. 4LPzH6dfRnKf2jCer3DtWALD
  65. -----END PRIVATE KEY-----
  66. -----BEGIN CERTIFICATE-----
  67. MIID6DCCAtACAwtEVjANBgkqhkiG9w0BAQsFADCBtzELMAkGA1UEBhMCVFIxDzAN
  68. BgNVBAgMBsOHb3J1bTEUMBIGA1UEBwwLQmHFn21ha8OnxLExEjAQBgNVBAMMCWxv
  69. Y2FsaG9zdDEcMBoGA1UECgwTVHdpc3RlZCBNYXRyaXggTGFiczEkMCIGA1UECwwb
  70. QXV0b21hdGVkIFRlc3RpbmcgQXV0aG9yaXR5MSkwJwYJKoZIhvcNAQkBFhpzZWN1
  71. cml0eUB0d2lzdGVkbWF0cml4LmNvbTAgFw0yMjA4MjMyMzUyNTJaGA8yMTIyMDcz
  72. MDIzNTI1MlowgbcxCzAJBgNVBAYTA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