Return the HTML code for custom simple tag _ACT

@param Certificate $certificatePath Certificate (as per the GEDCOM)
@param string|null $sid Linked Source ID, if it exists
180950
protected function getDisplay_ACT(Certificate $certificate, $sid = null){    
        $html = '';
        if($certificate){
            $certificate->setSource($sid);
            $html = $certificate->displayImage('icon');
        }
        return $html;
    }
720408
public static String getCertIdByKeyStoreMap(String certPath, String certPwd) {
		if (!keyStoreMap.containsKey(certPath)) {
			// 缓存中未查询到,则加载RSA证书
			loadSignCert(certPath, certPwd);
		}
		return getCertIdIdByStore(keyStoreMap.get(certPath));
	}
988169
protected function processAuthor(PHP_CodeSniffer_File $phpcsFile, array $tags)
	{
		$tokens = $phpcsFile->getTokens();

		foreach ($tags as $tag)
		{
			if ($tokens[($tag + 2)]['code'] !== T_DOC_COMMENT_STRING)
			{
				// No content.
				continue;
			}

			$content = $tokens[($tag + 2)]['content'];
			$local   = '\da-zA-Z-_+';

			// Dot character cannot be the first or last character in the local-part.
			$localMiddle = $local . '.\w';

			if (preg_match(
				'/^([^<]*)\s+<([' . $local . ']([' . $localMiddle . ']*[' . $local . '])*@[\da-zA-Z][-.\w]*[\da-zA-Z]\.[a-zA-Z]{2,7})>$/',
				$content
			) === 0)
			{
				$error = 'Content of the @author tag must be in the form "Display Name <username@example.com>"';
				$phpcsFile->addError($error, $tag, 'InvalidAuthors');
			}
		}
	}
399306
static function createRequestUri($servicePath, $restPath, $params) {
    $requestUrl = $servicePath . $restPath;
    $uriTemplateVars = array();
    $queryVars = array();
    foreach ($params as $paramName => $paramSpec) {
      // Discovery v1.0 puts the canonical location under the 'location' field.
      if (! isset($paramSpec['location'])) {
        $paramSpec['location'] = $paramSpec['restParameterType'];
      }

      if ($paramSpec['type'] == 'boolean') {
        $paramSpec['value'] = ($paramSpec['value']) ? 'true' : 'false';
      }
      if ($paramSpec['location'] == 'path') {
        $uriTemplateVars[$paramName] = $paramSpec['value'];
      } else {
        if (isset($paramSpec['repeated']) && is_array($paramSpec['value'])) {
          foreach ($paramSpec['value'] as $value) {
            $queryVars[] = $paramName . '=' . rawurlencode($value);
          }
        } else {
          $queryVars[] = $paramName . '=' . rawurlencode($paramSpec['value']);
        }
      }
    }

    if (count($uriTemplateVars)) {
      $uriTemplateParser = new URI_Template_Parser($requestUrl);
      $requestUrl = $uriTemplateParser->expand($uriTemplateVars);
    }
    //FIXME work around for the the uri template lib which url encodes
    // the @'s & confuses our servers.
    $requestUrl = str_replace('%40', '@', $requestUrl);

    if (count($queryVars)) {
      $requestUrl .= '?' . implode($queryVars, '&');
    }

    return $requestUrl;
  }
696954
private static boolean verifyCertificateChain(X509Certificate cert){
		
		if ( null == cert) {
			LogUtil.writeErrorLog("cert must Not null");
			return false;
		}
		
		X509Certificate middleCert = CertUtil.getMiddleCert();
		if (null == middleCert) {
			LogUtil.writeErrorLog("middleCert must Not null");
			return false;
		}
		
		X509Certificate rootCert = CertUtil.getRootCert();
		if (null == rootCert) {
			LogUtil.writeErrorLog("rootCert or cert must Not null");
			return false;
		}
		
		try {
		
	        X509CertSelector selector = new X509CertSelector();
	        selector.setCertificate(cert);
	        
	        Set<TrustAnchor> trustAnchors = new HashSet<TrustAnchor>();
	        trustAnchors.add(new TrustAnchor(rootCert, null));
	        PKIXBuilderParameters pkixParams = new PKIXBuilderParameters(
			        trustAnchors, selector);
	
	        Set<X509Certificate> intermediateCerts = new HashSet<X509Certificate>();
	        intermediateCerts.add(rootCert);
	        intermediateCerts.add(middleCert);
	        intermediateCerts.add(cert);
	        
	        pkixParams.setRevocationEnabled(false);
	
	        CertStore intermediateCertStore = CertStore.getInstance("Collection",
	                new CollectionCertStoreParameters(intermediateCerts), "BC");
	        pkixParams.addCertStore(intermediateCertStore);
	
	        CertPathBuilder builder = CertPathBuilder.getInstance("PKIX", "BC");
	        
        	@SuppressWarnings("unused")
			PKIXCertPathBuilderResult result = (PKIXCertPathBuilderResult) builder
                .build(pkixParams);
			LogUtil.writeLog("verify certificate chain succeed.");
			return true;
        } catch (java.security.cert.CertPathBuilderException e){
			LogUtil.writeErrorLog("verify certificate chain fail.", e);
		} catch (Exception e) {
			LogUtil.writeErrorLog("verify certificate chain exception: ", e);
		}
		return false;
	}
76483
private function _getCertificateFromCertifcatePath($certificatePath)
    {
        $this->_validateUrl($certificatePath); //ADDED EXTRA CHECK
        try {
            $cert = file_get_contents($certificatePath);
        } catch (Exception $ex) {
            throw new OffAmazonPaymentsNotifications_InvalidMessageException(
                "Error with signature validation - unable to request signing ".
                "certificate at " . $certificatePath, null, $ex
            );
        }

        if ($cert === false) {
            throw new OffAmazonPaymentsNotifications_InvalidMessageException(
                "Error with signature validation - unable to request signing ".
                "certificate at " . $certificatePath
            );
        }

        return $cert;
    }
586534
public static String getPublicKey(Map<String, String> params, String certPath, String certPassword) {
		return WxPayApi.doPostSSL(GETPUBLICKEY_URL, params, certPath, certPassword);
	}
766702
public void invoke(X509Certificate cert, GSIConstants.CertificateType certType) throws CertPathValidatorException {
        if (proxyCertValidator.getIdentityCertificate() == null) {
            // check if limited
            if (ProxyCertificateUtil.isLimitedProxy(certType)) {
                proxyCertValidator.setLimited(true);

                if (proxyCertValidator.isRejectLimitedProxy()) {
                    throw new CertPathValidatorException(
                            "Limited proxy not accepted");
                }
            }

            // set the identity cert
            if (!ProxyCertificateUtil.isImpersonationProxy(certType)) {
                proxyCertValidator.setIdentityCert(cert);
            }
        }
    }
482251
private void doCustomServerIdentityCheck(X509Certificate cert) throws CertificateException{
		if (EndpointIdentificationAlgorithm.APIS == identityAlg) {
			APINameChecker.verifyAndThrow(trustedNameSet, cert);
		}
	}
205324
private void updateState(X509Certificate currCert)
        throws CertPathValidatorException
    {
        PublicKey cKey = currCert.getPublicKey();
        if (debug != null) {
            debug.println("BasicChecker.updateState issuer: " +
                currCert.getIssuerX500Principal().toString() + "; subject: " +
                currCert.getSubjectX500Principal() + "; serial#: " +
                currCert.getSerialNumber().toString());
        }
        if (PKIX.isDSAPublicKeyWithoutParams(cKey)) {
            // cKey needs to inherit DSA parameters from prev key
            cKey = makeInheritedParamsKey(cKey, prevPubKey);
            if (debug != null) debug.println("BasicChecker.updateState Made " +
                                             "key with inherited params");
        }
        prevPubKey = cKey;
        prevSubject = currCert.getSubjectX500Principal();
    }
174417
public void invoke(X509Certificate cert, GSIConstants.CertificateType certType) throws CertPathValidatorException {
        if (!requireSigningPolicyCheck(certType)) {
            return;
        }
        X500Principal caPrincipal = cert.getIssuerX500Principal();
        SigningPolicy policy;
        try {
            policy = this.policyStore.getSigningPolicy(caPrincipal);
        } catch (CertStoreException e) {
            throw new CertPathValidatorException(e);
        }

        if (policy == null) {
            throw new CertPathValidatorException("No signing policy for " + cert.getIssuerDN());
        }

        boolean valid = policy.isValidSubject(cert.getSubjectX500Principal());

        if (!valid) {
            throw new CertPathValidatorException("Certificate " + cert.getSubjectDN()
                    + " violates signing policy for CA " + caPrincipal.getName());
        }
    }
499897
public function uploadeMedia($sSourcePath, $sDestPath, $blCreateThumbs = false)
    {
        $this->createDirs();

        $sThumbName = '';
        $sFileName = basename($sDestPath);
        $iFileCount = 0;

        while (file_exists($sDestPath)) {
            $aFileParts = explode('.', $sFileName);
            $aFileParts = array_reverse($aFileParts);

            $sFileExt = $aFileParts[0];
            unset($aFileParts[0]);

            $sBaseName = implode('.', array_reverse($aFileParts));

            $aBaseParts = explode('_', $sBaseName);
            $aBaseParts = array_reverse($aBaseParts);

            if (strlen($aBaseParts[0]) == 1 && is_numeric($aBaseParts[0])) {
                $iFileCount = (int) $aBaseParts[0];
                unset($aBaseParts[0]);
            }

            $sBaseName = implode('_', array_reverse($aBaseParts));

            $sFileName = $sBaseName . '_' . (++$iFileCount) . '.' . $sFileExt;
            $sDestPath = dirname( $sDestPath ) . '/' . $sFileName;
        }

        move_uploaded_file($sSourcePath, $sDestPath);

        if ($blCreateThumbs) {
            try {
                $sThumbName = $this->createThumbnail($sFileName);

                $this->createMoreThumbnails($sFileName);
            } catch ( \Exception $e) {
                $sThumbName = '';
            }
        }

        return array(
            'filepath'  => $sDestPath,
            'filename'  => $sFileName,
            'thumbnail' => $sThumbName
        );
    }
192645
private function parseCertificateData($path, array $provider)
    {
        if (isset($provider['certificate_file']) && !isset($provider['certificate'])) {
            $configuration['certificateFile'] = $provider['certificate_file'];
        } elseif (isset($provider['certificate'])) {
            $configuration['certificateData'] = $provider['certificate'];
        } else {
            throw SamlInvalidConfigurationException::missingCertificate($path);
        }

        return $configuration;
    }
33911
protected void validateCertificate(X509Certificate[] chain) throws com.ibm.wsspi.security.wim.exception.CertificateMapFailedException {
        // validate the certificate array
        if (chain == null || chain.length == 0) {
            throw new com.ibm.wsspi.security.wim.exception.CertificateMapFailedException();
        }

        for (X509Certificate cert : chain) {
            if (cert == null) {
                throw new com.ibm.wsspi.security.wim.exception.CertificateMapFailedException();
            }
        }
    }
729056
private void init(X509Certificate[] certChainArray) {
        X509Certificate[] partCertChainArray = new X509Certificate[certChainArray.length - 1];
        System.arraycopy(certChainArray, 0, partCertChainArray, 0, partCertChainArray.length);
        certChain = Arrays.asList(partCertChainArray);
        fullCertChain = Arrays.asList(certChainArray);
    }
1137953
public function validate($certPath, $keyPath, array $chainPaths)
    {
        // Get the contents.
        if (!is_readable($certPath)) {
            throw new \InvalidArgumentException('The certificate file could not be read: ' . $certPath);
        }
        $sslCert = trim(file_get_contents($certPath));
        // Do a bit of validation.
        $certResource = openssl_x509_read($sslCert);
        if (!$certResource) {
            throw new \InvalidArgumentException('The certificate file is not a valid X509 certificate: ' . $certPath);
        }
        // Then the key. Does it match?
        if (!is_readable($keyPath)) {
            throw new \InvalidArgumentException('The private key file could not be read: ' . $keyPath);
        }
        $sslPrivateKey = trim(file_get_contents($keyPath));
        $keyResource = openssl_pkey_get_private($sslPrivateKey);
        if (!$keyResource) {
            throw new \InvalidArgumentException('Private key not valid, or passphrase-protected: ' . $keyPath);
        }
        $keyMatch = openssl_x509_check_private_key($certResource, $keyResource);
        if (!$keyMatch) {
            throw new \InvalidArgumentException('The provided certificate does not match the provided private key.');
        }

        // Each chain needs to contain one or more valid certificates.
        $chainFileContents = $this->readChainFiles($chainPaths);
        foreach ($chainFileContents as $filePath => $data) {
            $chainResource = openssl_x509_read($data);
            if (!$chainResource) {
                throw new \InvalidArgumentException('File contains an invalid X509 certificate: ' . $filePath);
            }
            openssl_x509_free($chainResource);
        }

        // Split up the chain file contents.
        $chain = [];
        $begin = '-----BEGIN CERTIFICATE-----';
        foreach ($chainFileContents as $data) {
            if (substr_count($data, $begin) > 1) {
                foreach (explode($begin, $data) as $cert) {
                    $chain[] = $begin . $cert;
                }
            } else {
                $chain[] = $data;
            }
        }

        return [
            'certificate' => $sslCert,
            'key' => $sslPrivateKey,
            'chain' => $chain,
        ];
    }
476347
public void symlink(String path, String link) throws SftpStatusException,
			SshException {
		String actualPath = resolveRemotePath(path);
		String actualLink = resolveRemotePath(link);

		sftp.createSymbolicLink(actualLink, actualPath);
	}