Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REF] Remover o método assina_tag #31

Merged
merged 1 commit into from
Mar 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions src/erpbrasil/assinatura/assinatura.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.asymmetric import padding
from lxml import etree
from Crypto.PublicKey import RSA
from Crypto.Hash import SHA
from Crypto.Signature import PKCS1_v1_5
from hashlib import sha1


Expand Down Expand Up @@ -146,15 +143,6 @@ def assina_pdf(self, arquivo, dados_assinatura, algoritmo='sha256'):
algomd=algoritmo
)

def assina_tag(self, message):
privateKeyContent = (self.certificado._chave).decode('utf-8')
message = message.encode('utf-8')
message = SHA.new(message)
rsaKey = RSA.importKey(privateKeyContent)
signer = PKCS1_v1_5.new(rsaKey)
signature = signer.sign(message)
return b64encode(signature).decode()

def verificar_assinatura_string(self, message, signature):
public_key = self.certificado.key.public_key()
return public_key.verify(
Expand Down