Files
quality_recticel/tray/assets/signing/sign-message.py
Scheianu Ionut c7266c32ee Add custom QZ Tray fork with pairing key authentication
- Custom fork of QZ Tray 2.2.x with certificate validation bypassed
- Implemented pairing key (HMAC) authentication as replacement
- Modified files: PrintSocketClient.java (certificate check disabled)
- New files: PairingAuth.java, PairingConfigDialog.java
- Excluded build artifacts (out/, lib/javafx*) from repository
- Library JARs included for dependency management
2025-10-02 02:27:45 +03:00

40 lines
1.8 KiB
Python

#
# Python Django example for views.py
# Echoes the signed message and exits
#
#########################################################
# WARNING WARNING WARNING #
#########################################################
# #
# This file is intended for demonstration purposes #
# only. #
# #
# It is the SOLE responsibility of YOU, the programmer #
# to prevent against unauthorized access to any signing #
# functions. #
# #
# Organizations that do not protect against un- #
# authorized signing will be black-listed to prevent #
# software piracy. #
# #
# -QZ Industries, LLC #
# #
#########################################################
import base64
import os
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes, serialization
from cryptography.hazmat.primitives.asymmetric import padding
from django.http import HttpResponse, HttpResponseBadRequest
def get(self, request, message):
# Load signature
key = serialization.load_pem_private_key(open("private-key.pem","rb").read(), None, backend=default_backend())
# Create the signature
signature = key.sign(message.encode('utf-8'), padding.PKCS1v15(), hashes.SHA512()) # Use hashes.SHA1() for QZ Tray 2.0 and older
# Echo the signature
return HttpResponse(base64.b64encode(signature), content_type="text/plain")