Initial Commit
This commit is contained in:
54
iTechSharp/srcbc/crypto/parameters/RsaKeyParameters.cs
Normal file
54
iTechSharp/srcbc/crypto/parameters/RsaKeyParameters.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
|
||||
using Org.BouncyCastle.Crypto;
|
||||
using Org.BouncyCastle.Math;
|
||||
|
||||
namespace Org.BouncyCastle.Crypto.Parameters
|
||||
{
|
||||
public class RsaKeyParameters
|
||||
: AsymmetricKeyParameter
|
||||
{
|
||||
private readonly BigInteger modulus;
|
||||
private readonly BigInteger exponent;
|
||||
|
||||
public RsaKeyParameters(
|
||||
bool isPrivate,
|
||||
BigInteger modulus,
|
||||
BigInteger exponent)
|
||||
: base(isPrivate)
|
||||
{
|
||||
this.modulus = modulus;
|
||||
this.exponent = exponent;
|
||||
}
|
||||
|
||||
public BigInteger Modulus
|
||||
{
|
||||
get { return modulus; }
|
||||
}
|
||||
|
||||
public BigInteger Exponent
|
||||
{
|
||||
get { return exponent; }
|
||||
}
|
||||
|
||||
public override bool Equals(
|
||||
object obj)
|
||||
{
|
||||
RsaKeyParameters kp = obj as RsaKeyParameters;
|
||||
|
||||
if (kp == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return kp.IsPrivate == this.IsPrivate
|
||||
&& kp.Modulus.Equals(this.modulus)
|
||||
&& kp.Exponent.Equals(this.exponent);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return modulus.GetHashCode() ^ exponent.GetHashCode() ^ IsPrivate.GetHashCode();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user