/// <summary>
        /// Parse asn data
        /// </summary>
        /// <param name="data"></param>
        private void Parse(byte[] data)
        {
            if (base.Oid.Value != Oids.AuthorityKeyIdentifier &&
                base.Oid.Value != Oids.AuthorityKeyIdentifier2)
            {
                throw new FormatException("Extension has unknown oid.");
            }
            var authorityKey =
                new Org.BouncyCastle.X509.Extension.AuthorityKeyIdentifierStructure(
                    new Org.BouncyCastle.Asn1.DerOctetString(data));

            if (authorityKey == null)
            {
                throw new FormatException("Extension has bad oid.");
            }
            if (authorityKey.AuthorityCertSerialNumber != null)
            {
                SerialNumber = new SerialNumber(
                    authorityKey.AuthorityCertSerialNumber.ToByteArray());
            }
            AuthorityNames.Clear();
            if (authorityKey.AuthorityCertIssuer != null)
            {
                foreach (var name in authorityKey.AuthorityCertIssuer.GetNames())
                {
                    if (name.TagNo == Org.BouncyCastle.Asn1.X509.GeneralName.DirectoryName)
                    {
                        AuthorityNames.Add(name.Name.ToString());
                    }
                }
            }
            KeyId = authorityKey.GetKeyIdentifier().ToBase16String();
        }
 private void Parse(byte[] data)
 {
     if (base.Oid.Value == AuthorityKeyIdentifierOid ||
         base.Oid.Value == AuthorityKeyIdentifier2Oid)
     {
         Org.BouncyCastle.X509.Extension.AuthorityKeyIdentifierStructure authorityKey =
             new Org.BouncyCastle.X509.Extension.AuthorityKeyIdentifierStructure(
                 new Org.BouncyCastle.Asn1.DerOctetString(data));
         if (authorityKey != null)
         {
             if (authorityKey.AuthorityCertSerialNumber != null)
             {
                 m_serialNumber = Utils.ToHexString(authorityKey.AuthorityCertSerialNumber.ToByteArray());
             }
             if (authorityKey.AuthorityCertIssuer != null)
             {
                 List <string> authorityNames = new List <string>();
                 foreach (var name in authorityKey.AuthorityCertIssuer.GetNames())
                 {
                     if (name.TagNo == Org.BouncyCastle.Asn1.X509.GeneralName.DirectoryName)
                     {
                         authorityNames.Add(name.Name.ToString());
                     }
                 }
                 m_authorityNames = new ReadOnlyList <string>(authorityNames);
             }
             m_keyId = Utils.ToHexString(authorityKey.GetKeyIdentifier());
             return;
         }
     }
     throw new ServiceResultException(
               StatusCodes.BadCertificateInvalid,
               "Certificate uses unknown or bad AuthorityKeyIdentifierOid.");
 }