From d75a665afb72634d4a2af42b3c8d29931fcdaf3e Mon Sep 17 00:00:00 2001 From: David Hook Date: Mon, 7 Nov 2022 17:39:01 +1100 Subject: fixed use of property --- crypto/src/pqc/crypto/frodo/FrodoKEMExtractor.cs | 2 +- crypto/src/pqc/crypto/frodo/FrodoKEMGenerator.cs | 2 +- crypto/src/pqc/crypto/frodo/FrodoPrivateKeyParameters.cs | 7 +++++-- crypto/src/pqc/crypto/frodo/FrodoPublicKeyParameters.cs | 10 +++++++--- 4 files changed, 14 insertions(+), 7 deletions(-) (limited to 'crypto/src') diff --git a/crypto/src/pqc/crypto/frodo/FrodoKEMExtractor.cs b/crypto/src/pqc/crypto/frodo/FrodoKEMExtractor.cs index 055fe3bc6..8a26e90a4 100644 --- a/crypto/src/pqc/crypto/frodo/FrodoKEMExtractor.cs +++ b/crypto/src/pqc/crypto/frodo/FrodoKEMExtractor.cs @@ -25,7 +25,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Frodo public byte[] ExtractSecret(byte[] encapsulation) { byte[] session_key = new byte[engine.SessionKeySize]; - engine.kem_dec(session_key, encapsulation, ((FrodoPrivateKeyParameters)key).PrivateKey); + engine.kem_dec(session_key, encapsulation, ((FrodoPrivateKeyParameters)key).privateKey); return session_key; } diff --git a/crypto/src/pqc/crypto/frodo/FrodoKEMGenerator.cs b/crypto/src/pqc/crypto/frodo/FrodoKEMGenerator.cs index 5de9a2094..540024409 100644 --- a/crypto/src/pqc/crypto/frodo/FrodoKEMGenerator.cs +++ b/crypto/src/pqc/crypto/frodo/FrodoKEMGenerator.cs @@ -24,7 +24,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Frodo FrodoEngine engine = key.Parameters.Engine; byte[] cipher_text = new byte[engine.CipherTextSize]; byte[] sessionKey = new byte[engine.SessionKeySize]; - engine.kem_enc(cipher_text, sessionKey, key.PublicKey, sr); + engine.kem_enc(cipher_text, sessionKey, key.m_publicKey, sr); return new SecretWithEncapsulationImpl(sessionKey, cipher_text); } diff --git a/crypto/src/pqc/crypto/frodo/FrodoPrivateKeyParameters.cs b/crypto/src/pqc/crypto/frodo/FrodoPrivateKeyParameters.cs index 400454c9a..7cf215504 100644 --- a/crypto/src/pqc/crypto/frodo/FrodoPrivateKeyParameters.cs +++ b/crypto/src/pqc/crypto/frodo/FrodoPrivateKeyParameters.cs @@ -7,9 +7,12 @@ namespace Org.BouncyCastle.Pqc.Crypto.Frodo public class FrodoPrivateKeyParameters : FrodoKeyParameters { - private byte[] privateKey; + internal byte[] privateKey; - public byte[] PrivateKey => Arrays.Clone(privateKey); + public byte[] GetPrivateKey() + { + return Arrays.Clone(privateKey); + } public FrodoPrivateKeyParameters(FrodoParameters parameters, byte[] privateKey) : base(true, parameters) diff --git a/crypto/src/pqc/crypto/frodo/FrodoPublicKeyParameters.cs b/crypto/src/pqc/crypto/frodo/FrodoPublicKeyParameters.cs index 1b8c37331..70fad4024 100644 --- a/crypto/src/pqc/crypto/frodo/FrodoPublicKeyParameters.cs +++ b/crypto/src/pqc/crypto/frodo/FrodoPublicKeyParameters.cs @@ -7,13 +7,17 @@ namespace Org.BouncyCastle.Pqc.Crypto.Frodo public class FrodoPublicKeyParameters : FrodoKeyParameters { - private readonly byte[] m_publicKey; + internal readonly byte[] m_publicKey; + + public byte[] GetPublicKey() + { + return Arrays.Clone(m_publicKey); + } - public byte[] PublicKey => Arrays.Clone(m_publicKey); public byte[] GetEncoded() { - return PublicKey; + return GetPublicKey(); } public FrodoPublicKeyParameters(FrodoParameters parameters, byte[] publicKey) -- cgit 1.4.1