Verify a public key (no hybrid keys allowed).
@param {Buffer} key
@returns {Boolean}
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;
  }
}
1225756
function getkey (key) {
    var parsedKey = Number(key)

    return (
      isNaN(parsedKey) ||
      key.indexOf('.') !== -1 ||
      opts.object
    ) ? key
      : parsedKey
  }
276946
private static boolean Verify(InputStream isSignature, InputStream isMessage, InputStream isPublicKey) throws LRException
    {
		// Get the public key ring collection from the public key input stream
		PGPPublicKeyRingCollection pgpRings = null;
		
		try
		{
			 pgpRings = new PGPPublicKeyRingCollection(PGPUtil.getDecoderStream(isPublicKey));
		}
		catch (Exception e)
		{
			throw new LRException(LRException.INVALID_PUBLIC_KEY);
		}
	
		// Add the Bouncy Castle security provider
		Security.addProvider(new BouncyCastleProvider());
		
		// Build an output stream from the message for verification
		boolean verify = false;
		int ch;
		ByteArrayOutputStream bOut = new ByteArrayOutputStream();
		ArmoredInputStream aIn  = null;
		
		try
		{
			aIn = new ArmoredInputStream(isMessage);
			// We are making no effort to clean the input for this example
			// If this turns into a fully-featured verification utility in a future version, this will need to be handled
			while ((ch = aIn.read()) >= 0 && aIn.isClearText())
			{
				bOut.write((byte)ch);
			}
			
			bOut.close();
		}
		catch (Exception e)
		{
			throw new LRException(LRException.MESSAGE_INVALID);
		}
		
		// Build an object factory from the signature input stream and try to get an object out of it
		Object o = null;
		try
		{
			PGPObjectFactory pgpFact = new PGPObjectFactory(PGPUtil.getDecoderStream(isSignature));
			o = pgpFact.nextObject();
		}
		catch (Exception e)
		{
			throw new LRException(LRException.SIGNATURE_INVALID);
		}
			
		// Check if the object we fetched is a signature list and if it is, get the signature and use it to verfiy
		try
		{
			if (o instanceof PGPSignatureList)
			{
				PGPSignatureList list = (PGPSignatureList)o;
				if (list.size() > 0)
				{
					PGPSignature sig = list.get(0);
					
					PGPPublicKey publicKey = pgpRings.getPublicKey(sig.getKeyID());
					sig.init(new JcaPGPContentVerifierBuilderProvider().setProvider("BC"), publicKey);
					
					sig.update(bOut.toByteArray());
					verify = sig.verify();
				}
			}
		}
		catch (Exception e)
		{
			throw new LRException(LRException.SIGNATURE_NOT_FOUND);
		}
		
		return verify;
	}
958575
public boolean containsKey(Key<?> key) {
    for (int i = 0; i < size; i++) {
      if (bytesEqual(key.asciiName(), name(i))) {
        return true;
      }
    }
    return false;
  }
533046
function isRevalidatingCacheKey (ctx, currentEntryKey) {
  const revalidatingCache = ctx.locals.revalidatingCache
  return (revalidatingCache && revalidatingCache.entryKey) === currentEntryKey
}
146120
function privateToPublic(privateKey) {
  if (typeof privateKey !== 'string') { throw new Error(`[ethjs-account] private key must be type String, got ${typeof(privateKey)}`); }
  if (!privateKey.match(/^(0x)?[0-9a-fA-F]{64}$/)) { throw new Error('[ethjs-account] private key must be an alphanumeric hex string that is 32 bytes long.'); }

  const privateKeyBuffer = new Buffer(stripHexPrefix(privateKey), 'hex');
  return (new Buffer(secp256k1.keyFromPrivate(privateKeyBuffer).getPublic(false, 'hex'), 'hex')).slice(1);
}
1243413
function ECDSA(keys /* { publicKey: CryptoKey, privateKey?: CryptoKey } */) {
    if (keys.publicKey) this.publicKey = keys.publicKey
    if (keys.privateKey) this.privateKey = keys.privateKey
  }
2873
public boolean containsKey(Object key) {
        return isValidKey(key) && vals[((Enum<?>)key).ordinal()] != null;
    }
521987
function checksig(msg, sig, key) {
  return secp256k1.verify(msg, sig.slice(0, -1), key);
}
1081418
def verify_key (self, acctname=None, tokenkey=None):
        ''' 
        '''
        if (re.match( r'^[A-Za-z0-9]+$', tokenkey)
                        and tokenkey is not None
                        and len(tokenkey) <= 64
                        and len(tokenkey) >= 16):
            pubkey = PrivateKey(tokenkey).pubkey or 0
            pubkey2 = self.account(acctname)
            if (str(pubkey) 
                    == str(pubkey2['posting']['key_auths'][0][0])):
                self.privatekey = tokenkey
                self.refreshtoken = None
                self.accesstoken = None
                return True
            else:
                return False
        elif (re.match( r'^[A-Za-z0-9\-\_\.]+$', tokenkey)
                        and tokenkey is not None
                        and len(tokenkey) > 64):
            self.privatekey = None
            self.accesstoken = self.connect.get_token(tokenkey)
            if self.accesstoken:
                self.username = self.connect.username
                self.refreshtoken = self.connect.refresh_token
                return True
            else:
                return False
        else:
            return False
874878
function fingerprint(key) {
    assert.string(key, 'ssh_key');

    var k = sshpk.parseKey(key, 'ssh');
    return (k.fingerprint('md5').toString('hex'));
  }
194518
function SigCacheEntry(sig, key) {
  this.sig = Buffer.from(sig);
  this.key = Buffer.from(key);
}
806897
public function isValidPublicKey($key)
    {
        $data = ['public_integration_key' => $key];
        try {
            $response = $this->getHttpClient()->validatePublicKey($data);

            return $response['status'] === 'SUCCESS';
        } catch (\Exception $e) {
            if ($e->getCode() === 409) {
                return false;
            }

            throw $e;
        }
    }
1234989
function getkey(key) {
        var parsedKey = Number(key);

        return (isNaN(parsedKey) || key.indexOf('.') !== -1)? key : parsedKey;
    }
1337231
def verify(self):
        """"""
        if not self.public_key:
            self.fetch_public_key()
        data = self.doc.find(".//{http://salmon-protocol.org/ns/magic-env}data").text
        sig = self.doc.find(".//{http://salmon-protocol.org/ns/magic-env}sig").text
        sig_contents = '.'.join([
            data,
            b64encode(b"application/xml").decode("ascii"),
            b64encode(b"base64url").decode("ascii"),
            b64encode(b"RSA-SHA256").decode("ascii")
        ])
        sig_hash = SHA256.new(sig_contents.encode("ascii"))
        cipher = PKCS1_v1_5.new(RSA.importKey(self.public_key))
        if not cipher.verify(sig_hash, urlsafe_b64decode(sig)):
            raise SignatureVerificationError("Signature cannot be verified using the given public key")
404129
function privKeyToPubKey(privKey, toCompressed) {
  toCompressed = toCompressed || false;

  const pkBuffer = Buffer.from(privKey, 'hex');
  var publicKey = secp256k1.publicKeyCreate(pkBuffer, toCompressed);
  return publicKey.toString('hex');
}
1100596
def is_valid_key(key):
    

    if PY3 and isinstance(key, bytes):
        raise TypeError("needs to be str not bytes")

    for c in key:
        if c < " " or c > "}" or c == "=":
            return False
    else:
        return bool(key)