Commit f9468bde authored by Daniel's avatar Daniel
Browse files

Merge

parents 70225d08 5a01e137
......@@ -1328,6 +1328,16 @@ class ComprobanteV4 {
$this->Certificado = $this->parseCertificado();
}
function addSellos_string() {
$this->toXML();
$pkeyid = openssl_get_privatekey($this->keyPemContent);
openssl_sign($this->getCadenaOriginal(), $crypttext, $pkeyid, OPENSSL_ALGO_SHA256); // convierte la cadena a sha256
openssl_free_key($pkeyid); //libera la clave asociada con el indetificador de clave
$this->Sello = base64_encode($crypttext);
$this->Certificado = $this->parseCertificado_string();
}
public function validateSellos() {
# valida los archivos .key y .pem por medio de algunos metodos que se encuentran declarados en este script
# si llegan estar fuera del rango de fecha o este mal declarado el certificado te regrese una exepcion
......@@ -1346,6 +1356,11 @@ class ComprobanteV4 {
return $this->Certificado;
}
public function parseCertificado_string() {
$this->Certificado = preg_replace('[\s+]', "", $this->between('-----BEGIN CERTIFICATE-----', '-----END CERTIFICATE-----', $this->cerPemContent));
return $this->Certificado;
}
private function between($inicio, $that, $inthat) {
return $this->before($that, $this->after($inicio, $inthat));
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment