public function sign(SignatureAlgorithmIdentifier $algo,
        PrivateKeyInfo $privkey_info, Crypto $crypto = null): AttributeCertificate
    {
        $crypto = $crypto ?: Crypto::getDefault();
        $aci = clone $this;
        if (!isset($aci->_serialNumber)) {
            $aci->_serialNumber = "0";
        }
        $aci->_signature = $algo;
        $data = $aci->toASN1()->toDER();
        $signature = $crypto->sign($data, $privkey_info, $algo);
        return new AttributeCertificate($aci, $algo, $signature);
    }
public function sign(SignatureAlgorithmIdentifier $algo,
        PrivateKeyInfo $privkey_info, Crypto $crypto = null): AttributeCertificate
    {
        $crypto = $crypto ?: Crypto::getDefault();
        $aci = clone $this;
        if (!isset($aci->_serialNumber)) {
            $aci->_serialNumber = "0";
        }
        $aci->_signature = $algo;
        $data = $aci->toASN1()->toDER();
        $signature = $crypto->sign($data, $privkey_info, $algo);
        return new AttributeCertificate($aci, $algo, $signature);
    }
public function sign ( SignatureAlgorithmIdentifier $ algo , PrivateKeyInfo $ privkey_info , Crypto $ crypto = null ) : AttributeCertificate { $ crypto = $ crypto ? : Crypto :: getDefault ( ) ; $ aci = clone $ this ; if ( ! isset ( $ aci -> _serialNumber ) ) { $ aci -> _serialNumber = "0" ; } $ aci -> _signature = $ algo ; $ data = $ aci -> toASN1 ( ) -> toDER ( ) ; $ signature = $ crypto -> sign ( $ data , $ privkey_info , $ algo ) ; return new AttributeCertificate ( $ aci , $ algo , $ signature ) ; }
Create signed attribute certificate.

@param SignatureAlgorithmIdentifier $algo Signature algorithm
@param PrivateKeyInfo $privkey_info Private key
@param Crypto|null $crypto Crypto engine, use default if not set
@return AttributeCertificate
Create signed attribute certificate .