EldoS | Feel safer!

Software components for data protection, secure storage and transfer

DNS SANS as a string

Also by EldoS: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.
#27518
Posted: 12/01/2013 09:17:51
by Phil Grafter (Basic support level)
Joined: 11/20/2013
Posts: 4

I have created a certificate object using the following code:

Code
sbbCert = new TElX509Certificate();
sbbCert.LoadFromBuffer(der);


What I would like to do now is get a string of all the DNS type Subject Alt Names. So in other words, for the cert associated with this site I would get the string:

"eldos.com, www.eldos.com"

How would I do this?

Thank you very much

Phil
#27519
Posted: 12/01/2013 09:52:15
by Eugene Mayevski (EldoS Corp.)

Use something like this code to collect values:

Code
if ((Certificate.Extensions.Included & SBX509Ext.Global.ceSubjectAlternativeName) == SBX509Ext.Global.ceSubjectAlternativeName)
{
      TElAlternativeNameExtension AltName = Certificate.Extensions.SubjectAlternativeName;
      if (AltName.Content.Count > 0)
      {
        String Name;    
        int i = 0;
        // check the domain names
        do
        {
            i = AltName.Content.FindNameByType(TSBGeneralName.gnDNSName, i);
            if (i != -1)
            {
              Name = AltName.Content.get_Names(i).DNSName;
              if (we like the name)
                ...
              else
                i++;
            }
          while (i != -1);
        }


Sincerely yours
Eugene Mayevski
#27520
Posted: 12/01/2013 09:58:43
by Phil Grafter (Basic support level)
Joined: 11/20/2013
Posts: 4

Thank you very much for the excellent support Eugene!!!


Kind Regards
phil

Reply

Statistics

Topic viewed 358 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!