Files
quality_recticel/tray/assets/signing/sign-message.pl
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

53 lines
1.8 KiB
Perl

#!/usr/bin/perl
#
# Echoes the signed message and exits
# usage: ./sign-message.pl "test"
#
#########################################################
# 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 #
# #
#########################################################
# RSA Crypto libs provided by:
# Debian: libcrypt-openssl-rsa-perl
# RedHat: perl-Crypt-OpenSSL-RSA
use Crypt::OpenSSL::RSA;
use MIME::Base64 qw(encode_base64);
# Get first argument passed to script
my $request = $ARGV[0];
# Path to the private key
my $pem_file = "private-key.pem";
# Read private key
my $private_key = do {
local $/ = undef;
open my $fh, "<", $pem_file
or die "could not open $file: $!";
<$fh>;
};
# Load private key
my $rsa = Crypt::OpenSSL::RSA->new_private_key($private_key);
# Create signature
$rsa->use_sha512_hash(); # use_sha1_hash for QZ Tray 2.0 and older
my $sig = encode_base64($rsa->sign($request));
print $sig;