From 3a208d8c441470d6dfb580d7594dfcc63e477d6f Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Tue, 28 Feb 2023 20:45:20 +0700 Subject: Refactoring around ASN.1 DL encodings --- crypto/src/asn1/DerInteger.cs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'crypto/src/asn1/DerInteger.cs') diff --git a/crypto/src/asn1/DerInteger.cs b/crypto/src/asn1/DerInteger.cs index 05a790743..663a00169 100644 --- a/crypto/src/asn1/DerInteger.cs +++ b/crypto/src/asn1/DerInteger.cs @@ -220,6 +220,11 @@ namespace Org.BouncyCastle.Asn1 return new DerInteger(contents, false); } + internal static int GetEncodingLength(BigInteger x) + { + return Asn1OutputStream.GetLengthOfEncodingDL(Asn1Tags.Integer, BigIntegers.GetByteLength(x)); + } + internal static int IntValue(byte[] bytes, int start, int signExt) { int length = bytes.Length; -- cgit 1.4.1