Uranium
Application Framework
|
Public Member Functions | |
def | getHashAlgorithm (cls) |
str | getSignaturesLocalFilename (cls) |
str | getRootSignatureCategory (cls) |
str | getSignaturePathForFile (cls, str filename) |
str | getRootSignatureEntry (cls) |
Tuple[str, str] | getFilePathInfo (cls, str base_folder_path, str current_full_path, str local_filename) |
Optional[str] | getFileHash (cls, str filename) |
Optional[str] | getFileSignature (cls, str filename, RSAPrivateKey private_key) |
Static Public Member Functions | |
None | defaultViolationHandler (str message) |
Tuple[RSAPrivateKeyWithSerialization, RSAPublicKey] | generateNewKeyPair () |
Optional[RSAPrivateKey] | loadPrivateKey (str private_filename, Optional[str] optional_password) |
bool | saveKeyPair ("RSAPrivateKeyWithSerialization" private_key, str private_path, str public_path, Optional[str] optional_password=None) |
bool | removeCached (str path) |
Anything shared between the main code and the (keygen/signing) scripts which does not need state. See 'Trust' (below) and the 'createkeypair.py', 'signfile.py' and 'signfolder.py' scripts in the 'scripts' folder.
|
static |
This violationHandler is called after any other handlers
|
static |
Create a new private-public key-pair. :return: A tulple of private-key/public key.
Optional[str] UM.Trust.TrustBasics.getFileHash | ( | cls, | |
str | filename | ||
) |
Gets the hash for the provided file. :param filename: The filename of the file to be hashed. :return: The hash of the file.
Tuple[str, str] UM.Trust.TrustBasics.getFilePathInfo | ( | cls, | |
str | base_folder_path, | ||
str | current_full_path, | ||
str | local_filename | ||
) |
'Signed folder' scenario: When walking over directory, it's convenient to have the full path on one hand, and the 'name' of the file in the signature json file just below the signed directory on the other. :param base_folder_path: The signed folder(name), where the signature file resides. :param current_full_path: The full path to the current folder. :param local_filename: The local filename of the current file. :return: A tuple with the full path to the file on disk and the 'signed-folder-local' path of that same file.
Optional[str] UM.Trust.TrustBasics.getFileSignature | ( | cls, | |
str | filename, | ||
RSAPrivateKey | private_key | ||
) |
Creates the signature for the (hash of the) provided file, given a private key. :param filename: The file to be signed. :param private_key: The private key used for signing. :return: The signature if successful, 'None' otherwise.
def UM.Trust.TrustBasics.getHashAlgorithm | ( | cls | ) |
To ensure the same hash-algorithm is used by every part of this code. :return: The hash-algorithm used for the entire 'suite'.
str UM.Trust.TrustBasics.getRootSignatureCategory | ( | cls | ) |
'Signed folder' scenario: In anticipation of other keys, put the 'master' signature into this category. :return: The json 'name' for the main signatures category.
str UM.Trust.TrustBasics.getRootSignatureEntry | ( | cls | ) |
'Single signed file' scenario: In anticipation of other keys, put the 'master' signature into this entry. :return: The json 'name' for the main signature.
str UM.Trust.TrustBasics.getSignaturePathForFile | ( | cls, | |
str | filename | ||
) |
'Single signed file' scenario: Get the name of the signature-file that should be located next to the file. :param filename: The file that has (or needs to be) signed. :return: The path of the signature-file of this file.
str UM.Trust.TrustBasics.getSignaturesLocalFilename | ( | cls | ) |
'Signed folder' scenario: Get the filename the signature file in a folder has. :return: The filename of the signatures file (not the path).
|
static |
Load a private key from a file. :param private_filename: The filename of the file containing the private key. :param optional_password: The key can be signed with a password as well (or not). :return: The private key contained in the file.
|
static |
Save a key-pair to two distinct files. :param private_key: The private key to save. The public one will be generated from it. :param private_path: Path to the filename where the private key will be saved. :param public_path: Path to the filename where the public key will be saved. :param optional_password: The private key can be signed with a password as well (or not). :return: True on success.