-
Notifications
You must be signed in to change notification settings - Fork 82
Refatorar a recuperação da chave de assinatura em Assinador.cs #126
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -65,7 +65,14 @@ | |
|
|
||
| documento.LoadXml(xml); | ||
|
|
||
| var docXml = new SignedXml(documento) { SigningKey = certificadoDigital.PrivateKey }; | ||
| SignedXml docXml = new SignedXml(documento); | ||
|
|
||
| // Pega a chave RSA de forma "moderna", compatível com CNG e CSP | ||
| RSA rsa = certificadoDigital.GetRSAPrivateKey(); | ||
|
Check failure on line 71 in NFe.Utils/Assinatura/Assinador.cs
|
||
| if (rsa == null) | ||
| throw new Exception("O certificado não possui chave privada RSA."); | ||
|
|
||
| docXml.SigningKey = rsa; | ||
|
Comment on lines
+71
to
+75
|
||
|
|
||
| docXml.SignedInfo.SignatureMethod = signatureMethod; | ||
|
|
||
|
|
@@ -103,4 +110,4 @@ | |
|
|
||
| } | ||
| } | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
RSAtype requires a using directive forSystem.Security.Cryptography. Addusing System.Security.Cryptography;at the top of the file to resolve this type.