Get signing key pair for input verification key.

        Raise WalletState if wallet is closed, AbsentRecord for no such key pair.

        :param verkey: verification key of key pair
        :return: KeyInfo for key pair
976991
async def get_signing_key(self, verkey: str) -> KeyInfo:
        

        LOGGER.debug('Wallet.get_signing_key >>> seed: [SEED], verkey: %s', verkey)

        if not self.handle:
            LOGGER.debug('Wallet.get_signing_key <!< Wallet %s is closed', self.name)
            raise WalletState('Wallet {} is closed'.format(self.name))

        try:
            metadata = await crypto.get_key_metadata(self.handle, verkey)
        except IndyError as x_indy:
            if x_indy.error_code == ErrorCode.WalletItemNotFound:
                LOGGER.debug('Wallet.get_signing_key <!< Verification key %s not in wallet %s', verkey, self.name)
                raise AbsentRecord('Verification key not in wallet {}'.format(self.name))
            LOGGER.debug('Wallet.get_signing_key <!< indy-sdk raised error %s', x_indy.error_code)
            raise

        rv = KeyInfo(verkey, json.loads(metadata) if metadata else {})
        LOGGER.debug('Wallet.get_signing_key <<< %s', rv)
        return rv
521845
def verify(self, digest, signature, **kwargs):
        
        ctx = libcrypto.EVP_PKEY_CTX_new(self.key, None)
        if ctx is None:
            raise PKeyError("Initailizing verify context")
        if libcrypto.EVP_PKEY_verify_init(ctx) < 1:
            raise PKeyError("verify_init")
        self._configure_context(ctx, kwargs)
        ret = libcrypto.EVP_PKEY_verify(ctx, signature, len(signature), digest,
                                        len(digest))
        if ret < 0:
            raise PKeyError("Signature verification")
        libcrypto.EVP_PKEY_CTX_free(ctx)
        return ret > 0
59792
def confirm_registration(request, key, template="locksmith/confirmed.html"):
    '''
        
    '''
    context = {'LOCKSMITH_BASE_TEMPLATE': settings.LOCKSMITH_BASE_TEMPLATE}
    try:
        context['key'] = key_obj = Key.objects.get(key=key)
        if key_obj.status != 'U':
            context['error'] = 'Key Already Activated'
        else:
            key_obj.status = 'A'
            key_obj.save()
            key_obj.mark_for_update()
    except Key.DoesNotExist:
        context['error'] = 'Invalid Key'
    return render_to_response(template, context,
                              context_instance=RequestContext(request))
701063
def get_signing_key(self, key_type):
        
        route_values = {}
        if key_type is not None:
            route_values['keyType'] = self._serialize.url('key_type', key_type, 'str')
        response = self._send(http_method='GET',
                              location_id='92ed5cf4-c38b-465a-9059-2f2fb7c624b5',
                              version='5.0-preview.1',
                              route_values=route_values)
        return self._deserialize('str', response)
1023792
def getAPIKey(self, keyID=None):
        
        kcfg = self.getKeyConfig(keyID)
        if 'key' not in kcfg:
            raise ConfigException('invalid config: missing api key')
        return kcfg['key']
371950
def key_exists(key_id, region=None, key=None, keyid=None, profile=None):
    '''
    
    '''
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)

    r = {}
    try:
        key = conn.describe_key(key_id)
        # TODO: add to context cache
        r['result'] = True
    except boto.exception.BotoServerError as e:
        if isinstance(e, boto.kms.exceptions.NotFoundException):
            r['result'] = False
            return r
        r['error'] = __utils__['boto.get_error'](e)
    return r
479786
def Verify(self, public_key):
    
    if self.digest_type != self.HashType.SHA256:
      raise rdfvalue.DecodeError("Unsupported digest.")
    if self.signature_type not in [
        self.SignatureType.RSA_PKCS1v15, self.SignatureType.RSA_PSS
    ]:
      raise rdfvalue.DecodeError("Unsupported signature type.")

    try:
      public_key.Verify(self.data, self.signature)
    except InvalidSignature as e:
      raise rdfvalue.DecodeError("Could not verify blob. Error: %s" % e)

    return True
1312430
def signing_keys(self):
        
        if self._signing_keys is None:
            self._signing_keys = SigningKeyList(self._version, account_sid=self._solution['sid'], )
        return self._signing_keys
1171238
def p2pkh_input_and_witness(outpoint, sig, pubkey, sequence=0xFFFFFFFE):
    '''
    
    '''
    stack_script = '{sig} {pk}'.format(sig=sig, pk=pubkey)
    return tb.make_legacy_input_and_empty_witness(
        outpoint=outpoint,
        stack_script=script_ser.serialize(stack_script),
        redeem_script=b'',
        sequence=sequence)
502512
def get_upload_key(self):
        

        if not hasattr(self, '_upload_key'):
            self._upload_key = self.get_storage().bucket.get_key(
                self.cleaned_data['key_name'])
        return self._upload_key
849589
def have_key(self, *keygrips):
        """"""
        for keygrip in keygrips:
            try:
                self.get_identity(keygrip=keygrip)
                break
            except KeyError as e:
                log.warning('HAVEKEY(%s) failed: %s', keygrip, e)
        else:
            raise AgentError(b'ERR 67108881 No secret key <GPG Agent>')
160972
def verify(self, token, verifying_key_or_keys, num_required=None):
        
        if not isinstance(verifying_key_or_keys, (list, str, unicode)):
            raise ValueError("Invalid verifying key(s): expected list or string")

        if isinstance(verifying_key_or_keys, list):
            return self._verify_multi(token, verifying_key_or_keys, num_required=num_required)

        else:
            return self._verify_single(token, str(verifying_key_or_keys))
740437
def check_signing_key(self):
        
        user_keys = self.gpg.list_keys()
        if len(user_keys) > 0:
            trusted = False
            for key in user_keys:
                if key['fingerprint'] == self.key_info['fingerprint']:
                    trusted = True
                    logger.debug(("repo signing key trusted in user keyring, "
                                  "fingerprint {0}".format(key['fingerprint'])))
        else:
            trusted = False
        if trusted is False:
            repo_key_url = "{0}/{1}".format(self.url, self.repo_signing_key)
            raise RepositoryUntrustedSigningKeyError(repo_key_url,
                                                     self.key_info['fingerprint'])
102163
def verifySignature(ecPublicSigningKey, message, signature):
        

        if ecPublicSigningKey.getType() == Curve.DJB_TYPE:
            result = _curve.verifySignature(ecPublicSigningKey.getPublicKey(), message, signature)
            return result == 0
        else:
            raise InvalidKeyException("Unknown type: %s" % ecPublicSigningKey.getType())
1167879
def _verify(self):
        """"""
        if not self.keyid:
            raise ValueError('No GPG key specified for signing, did you mean to use --no-sign?')
        sign = self.gpg.sign('', keyid=self.keyid)
        if 'secret key not available' in sign.stderr:
            raise ValueError('Key not found')
        elif 'NEED_PASSPHRASE' in sign.stderr:
            self.passphrase = getpass.getpass('Passphrase for GPG key: ')
1241570
def sign(self, data):
        
        if self.signing_key is None:
            raise MissingSigningKeyError("KeyPair does not contain secret key. "
                                         "Use Keypair.from_seed method to create a new keypair with a secret key.")
        return self.signing_key.sign(data)
603071
def verify_signature(self):
        
        if self.get_contact_key:
            sender_key = self.get_contact_key(self.sender_handle)
        else:
            sender_key = fetch_public_key(self.sender_handle)
        if not sender_key:
            raise NoSenderKeyFoundError("Could not find a sender contact to retrieve key")
        MagicEnvelope(doc=self.doc, public_key=sender_key, verify=True)