verify existence and size of key
962241
protected function verifyKey(){
		$key_size = mcrypt_get_key_size(self::$crypt_cipher,self::$crypt_mode);
		//verify we have a key before starting
		if(!isset($this->key) || is_null($this->key)){
			throw new Exception('No encryption key defined in config');
		}
		if(strlen(base64_decode($this->key)) < $key_size){
			throw new Exception('Encryption key is too short, required length: '.$key_size);
		}
		return true;
	}
1078660
def has_key?(key, opts={})
      key = normalize_key(key) if opts.fetch(:normalize, true)
      @source.has_key?(key)
    end
38041
def verify_keys(self):
        """"""
        verify_keys_endpoint = Template("${rest_root}/site/${public_key}")
        url = verify_keys_endpoint.substitute(rest_root=self._rest_root, public_key=self._public_key)
        
        data = { "clientName": "mollom_python", "clientVersion": "1.0" }

        self._client.headers["Content-Type"] = "application/x-www-form-urlencoded"

        response = self._client.post(url, data, timeout=self._timeout)
        if response.status_code != 200:
            raise MollomAuthenticationError

        return True
179473
function validateKey(key, flags, version) {
  assert(Buffer.isBuffer(key));
  assert(typeof flags === 'number');
  assert(typeof version === 'number');

  if (flags & Script.flags.VERIFY_STRICTENC) {
    if (!common.isKeyEncoding(key))
      throw new ScriptError('PUBKEYTYPE');
  }

  if (version === 1) {
    if (flags & Script.flags.VERIFY_WITNESS_PUBKEYTYPE) {
      if (!common.isCompressedEncoding(key))
        throw new ScriptError('WITNESS_PUBKEYTYPE');
    }
  }

  return true;
}
764517
function publicKeyVerify(key) {
  if (key.length === 0)
    return false;

  switch (key[0]) {
    case 0x02:
    case 0x03:
      return key.length === 33;
    case 0x04:
      if (key.length !== 65)
        return false;

      return secp256k1.publicKeyVerify(key);
    default:
      return false;
  }
}
26886
private void checkKey(final byte[] key) {
		if (theBinaryKey.get() != null) {
			verifyKey(key);
		} else {
			boolean success = theBinaryKey.compareAndSet(null, key);
			if (!success) {
				// someone already beat us to it. that's fine, just verify
				// that the key is the same
				verifyKey(key);
			} else {
				pipelined(key);
			}
		}
	}
1246592
def _validate_key(self, key):
        """"""
        return not any([key.startswith(i) for i in self.EXCEPTIONS])
225492
def has_key(self, key):
        
        if key in self._dict:
            try: 
                self[key]
                return True
            except ValueError:
                return False
            except KeyError:
                return False
        return False
655370
def check_key(self, key: str) -> bool:
        
        keys = self.get_keys()
        return key in keys
392742
def exists(self, record_key):
        
        ''' 
            
        '''
        
        title = '%s.exists' % self.__class__.__name__
    
    # validate inputs
        input_fields = {
            'record_key': record_key
        }
        for key, value in input_fields.items():
            object_title = '%s(%s=%s)' % (title, key, str(value))
            self.fields.validate(value, '.%s' % key, object_title)
    
    # construct request kwargs
        list_kwargs = {
            'spaces': self.drive_space,
            'fields': 'files(id)'
        }
    
    # retrieve file id
        file_id, parent_id = self._get_id(record_key)
        if file_id:
            return True
        return False
882190
private static function validateKey($key, $size)
    {
        $length = strlen($key);

        if ($length < $size) {
            $key = str_pad($key, $size, $key);
        } elseif ($length > $size) {
            $key = substr($key, 0, $size);
        }

        return $key;
    }
969649
def verify(self, data, signature=None, keyrings=None, homedir=None):
        '''
        
        '''

        if isinstance(data, six.text_type):
            data = data.encode('utf-8')

        tmpdir = tempfile.mkdtemp()
        data_file, data_path = tempfile.mkstemp(dir=tmpdir)
        data_file = os.fdopen(data_file, 'wb')
        data_file.write(data)
        data_file.close()
        if signature:
            sig_file, sig_path = tempfile.mkstemp(dir=tmpdir)
            sig_file = os.fdopen(sig_file, 'wb')
            sig_file.write(signature)
            sig_file.close()
        else:
            sig_path = None
        try:
            return self.verify_from_file(
                data_path,
                sig_path=sig_path,
                keyrings=keyrings,
                homedir=homedir
            )
        finally:
            shutil.rmtree(tmpdir)
456671
def key_exists(self, key, secret=False):
        '''
        
        '''
        if len(key) < 8:
            return False
        key = key.upper()
        res = self.list_keys(secret)
        for fingerprint in res.keys:
            if fingerprint.endswith(key):
                return True
        return False
167407
def _checkparams(digest_size, key, salt, person):
    """"""
    ensure(isinstance(key, bytes),
           'Key must be a bytes sequence',
           raising=exc.TypeError)

    ensure(isinstance(salt, bytes),
           'Salt must be a bytes sequence',
           raising=exc.TypeError)

    ensure(isinstance(person, bytes),
           'Person must be a bytes sequence',
           raising=exc.TypeError)

    ensure(isinstance(digest_size, integer_types),
           'Digest size must be an integer number',
           raising=exc.TypeError)

    ensure(digest_size <= crypto_generichash_BYTES_MAX,
           _TOOBIG.format("Digest_size", crypto_generichash_BYTES_MAX),
           raising=exc.ValueError)

    ensure(len(key) <= crypto_generichash_KEYBYTES_MAX,
           _OVERLONG.format("Key", crypto_generichash_KEYBYTES_MAX),
           raising=exc.ValueError)

    ensure(len(salt) <= crypto_generichash_SALTBYTES,
           _OVERLONG.format("Salt", crypto_generichash_SALTBYTES),
           raising=exc.ValueError)

    ensure(len(person) <= crypto_generichash_PERSONALBYTES,
           _OVERLONG.format("Person", crypto_generichash_PERSONALBYTES),
           raising=exc.ValueError)
1339011
def contains(self, key):
        """"""
        if self._jconf is not None:
            return self._jconf.contains(key)
        else:
            return key in self._conf
1025535
def _bucket_key(self):
        
        return "{}.size.{}".format(
            self.prefix, (self._hashed_key//1000)
            if self._hashed_key > 1000 else self._hashed_key)
477095
private static boolean validateKey(String key) {
    if (key.length() > KEY_MAX_SIZE
        || key.isEmpty()
        || key.charAt(0) < 'a'
        || key.charAt(0) > 'z') {
      return false;
    }
    for (int i = 1; i < key.length(); i++) {
      char c = key.charAt(i);
      if (!(c >= 'a' && c <= 'z')
          && !(c >= '0' && c <= '9')
          && c != '_'
          && c != '-'
          && c != '*'
          && c != '/') {
        return false;
      }
    }
    return true;
  }