File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -13,9 +13,25 @@ public static CmpCertificate GetInstance(object obj)
13
13
return null ;
14
14
if ( obj is CmpCertificate cmpCertificate )
15
15
return cmpCertificate ;
16
+ if ( obj is X509CertificateStructure certificate )
17
+ return new CmpCertificate ( certificate ) ;
16
18
if ( obj is Asn1TaggedObject taggedObject )
17
19
return new CmpCertificate ( taggedObject ) ;
18
- return new CmpCertificate ( X509CertificateStructure . GetInstance ( obj ) ) ;
20
+
21
+ Asn1Object asn1Object = null ;
22
+ if ( obj is IAsn1Convertible asn1Convertible )
23
+ {
24
+ asn1Object = asn1Convertible . ToAsn1Object ( ) ;
25
+ }
26
+ else if ( obj is byte [ ] bytes )
27
+ {
28
+ asn1Object = Asn1Object . FromByteArray ( bytes ) ;
29
+ }
30
+
31
+ if ( asn1Object is Asn1TaggedObject asn1TaggedObject )
32
+ return new CmpCertificate ( asn1TaggedObject ) ;
33
+
34
+ return new CmpCertificate ( X509CertificateStructure . GetInstance ( asn1Object ?? obj ) ) ;
19
35
}
20
36
21
37
public static CmpCertificate GetInstance ( Asn1TaggedObject taggedObject , bool declaredExplicit )
You can’t perform that action at this time.
0 commit comments