Specifications

If the privateKeyPath argument is missing or null, the private key built
into Switch is used instead. The resulting signature allows a receiver to
verify that the data was indeed generated by a script running in Switch
(since the public key corresponding to the private key is part of the
public Switch documentation).
Verifies whether the specified digital signature fits the data in the
receiving ByteArray using the specified public key. If this function returns
verifySignature(
signature : ByteArray,
publicKeyPath : String
) : Boolean
true, the data was indeed generated by a sender with access to the
private key corresponding to the specified public key (with the certainty
level offered by PKCS#1 v2.0).
The publicKeyPath argument specifies the path to a public key file in
the standard Base64 encoded X.509 format (also called PEM).
If the publicKeyPath argument is missing or null, the public key
corresponding to the private key built into Switch is used instead. This
avoids including an explicit reference to the public key which is part of
the public Switch documentation.
Example: the following code would generate a signature for authenticating Switch with the
Alwan CMYK Optimizer CLI:
var strData = "2008-10-12T14:16:22+01:00/var/tmp/foo.pdf/var/tmp/bar.pdf";
var binData = new ByteArray(strData, "UTF-8");
var binSignature = binData.generateSignature();
var strSignature = binSignature.toString("toBase64");
Public Key in C++ syntax:
-----BEGIN CERTIFICATE-----
MIIBgTCCASugAwIBAgIJAN+2brjXZa75MA0GCSqGSIb3DQEBBQUAMA0xCzAJBgNV
BAYTAkJZMB4XDTA5MDUxMjA4MDAwMVoXDTA5MDYxMTA4MDAwMVowDTELMAkGA1UE
BhMCQlkwXDANBgkqhkiG9w0BAQEFAANLADBIAkEAqm5CNFaMI/Jc7++ySmLdVb9W
Y/C+l5Zt1qr8v4qObYZOgpuwucDh9QzC7wgWnCWUINs9xgcU9p6WwrSFcyAbqQID
AQABo24wbDAdBgNVHQ4EFgQUTFkQhg1pkDGONt6MFc2zF+L2vRswPQYDVR0jBDYw
NIAUTFkQhg1pkDGONt6MFc2zF+L2vRuhEaQPMA0xCzAJBgNVBAYTAkJZggkA37Zu
uNdlrvkwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAANBAKjV5bqRnkgufLyS
ddAIwhyvWa5nvVbobF26cEE+7jkC+fspsSvnJDLIW72zCKFEqtnBtEM4uCweYnDV
ODWBKjg=
-----END CERTIFICATE-----
File class
The File class provides functionality for reading and writing binary and text files. A File can be
instantiated as an object, giving the script developer complete flexibility when reading and
writing files. In addition, the File class provides a set of static convenience functions for reading
and writing files in one go.
Enum AccessMode
The enum AccessMode is used in conjunction with File.open() to specify the mode in which the
file is opened. The access mode is specified by OR-ing together values from the following list.
DescriptionAccess mode
Opens the file in read-only modeFile.ReadOnly
412
Enfocus Switch 10