@param string|string[] $fingerprint

@throws InvalidArgumentException When an invalid fingerprint is passed
191298
private static function normalizePeerFingerprint($fingerprint): array
    {
        if (\is_string($fingerprint)) {
            switch (\strlen($fingerprint = str_replace(':', '', $fingerprint))) {
                case 32: $fingerprint = ['md5' => $fingerprint]; break;
                case 40: $fingerprint = ['sha1' => $fingerprint]; break;
                case 44: $fingerprint = ['pin-sha256' => [$fingerprint]]; break;
                case 64: $fingerprint = ['sha256' => $fingerprint]; break;
                default: throw new InvalidArgumentException(sprintf('Cannot auto-detect fingerprint algorithm for "%s".', $fingerprint));
            }
        } elseif (\is_array($fingerprint)) {
            foreach ($fingerprint as $algo => $hash) {
                $fingerprint[$algo] = 'pin-sha256' === $algo ? (array) $hash : str_replace(':', '', $hash);
            }
        } else {
            throw new InvalidArgumentException(sprintf('Option "peer_fingerprint" must be string or array, %s given.', \gettype($fingerprint)));
        }

        return $fingerprint;
    }
1019309
public function registerProcessor(string $class, string $processorClass): void
    {
        if (! (new \ReflectionClass($processorClass))->implementsInterface(ProcessorInterface::class)) {
            throw InvalidArgumentException::create(InvalidArgumentException::INVALID_PROCESSOR_INTERFACE_CLASS, $processorClass);
        }

        if (! isset($this->processors[$class])) {
            $this->processors[$class] = $processorClass;
        } elseif (! is_array($this->processors[$class])) {
            $this->processors[$class] = [$this->processors[$class], $processorClass];
        } else {
            $this->processors[$class][] = $processorClass;
        }
    }
424371
public function getFingerprint(string $algorithm = 'SHA1'): Hash {
        $value = openssl_x509_fingerprint(
            $this->getHandle(),
            $algorithm,
            TRUE
        );
        if(!$value) {
            throw new RuntimeException(OpenSSL::getLastError());
        }
        $hash = new Hash($algorithm);
        $hash->setValue($value);
        return $hash;
    }
412441
public function getByFingerprint($fingerprint)
    {
        $key = $this->adapter->get(sprintf('%s/account/keys/%s', $this->endpoint, $fingerprint));

        $key = json_decode($key);

        return new KeyEntity($key->ssh_key);
    }
1087628
public function setPadding($padding = 0) {
		$padding = $this->parseSizes($padding);

		foreach ($padding as $side => $value) {
			if (! is_int($value) || $value < 0) {
				throw new InvalidArgumentException(sprintf(
					'Invalid %s padding: "%s". Must be a positive integer value.',
					$side, $value
				));
			}

			$this->padding[$side] = $value;
		}
	}
828462
public static function setIdentifierName(string $identifier): void
    {
        if (empty($identifier)) {
            throw new InvalidArgumentException("Identifier shouldn't be empty.");
        } elseif (\in_array($identifier, ['password'])) {
            throw new InvalidArgumentException("Identifier [{$identifier}] is not allowed!");
        }

        static::$identifier = $identifier;
    }
1122833
public function initSettings(array $settings)
    {
        if (!isset($settings['tcp'])) {
            throw new \InvalidArgumentException('Tcp startup parameter is not configured，settings=' . \json_encode($settings));
        }

        if (!isset($settings['http'])) {
            throw new \InvalidArgumentException('HTTP startup parameters is not configured, settings=' . \json_encode($settings));
        }

        if (!isset($settings['server'])) {
            throw new \InvalidArgumentException('server startup parameters is not configured, settings=' . \json_encode($settings));
        }

        if (!isset($settings['setting'])) {
            throw new \InvalidArgumentException('"setting" parameters is not configured, settings=' . \json_encode($settings));
        }

        foreach ($settings['setting'] as $key => $value) {
            // path alias
            if ($value && \is_string($value) && $value[0] === '@') {
                $settings['setting'][$key] = App::getAlias($value);
            }
        }

        $this->setting = $settings['setting'];
        $this->tcpSetting = $settings['tcp'];
        $this->httpSetting = $settings['http'];
        $this->serverSetting = $settings['server'];

        // fix bug must to int
        if (isset($this->setting['task_ipc_mode'])) {
            $this->setting['task_ipc_mode'] = (int)$this->setting['task_ipc_mode'];
        }
        if (isset($this->setting['message_queue_key'])) {
            $this->setting['message_queue_key'] = (int)$this->setting['message_queue_key'];
        }
    }
265118
public function setUsername(string $username): void
	{
		if (Strings::match($username, '/[^A-Za-z0-9_]/')) {
			throw new InvalidArgumentException('Username contains invalid characters');
		}

		/* @var $repository UsersRepository */
		$repository = $this->getRepository();
		$user = $repository->getByUsername($username);
		if ($user !== null && $user !== $this) {
			throw new UniqueConstraintViolationException("Username '$username' exists");
		}
		$this->username = $username;
	}
973135
private function validate($hash, string $validation_regex): void {
    if(!is_string($hash) || preg_match($validation_regex, $hash) === 0) {
      throw new InvalidArgumentException('Expected hash, but got ' . var_export($hash, true) . '] instead');
    }
  }
928213
protected function setIp($ip)
    {
        if (filter_var($ip, FILTER_VALIDATE_IP) === false) {
            throw new \InvalidArgumentException('$ip must be correct');
        }

        $this->ip = $ip;
    }
546947
public function valid_fingerprint( $fingerprint = null )
	{
		if ( is_null( $fingerprint ) )
		{
			$fingerprint = \CCIn::get( \ClanCats::$config->get( 'session.default_fingerprint_parameter' ), false );
		}
		
		return $this->fingerprint === $fingerprint;
	}
1182059
public void updateFingerprint (String retina_name, String fingerprint_id, String name) throws ApiException {
        // verify required params are set
        if(retina_name == null || fingerprint_id == null || name == null ) {
             throw new ApiException(400, "missing required params");
        }
        // create path and map variables
        String path = "/fingerprints/update".replaceAll("\\{format\\}","json");

        // query params
        Map<String, String> queryParams = new HashMap<String, String>();
        Map<String, String> headerParams = new HashMap<String, String>();

        if(!"null".equals(String.valueOf(retina_name)))
            queryParams.put("retina_name", String.valueOf(retina_name));
        if(!"null".equals(String.valueOf(fingerprint_id)))
            queryParams.put("fingerprint_id", String.valueOf(fingerprint_id));
        if(!"null".equals(String.valueOf(name)))
            queryParams.put("name", String.valueOf(name));
        String contentType = "application/json";

        try {
            Object response = apiInvoker.invokeAPI(basePath, path, "PUT", queryParams
                , null, headerParams, contentType);
            if(response != null) {
                if (response instanceof String) {
                        return ;
                }
                else if (response instanceof java.io.ByteArrayInputStream) {
                        return ;
                }
                
            }
            else {
                return ;
            }
        } catch (ApiException ex) {
            if(ex.getCode() == 404) {
            	return ;
            }
            else {
                throw ex;
            }
        }
        }
187876
protected function isValidFile($file)
    {
        if (!is_file($file) || !is_readable($file)) {
            throw new \InvalidArgumentException(sprintf(
                    'File "%s" Is Not Readable', (string) $file
            ));
        }
    }
410598
public function scheduleForInsert(ClassMetadata $class, object $document) : void
    {
        $oid = spl_object_hash($document);

        if (isset($this->documentUpdates[$oid])) {
            throw new InvalidArgumentException('Dirty document can not be scheduled for insertion.');
        }
        if (isset($this->documentDeletions[$oid])) {
            throw new InvalidArgumentException('Removed document can not be scheduled for insertion.');
        }
        if (isset($this->documentInsertions[$oid])) {
            throw new InvalidArgumentException('Document can not be scheduled for insertion twice.');
        }

        $this->documentInsertions[$oid] = $document;

        if (! isset($this->documentIdentifiers[$oid])) {
            return;
        }

        $this->addToIdentityMap($document);
    }
1290977
public void clearFingerprints() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "clearFingerprints");
        getHdr2().setChoiceField(JsHdr2Access.FINGERPRINTS, JsHdr2Access.IS_FINGERPRINTS_EMPTY);
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "clearFingerprints");
    }
618496
protected function keyExistsByFingerprint($fingerprint)
    {
        foreach ($this->api()->getClient()->getSshKeys() as $existingKey) {
            if ($existingKey->fingerprint === $fingerprint) {
                return true;
            }
        }

        return false;
    }
1268414
public function unserialize($serialized)
	{
		list(	$this->pemFile,
				$this->passphrase,
				$this->endpointEnv,

				$this->isValidated,
				$this->description,
				$this->validFrom,
				$this->validTo) = unserialize($serialized);

		// Fingerprint should be recalculated
		$this->fingerprint = null;
	}