Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
pilotoautomatico
class_cfdi_v33
Commits
f9468bde
Commit
f9468bde
authored
8 months ago
by
Daniel
Browse files
Options
Download
Plain Diff
Merge
parents
70225d08
5a01e137
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
0 deletions
+15
-0
src/ComprobanteV4.php
src/ComprobanteV4.php
+15
-0
No files found.
src/ComprobanteV4.php
View file @
f9468bde
...
...
@@ -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
));
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment