From b32ec48620a0b66cf41d75c9a4ac0a3b50118c60 Mon Sep 17 00:00:00 2001 From: David Hook Date: Sun, 24 Jul 2022 19:52:44 +1000 Subject: moved picnic GetParameters to Parameters --- crypto/src/pqc/crypto/picnic/PicnicKeyParameters.cs | 17 +++++++---------- crypto/src/pqc/crypto/picnic/PicnicSigner.cs | 4 ++-- crypto/src/pqc/crypto/utils/PrivateKeyInfoFactory.cs | 2 +- .../src/pqc/crypto/utils/SubjectPublicKeyInfoFactory.cs | 2 +- 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/crypto/src/pqc/crypto/picnic/PicnicKeyParameters.cs b/crypto/src/pqc/crypto/picnic/PicnicKeyParameters.cs index a26ab53b4..a98331455 100644 --- a/crypto/src/pqc/crypto/picnic/PicnicKeyParameters.cs +++ b/crypto/src/pqc/crypto/picnic/PicnicKeyParameters.cs @@ -7,17 +7,14 @@ namespace Org.BouncyCastle.Pqc.Crypto.Picnic : AsymmetricKeyParameter { - PicnicParameters parameters; + PicnicParameters parameters; - public PicnicKeyParameters(bool isPrivate, PicnicParameters parameters) - : base(isPrivate) - { - this.parameters = parameters; - } + public PicnicKeyParameters(bool isPrivate, PicnicParameters parameters) + : base(isPrivate) + { + this.parameters = parameters; + } - public PicnicParameters GetParameters() - { - return parameters; - } + public PicnicParameters Parameters => parameters; } } \ No newline at end of file diff --git a/crypto/src/pqc/crypto/picnic/PicnicSigner.cs b/crypto/src/pqc/crypto/picnic/PicnicSigner.cs index 7b631b3cb..5f3d5d67c 100644 --- a/crypto/src/pqc/crypto/picnic/PicnicSigner.cs +++ b/crypto/src/pqc/crypto/picnic/PicnicSigner.cs @@ -34,7 +34,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Picnic public byte[] GenerateSignature(byte[] message) { - PicnicEngine engine = privKey.GetParameters().GetEngine(); + PicnicEngine engine = privKey.Parameters.GetEngine(); byte[] sig = new byte[engine.GetSignatureSize(message.Length)]; engine.crypto_sign(sig, message, privKey.GetEncoded()); @@ -43,7 +43,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Picnic public bool VerifySignature(byte[] message, byte[] signature) { - PicnicEngine engine = pubKey.GetParameters().GetEngine(); + PicnicEngine engine = pubKey.Parameters.GetEngine(); byte[] verify_message = new byte[message.Length]; bool verify = engine.crypto_sign_open(verify_message, signature, pubKey.GetEncoded()); if (!Arrays.AreEqual(message, verify_message)) diff --git a/crypto/src/pqc/crypto/utils/PrivateKeyInfoFactory.cs b/crypto/src/pqc/crypto/utils/PrivateKeyInfoFactory.cs index 2069ba5c3..c5c3f9e45 100644 --- a/crypto/src/pqc/crypto/utils/PrivateKeyInfoFactory.cs +++ b/crypto/src/pqc/crypto/utils/PrivateKeyInfoFactory.cs @@ -97,7 +97,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Utilities byte[] encoding = parameters.GetEncoded(); - AlgorithmIdentifier algorithmIdentifier = new AlgorithmIdentifier(PqcUtilities.PicnicOidLookup(parameters.GetParameters())); + AlgorithmIdentifier algorithmIdentifier = new AlgorithmIdentifier(PqcUtilities.PicnicOidLookup(parameters.Parameters)); return new PrivateKeyInfo(algorithmIdentifier, new DerOctetString(encoding), attributes); } if (privateKey is SIKEPrivateKeyParameters) diff --git a/crypto/src/pqc/crypto/utils/SubjectPublicKeyInfoFactory.cs b/crypto/src/pqc/crypto/utils/SubjectPublicKeyInfoFactory.cs index 9242ee936..0cf80bbe3 100644 --- a/crypto/src/pqc/crypto/utils/SubjectPublicKeyInfoFactory.cs +++ b/crypto/src/pqc/crypto/utils/SubjectPublicKeyInfoFactory.cs @@ -75,7 +75,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Utilities byte[] encoding = parameters.GetEncoded(); - AlgorithmIdentifier algorithmIdentifier = new AlgorithmIdentifier(PqcUtilities.PicnicOidLookup(parameters.GetParameters())); + AlgorithmIdentifier algorithmIdentifier = new AlgorithmIdentifier(PqcUtilities.PicnicOidLookup(parameters.Parameters)); return new SubjectPublicKeyInfo(algorithmIdentifier, new DerOctetString(encoding)); } if (publicKey is SIKEPublicKeyParameters) -- cgit 1.4.1