Skip to content

Commit 5498c9c

Browse files
committed
Reformatting
1 parent 0692a71 commit 5498c9c

File tree

2 files changed

+120
-120
lines changed

2 files changed

+120
-120
lines changed

crypto/src/asn1/pkcs/RSAPrivateKeyStructure.cs

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ namespace Org.BouncyCastle.Asn1.Pkcs
99
public class RsaPrivateKeyStructure
1010
: Asn1Encodable
1111
{
12-
private readonly BigInteger modulus;
13-
private readonly BigInteger publicExponent;
14-
private readonly BigInteger privateExponent;
15-
private readonly BigInteger prime1;
16-
private readonly BigInteger prime2;
17-
private readonly BigInteger exponent1;
18-
private readonly BigInteger exponent2;
19-
private readonly BigInteger coefficient;
12+
private readonly BigInteger modulus;
13+
private readonly BigInteger publicExponent;
14+
private readonly BigInteger privateExponent;
15+
private readonly BigInteger prime1;
16+
private readonly BigInteger prime2;
17+
private readonly BigInteger exponent1;
18+
private readonly BigInteger exponent2;
19+
private readonly BigInteger coefficient;
2020

2121
public static RsaPrivateKeyStructure GetInstance(Asn1TaggedObject obj, bool isExplicit)
2222
{
@@ -33,14 +33,14 @@ public static RsaPrivateKeyStructure GetInstance(object obj)
3333
}
3434

3535
public RsaPrivateKeyStructure(
36-
BigInteger modulus,
37-
BigInteger publicExponent,
38-
BigInteger privateExponent,
39-
BigInteger prime1,
40-
BigInteger prime2,
41-
BigInteger exponent1,
42-
BigInteger exponent2,
43-
BigInteger coefficient)
36+
BigInteger modulus,
37+
BigInteger publicExponent,
38+
BigInteger privateExponent,
39+
BigInteger prime1,
40+
BigInteger prime2,
41+
BigInteger exponent1,
42+
BigInteger exponent2,
43+
BigInteger coefficient)
4444
{
4545
this.modulus = modulus;
4646
this.publicExponent = publicExponent;
@@ -56,18 +56,18 @@ public RsaPrivateKeyStructure(
5656
public RsaPrivateKeyStructure(
5757
Asn1Sequence seq)
5858
{
59-
BigInteger version = ((DerInteger) seq[0]).Value;
59+
BigInteger version = ((DerInteger)seq[0]).Value;
6060
if (version.IntValue != 0)
6161
throw new ArgumentException("wrong version for RSA private key");
6262

63-
modulus = ((DerInteger) seq[1]).Value;
64-
publicExponent = ((DerInteger) seq[2]).Value;
65-
privateExponent = ((DerInteger) seq[3]).Value;
66-
prime1 = ((DerInteger) seq[4]).Value;
67-
prime2 = ((DerInteger) seq[5]).Value;
68-
exponent1 = ((DerInteger) seq[6]).Value;
69-
exponent2 = ((DerInteger) seq[7]).Value;
70-
coefficient = ((DerInteger) seq[8]).Value;
63+
modulus = ((DerInteger)seq[1]).Value;
64+
publicExponent = ((DerInteger)seq[2]).Value;
65+
privateExponent = ((DerInteger)seq[3]).Value;
66+
prime1 = ((DerInteger)seq[4]).Value;
67+
prime2 = ((DerInteger)seq[5]).Value;
68+
exponent1 = ((DerInteger)seq[6]).Value;
69+
exponent2 = ((DerInteger)seq[7]).Value;
70+
coefficient = ((DerInteger)seq[8]).Value;
7171
}
7272

7373
public BigInteger Modulus

crypto/src/crypto/parameters/RsaPrivateCrtKeyParameters.cs

Lines changed: 95 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -7,112 +7,112 @@
77
namespace Org.BouncyCastle.Crypto.Parameters
88
{
99
public class RsaPrivateCrtKeyParameters
10-
: RsaKeyParameters
10+
: RsaKeyParameters
1111
{
1212
private readonly BigInteger e, p, q, dP, dQ, qInv;
1313

14-
public RsaPrivateCrtKeyParameters(
15-
BigInteger modulus,
16-
BigInteger publicExponent,
17-
BigInteger privateExponent,
18-
BigInteger p,
19-
BigInteger q,
20-
BigInteger dP,
21-
BigInteger dQ,
22-
BigInteger qInv)
23-
: base(true, modulus, privateExponent)
14+
public RsaPrivateCrtKeyParameters(
15+
BigInteger modulus,
16+
BigInteger publicExponent,
17+
BigInteger privateExponent,
18+
BigInteger p,
19+
BigInteger q,
20+
BigInteger dP,
21+
BigInteger dQ,
22+
BigInteger qInv)
23+
: base(true, modulus, privateExponent)
2424
{
25-
ValidateValue(publicExponent, "publicExponent", "exponent");
26-
ValidateValue(p, "p", "P value");
27-
ValidateValue(q, "q", "Q value");
28-
ValidateValue(dP, "dP", "DP value");
29-
ValidateValue(dQ, "dQ", "DQ value");
30-
ValidateValue(qInv, "qInv", "InverseQ value");
31-
32-
this.e = publicExponent;
25+
ValidateValue(publicExponent, "publicExponent", "exponent");
26+
ValidateValue(p, "p", "P value");
27+
ValidateValue(q, "q", "Q value");
28+
ValidateValue(dP, "dP", "DP value");
29+
ValidateValue(dQ, "dQ", "DQ value");
30+
ValidateValue(qInv, "qInv", "InverseQ value");
31+
32+
this.e = publicExponent;
3333
this.p = p;
3434
this.q = q;
3535
this.dP = dP;
3636
this.dQ = dQ;
3737
this.qInv = qInv;
3838
}
3939

40-
public RsaPrivateCrtKeyParameters(RsaPrivateKeyStructure rsaPrivateKey)
41-
: this(
42-
rsaPrivateKey.Modulus,
43-
rsaPrivateKey.PublicExponent,
44-
rsaPrivateKey.PrivateExponent,
45-
rsaPrivateKey.Prime1,
46-
rsaPrivateKey.Prime2,
47-
rsaPrivateKey.Exponent1,
48-
rsaPrivateKey.Exponent2,
49-
rsaPrivateKey.Coefficient
50-
)
51-
{ }
52-
53-
public BigInteger PublicExponent
40+
public RsaPrivateCrtKeyParameters(RsaPrivateKeyStructure rsaPrivateKey)
41+
: this(
42+
rsaPrivateKey.Modulus,
43+
rsaPrivateKey.PublicExponent,
44+
rsaPrivateKey.PrivateExponent,
45+
rsaPrivateKey.Prime1,
46+
rsaPrivateKey.Prime2,
47+
rsaPrivateKey.Exponent1,
48+
rsaPrivateKey.Exponent2,
49+
rsaPrivateKey.Coefficient)
50+
{
51+
}
52+
53+
public BigInteger PublicExponent
5454
{
5555
get { return e; }
56-
}
57-
58-
public BigInteger P
59-
{
60-
get { return p; }
61-
}
62-
63-
public BigInteger Q
64-
{
65-
get { return q; }
66-
}
67-
68-
public BigInteger DP
69-
{
70-
get { return dP; }
71-
}
72-
73-
public BigInteger DQ
74-
{
75-
get { return dQ; }
76-
}
77-
78-
public BigInteger QInv
79-
{
80-
get { return qInv; }
81-
}
82-
83-
public override bool Equals(
84-
object obj)
85-
{
86-
if (obj == this)
87-
return true;
88-
89-
RsaPrivateCrtKeyParameters kp = obj as RsaPrivateCrtKeyParameters;
90-
91-
if (kp == null)
92-
return false;
93-
94-
return kp.DP.Equals(dP)
95-
&& kp.DQ.Equals(dQ)
96-
&& kp.Exponent.Equals(this.Exponent)
97-
&& kp.Modulus.Equals(this.Modulus)
98-
&& kp.P.Equals(p)
99-
&& kp.Q.Equals(q)
100-
&& kp.PublicExponent.Equals(e)
101-
&& kp.QInv.Equals(qInv);
102-
}
103-
104-
public override int GetHashCode()
105-
{
106-
return DP.GetHashCode() ^ DQ.GetHashCode() ^ Exponent.GetHashCode() ^ Modulus.GetHashCode()
107-
^ P.GetHashCode() ^ Q.GetHashCode() ^ PublicExponent.GetHashCode() ^ QInv.GetHashCode();
108-
}
109-
110-
private static void ValidateValue(BigInteger x, string name, string desc)
111-
{
112-
if (x == null)
113-
throw new ArgumentNullException(name);
114-
if (x.SignValue <= 0)
115-
throw new ArgumentException("Not a valid RSA " + desc, name);
116-
}
117-
}
56+
}
57+
58+
public BigInteger P
59+
{
60+
get { return p; }
61+
}
62+
63+
public BigInteger Q
64+
{
65+
get { return q; }
66+
}
67+
68+
public BigInteger DP
69+
{
70+
get { return dP; }
71+
}
72+
73+
public BigInteger DQ
74+
{
75+
get { return dQ; }
76+
}
77+
78+
public BigInteger QInv
79+
{
80+
get { return qInv; }
81+
}
82+
83+
public override bool Equals(
84+
object obj)
85+
{
86+
if (obj == this)
87+
return true;
88+
89+
RsaPrivateCrtKeyParameters kp = obj as RsaPrivateCrtKeyParameters;
90+
91+
if (kp == null)
92+
return false;
93+
94+
return kp.DP.Equals(dP)
95+
&& kp.DQ.Equals(dQ)
96+
&& kp.Exponent.Equals(this.Exponent)
97+
&& kp.Modulus.Equals(this.Modulus)
98+
&& kp.P.Equals(p)
99+
&& kp.Q.Equals(q)
100+
&& kp.PublicExponent.Equals(e)
101+
&& kp.QInv.Equals(qInv);
102+
}
103+
104+
public override int GetHashCode()
105+
{
106+
return DP.GetHashCode() ^ DQ.GetHashCode() ^ Exponent.GetHashCode() ^ Modulus.GetHashCode()
107+
^ P.GetHashCode() ^ Q.GetHashCode() ^ PublicExponent.GetHashCode() ^ QInv.GetHashCode();
108+
}
109+
110+
private static void ValidateValue(BigInteger x, string name, string desc)
111+
{
112+
if (x == null)
113+
throw new ArgumentNullException(name);
114+
if (x.SignValue <= 0)
115+
throw new ArgumentException("Not a valid RSA " + desc, name);
116+
}
117+
}
118118
}

0 commit comments

Comments
 (0)