Search is not available for this dataset
text
stringlengths
75
104k
def _get_or_create_subscription(self): """In a broadcast queue, workers have a unique subscription ensuring that every worker recieves a copy of every task.""" topic_path = self._get_topic_path() subscription_name = '{}-{}-{}-worker'.format( queue.PUBSUB_OBJECT_PREFIX, self.n...
def cleanup(self): """Deletes this worker's subscription.""" if self.subscription: logger.info("Deleting worker subscription...") self.subscriber_client.delete_subscription(self.subscription)
def _get_or_create_subscription(self): """Workers all share the same subscription so that tasks are distributed across all workers.""" topic_path = self._get_topic_path() subscription_name = '{}-{}-shared'.format( PUBSUB_OBJECT_PREFIX, self.name) subscription_path = s...
def enqueue(self, f, *args, **kwargs): """Enqueues a function for the task queue to execute.""" task = Task(uuid4().hex, f, args, kwargs) self.storage.put_task(task) return self.enqueue_task(task)
def enqueue_task(self, task): """Enqueues a task directly. This is used when a task is retried or if a task was manually created. Note that this does not store the task. """ data = dumps(task) if self._async: self.publisher_client.publish(self.topic_path, da...
def unpickle(pickled_string): """Unpickles a string, but raises a unified UnpickleError in case anything fails. This is a helper method to not have to deal with the fact that `loads()` potentially raises many types of exceptions (e.g. AttributeError, IndexError, TypeError, KeyError, etc.) """ ...
def main(path, pid, queue): """ Standalone PSQ worker. The queue argument must be the full importable path to a psq.Queue instance. Example usage: psqworker config.q psqworker --path /opt/app queues.fast """ setup_logging() if pid: with open(os.path.expandus...
def result(self, timeout=None): """Gets the result of the task. Arguments: timeout: Maximum seconds to wait for a result before raising a TimeoutError. If set to None, this will wait forever. If the queue doesn't store results and timeout is None, this call w...
def service_start(service=None, param=None): """ Launch a Process, return his pid """ if service is not None: to_run = ["python", service] if param is not None: to_run += param return subprocess.Popen(to_run) return False
def update_running_pids(old_procs): """ Update the list of the running process and return the list """ new_procs = [] for proc in old_procs: if proc.poll() is None and check_pid(proc.pid): publisher.debug(str(proc.pid) + ' is alive') new_procs.append(proc) ...
def run_splitted_processing(max_simultaneous_processes, process_name, filenames): """ Run processes which push the routing dump of the RIPE in a redis database. The dump has been splitted in multiple files and each process run on one of this files. """...
def fsplit(file_to_split): """ Split the file and return the list of filenames. """ dirname = file_to_split + '_splitted' if not os.path.exists(dirname): os.mkdir(dirname) part_file_size = os.path.getsize(file_to_split) / number_of_files + 1 splitted_files = [] with open(file...
def __entry_point(): """ Function called when an query is made on /json. Expects a JSON object with at least a 'method' entry. """ ip = request.remote_addr ua = request.headers.get('User-Agent', 'Empty User-Agent') method = request.json.get('method') if method is None: __...
def asn(self, ip, announce_date=None): """ Give an IP, maybe a date, get the ASN. This is the fastest command. :param ip: IP address to search for :param announce_date: Date of the announcement :rtype: String, ASN. """ assignations, ...
def date_asn_block(self, ip, announce_date=None): """ Get the ASN and the IP Block announcing the IP at a specific date. :param ip: IP address to search for :param announce_date: Date of the announcement :rtype: tuple .. code-block:: python ...
def history(self, ip, days_limit=None): """ Get the full history of an IP. It takes time. :param ip: IP address to search for :param days_limit: Max amount of days to query. (None means no limit) :rtype: list. For each day in the database: day, asn, block ...
def aggregate_history(self, ip, days_limit=None): """ Get the full history of an IP, aggregate the result instead of returning one line per day. :param ip: IP address to search for :param days_limit: Max amount of days to query. (None means no limit) ...
def downloadURL(url, filename): """ Inconditianilly download the URL in a temporary directory. When finished, the file is moved in the real directory. Like this an other process will not attempt to extract an inclomplete file. """ path_temp_bviewfile = os.path.join(c.raw_data, c.bvie...
def already_downloaded(filename): """ Verify that the file has not already been downloaded. """ cur_file = os.path.join(c.bview_dir, filename) old_file = os.path.join(c.bview_dir, 'old', filename) if not os.path.exists(cur_file) and not os.path.exists(old_file): return False retu...
def to_download(): """ Build interval of urls to download. We always get the first file of the next day. Ex: 2013-01-01 => 2013-01-02.0000 """ first_day = parse(interval_first) last_day = parse(interval_last) format_change = parse('2010-06-14') one_day = datetime.timedelt...
def strToBool(val): """ Helper function to turn a string representation of "true" into boolean True. """ if isinstance(val, str): val = val.lower() return val in ['true', 'on', 'yes', True]
def get_page_url(page_num, current_app, url_view_name, url_extra_args, url_extra_kwargs, url_param_name, url_get_params, url_anchor): """ Helper function to return a valid URL string given the template tag parameters """ if url_view_name is not None: # Add page param to the kwargs list. Override...
def bootstrap_paginate(parser, token): """ Renders a Page object as a Twitter Bootstrap styled pagination bar. Compatible with Bootstrap 3.x and 4.x only. Example:: {% bootstrap_paginate page_obj range=10 %} Named Parameters:: range - The size of the pagination bar (ie, if set t...
def configure_devel_jobs( config_url, rosdistro_name, source_build_name, groovy_script=None, dry_run=False, whitelist_repository_names=None): """ Configure all Jenkins devel jobs. L{configure_release_job} will be invoked for source repository and target which matches the build file crit...
def configure_devel_job( config_url, rosdistro_name, source_build_name, repo_name, os_name, os_code_name, arch, pull_request=False, config=None, build_file=None, index=None, dist_file=None, dist_cache=None, jenkins=None, views=None, is_disabled=False, groo...
def configure_release_jobs( config_url, rosdistro_name, release_build_name, groovy_script=None, dry_run=False, whitelist_package_names=None): """ Configure all Jenkins release jobs. L{configure_release_job} will be invoked for every released package and target which matches the build fi...
def configure_release_job( config_url, rosdistro_name, release_build_name, pkg_name, os_name, os_code_name, config=None, build_file=None, index=None, dist_file=None, dist_cache=None, jenkins=None, views=None, generate_import_package_job=True, generate_sync_package...
def configure_doc_jobs( config_url, rosdistro_name, doc_build_name, groovy_script=None, dry_run=False, whitelist_repository_names=None): """ Configure all Jenkins doc jobs. L{configure_doc_job} will be invoked for doc repository and target which matches the build file criteria. """ ...
def configure_doc_job( config_url, rosdistro_name, doc_build_name, repo_name, os_name, os_code_name, arch, config=None, build_file=None, index=None, dist_file=None, dist_cache=None, jenkins=None, views=None, is_disabled=False, groovy_script=None, doc_repos...
def get_affected_by_sync( package_descriptors, targets, testing_repo_data, main_repo_data): """ For each package and target check if it is affected by a sync. This is the case when the package version in the testing repo is different from the version in the main repo. :return: a di...
def get_regressions( package_descriptors, targets, building_repo_data, testing_repo_data, main_repo_data): """ For each package and target check if it is a regression. This is the case if the main repo contains a package version which is higher then in any of the other repos or if any o...
def get_version_status( package_descriptors, targets, repos_data, strip_version=False, strip_os_code_name=False): """ For each package and target check if it is affected by a sync. This is the case when the package version in the testing repo is different from the version in the main re...
def _strip_version_suffix(version): """ Remove trailing junk from the version number. >>> strip_version_suffix('') '' >>> strip_version_suffix('None') 'None' >>> strip_version_suffix('1.2.3-4trusty-20140131-1359-+0000') '1.2.3-4' >>> strip_version_suffix('1.2.3-foo') '1.2.3' ...
def get_homogeneous(package_descriptors, targets, repos_data): """ For each package check if the version in one repo is equal for all targets. The version could be different in different repos though. :return: a dict indexed by package names containing a boolean flag """ homogeneous = {} f...
def get_package_counts(package_descriptors, targets, repos_data): """ Get the number of packages per target and repository. :return: a dict indexed by targets containing a list of integer values (one for each repo) """ counts = {} for target in targets: counts[target] = [0] * len(...
def get_jenkins_job_urls( rosdistro_name, jenkins_url, release_build_name, targets): """ Get the Jenkins job urls for each target. The placeholder {pkg} needs to be replaced with the ROS package name. :return: a dict indexed by targets containing a string """ urls = {} for target i...
def configure_ci_jobs( config_url, rosdistro_name, ci_build_name, groovy_script=None, dry_run=False): """Configure all Jenkins CI jobs.""" config = get_config_index(config_url) build_files = get_ci_build_files(config, rosdistro_name) build_file = build_files[ci_build_name] index = g...
def configure_ci_job( config_url, rosdistro_name, ci_build_name, os_name, os_code_name, arch, config=None, build_file=None, index=None, dist_file=None, jenkins=None, views=None, is_disabled=False, groovy_script=None, build_targets=None, dry_run=Fal...
def write_groovy_script_and_configs( filename, content, job_configs, view_configs=None): """Write out the groovy script and configs to file. This writes the reconfigure script to the file location and places the expanded configs in subdirectories 'view_configs' / 'job_configs' that the script c...
def topological_order_packages(packages): """ Order packages topologically. First returning packages which have message generators and then the rest based on all direct depends and indirect recursive run_depends. :param packages: A dict mapping relative paths to ``Package`` objects ``dict`` :r...
def parse_public(data): """ Loads a public key from a DER or PEM-formatted file. Supports RSA, DSA and EC public keys. For RSA keys, both the old RSAPublicKey and SubjectPublicKeyInfo structures are supported. Also allows extracting a public key from an X.509 certificate. :param data: A...
def parse_certificate(data): """ Loads a certificate from a DER or PEM-formatted file. Supports X.509 certificates only. :param data: A byte string to load the certificate from :raises: ValueError - when the data does not appear to contain a certificate :return: An asn...
def parse_private(data, password=None): """ Loads a private key from a DER or PEM-formatted file. Supports RSA, DSA and EC private keys. Works with the follow formats: - RSAPrivateKey (PKCS#1) - ECPrivateKey (SECG SEC1 V2) - DSAPrivateKey (OpenSSL) - PrivateKeyInfo (RSA/DSA/EC - PKCS#8)...
def _unarmor_pem(data, password=None): """ Removes PEM-encoding from a public key, private key or certificate. If the private key is encrypted, the password will be used to decrypt it. :param data: A byte string of the PEM-encoded data :param password: A byte string of the encrypti...
def _unarmor_pem_openssl_private(headers, data, password): """ Parses a PKCS#1 private key, or encrypted private key :param headers: A dict of "Name: Value" lines from right after the PEM header :param data: A byte string of the DER-encoded PKCS#1 private key :param password: ...
def parse_pkcs12(data, password=None): """ Parses a PKCS#12 ANS.1 DER-encoded structure and extracts certs and keys :param data: A byte string of a DER-encoded PKCS#12 file :param password: A byte string of the password to any encrypted data :raises: ValueError - when any ...
def _parse_safe_contents(safe_contents, certs, private_keys, password): """ Parses a SafeContents PKCS#12 ANS.1 structure and extracts certs and keys :param safe_contents: A byte string of ber-encoded SafeContents, or a asn1crypto.pkcs12.SafeContents parsed object :param certs: ...
def _decrypt_encrypted_data(encryption_algorithm_info, encrypted_content, password): """ Decrypts encrypted ASN.1 data :param encryption_algorithm_info: An instance of asn1crypto.pkcs5.Pkcs5EncryptionAlgorithm :param encrypted_content: A byte string of the encrypted content :param...
def aes_cbc_no_padding_decrypt(key, data, iv): """ Decrypts AES ciphertext in CBC mode using a 128, 192 or 256 bit key and no padding. :param key: The encryption key - a byte string either 16, 24 or 32 bytes long :param data: The ciphertext - a byte string :param iv: T...
def aes_cbc_pkcs7_encrypt(key, data, iv): """ Encrypts plaintext using AES in CBC mode with a 128, 192 or 256 bit key and PKCS#7 padding. :param key: The encryption key - a byte string either 16, 24 or 32 bytes long :param data: The plaintext - a byte string :param iv: ...
def aes_cbc_pkcs7_decrypt(key, data, iv): """ Decrypts AES ciphertext in CBC mode using a 128, 192 or 256 bit key :param key: The encryption key - a byte string either 16, 24 or 32 bytes long :param data: The ciphertext - a byte string :param iv: The initialization vector ...
def _calculate_aes_cipher(key): """ Determines if the key is a valid AES 128, 192 or 256 key :param key: A byte string of the key to use :raises: ValueError - when an invalid key is provided :return: A unicode string of the AES variation - "aes128", "aes192" or "aes256" ...
def rc4_encrypt(key, data): """ Encrypts plaintext using RC4 with a 40-128 bit key :param key: The encryption key - a byte string 5-16 bytes long :param data: The plaintext - a byte string :raises: ValueError - when any of the parameters contain an invalid value Ty...
def rc4_decrypt(key, data): """ Decrypts RC4 ciphertext using a 40-128 bit key :param key: The encryption key - a byte string 5-16 bytes long :param data: The ciphertext - a byte string :raises: ValueError - when any of the parameters contain an invalid value TypeE...
def tripledes_cbc_pkcs5_decrypt(key, data, iv): """ Decrypts 3DES ciphertext in CBC mode using either the 2 or 3 key variant (16 or 24 byte long key) and PKCS#5 padding. :param key: The encryption key - a byte string 16 or 24 bytes long (2 or 3 key mode) :param data: The ciphertext...
def des_cbc_pkcs5_decrypt(key, data, iv): """ Decrypts DES ciphertext in CBC mode using a 56 bit key and PKCS#5 padding. :param key: The encryption key - a byte string 8 bytes long (includes error correction bits) :param data: The ciphertext - a byte string :param iv: The ...
def _encrypt(cipher, key, data, iv, padding): """ Encrypts plaintext :param cipher: A unicode string of "aes128", "aes192", "aes256", "des", "tripledes_2key", "tripledes_3key", "rc2", "rc4" :param key: The encryption key - a byte string 5-32 bytes long :param data: ...
def _setup_evp_encrypt_decrypt(cipher, data): """ Creates an EVP_CIPHER pointer object and determines the buffer size necessary for the parameter specified. :param evp_cipher_ctx: An EVP_CIPHER_CTX pointer :param cipher: A unicode string of "aes128", "aes192", "aes256", "des", ...
def handle_error(result): """ Extracts the last Windows error message into a python unicode string :param result: A function result, 0 or None indicates failure :return: A unicode string error message """ if result: return _, error_string = get_error() if not...
def handle_error(result, exception_class=None): """ Extracts the last Windows error message into a python unicode string :param result: A function result, 0 or None indicates failure :param exception_class: The exception class to use for the exception if an error occurred :return:...
def generate_pair(algorithm, bit_size=None, curve=None): """ Generates a public/private key pair :param algorithm: The key algorithm - "rsa", "dsa" or "ec" :param bit_size: An integer - used for "rsa" and "dsa". For "rsa" the value maye be 1024, 2048, 3072 or 4096. For "dsa" th...
def generate_dh_parameters(bit_size): """ Generates DH parameters for use with Diffie-Hellman key exchange. Returns a structure in the format of DHParameter defined in PKCS#3, which is also used by the OpenSSL dhparam tool. THIS CAN BE VERY TIME CONSUMING! :param bit_size: The integer ...
def load_certificate(source): """ Loads an x509 certificate into a Certificate object :param source: A byte string of file contents, a unicode string filename or an asn1crypto.x509.Certificate object :raises: ValueError - when any of the parameters contain an invalid value ...
def _load_x509(certificate): """ Loads an ASN.1 object of an x509 certificate into a Certificate object :param certificate: An asn1crypto.x509.Certificate object :return: A Certificate object """ source = certificate.dump() buffer = buffer_from_bytes(source) evp_pkey ...
def load_private_key(source, password=None): """ Loads a private key into a PrivateKey object :param source: A byte string of file contents, a unicode string filename or an asn1crypto.keys.PrivateKeyInfo object :param password: A byte or unicode string to decrypt the private ke...
def load_public_key(source): """ Loads a public key into a PublicKey object :param source: A byte string of file contents, a unicode string filename or an asn1crypto.keys.PublicKeyInfo object :raises: ValueError - when any of the parameters contain an invalid value Type...
def _load_key(private_object): """ Loads a private key into a PrivateKey object :param private_object: An asn1crypto.keys.PrivateKeyInfo object :return: A PrivateKey object """ if libcrypto_version_info < (1,) and private_object.algorithm == 'dsa' and private_object.hash_algo ...
def _encrypt(certificate_or_public_key, data, padding): """ Encrypts plaintext using an RSA public key or certificate :param certificate_or_public_key: A PublicKey, Certificate or PrivateKey object :param data: The byte string to encrypt :param padding: The padding mode to...
def _decrypt(private_key, ciphertext, padding): """ Decrypts RSA ciphertext using a private key :param private_key: A PrivateKey object :param ciphertext: The ciphertext - a byte string :param padding: The padding mode to use :raises: ValueError - when any of ...
def _verify(certificate_or_public_key, signature, data, hash_algorithm, rsa_pss_padding=False): """ Verifies an RSA, DSA or ECDSA signature :param certificate_or_public_key: A Certificate or PublicKey instance to verify the signature with :param signature: A byte string of the signatur...
def rsa_pkcs1v15_sign(private_key, data, hash_algorithm): """ Generates an RSASSA-PKCS-v1.5 signature. When the hash_algorithm is "raw", the operation is identical to RSA private key encryption. That is: the data is not hashed and no ASN.1 structure with an algorithm identifier of the hash algorith...
def _sign(private_key, data, hash_algorithm, rsa_pss_padding=False): """ Generates an RSA, DSA or ECDSA signature :param private_key: The PrivateKey to generate the signature with :param data: A byte string of the data the signature is for :param hash_algorithm: A unicode ...
def public_key(self): """ :return: The PublicKey object for the public key this certificate contains """ if not self._public_key and self.x509: evp_pkey = libcrypto.X509_get_pubkey(self.x509) self._public_key = PublicKey(evp_pkey, self.asn1['tbs_certi...
def generate_pair(algorithm, bit_size=None, curve=None): """ Generates a public/private key pair :param algorithm: The key algorithm - "rsa", "dsa" or "ec" :param bit_size: An integer - used for "rsa" and "dsa". For "rsa" the value maye be 1024, 2048, 3072 or 4096. For "dsa" th...
def _advapi32_generate_pair(algorithm, bit_size=None): """ Generates a public/private key pair using CryptoAPI :param algorithm: The key algorithm - "rsa" or "dsa" :param bit_size: An integer - used for "rsa" and "dsa". For "rsa" the value maye be 1024, 2048, 3072 or 4096. For ...
def _bcrypt_generate_pair(algorithm, bit_size=None, curve=None): """ Generates a public/private key pair using CNG :param algorithm: The key algorithm - "rsa", "dsa" or "ec" :param bit_size: An integer - used for "rsa" and "dsa". For "rsa" the value maye be 1024, 2048, 3072 or ...
def generate_dh_parameters(bit_size): """ Generates DH parameters for use with Diffie-Hellman key exchange. Returns a structure in the format of DHParameter defined in PKCS#3, which is also used by the OpenSSL dhparam tool. THIS CAN BE VERY TIME CONSUMING! :param bit_size: The integer ...
def _is_prime(bit_size, n): """ An implementation of Miller–Rabin for checking if a number is prime. :param bit_size: An integer of the number of bits in the prime number :param n: An integer, the prime number :return: A boolean """ r = 0 s = n - 1 while s...
def _advapi32_interpret_rsa_key_blob(bit_size, blob_struct, blob): """ Takes a CryptoAPI RSA private key blob and converts it into the ASN.1 structures for the public and private keys :param bit_size: The integer bit size of the key :param blob_struct: An instance of the advapi32.R...
def _advapi32_interpret_dsa_key_blob(bit_size, public_blob, private_blob): """ Takes a CryptoAPI DSS private key blob and converts it into the ASN.1 structures for the public and private keys :param bit_size: The integer bit size of the key :param public_blob: A byte string of the ...
def _bcrypt_interpret_rsa_key_blob(key_type, blob_struct, blob): """ Take a CNG BCRYPT_RSAFULLPRIVATE_BLOB and converts it into an ASN.1 structure :param key_type: A unicode string of "private" or "public" :param blob_struct: An instance of BCRYPT_RSAKEY_BLOB :param blob: ...
def _bcrypt_interpret_dsa_key_blob(key_type, version, blob_struct, blob): """ Take a CNG BCRYPT_DSA_KEY_BLOB or BCRYPT_DSA_KEY_BLOB_V2 and converts it into an ASN.1 structure :param key_type: A unicode string of "private" or "public" :param version: An integer - 1 or 2, indicating ...
def _bcrypt_interpret_ec_key_blob(key_type, blob_struct, blob): """ Take a CNG BCRYPT_ECCKEY_BLOB and converts it into an ASN.1 structure :param key_type: A unicode string of "private" or "public" :param blob_struct: An instance of BCRYPT_ECCKEY_BLOB :param blob: A byte st...
def _load_key(key_object, container): """ Loads a certificate, public key or private key into a Certificate, PublicKey or PrivateKey object :param key_object: An asn1crypto.x509.Certificate, asn1crypto.keys.PublicKeyInfo or asn1crypto.keys.PrivateKeyInfo object :param container: ...
def _advapi32_load_key(key_object, key_info, container): """ Loads a certificate, public key or private key into a Certificate, PublicKey or PrivateKey object via CryptoAPI :param key_object: An asn1crypto.x509.Certificate, asn1crypto.keys.PublicKeyInfo or asn1crypto.keys.PrivateKeyInfo...
def _advapi32_create_blob(key_info, key_type, algo, signing=True): """ Generates a blob for importing a key to CryptoAPI :param key_info: An asn1crypto.keys.PublicKeyInfo or asn1crypto.keys.PrivateKeyInfo object :param key_type: A unicode string of "public" or "private" :p...
def _bcrypt_load_key(key_object, key_info, container, curve_name): """ Loads a certificate, public key or private key into a Certificate, PublicKey or PrivateKey object via CNG :param key_object: An asn1crypto.x509.Certificate, asn1crypto.keys.PublicKeyInfo or asn1crypto.keys.PrivateKey...
def load_public_key(source): """ Loads a public key into a PublicKey object :param source: A byte string of file contents, a unicode string filename or an asn1crypto.keys.PublicKeyInfo object :raises: ValueError - when any of the parameters contain an invalid value Type...
def load_pkcs12(source, password=None): """ Loads a .p12 or .pfx file into a PrivateKey object and one or more Certificates objects :param source: A byte string of file contents or a unicode string filename :param password: A byte or unicode string to decrypt the PKCS12 file. Unico...
def rsa_pkcs1v15_verify(certificate_or_public_key, signature, data, hash_algorithm): """ Verifies an RSASSA-PKCS-v1.5 signature. When the hash_algorithm is "raw", the operation is identical to RSA public key decryption. That is: the data is not hashed and no ASN.1 structure with an algorithm identi...
def rsa_pss_verify(certificate_or_public_key, signature, data, hash_algorithm): """ Verifies an RSASSA-PSS signature. For the PSS padding the mask gen algorithm will be mgf1 using the same hash algorithm as the signature. The salt length with be the length of the hash algorithm, and the trailer field wi...
def _verify(certificate_or_public_key, signature, data, hash_algorithm, rsa_pss_padding=False): """ Verifies an RSA, DSA or ECDSA signature :param certificate_or_public_key: A Certificate or PublicKey instance to verify the signature with :param signature: A byte string of the signatur...
def _advapi32_verify(certificate_or_public_key, signature, data, hash_algorithm, rsa_pss_padding=False): """ Verifies an RSA, DSA or ECDSA signature via CryptoAPI :param certificate_or_public_key: A Certificate or PublicKey instance to verify the signature with :param signature: A byte...
def _bcrypt_verify(certificate_or_public_key, signature, data, hash_algorithm, rsa_pss_padding=False): """ Verifies an RSA, DSA or ECDSA signature via CNG :param certificate_or_public_key: A Certificate or PublicKey instance to verify the signature with :param signature: A byte string ...
def rsa_pkcs1v15_sign(private_key, data, hash_algorithm): """ Generates an RSASSA-PKCS-v1.5 signature. When the hash_algorithm is "raw", the operation is identical to RSA private key encryption. That is: the data is not hashed and no ASN.1 structure with an algorithm identifier of the hash algorith...
def rsa_pss_sign(private_key, data, hash_algorithm): """ Generates an RSASSA-PSS signature. For the PSS padding the mask gen algorithm will be mgf1 using the same hash algorithm as the signature. The salt length with be the length of the hash algorithm, and the trailer field with be the standard 0xB...
def dsa_sign(private_key, data, hash_algorithm): """ Generates a DSA signature :param private_key: The PrivateKey to generate the signature with :param data: A byte string of the data the signature is for :param hash_algorithm: A unicode string of "md5", "sha1", "sha256", ...
def ecdsa_sign(private_key, data, hash_algorithm): """ Generates an ECDSA signature :param private_key: The PrivateKey to generate the signature with :param data: A byte string of the data the signature is for :param hash_algorithm: A unicode string of "md5", "sha1", "sha2...
def _sign(private_key, data, hash_algorithm, rsa_pss_padding=False): """ Generates an RSA, DSA or ECDSA signature :param private_key: The PrivateKey to generate the signature with :param data: A byte string of the data the signature is for :param hash_algorithm: A unicode ...
def _advapi32_sign(private_key, data, hash_algorithm, rsa_pss_padding=False): """ Generates an RSA, DSA or ECDSA signature via CryptoAPI :param private_key: The PrivateKey to generate the signature with :param data: A byte string of the data the signature is for :param hash_algori...