From cf9d584cebc3b589ba865ecf74d2af9d91bae631 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Fri, 30 Oct 2020 23:43:25 +0700 Subject: Cleanup after recent changes --- crypto/src/asn1/nist/KMACwithSHAKE128_params.cs | 25 ++++++++----------------- crypto/src/asn1/nist/KMACwithSHAKE256_params.cs | 25 ++++++++----------------- 2 files changed, 16 insertions(+), 34 deletions(-) (limited to 'crypto/src/asn1') diff --git a/crypto/src/asn1/nist/KMACwithSHAKE128_params.cs b/crypto/src/asn1/nist/KMACwithSHAKE128_params.cs index cd73ce2bc..a1fd8f403 100644 --- a/crypto/src/asn1/nist/KMACwithSHAKE128_params.cs +++ b/crypto/src/asn1/nist/KMACwithSHAKE128_params.cs @@ -10,50 +10,44 @@ namespace Org.BouncyCastle.Asn1.Nist /// customizationString OCTET STRING DEFAULT ''H /// } /// -public class KMACwithSHAKE128_params : Asn1Encodable +public class KMacWithShake128Params : Asn1Encodable { - private static readonly byte[] EMPTY_STRING = new byte[0]; private static readonly int DEF_LENGTH = 256; private readonly int outputLength; private readonly byte[] customizationString; - - public KMACwithSHAKE128_params(int outputLength) + public KMacWithShake128Params(int outputLength) { this.outputLength = outputLength; this.customizationString = EMPTY_STRING; } - public KMACwithSHAKE128_params(int outputLength, byte[] customizationString) + public KMacWithShake128Params(int outputLength, byte[] customizationString) { this.outputLength = outputLength; this.customizationString = Arrays.Clone(customizationString); } - - public static KMACwithSHAKE128_params getInstance(Object o) + public static KMacWithShake128Params GetInstance(object o) { - if (o is KMACwithSHAKE128_params) + if (o is KMacWithShake128Params) { - return (KMACwithSHAKE128_params)o; + return (KMacWithShake128Params)o; } else if (o != null) { - return new KMACwithSHAKE128_params(Asn1Sequence.GetInstance(o)); + return new KMacWithShake128Params(Asn1Sequence.GetInstance(o)); } return null; } - - private KMACwithSHAKE128_params(Asn1Sequence seq) + private KMacWithShake128Params(Asn1Sequence seq) { if (seq.Count > 2) - { throw new InvalidOperationException("sequence size greater than 2"); - } if (seq.Count == 2) { @@ -80,8 +74,6 @@ public class KMACwithSHAKE128_params : Asn1Encodable } } - - public int OutputLength { get { return outputLength; } @@ -92,7 +84,6 @@ public class KMACwithSHAKE128_params : Asn1Encodable get { return Arrays.Clone(customizationString); } } - public override Asn1Object ToAsn1Object() { Asn1EncodableVector v = new Asn1EncodableVector(); diff --git a/crypto/src/asn1/nist/KMACwithSHAKE256_params.cs b/crypto/src/asn1/nist/KMACwithSHAKE256_params.cs index e70fc807d..fa7471913 100644 --- a/crypto/src/asn1/nist/KMACwithSHAKE256_params.cs +++ b/crypto/src/asn1/nist/KMACwithSHAKE256_params.cs @@ -9,50 +9,44 @@ namespace Org.BouncyCastle.Asn1.Nist /// customizationString OCTET STRING DEFAULT ''H /// } /// -public class KMACwithSHAKE256_params : Asn1Encodable +public class KMacWithShake256Params : Asn1Encodable { - private static readonly byte[] EMPTY_STRING = new byte[0]; private static readonly int DEF_LENGTH = 512; private readonly int outputLength; private readonly byte[] customizationString; - - public KMACwithSHAKE256_params(int outputLength) + public KMacWithShake256Params(int outputLength) { this.outputLength = outputLength; this.customizationString = EMPTY_STRING; } - public KMACwithSHAKE256_params(int outputLength, byte[] customizationString) + public KMacWithShake256Params(int outputLength, byte[] customizationString) { this.outputLength = outputLength; this.customizationString = Arrays.Clone(customizationString); } - - public static KMACwithSHAKE256_params getInstance(Object o) + public static KMacWithShake256Params GetInstance(Object o) { - if (o is KMACwithSHAKE256_params) + if (o is KMacWithShake256Params) { - return (KMACwithSHAKE256_params)o; + return (KMacWithShake256Params)o; } else if (o != null) { - return new KMACwithSHAKE256_params(Asn1Sequence.GetInstance(o)); + return new KMacWithShake256Params(Asn1Sequence.GetInstance(o)); } return null; } - - private KMACwithSHAKE256_params(Asn1Sequence seq) + private KMacWithShake256Params(Asn1Sequence seq) { if (seq.Count > 2) - { throw new InvalidOperationException("sequence size greater than 2"); - } if (seq.Count == 2) { @@ -79,8 +73,6 @@ public class KMACwithSHAKE256_params : Asn1Encodable } } - - public int OutputLength { get { return outputLength; } @@ -91,7 +83,6 @@ public class KMACwithSHAKE256_params : Asn1Encodable get { return Arrays.Clone(customizationString); } } - public override Asn1Object ToAsn1Object() { Asn1EncodableVector v = new Asn1EncodableVector(); -- cgit 1.4.1