Open fmoric opened 4 years ago
Hi Filip,
In Certificates you can upload a certificate now (with password if needed). You can use codeunit 1259 Certificate Management to get the certificate. Use the function VerifyCert and than use the global DotNet_X509Certificate2.
When you have the certificate you can do the following
Name | DataType | Subtype | Length |
---|---|---|---|
DotNetRSA | DotNet | System.Security.Cryptography.RSA.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' | |
DotNetRSACertificateExtensions | DotNet | System.Security.Cryptography.X509Certificates.RSACertificateExtensions.'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' |
DotNetRSA := DotNetRSACertificateExtensions.GetRSAPrivateKey(DotNetX509Certificate2); CertificateXml := DotNetRSA.ToXmlString(TRUE);
CertificateXml contains the privatekey (see https://docs.microsoft.com/en-us/dotnet/api/system.security.cryptography.rsa.toxmlstring?view=netframework-4.8)
Ok, i get that part, but that's using DotNet DataType and DotNet is only available on-premise. I was wondering if there is any way of using only External functions, and building extension?
I would need it for local functionality, i need to send invoices to TA.
How to get private key from certificate? For example use to SignXmlText function?
I run through all codeunits and i see no way. I wanted to make extension that has to sign an xml and send it.
So i would appreciate some help.