Sign string with PFX certificate

Alexandre <[email protected]>
Newsgroups gmane.comp.lang.as400.c
Message-ID <[email protected]>
It is possible to sign a string, using a PFX certificate (which contains 
all the authenticating chain) in C-ILE or C++/ILE ?

A simple example of what I want, in C#

public byte[] SignString(string mensagem)
         {
             X509Certificate2 certificado = GetPFXCertificate();
             CmsSigner signer = new 
CmsSigner(SubjectIdentifierType.IssuerAndSerialNumber, certificado);
             signer.DigestAlgorithm = new Oid("2.16.840.1.101.3.4.2.1"); 
//SHA256

             ContentInfo content = new ContentInfo(new 
Oid(Configuration.ContentOid), new 
System.Text.UTF8Encoding().GetBytes(mensagem));
             SignedCms signedCms = new SignedCms(content, false);

             signedCms.ComputeSignature(signer, false);
             var assinatura = signedCms.Encode();

             return assinatura;
         }

-- 
Alexandre S. Bencz

+55 {15} 997-980-511

-- 
This is the Bare Metal Programming IBM i (AS/400 and iSeries) (C400-L) mailing list
To post a message email: [email protected]
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/c400-l
or email: [email protected]
Before posting, please take a moment to review the archives
at https://archive.midrange.com/c400-l.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.