/// <summary> /// Decides whether the given object <c>other</c> is the same as this field /// </summary> /// /// <param name="Obj">The object for comparison</param> /// /// <returns>Returns <c>(this == other)</c></returns> public override bool Equals(Object Obj) { if (Obj == null || !(Obj is RNBWPrivateKey)) { return(false); } RNBWPrivateKey other = (RNBWPrivateKey)Obj; if (!Compare.AreEqual(ArrayUtils.ToBytes(_a1Inv), ArrayUtils.ToBytes(other.InvA1))) { return(false); } if (!Compare.AreEqual(ArrayUtils.ToBytes(_B1), ArrayUtils.ToBytes(other.B1))) { return(false); } if (!Compare.AreEqual(ArrayUtils.ToBytes(_a2Inv), ArrayUtils.ToBytes(other.InvA2))) { return(false); } if (!Compare.AreEqual(ArrayUtils.ToBytes(_B2), ArrayUtils.ToBytes(other.B2))) { return(false); } if (!Compare.AreEqual(ArrayUtils.ToBytes(_VI), ArrayUtils.ToBytes(other.VI))) { return(false); } return(true); }
/// <summary> /// Generate an encryption Key pair /// </summary> /// /// <returns>A RNBWKeyPair containing public and private keys</returns> public IAsymmetricKeyPair GenerateKeyPair() { RNBWPrivateKey privKey; RNBWPublicKey pubKey; _VI = m_rlweParams.Vi; _numLayers = m_rlweParams.NumLayers; // choose all coefficients at random Generate(); // now marshall them to PrivateKey privKey = new RNBWPrivateKey(_A1Inv, _B1, _A2Inv, _B2, _VI, _layers); // marshall to PublicKey pubKey = new RNBWPublicKey(_VI[_VI.Length - 1] - _VI[0], _pubQuadratic, _pubSingular, _pubScalar); return(new RNBWKeyPair(pubKey, privKey)); }
/// <summary> /// Generate an encryption Key pair /// </summary> /// /// <returns>A RNBWKeyPair containing public and private keys</returns> public IAsymmetricKeyPair GenerateKeyPair() { RNBWPrivateKey privKey; RNBWPublicKey pubKey; _VI = _rlweParams.Vi; _numLayers = _rlweParams.NumLayers; // choose all coefficients at random Generate(); // now marshall them to PrivateKey privKey = new RNBWPrivateKey(_A1Inv, _B1, _A2Inv, _B2, _VI, _layers); // marshall to PublicKey pubKey = new RNBWPublicKey(_VI[_VI.Length - 1] - _VI[0], _pubQuadratic, _pubSingular, _pubScalar); return new RNBWKeyPair(pubKey, privKey); }