public override bool Equals(object o) { CheckApprovedOnlyModeStatus(); if (this == o) { return(true); } if (!(o is AsymmetricRsaPrivateKey)) { return(false); } AsymmetricRsaPrivateKey other = (AsymmetricRsaPrivateKey)o; return(Modulus.Equals(other.Modulus) && privateExponent.Equals(other.privateExponent) && PublicExponent.Equals(other.PublicExponent) && p.Equals(other.p) && q.Equals(other.q) && dp.Equals(other.dp) && dq.Equals(other.dq) && qInv.Equals(other.qInv)); }
public override int GetHashCode() { return(DP.GetHashCode() ^ DQ.GetHashCode() ^ Exponent.GetHashCode() ^ Modulus.GetHashCode() ^ P.GetHashCode() ^ Q.GetHashCode() ^ PublicExponent.GetHashCode() ^ QInv.GetHashCode()); }
/// <summary> /// Gets the encrypting stream. /// </summary> /// <param name="output">The output.</param> /// <returns></returns> public FinishingStream GetEncryptingStream(Stream output, KeyczarBase keyczar) { var rsa = new RsaEngine(); var oaep = UpdatePadding(rsa); return(new AsymmetricStream( oaep, output, (cipher, encrypt) => cipher.Init(encrypt, new RsaKeyParameters(false, Modulus.ToBouncyBigInteger(), PublicExponent.ToBouncyBigInteger())), encrypt: true)); }