Skip to content

Commit c4af489

Browse files
committed
added purpose check, marked deprecated method
1 parent 2ac0e18 commit c4af489

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

core/src/main/java/org/bouncycastle/asn1/x509/V2TBSCertListGenerator.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,10 @@ public void addCRLEntry(ASN1Integer userCertificate, Time revocationDate, Extens
195195
addCRLEntry(new DERSequence(v));
196196
}
197197

198+
/**
199+
* @deprecated use the method taking Extensions
200+
*/
201+
@Deprecated
198202
public void setExtensions(
199203
X509Extensions extensions)
200204
{

core/src/main/java/org/bouncycastle/crypto/digests/KeccakDigest.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class KeccakDigest
2121
0x000000008000808bL, 0x800000000000008bL, 0x8000000000008089L, 0x8000000000008003L, 0x8000000000008002L,
2222
0x8000000000000080L, 0x000000000000800aL, 0x800000008000000aL, 0x8000000080008081L, 0x8000000000008080L,
2323
0x0000000080000001L, 0x8000000080008008L };
24-
protected final CryptoServicePurpose purpose;
24+
protected CryptoServicePurpose purpose;
2525

2626
protected long[] state = new long[25];
2727
protected byte[] dataQueue = new byte[192];
@@ -84,6 +84,15 @@ protected KeccakDigest(byte[] encodedState)
8484
squeezing = encodedState[encOff] != 0;
8585
}
8686

87+
protected KeccakDigest(byte[] encodedState, CryptoServicePurpose purpose)
88+
{
89+
this(encodedState);
90+
if (!this.purpose.equals(purpose))
91+
{
92+
throw new IllegalStateException("digest encoded for a different purpose");
93+
}
94+
}
95+
8796
private static CryptoServicePurpose getCryptoServicePurpose(byte b)
8897
{
8998
CryptoServicePurpose[] values = CryptoServicePurpose.values();

0 commit comments

Comments
 (0)