Пример #1
0
 public static SesCertCollect GetInstance(DerInteger type, object o)
 {
     if (o is SesCertCollect sesCertCollect)
     {
         return(sesCertCollect);
     }
     if (o == null)
     {
         return(null);
     }
     if (o is Asn1Encodable)
     {
         int value = type.Value.IntValue;
         if (value == 1)
         {
             return(new SesCertCollect(CertInfoCollect.GetInstance(o)));
         }
         if (value == 2)
         {
             return(new SesCertCollect(CertDigestCollect.GetInstance(o)));
         }
         throw new NotSupportedException($"unknown type in getInstance():{o.GetType().Name}");
     }
     if (o is byte[] bytes)
     {
         try
         {
             return(GetInstance(type, Asn1Object.FromByteArray(bytes)));
         }
         catch (Exception e)
         {
             throw new NotSupportedException("unknown encoding in getInstance()", e);
         }
     }
     throw new NotSupportedException($"unknown object in getInstance():{o.GetType().Name}");
 }
Пример #2
0
 public SesCertCollect(CertInfoCollect certInfoCollect)
 {
     _certInfoCollect = certInfoCollect;
 }