예제 #1
0
파일: RootCA.php 프로젝트: phpecc/x509
 /**
  * @param CertificateInfo $certificateInfo
  * @return Sequence
  */
 public function apply(CertificateInfo $certificateInfo)
 {
     $caKey = $certificateInfo->getPublicKey();
     $caHasher = SigAlgorithmOidMapper::getHasher($certificateInfo->getSigAlgo());
     $hash = $this->keyIdentifier($caHasher, $caKey);
     $extensions = new CertificateExtensions();
     return new Sequence(new Sequence(new ObjectIdentifier('2.5.29.14'), new OctetString(bin2hex($hash->getBinary()))), new Sequence(new ObjectIdentifier('2.5.29.35'), new OctetString(bin2hex((new Sequence($hash))->getBinary()))), new Sequence(new ObjectIdentifier('2.5.29.19'), new OctetString(bin2hex((new Sequence(new Boolean(true)))->getBinary()))));
 }
예제 #2
0
파일: Parser.php 프로젝트: phpecc/x509
 /**
  * @param Sequence $sigSection
  * @return string
  * @throws \Exception
  */
 public function parseSigAlg(Sequence $sigSection)
 {
     $sigInfo = $sigSection->getContent();
     if (!$sigInfo[0] instanceof ObjectIdentifier) {
         throw new \Exception('Invaid sig: object identfier');
     }
     return SigAlgorithmOidMapper::getAlgorithmFromOid($sigInfo[0]);
 }
예제 #3
0
파일: Formatter.php 프로젝트: phpecc/x509
 /**
  * @param Certificate $cert
  * @return Sequence
  */
 public function getCertificateASN(Certificate $cert)
 {
     return new Sequence($this->getCertInfoASN($cert->getInfo()), new Sequence(SigAlgorithmOidMapper::getSigAlgorithmOid($cert->getSigAlgorithm())), new BitString(bin2hex($this->sigSer->serialize($cert->getSignature()))));
 }
예제 #4
0
 /**
  * @param Csr $csr
  * @return Sequence
  */
 public function getCsrASN(Csr $csr)
 {
     return new Sequence($this->getCertRequestInfoASN($csr->getCurve(), $csr->getPublicKey(), $csr->getSubject()), new Sequence(SigAlgorithmOidMapper::getSigAlgorithmOid($csr->getSigAlgorithm())), new BitString(bin2hex($this->sigSer->serialize($csr->getSignature()))));
 }