summary refs log tree commit diff
path: root/crypto/src/asn1/crmf/PKIArchiveOptions.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2023-07-18 12:06:03 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2023-07-18 12:06:03 +0700
commit913eada3ad9394f1327a1feb80a3261f7c6e55bb (patch)
tree6366c1e196ad2ac249edf12a4d41d52ee2d28629 /crypto/src/asn1/crmf/PKIArchiveOptions.cs
parentRefactoring around PrivateKeyInfo (diff)
downloadBouncyCastle.NET-ed25519-913eada3ad9394f1327a1feb80a3261f7c6e55bb.tar.xz
Deprecated Asn1TaggedObject.GetObject and refactor
Diffstat (limited to 'crypto/src/asn1/crmf/PKIArchiveOptions.cs')
-rw-r--r--crypto/src/asn1/crmf/PKIArchiveOptions.cs24
1 files changed, 12 insertions, 12 deletions
diff --git a/crypto/src/asn1/crmf/PKIArchiveOptions.cs b/crypto/src/asn1/crmf/PKIArchiveOptions.cs
index e546fb3bb..f1a35541a 100644
--- a/crypto/src/asn1/crmf/PKIArchiveOptions.cs
+++ b/crypto/src/asn1/crmf/PKIArchiveOptions.cs
@@ -19,7 +19,7 @@ namespace Org.BouncyCastle.Asn1.Crmf
                 return pkiArchiveOptions;
 
             if (obj is Asn1TaggedObject taggedObject)
-                return new PkiArchiveOptions(taggedObject);
+                return new PkiArchiveOptions(Asn1Utilities.CheckTagClass(taggedObject, Asn1Tags.ContextSpecific));
 
             throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj");
         }
@@ -28,17 +28,17 @@ namespace Org.BouncyCastle.Asn1.Crmf
         {
             switch (tagged.TagNo)
             {
-                case encryptedPrivKey:
-                    value = EncryptedKey.GetInstance(tagged.GetObject());
-                    break;
-                case keyGenParameters:
-                    value = Asn1OctetString.GetInstance(tagged, false);
-                    break;
-                case archiveRemGenPrivKey:
-                    value = DerBoolean.GetInstance(tagged, false);
-                    break;
-                default:
-                    throw new ArgumentException("unknown tag number: " + tagged.TagNo, "tagged");
+            case encryptedPrivKey:
+                value = EncryptedKey.GetInstance(tagged.GetExplicitBaseObject());
+                break;
+            case keyGenParameters:
+                value = Asn1OctetString.GetInstance(tagged, false);
+                break;
+            case archiveRemGenPrivKey:
+                value = DerBoolean.GetInstance(tagged, false);
+                break;
+            default:
+                throw new ArgumentException("unknown tag number: " + tagged.TagNo, "tagged");
             }
         }