EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Details A3 certificate

Also by EldoS: Callback File System
Create virtual file systems and disks, expose and manage remote data as if they were files on the local disk.
#29851
Posted: 06/18/2014 16:33:39
by Petruccio Montezuma (Standard support level)
Joined: 10/31/2013
Posts: 8

Dear good night!

I am using the following components:

CertStorage, WinCertStorage, Document and PublicKeyHandler

Delphi, unable to get the following information as the token screen attached

Serial Number: 32 30 31 31 ....

Container name: 16a2fbc3-3790-45....

Modulus.......: 93e4116b1d6670...

In delphi managed to get the following data below with example


Code
procedure TF_PCMSO_0142_AD.AssinandoDocumentoPDF;
var
   TempPath   : string;
   Success    : boolean;
   F          : TFileStream;
   Index      : integer;
   Sig        : TElPDFSignature;
   Cert       : TElX509Certificate;
begin


        ShowMessage('Pais: '                + Cert.SubjectName.Country          + CHR(13) +
                    'Estado: '              + Cert.SubjectName.StateOrProvince  + CHR(13) +
                    'Localidade: '          + Cert.SubjectName.Locality         + CHR(13) +
                    'Organização: '         + Cert.SubjectName.Organization     + CHR(13) +
                    'Organização Unidade: ' + Cert.SubjectName.OrganizationUnit + CHR(13) +
                    'CommonName: '          + Cert.SubjectName.CommonName       + CHR(13) +
                    'EMail: '               + Cert.SubjectName.EMailAddress     + CHR(13) +
                    'Cert.Signature: '      + Cert.Signature                    + CHR(13) +
                    'Cert.SerialNumber: '   + Cert.SerialNumber                 + CHR(13) +
                    'Cert.FriendlyName: '   + Cert.FriendlyName                 + CHR(13) +
                    'Cert.IssuerUniqueID: ' + Cert.IssuerUniqueID               + CHR(13) +
                    'Cert.StorageName: '    + Cert.StorageName                  + CHR(13)
                   );


How can I get this information?


#29854
Posted: 06/19/2014 01:16:33
by Eugene Mayevski (EldoS Corp.)

ContainerName is specific to Windows certificate store, not a property of the certificate.

Serial Number is available via SerialNumber property. Note, that SerialNumber is a long binary value, not a string. If you want to convert it to string, do this the way you like (various applications format serial numbers in different ways). One of options is to use SBEncoding.Base64EncodeArray() function and then format the resulting string.

Modulus - probably it's a modulus of the public key. You can access the key using TElX509Certificate.KeyMaterial property. You need to cast it to TElRSAKeyMaterial, then read its PublicModulus property:

Code
Modulus := TElRSAKeyMaterial(TElX509Certificate.KeyMaterial).PublicModulus;


Note, that you need to check the type of the object referenced by TElX509Certificate.KeyMaterial property before typecasting - in case you have a DSA certificate (which is possible though rare) there's no PublicModulus there, as DSA is a different algorithm.


Sincerely yours
Eugene Mayevski
#29955
Posted: 06/30/2014 09:39:13
by Petruccio Montezuma (Standard support level)
Joined: 10/31/2013
Posts: 8

Dear Eugene, you would have an example in Delphi? Unable to resolve as you explained.
#29959
Posted: 06/30/2014 09:51:01
by Eugene Mayevski (EldoS Corp.)

I have described what properties you need to read. I don't understand what else I can offer you.


Sincerely yours
Eugene Mayevski

Reply

Statistics

Topic viewed 496 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!