Recover deleted key for a domain.
555420
def keys_recover(cls, fqdn, key):
        """"""
        data = {
            "deleted": False,
        }
        return cls.json_put('%s/domains/%s/keys/%s' % (cls.api_url, fqdn, key),
                            data=json.dumps(data),)
736215
def keys(cls, fqdn, sort_by=None):
        """"""
        meta = cls.get_fqdn_info(fqdn)
        url = meta['domain_keys_href']
        return cls.json_get(cls.get_sort_url(url, sort_by))
509112
def get_domain_home_from_url(url):
    
    p = parse.urlparse(url)
    if p.netloc:
        return '{}://{}'.format(p.scheme, p.netloc), p.netloc
    else:
        return '', ''
803152
def recover(self, key, value):
        """"""
        if key not in self._dtypes:
            self.read_types()
        if key not in self._dtypes:
            raise ValueError("Unknown datatype for {} and {}".format(key, value))
        return self._dtypes[key][2](value)
1303605
def _cleanup(self, domains):
        """"""
        for option in domains.values():
            try:
                os.remove(option['pot'])
            except (IOError, OSError):
                # It is not a problem if we can't actually remove the temporary file
                pass
1070728
def Restore(cls, state):
        """"""

        target = SlotIdentifier.FromString(state.get('target'))
        data = base64.b64decode(state.get('data'))
        var_id = state.get('var_id')
        valid = state.get('valid')

        return ConfigEntry(target, var_id, data, valid)
1259066
def restore(self, key, ttl, value):
        """"""
        return self.execute(b'RESTORE', key, ttl, value)
77093
def clean_key_name(self):
        """"""
        key = self.cleaned_data['key_name']
        # Ensure key starts with prefix
        if not key.startswith(self.get_key_prefix()):
            raise forms.ValidationError('Key does not have required prefix.')
        # Ensure key exists
        if not self.get_upload_key():
            raise forms.ValidationError('Key does not exist.')
        return key
1214179
def delete(gandi, fqdn, name, type, force):
    """"""
    domains = gandi.dns.list()
    domains = [domain['fqdn'] for domain in domains]
    if fqdn not in domains:
        gandi.echo('Sorry domain %s does not exist' % fqdn)
        gandi.echo('Please use one of the following: %s' % ', '.join(domains))
        return

    if not force:
        if not name and not type:
            prompt = ("Are you sure to delete all records for domain %s ?" %
                      fqdn)
        elif name and not type:
            prompt = ("Are you sure to delete all '%s' name records for "
                      "domain %s ?" % (name, fqdn))
        else:
            prompt = ("Are you sure to delete all '%s' records of type %s "
                      "for domain %s ?" % (name, type, fqdn))

        proceed = click.confirm(prompt)

        if not proceed:
            return

    result = gandi.dns.del_record(fqdn, name, type)
    gandi.echo('Delete successful.')
    return result
43872
def clean_key(cls, key):
        
        for var_re in cls.VARIABLE_RES:
            key = var_re.sub('#', key)
        return key
952530
def restore(self, url):
        """"""
        self._run(
            [
                "heroku",
                "pg:backups:restore",
                "{}".format(url),
                "DATABASE_URL",
                "--app",
                self.name,
                "--confirm",
                self.name,
            ]
        )
84434
def _recover_public_key(G, order, r, s, i, e):
    

    c = G.curve()

    # 1.1 Let x = r + jn
    x = r + (i // 2) * order

    # 1.3 point from x
    alpha = (x * x * x + c.a() * x + c.b()) % c.p()
    beta = pycoin.ecdsa.numbertheory.modular_sqrt(alpha, c.p())
    y = beta if (beta - i) % 2 == 0 else c.p() - beta

    # 1.4 Check that nR is at infinity
    R = pycoin.ecdsa.ellipticcurve.Point(c, x, y, order)

    rInv = pycoin.ecdsa.numbertheory.inverse_mod(r, order)  # r^-1
    eNeg = -e % order  # -e

    # 1.6 compute Q = r^-1 (sR - eG)
    Q = rInv * (s * R + eNeg * G)
    return Q
1229784
def recover_from_duplicatekeyerror(self, e):
        
        if isinstance(e, DuplicateKeyError):
            try:
                return self.get_by_params(e.process_name, e.timeperiod, e.start_id, e.end_id)
            except LookupError as e:
                self.logger.error('Unable to recover from DuplicateKeyError error due to {0}'.format(e), exc_info=True)
        else:
            msg = 'Unable to recover from DuplicateKeyError due to unspecified UOW primary key'
            self.logger.error(msg)
831048
def re_encrypt(ciphertext_blob, destination_key_id,
               source_encryption_context=None,
               destination_encryption_context=None, grant_tokens=None,
               region=None, key=None, keyid=None, profile=None):
    '''
    
    '''
    conn = _get_conn(
        region=region,
        key=key,
        keyid=keyid,
        profile=profile
    )

    r = {}
    try:
        ciphertext = conn.re_encrypt(
            ciphertext_blob, destination_key_id, source_encryption_context,
            destination_encryption_context, grant_tokens
        )
        r['ciphertext'] = ciphertext
    except boto.exception.BotoServerError as e:
        r['error'] = __utils__['boto.get_error'](e)
    return r
868782
def recoverPubkey(idText, cert, caPubkey):
    
    # Verify types
    assertType(cert, ec1Element)
    assertType(caPubkey, ec1Element)

    # Compute the pubkey
    return _exp(cert, idText)*cert + caPubkey
1012736
def key_absent(name, region=None, key=None, keyid=None, profile=None):
    '''
    
    '''
    ret = {'name': name,
           'result': True,
           'comment': '',
           'changes': {}
           }
    exists = __salt__['boto_ec2.get_key'](name, region, key, keyid, profile)
    if exists:
        if __opts__['test']:
            ret['comment'] = 'The key {0} is set to be deleted.'.format(name)
            ret['result'] = None
            return ret
        deleted = __salt__['boto_ec2.delete_key'](name, region,
                                                  key, keyid,
                                                  profile)
        log.debug('exists is %s', deleted)
        if deleted:
            ret['result'] = True
            ret['comment'] = 'The key {0} is deleted.'.format(name)
            ret['changes']['old'] = name
        else:
            ret['result'] = False
            ret['comment'] = 'Could not delete key {0} '.format(name)
    else:
        ret['result'] = True
        ret['comment'] = 'The key name {0} does not exist'.format(name)
    return ret
208137
def check_key(self, key):
        """"""
        return _check_key(key, allow_unicode_keys=self.allow_unicode_keys,
                          key_prefix=self.key_prefix)