maptek.crypt module

This module implements utilities for script encryption. This encryption is based on license and can be decrypted by any user with a regular license.

This module allows running of encrypted scripts and also compiling scripts to an ecrypted format with a supplied private key.

decrypt_file(filename, outfile)

Decrypts a script file and outputs it to the desired output file. Decryption will only occur if the correct licensing is available.

encrypt_file(filename, outfile, mode=None)

Encrypts a script file and puts the contents into the specified output file. If the comment `# BEGIN_ENCRYPT` is found, it will start encryption after that line and all data above will stay unencrypted.

Parameters:
  • filename (str) – Input file to encrypt

  • outfile (str) – File to store encrytped data to.

  • mode (str) – Encryption key to use.

class encrypt

Bases: object

Class for encrypting data.

__init__()

Class for encrypting data.

set_encryption_mode(encrypt self, int mode)
set_encryption_mode(encrypt self, str mode) None

Overrides the encryption mode.The default value is based on licensing.

get_encryption_mode(encrypt self) int

Gets the encryption mode id.

get_encrypt_mode_name(encrypt self) str

Gets the encryption mode name.

encrypt_data(encrypt self, str data) PyBinaryData

Encrypts the data and returns the encrypted string.

class decrypt(data)

Bases: object

Class for decrypting data.

__init__(data)

Class for decrypting data.

get_encrypt_mode_name(decrypt self) str

Gets the encryption mode name used in the input data.

decrypt_data(decrypt self) str

Returns the decrypted data if authorised.

run(decrypt self)

Runs the stored encrypted data.