コード例 #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)
コード例 #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
コード例 #3
0
ファイル: handler.py プロジェクト: pombreda/UnnaturalCodeFork
    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)
コード例 #4
0
ファイル: handler.py プロジェクト: pombreda/UnnaturalCodeFork
    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
コード例 #5
0
ファイル: handler.py プロジェクト: pombredanne/launchpad-3
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