schrodinger.application.matsci.enc module

Utilities for encryption.

Copyright Schrodinger, LLC. All rights reserved.

schrodinger.application.matsci.enc.get_encryption_key(key_file_name, key_file_path=None)

Return the encryption key for the given file name. If the file doesn’t exist then an encryption key will be created for it.

Parameters
  • key_file_name (str) – the key file name

  • key_file_path (str or None) – the key file path, if None then the default Schrodinger path is used

Return type

bytes

Returns

the encryption key

schrodinger.application.matsci.enc.write_encrypted_file(in_file_path, key_file_name, key_file_path=None)

Write an encrypted version of the given input file path.

Parameters
  • in_file_path (str) – the in file path to encrypt

  • key_file_name (str) – the key file name to use in the encryption

  • key_file_path (str or None) – the key file path, if None then the default Schrodinger path is used

Raises

ValueError – if there is a problem

Return type

str

Returns

the encrypted file path

schrodinger.application.matsci.enc.write_encrypted_text(text, in_file_path, key_file_name, key_file_path=None)

Write the unencrypted text to an encrypted file with the given path.

Parameters
  • text (str) – the text to encrypt

  • in_file_path (str) – the file path to which to write the encrypted text

  • key_file_name (str) – the key file name to use in the encryption

  • key_file_path (str or None) – the key file path, if None then the default Schrodinger path is used

Return type

str

Returns

the encrypted file path

schrodinger.application.matsci.enc.get_unencrypted_text(in_file_path, key_file_name, key_file_path=None)

Return the unencrypted text for the given encrypted input file path.

Parameters
  • in_file_path (str) – the encrypted in file path to unencrypt

  • key_file_name (str) – the key file name to use in the unencryption

  • key_file_path (str or None) – the key file path, if None then the default Schrodinger path is used

Raises

ValueError – if there is a problem

Return type

str

Returns

the unencrypted text

schrodinger.application.matsci.enc.write_unencrypted_file(in_file_path, key_file_name, key_file_path=None)

Write an unencrypted version for the given encrypted input file path.

Parameters
  • in_file_path (str) – the encrypted in file path to unencrypt

  • key_file_name (str) – the key file name to use in the unencryption

  • key_file_path (str or None) – the key file path, if None then the default Schrodinger path is used

Return type

str

Returns

the unencrypted file path

schrodinger.application.matsci.enc.encrypt_cms(in_cms_fp, out_cms_fp=None)

Encrypt the FF parameters in the given cms file.

Parameters
  • in_cms_fp (str) – the file path for the cms to be encrypted

  • out_cms_fp (str or None) – the file path to which to write the encrypted cms if None then the input file path will be overwritten

schrodinger.application.matsci.enc.decrypt_cms(in_cms_fp, out_cms_fp=None)

Decrypt the FF parameters in the given cms file.

Parameters
  • in_cms_fp (str) – the file path for the cms to be decrypted

  • out_cms_fp (str or None) – the file path to which to write the decrypted cms if None then the input file path will be overwritten

schrodinger.application.matsci.enc.fst_copy(fst)

Return a copy of the given FFIOStructure.

Parameters

fst (ffiostructure.FFIOStructure) – the structure

Return type

ffiostructure.FFIOStructure

Returns

a copy of the structure