diff options
| author | Justus Winter <[email protected]> | 2017-02-14 15:30:30 +0000 | 
|---|---|---|
| committer | Justus Winter <[email protected]> | 2017-02-14 15:33:55 +0000 | 
| commit | 92adc9bbf640eb5d9177d3ba0189e0f6cee4e995 (patch) | |
| tree | b3eed78f8aa1333d59442389d847b0aff38a0e00 /lang/python/gpg/core.py | |
| parent | python: Use the correct function to free buffers. (diff) | |
| download | gpgme-92adc9bbf640eb5d9177d3ba0189e0f6cee4e995.tar.gz gpgme-92adc9bbf640eb5d9177d3ba0189e0f6cee4e995.zip | |
python: Wrap utility functions.
* NEWS: Update.
* lang/python/gpg/core.py (pubkey_algo_string): New function.
(pubkey_algo_name): Add docstring.
(hash_algo_name): Likewise.
(get_protocol_name): Likewise.
(addrspec_from_uid): New function.
* lang/python/gpgme.i (gpgme_pubkey_algo_string): Result must be
freed.
(gpgme_addrspec_from_uid): Likewise.
Signed-off-by: Justus Winter <[email protected]>
Diffstat (limited to 'lang/python/gpg/core.py')
| -rw-r--r-- | lang/python/gpg/core.py | 49 | 
1 files changed, 49 insertions, 0 deletions
| diff --git a/lang/python/gpg/core.py b/lang/python/gpg/core.py index e07ec330..18a7e3a5 100644 --- a/lang/python/gpg/core.py +++ b/lang/python/gpg/core.py @@ -1118,15 +1118,64 @@ class Data(GpgmeWrapper):                  chunks.append(result)              return b''.join(chunks) +def pubkey_algo_string(subkey): +    """Return short algorithm string + +    Return a public key algorithm string (e.g. "rsa2048") for a given +    SUBKEY. + +    Returns: +    algo      - a string + +    """ +    return gpgme.gpgme_pubkey_algo_string(subkey) +  def pubkey_algo_name(algo): +    """Return name of public key algorithm + +    Return the name of the public key algorithm for a given numeric +    algorithm id ALGO (cf. RFC4880). + +    Returns: +    algo      - a string + +    """      return gpgme.gpgme_pubkey_algo_name(algo)  def hash_algo_name(algo): +    """Return name of hash algorithm + +    Return the name of the hash algorithm for a given numeric +    algorithm id ALGO (cf. RFC4880). + +    Returns: +    algo      - a string + +    """      return gpgme.gpgme_hash_algo_name(algo)  def get_protocol_name(proto): +    """Get protocol description + +    Get the string describing protocol PROTO. + +    Returns: +    proto     - a string + +    """      return gpgme.gpgme_get_protocol_name(proto) +def addrspec_from_uid(uid): +    """Return the address spec + +    Return the addr-spec (cf. RFC2822 section 4.3) from a user id UID. + +    Returns: +    addr_spec - a string + +    """ +    return gpgme.gpgme_addrspec_from_uid(uid) +  def check_version(version=None):      return gpgme.gpgme_check_version(version) | 
