Beispiel #1
0
 /**
  * @param CertificateInfo $info
  * @return Sequence
  */
 public function getCertInfoAsn(CertificateInfo $info)
 {
     $curve = EccFactory::getSecgCurves()->curve256k1();
     if ($this->extension === null) {
         return new Sequence(new Integer($info->getSerialNo()), new Sequence(SigAlgorithmOidMapper::getSigAlgorithmOid($info->getSigAlgorithm())), $this->subjectSer->toAsn($info->getIssuerInfo()), new Sequence(new UTCTime($info->getValidityStart()->format(CertificateSerializer::UTCTIME_FORMAT)), new UTCTime($info->getValidityEnd()->format(CertificateSerializer::UTCTIME_FORMAT))), $this->subjectSer->toAsn($info->getSubjectInfo()), $this->getSubjectKeyASN($curve, $info->getPublicKey()));
     }
     return new Sequence(new Integer($info->getSerialNo()), new Sequence(SigAlgorithmOidMapper::getSigAlgorithmOid($info->getSigAlgorithm())), $this->subjectSer->toAsn($info->getIssuerInfo()), new Sequence(new UTCTime($info->getValidityStart()->format(CertificateSerializer::UTCTIME_FORMAT)), new UTCTime($info->getValidityEnd()->format(CertificateSerializer::UTCTIME_FORMAT))), $this->subjectSer->toAsn($info->getSubjectInfo()), $this->getSubjectKeyASN($curve, $info->getPublicKey()), $this->extension->apply($info));
 }
Beispiel #2
0
 /**
  * @param NamedCurveFp $curve
  * @param PublicKeyInterface $publicKey
  * @param CertificateSubject $subject
  * @return Sequence
  */
 public function getCertRequestInfoASN(NamedCurveFp $curve, PublicKeyInterface $publicKey, CertificateSubject $subject)
 {
     return new Sequence(new Integer(\FG\X509\CSR\CSR::CSR_VERSION_NR), $this->subjectSer->toAsn($subject), $this->getSubjectKeyASN($curve, $publicKey), new Attributes());
 }
Beispiel #3
0
 /**
  * @param EcDomain $domain
  * @param CertificateSubject $subject
  * @param PrivateKeyInterface $privateKey
  * @return Csr
  */
 public static function getCsr(EcDomain $domain, CertificateSubject $subject, PrivateKeyInterface $privateKey)
 {
     $subjectSerializer = new CertificateSubjectSerializer();
     $serialized = $subjectSerializer->serialize($subject);
     return new Csr($domain, $subject, $privateKey->getPublicKey(), $domain->getSigner()->sign($privateKey, $domain->getHasher()->hashDec($serialized), RandomGeneratorFactory::getUrandomGenerator()->generate($domain->getGenerator()->getOrder())));
 }