Esempio n. 1
0
    def _buildFromFingerprint(self, fingerprint):
        """Build key information from a fingerprint."""
        context = gpgme.Context()
        # retrive additional key information
        try:
            key = context.get_key(fingerprint, False)
        except gpgme.GpgmeError:
            key = None

        if key and valid_fingerprint(key.subkeys[0].fpr):
            self._buildFromGpgmeKey(key)
Esempio n. 2
0
    def sanitizeFingerprint(self, fingerprint):
        """See IGPGHandler."""
        # remove whitespaces, truncate to max of 40 (as per v4 keys) and
        # convert to upper case
        fingerprint = fingerprint.replace(' ', '')
        fingerprint = fingerprint[:40].upper()

        if not valid_fingerprint(fingerprint):
            return None

        return fingerprint
Esempio n. 3
0
    def _buildFromFingerprint(self, fingerprint):
        """Build key information from a fingerprint."""
        context = gpgme.Context()
        # retrive additional key information
        try:
            key = context.get_key(fingerprint, False)
        except gpgme.GpgmeError:
            key = None

        if key and valid_fingerprint(key.subkeys[0].fpr):
            self._buildFromGpgmeKey(key)
Esempio n. 4
0
    def sanitizeFingerprint(self, fingerprint):
        """See IGPGHandler."""
        # remove whitespaces, truncate to max of 40 (as per v4 keys) and
        # convert to upper case
        fingerprint = fingerprint.replace(' ', '')
        fingerprint = fingerprint[:40].upper()

        if not valid_fingerprint(fingerprint):
            return None

        return fingerprint
Esempio n. 5
0
def sanitize_fingerprint(fingerprint):
    """Sanitize a GPG fingerprint.

    This is the ultimate implementation of IGPGHandler.sanitizeFingerprint.
    """
    # remove whitespaces, truncate to max of 40 (as per v4 keys) and
    # convert to upper case
    fingerprint = fingerprint.replace(' ', '')
    fingerprint = fingerprint[:40].upper()

    if not valid_fingerprint(fingerprint):
        return None

    return fingerprint