I've created a simple Flask server that runs on HTTPS, accessible by external devices.
When I connect another device (e.g. an ESP8266) I need to provide the SHA-1 fingerprint.
I have no control over the SHA-1 fingerprint that is generated (and I have no idea how it is generated).
So far I've always had to copy and paste the SHA-1 fingerprint from my browser (firefox): I need to visit the server URL through my browser, click on the lock symbol next to the URL, click on "view certificate" and copy and paste the SHA-1 fingerprint.
The SHA-1 fingerprint changes every time I restart the server, so I have to copy and paste it every time (as just described), which is time-consuming.
I was wondering if there was a way to either:
- generating MY OWN SHA-1 fingerprint (so that it is always the same every time I launch the server)OR
- automatically getting the SHA-1 fingerprint (maybe through a Flask function?) and printing it on a text file.
I've done some research on the internet but found nothing so far :(
Thank you in advance!
Here's my code:
from flask import Flask, requestapp = Flask(__name__)@app.route("/", methods=["GET"])def hello(): return "Hello World!if __name__ == "__main__": app.run(host="0.0.0.0", port=8080, ssl_context='adhoc')