Build certification path to given target.

@param Certificate $target Target end-entity certificate
@param CertificateBundle $trust_anchors List of trust anchors
@param CertificateBundle|null $intermediate Optional intermediate
certificates
@return self
512244
public static function toTarget(Certificate $target,
        CertificateBundle $trust_anchors, CertificateBundle $intermediate = null): self
    {
        $builder = new CertificationPathBuilder($trust_anchors);
        return $builder->shortestPathToTarget($target, $intermediate);
    }
57244
public function setLoginTarget(CNabuSiteTarget $nb_site_target)
    {
        $nb_site = $this->nb_engine->getHTTPServer()->getSite();
        if ($nb_site instanceof CNabuSite) {
            return $nb_site->setLoginTarget($nb_site_target);
        } else {
            throw new ENabuCoreException(ENabuCoreException::ERROR_SITE_NOT_INSTANTIATED);
        }
    }
546953
public function updateCertificate($name, $certificate, $privateKey, $intermediates)
    {
        $this->notAvailableInVersions(1);

        return $this->send('update_certificate', $name, $certificate, $privateKey, $intermediates);
    }
605726
public function setLoginTarget(CNabuDataObject $nb_site_target)
    {
        $this->setLoginTargetUseURI(CNabuSiteTargetLink::USE_URI_TRANSLATED);
        $this->transferValue($nb_site_target, 'nb_site_target_id', 'nb_site_login_target_id');

        return $this;
    }
932560
public function mapTarget(PersistenceTarget $target): Target
    {
        try {
            $targetType = $this->targetTypeRegistry->getTargetType(
                $target->type
            );
        } catch (TargetTypeException $e) {
            $targetType = new NullTargetType();
        }

        $targetData = [
            'id' => $target->id,
            'status' => $target->status,
            'ruleId' => $target->ruleId,
            'targetType' => $targetType,
            'value' => $target->value,
        ];

        return Target::fromArray($targetData);
    }
1032352
public function cert($path, $password = null)
    {
        $options = ['cert' => [$path, $password]];

        $this->options += $options;

        return $this;
    }
17379
protected function setTarget($target)
    {
        if ('*' == $target) {
            $this->target = $target;

            return $this;
        }
        if (is_string($target)) {
            $target = new Uri($target);
        }

        if (! $target instanceof UriInterface) {
            throw new InvalidArgumentException(sprintf(
                'Invalid target provided; must be an string or instance of '
                . '"%s", "%s" received.',
                'Psr\\Http\\Message\\UriInterface',
                is_object($target) ? get_class($target) : gettype($target)
            ));
        }
        $this->target = (string) $target->withFragment('');

        return $this;
    }
290354
private static TrustManager createNaiveTrustManager() {
        return new X509TrustManager() {
            public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
            }

            public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
            }

            public X509Certificate[] getAcceptedIssuers() {
                return null;
            }
        };
    }
289385
protected static function createLink( $source, $target )
	{
		if( file_exists( $target ) === false && @symlink( $source, $target ) === false )
		{
			$source = realpath( __DIR__ . '/' . $source );

			if( symlink( $source, $target ) === false ) {
				throw new \RuntimeException( sprintf( 'Failed to create symlink for "%1$s" to "%2$s"', $source, $target ) );
			}
		}
	}
1242247
public function setSiteTargetCTAId(int $nb_site_target_cta_id) : CNabuDataObject
    {
        if ($nb_site_target_cta_id === null) {
            throw new ENabuCoreException(
                    ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
                    array("\$nb_site_target_cta_id")
            );
        }
        $this->setValue('nb_site_target_cta_id', $nb_site_target_cta_id);
        
        return $this;
    }
1110352
protected function _deleteMappings(Certificate $cert, ValidatorState $state)
    {
        $idps = $cert->tbsCertificate()
            ->extensions()
            ->policyMappings()
            ->issuerDomainPolicies();
        // delete each node of depth i in the valid_policy_tree
        // where ID-P is the valid_policy
        foreach ($this->_nodesAtDepth($state->index()) as $node) {
            if (in_array($node->validPolicy(), $idps)) {
                $node->remove();
            }
        }
        $this->_pruneTree($state->index() - 1);
    }
1236110
public function addCertification(\Librinfo\SeedBatchBundle\Entity\Certification $certifications)
    {
        $this->certifications[] = $certifications;

        return $this;
    }
534339
public function setSiteTargetId(int $nb_site_target_id) : CNabuDataObject
    {
        if ($nb_site_target_id === null) {
            throw new ENabuCoreException(
                    ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
                    array("\$nb_site_target_id")
            );
        }
        $this->setValue('nb_site_target_id', $nb_site_target_id);
        
        return $this;
    }
1249223
public function processMappings(ValidatorState $state, Certificate $cert): ValidatorState
    {
        $tree = clone $this;
        if ($state->policyMapping() > 0) {
            $tree->_applyMappings($cert, $state);
        } else if ($state->policyMapping() == 0) {
            $tree->_deleteMappings($cert, $state);
        }
        // if whole tree is pruned
        if (!$tree->_root) {
            return $state->withoutValidPolicyTree();
        }
        return $state->withValidPolicyTree($tree);
    }
932333
public RequestTemplate target(String target) {
    /* target can be empty */
    if (Util.isBlank(target)) {
      return this;
    }

    /* verify that the target contains the scheme, host and port */
    if (!UriUtils.isAbsolute(target)) {
      throw new IllegalArgumentException("target values must be absolute.");
    }
    if (target.endsWith("/")) {
      target = target.substring(0, target.length() - 1);
    }
    try {
      /* parse the target */
      URI targetUri = URI.create(target);

      if (Util.isNotBlank(targetUri.getRawQuery())) {
        /*
         * target has a query string, we need to make sure that they are recorded as queries
         */
        this.extractQueryTemplates(targetUri.getRawQuery(), true);
      }

      /* strip the query string */
      this.target = targetUri.getScheme() + "://" + targetUri.getAuthority() + targetUri.getPath();
      if (targetUri.getFragment() != null) {
        this.fragment = "#" + targetUri.getFragment();
      }
    } catch (IllegalArgumentException iae) {
      /* the uri provided is not a valid one, we can't continue */
      throw new IllegalArgumentException("Target is not a valid URI.", iae);
    }
    return this;
  }
745550
public function useCert($certType, $certPath, $keyPath)
    {
        switch ($certType) {
            case self::CERT_TYPE_PEM:
            case self::CERT_TYPE_DER:
            case self::CERT_TYPE_ENG:
                $this->useCert      = true;
                $this->sslCertType  = $certType;
                $this->sslKeyType   = $certType;

                $this->sslCert      = $certPath;
                $this->sslKey       = $keyPath;
                break;
            default:
                $this->useCert = false;
                break;
        }
    }
1023729
function setTarget($target = null, $preserveHost = true)
    {
        $target = (string) $target;
        if (empty($target) && $target !== "0")
            $target = '/';
        
        // validate uri
        if (parse_url($target) === false)
        {
            $target = rawurlencode($target);

            /*
            throw new \InvalidArgumentException(sprintf(
                'Malformed URI: (%s).'
                , $target
            ));
            */
        }

        
        $this->target_uri = (string) $target;
        return $this;
    }