summary refs log tree commit diff
path: root/crypto
diff options
context:
space:
mode:
authorDavid Hook <david.hook@keyfactor.com>2022-11-07 17:39:01 +1100
committerDavid Hook <david.hook@keyfactor.com>2022-11-07 17:39:01 +1100
commitd75a665afb72634d4a2af42b3c8d29931fcdaf3e (patch)
tree550a4ba131270022873f5d7c2ef35b70451c552a /crypto
parentfixed use of property (diff)
downloadBouncyCastle.NET-ed25519-d75a665afb72634d4a2af42b3c8d29931fcdaf3e.tar.xz
fixed use of property
Diffstat (limited to 'crypto')
-rw-r--r--crypto/src/pqc/crypto/frodo/FrodoKEMExtractor.cs2
-rw-r--r--crypto/src/pqc/crypto/frodo/FrodoKEMGenerator.cs2
-rw-r--r--crypto/src/pqc/crypto/frodo/FrodoPrivateKeyParameters.cs7
-rw-r--r--crypto/src/pqc/crypto/frodo/FrodoPublicKeyParameters.cs10
-rw-r--r--crypto/test/src/pqc/crypto/test/FrodoVectorTest.cs4
5 files changed, 16 insertions, 9 deletions
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)
diff --git a/crypto/test/src/pqc/crypto/test/FrodoVectorTest.cs b/crypto/test/src/pqc/crypto/test/FrodoVectorTest.cs
index f7397c442..a8133e524 100644
--- a/crypto/test/src/pqc/crypto/test/FrodoVectorTest.cs
+++ b/crypto/test/src/pqc/crypto/test/FrodoVectorTest.cs
@@ -87,8 +87,8 @@ namespace Org.BouncyCastle.Pqc.Crypto.Tests
             FrodoPublicKeyParameters pubParams = (FrodoPublicKeyParameters)kp.Public;
             FrodoPrivateKeyParameters privParams = (FrodoPrivateKeyParameters)kp.Private;
 
-            Assert.True(Arrays.AreEqual(pk, pubParams.PublicKey), $"{name} {count} : public key");
-            Assert.True(Arrays.AreEqual(sk, privParams.PrivateKey), $"{name} {count} : secret key");
+            Assert.True(Arrays.AreEqual(pk, pubParams.GetPublicKey()), $"{name} {count} : public key");
+            Assert.True(Arrays.AreEqual(sk, privParams.GetPrivateKey()), $"{name} {count} : secret key");
 
             // kem_enc
             FrodoKEMGenerator frodoEncCipher = new FrodoKEMGenerator(random);