diff options
Diffstat (limited to 'crypto/src/pqc/crypto/crystals/dilithium/DilithiumPrivateKeyParameters.cs')
-rw-r--r-- | crypto/src/pqc/crypto/crystals/dilithium/DilithiumPrivateKeyParameters.cs | 64 |
1 files changed, 33 insertions, 31 deletions
diff --git a/crypto/src/pqc/crypto/crystals/dilithium/DilithiumPrivateKeyParameters.cs b/crypto/src/pqc/crypto/crystals/dilithium/DilithiumPrivateKeyParameters.cs index b5f3c2a32..66a518c93 100644 --- a/crypto/src/pqc/crypto/crystals/dilithium/DilithiumPrivateKeyParameters.cs +++ b/crypto/src/pqc/crypto/crystals/dilithium/DilithiumPrivateKeyParameters.cs @@ -5,45 +5,47 @@ namespace Org.BouncyCastle.Pqc.Crypto.Crystals.Dilithium public sealed class DilithiumPrivateKeyParameters : DilithiumKeyParameters { - internal byte[] rho; - internal byte[] k; - internal byte[] tr; - internal byte[] s1; - internal byte[] s2; - internal byte[] t0; - - private byte[] t1; - - public DilithiumPrivateKeyParameters(DilithiumParameters parameters, byte[] rho, byte[] K, byte[] tr, byte[] s1, byte[] s2, byte[] t0, byte[] t1) + internal byte[] m_rho; + internal byte[] m_k; + internal byte[] m_tr; + internal byte[] m_s1; + internal byte[] m_s2; + internal byte[] m_t0; + + private byte[] m_t1; + + public DilithiumPrivateKeyParameters(DilithiumParameters parameters, byte[] rho, byte[] K, byte[] tr, + byte[] s1, byte[] s2, byte[] t0, byte[] t1) : base(true, parameters) { - this.rho = Arrays.Clone(rho); - this.k = Arrays.Clone(K); - this.tr = Arrays.Clone(tr); - this.s1 = Arrays.Clone(s1); - this.s2 = Arrays.Clone(s2); - this.t0 = Arrays.Clone(t0); - this.t1 = Arrays.Clone(t1); + m_rho = Arrays.Clone(rho); + m_k = Arrays.Clone(K); + m_tr = Arrays.Clone(tr); + m_s1 = Arrays.Clone(s1); + m_s2 = Arrays.Clone(s2); + m_t0 = Arrays.Clone(t0); + m_t1 = Arrays.Clone(t1); } - - public byte[] Rho => Arrays.Clone(rho); - public byte[] K => Arrays.Clone(k); + public byte[] GetEncoded() => Arrays.ConcatenateAll(m_rho, m_k, m_tr, m_s1, m_s2, m_t0); - public byte[] Tr => Arrays.Clone(tr); + public byte[] K => Arrays.Clone(m_k); - public byte[] S1 => Arrays.Clone(s1); + public byte[] GetPublicKey() => DilithiumPublicKeyParameters.GetEncoded(m_rho, m_t1); - public byte[] S2 => Arrays.Clone(s2); - + public DilithiumPublicKeyParameters GetPublicKeyParameters() => + new DilithiumPublicKeyParameters(Parameters, m_rho, m_t1); - public byte[] T0 => Arrays.Clone(t0); + public byte[] Rho => Arrays.Clone(m_rho); - public byte[] T1 => t1; + public byte[] S1 => Arrays.Clone(m_s1); - public byte[] GetEncoded() - { - return Arrays.ConcatenateAll(rho, k, tr, s1, s2, t0); - } + public byte[] S2 => Arrays.Clone(m_s2); + + public byte[] T0 => Arrays.Clone(m_t0); + + public byte[] T1 => Arrays.Clone(m_t1); + + public byte[] Tr => Arrays.Clone(m_tr); } -} \ No newline at end of file +} |