diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2023-02-17 17:58:20 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2023-02-17 17:58:20 +0700 |
commit | e3d12a2c33a7a9d0f371e1d5ff07f7ab7a3eb7ae (patch) | |
tree | a0a855afdfbfe6a4cc8a5b026f9b815ee7147d4b /crypto/src/pqc/asn1 | |
parent | Refactoring in Cms (diff) | |
download | BouncyCastle.NET-ed25519-e3d12a2c33a7a9d0f371e1d5ff07f7ab7a3eb7ae.tar.xz |
Refactoring around Asn1EncodableVector
Diffstat (limited to 'crypto/src/pqc/asn1')
-rw-r--r-- | crypto/src/pqc/asn1/CmcePrivateKey.cs | 7 | ||||
-rw-r--r-- | crypto/src/pqc/asn1/CmcePublicKey.cs | 5 |
2 files changed, 6 insertions, 6 deletions
diff --git a/crypto/src/pqc/asn1/CmcePrivateKey.cs b/crypto/src/pqc/asn1/CmcePrivateKey.cs index c6ba33352..743b801f5 100644 --- a/crypto/src/pqc/asn1/CmcePrivateKey.cs +++ b/crypto/src/pqc/asn1/CmcePrivateKey.cs @@ -18,6 +18,7 @@ using Org.BouncyCastle.Utilities; // </pre> namespace Org.BouncyCastle.Pqc.Asn1 { + // TODO[api] Should only be Asn1Encodable public class CmcePrivateKey : Asn1Object { @@ -84,7 +85,7 @@ namespace Org.BouncyCastle.Pqc.Asn1 public Asn1Object ToAsn1Primitive() { - Asn1EncodableVector v = new Asn1EncodableVector(); + Asn1EncodableVector v = new Asn1EncodableVector(7); v.Add(new DerInteger(version)); v.Add(new DerOctetString(delta)); @@ -94,9 +95,9 @@ namespace Org.BouncyCastle.Pqc.Asn1 v.Add(new DerOctetString(s)); // todo optional publickey - if(PublicKey != null) + if (publicKey != null) { - v.Add(new CmcePublicKey(PublicKey.T)); + v.Add(new CmcePublicKey(publicKey.T)); } return new DerSequence(v); diff --git a/crypto/src/pqc/asn1/CmcePublicKey.cs b/crypto/src/pqc/asn1/CmcePublicKey.cs index 1e417c5df..00a2afe19 100644 --- a/crypto/src/pqc/asn1/CmcePublicKey.cs +++ b/crypto/src/pqc/asn1/CmcePublicKey.cs @@ -4,6 +4,7 @@ using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Pqc.Asn1 { + // TODO[api] Should only be Asn1Encodable public class CmcePublicKey : Asn1Object { @@ -23,9 +24,7 @@ namespace Org.BouncyCastle.Pqc.Asn1 public Asn1Object ToAsn1Primitive() { - Asn1EncodableVector v = new Asn1EncodableVector(); - v.Add(new DerOctetString(t)); - return new DerSequence(v); + return new DerSequence(new DerOctetString(t)); } public static CmcePublicKey GetInstance(Object o) |