Creating self-signed SSL certificates

Create a self-signed SSL certificate using openssl:

openssl req -x509 -newkey rsa:4096 -keyout key.pem -out certificate.pem -days 365 -nodes

OpenSSL will ask for Country Name, State or Province Name, Common Name and all that jazz before creating key and certificate.


Create a self-signed SSL certificate using python with the cryptography package:

#! /usr/bin/env python3

from cryptography import x509
 from cryptography.x509.oid import NameOID
 from cryptography.hazmat.primitives import serialization, hashes
 from cryptography.hazmat.primitives.asymmetric import rsa
 from cryptography.hazmat.backends import default_backend
 import datetime

name_attributes = []

country_name = input("COUNTRY_NAME: ")
 if(country_name != ""):
 name_attributes.append(x509.NameAttribute(NameOID.COUNTRY_NAME, country_name))

state_or_province_name = input("STATE_OR_PROVINCE_NAME: ")
 if(state_or_province_name != ""):
 name_attributes.append(x509.NameAttribute(NameOID.STATE_OR_PROVINCE_NAME, state_or_province_name))

locality_name = input("LOCALITY_NAME: ")
 if(locality_name != ""):
 name_attributes.append(x509.NameAttribute(NameOID.LOCALITY_NAME, locality_name))

organization_name = input("ORGANIZATION_NAME: ")
 if(organization_name != ""):
 name_attributes.append(x509.NameAttribute(NameOID.ORGANIZATION_NAME, organization_name))

common_name = input("COMMON_NAME: ")
 if(common_name != ""):
 name_attributes.append(x509.NameAttribute(NameOID.COMMON_NAME, common_name))

print("Enter SubjectAltName DNSName values, one at a time. Press Enter on an empty line to finish.")
 san_list = []
 san = "nonempty"
 while san != "":
 san = input("SAN DNSName: ")
 if san != "":
 san_list.append(x509.DNSName(san))

# Generate our key
 key = rsa.generate_private_key(
 public_exponent=65537,
 key_size=2048,
 backend=default_backend()
 )

# Write our key to disk for safe keeping
 with open("key.pem", "wb") as f:
 f.write(key.private_bytes(
 encoding=serialization.Encoding.PEM,
 format=serialization.PrivateFormat.TraditionalOpenSSL,
 encryption_algorithm=serialization.NoEncryption(),
 ))

# Various details about who we are. For a self-signed certificate the
 # subject and issuer are always the same.
 subject = issuer = x509.Name(name_attributes)

cert = x509.CertificateBuilder().subject_name(
 subject
 ).issuer_name(
 issuer
 ).public_key(
 key.public_key()
 ).serial_number(
 x509.random_serial_number()
 ).not_valid_before(
 datetime.datetime.utcnow()
 ).not_valid_after(
 # Our certificate will be valid for 365 days
 datetime.datetime.utcnow() + datetime.timedelta(days=365)
 )

# add SAN entries if any have been entered
 if san_list:
 cert = cert.add_extension(
 x509.SubjectAlternativeName(san_list),
 critical=False
 )

# Sign our certificate with our private key
 cert = cert.sign(key, hashes.SHA256(), default_backend())

# Write our certificate out to disk.
 with open("certificate.pem", "wb") as f:
 f.write(cert.public_bytes(serialization.Encoding.PEM))

The script will ask for Country Name, State or Province Name, Common Name and all that jazz before creating key and certificate. We even get to enter SubjectAlternativeName values! Great.

Fantastic End Of The World

Zwei Monate vor dem Abgabetermin der Masterarbeit ist ein perfekter Zeitpunkt, am Game Jam der Fachschaft Informatik teilzunehmen.

Über die letzten beiden Tage Nächte ist so ein packendes Spiel entstanden, dessen Hintergrundgeschichte sich vor den großen Blockbustern nicht zu verstecken braucht.

Das ganze natürlich auf Englisch, denn das am ersten Abend ausgeloste Game-Jam-Motto „Fantastic End Of The World“ ist schließlich auch auf Englisch. Außerdem kann so der internationale Markt besser erobert werden.

Ich möchte mich auf diesem Wege recht herzlich bei meinem Team bedanken, das die Entwicklung sehr tatkräftig und vor allem wortgewaltig unterstützt hat.

Welches Spiel, fragen Sie? Na dieses hier:

Hinweis 1: Funktioniert nur an Desktop-Rechnern, eine Steuerung für Mobilgeräte wurde nicht implementiert. Wir hatten ja nichts!

Hinweis 2: Das Spiel besteht aus 28 MB Sounddateien und ein bisschen Rest.

Den Quellcode gibt es latürnich auch, und zwar hier: https://github.com/HSZemi/jam

Umgesetzt habe ich das Spielchen mit pixi.js. Eine Bibliothek, die ich vor drei Tagen zum ersten Mal gesehen habe. Spricht für sie, finde ich.

Die Sounds könnten noch etwas besser aufeinander abgestimmt sein, aber man tut was man kann in den 48 Stunden.

A bigly presidential Twitter timeline

Take the well-known twitter account, all1 of its tweets, and a diagram in which we carefully place the tweets on the two axes according to day and time of publication. The result:

Pretty! Also, tweets and retweets are distinguished as well!

One might assume that Twitter did not introduce native retweets before 2013. Wrong! The have been available since 2009. Also, the data mainly contain „retweets“ of this style:

Obviously, something changed according to the twitter usage in 2013. From then on, he’s an avid retweeter, mainly at night time2. The businessman’s regular tweets are still mainly published during business hours. What is also remarkable: The candidacy was announced in Juni 2015. Starting in the middle of 2015 the nightly retweet-orgies seem to thin out as well.

Just watching „The Celebrity Apprentice 5“ and live-tweeting. Lol!

But behold! Our data offers so much more. We can also color the dots according to the client that has been used.

Oh boy, so many colors!

Let us have a look, shall we. In the beginning, only the web client / website is being used. He discovers TweetDeck in the middle of 2011, but replaces it with TwitLonger (Slogan: When you talk too much for Twitter) around christmas.

In 2013 he gets a new toy – an Android smartphone – which he uses to tweet and, as we learned before, retweet, at night. During business hours, the web client remains the client of choice, until it is replaced by an iPhone at the end of 2016. Or is that the apprentice who is tweeting? Some might think so.

There is one last pressing question: Does he sleep? Let’s compare that with an average person… well, I just have my own data:

I have just been tweeting since 2013, sorry! ❤

So if he sleeps, his sleep is less consistent than mine. I should probably have that printed on a T-shirt.

Of course the diagrams are not only raster images, but also available as a dynamic visualization so you can play with them yourselves.

Follow me, please.

The dataset has been taken from the truly great Trump Twitter Archive. They also archive other politicians‘ tweets.

  1. That is, all tweets that our dump contains.
  2. Note that the timestamps are in UTC 😉