diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2024-01-18 19:46:12 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2024-01-18 19:46:12 +0700 |
commit | 29df93849fe023828abf29d3c5151a62d88f69eb (patch) | |
tree | 3d8fcd817c0532e7a738d0c964151feaee72c5fc /crypto/src/asn1 | |
parent | Overhaul DerObjectIdentifier and Asn1RelativeOid (diff) | |
download | BouncyCastle.NET-ed25519-29df93849fe023828abf29d3c5151a62d88f69eb.tar.xz |
Refactoring in DerObjectIdentifier
Diffstat (limited to 'crypto/src/asn1')
-rw-r--r-- | crypto/src/asn1/DerObjectIdentifier.cs | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/crypto/src/asn1/DerObjectIdentifier.cs b/crypto/src/asn1/DerObjectIdentifier.cs index 7d45c9cb8..04792cbdd 100644 --- a/crypto/src/asn1/DerObjectIdentifier.cs +++ b/crypto/src/asn1/DerObjectIdentifier.cs @@ -114,15 +114,6 @@ namespace Org.BouncyCastle.Asn1 m_identifier = identifier; } - private DerObjectIdentifier(DerObjectIdentifier oid, string branchID) - { - if (!Asn1RelativeOid.IsValidIdentifier(branchID, 0)) - throw new FormatException("string " + branchID + " not a valid OID branch"); - - m_contents = Arrays.Concatenate(oid.m_contents, Asn1RelativeOid.ParseIdentifier(branchID)); - m_identifier = oid.GetID() + "." + branchID; - } - private DerObjectIdentifier(byte[] contents, bool clone) { if (!Asn1RelativeOid.IsValidContents(contents)) @@ -140,7 +131,12 @@ namespace Org.BouncyCastle.Asn1 public virtual DerObjectIdentifier Branch(string branchID) { - return new DerObjectIdentifier(this, branchID); + if (!Asn1RelativeOid.IsValidIdentifier(branchID, 0)) + throw new FormatException("string " + branchID + " not a valid OID branch"); + + return new DerObjectIdentifier( + contents: Arrays.Concatenate(m_contents, Asn1RelativeOid.ParseIdentifier(branchID)), + identifier: GetID() + "." + branchID); } public string GetID() |