Skip to content

Commit 581230c

Browse files
Merge branch 'master' into netstandard
2 parents 9c8ab17 + 60e3a22 commit 581230c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+8001
-954
lines changed

crypto/Contributors.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@
88
<h2>The Bouncy Castle Cryptographic C#&reg; API</h2>
99
<p>
1010
<h3>Donors</h3>
11+
<p>
12+
The following people and organisations donated financially to help with the release of 1.8.9:
13+
<br />&nbsp;<br />
14+
loligans and Encryptomatic LLC
15+
</p>
16+
<p>
17+
The following people and organisations donated financially to help with the release of 1.8.8:
18+
<br />&nbsp;<br />
19+
jey4554, Manual Corona, and Encryptomatic LLC
20+
</p>
1121
<p>
1222
The following people and organisations donated financially to help with the release of 1.8.5:
1323
<br />&nbsp;<br />
@@ -151,6 +161,9 @@ <h3>Code Contributors:</h3>
151161
</li>
152162
<li>
153163
<p>bkalakrishnan (https://github.com/bkalakrishnan) - reported issue with SecureRandom.NextDouble and advised how to fix.</p>
164+
</li>
165+
<li>
166+
<p>BlackthornYugen (https://github.com/BlackthornYugen) - contributed unit tests for NIST ECC..</p>
154167
</li>
155168
</ul>
156169
</body>

crypto/NBuild.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<property name="dist-path" value="./dist"/>
1717

1818
<!-- Version -->
19-
<property name="version" value="1.8.8"/>
19+
<property name="version" value="1.8.9"/>
2020
<property name="name" value="BouncyCastle.Crypto"/>
2121

2222
<property name="OPTIONAL_STRONG_NAME" value="" />

crypto/Readme.html

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ <h3><a class="mozTocH3" name="mozTocId685176"></a>Contents:<br/></h3>
3030
<li>
3131
<a href="#mozTocId3413">Notes:</a>
3232
<ol>
33+
<li>
34+
<a href="#mozTocId85323">Release 1.8.9</a>
3335
<li>
3436
<a href="#mozTocId85322">Release 1.8.8</a>
3537
<li>
@@ -304,6 +306,26 @@ <h3><a class="mozTocH3" name="mozTocId358608"></a>For first time users.</h3>
304306
<hr style="WIDTH: 100%; HEIGHT: 2px">
305307
<h3><a class="mozTocH3" name="mozTocId3413"></a>Notes:</h3>
306308

309+
<h4><a class="mozTocH4" name="mozTocId85323"></a>Release 1.8.9, Tuesday December 8, 2020</h4>
310+
311+
<h5>Defects Fixed</h5>
312+
<ul>
313+
<li>The TimeStampToken generator is now using PkcsObjectIdentifiers.IdAASigningCertificateV2 for the generating SigningCertificateV2.</li>
314+
</ul>
315+
<h5>Additional Features and Functionality</h5>
316+
<ul>
317+
<li>Added CSHAKE digest and KMAC.</li>
318+
<li>Added support for PKCS#5 Scheme 2 to Pkcs12Store.</li>
319+
<li>Improved performance for GCM.</li>
320+
</ul>
321+
<h5>Additional Notes</h5>
322+
<ul>
323+
<li>
324+
See the (cumulative) list of GitHub pull requests that we have accepted at
325+
<a href="https://github.com/bcgit/bc-csharp/pulls?q=is%3Apr+is%3Aclosed">bcgit/bc-csharp</a>.
326+
</li>
327+
</ul>
328+
307329
<h4><a class="mozTocH4" name="mozTocId85322"></a>Release 1.8.8, Monday September 21, 2020</h4>
308330

309331
<h5>Additional Features and Functionality</h5>

crypto/crypto.csproj

Lines changed: 73 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,6 +1483,16 @@
14831483
SubType = "Code"
14841484
BuildAction = "Compile"
14851485
/>
1486+
<File
1487+
RelPath = "src\asn1\nist\KMACwithSHAKE128_params.cs"
1488+
SubType = "Code"
1489+
BuildAction = "Compile"
1490+
/>
1491+
<File
1492+
RelPath = "src\asn1\nist\KMACwithSHAKE256_params.cs"
1493+
SubType = "Code"
1494+
BuildAction = "Compile"
1495+
/>
14861496
<File
14871497
RelPath = "src\asn1\nist\NISTNamedCurves.cs"
14881498
SubType = "Code"
@@ -3563,6 +3573,11 @@
35633573
SubType = "Code"
35643574
BuildAction = "Compile"
35653575
/>
3576+
<File
3577+
RelPath = "src\crypto\digests\CSHAKEDigest.cs"
3578+
SubType = "Code"
3579+
BuildAction = "Compile"
3580+
/>
35663581
<File
35673582
RelPath = "src\crypto\digests\DSTU7564Digest.cs"
35683583
SubType = "Code"
@@ -3718,6 +3733,11 @@
37183733
SubType = "Code"
37193734
BuildAction = "Compile"
37203735
/>
3736+
<File
3737+
RelPath = "src\crypto\digests\XofUtils.cs"
3738+
SubType = "Code"
3739+
BuildAction = "Compile"
3740+
/>
37213741
<File
37223742
RelPath = "src\crypto\ec\CustomNamedCurves.cs"
37233743
SubType = "Code"
@@ -4279,22 +4299,27 @@
42794299
BuildAction = "Compile"
42804300
/>
42814301
<File
4282-
RelPath = "src\crypto\macs\Poly1305.cs"
4302+
RelPath = "src\crypto\macs\ISO9797Alg3Mac.cs"
42834303
SubType = "Code"
42844304
BuildAction = "Compile"
42854305
/>
42864306
<File
4287-
RelPath = "src\crypto\macs\SipHash.cs"
4307+
RelPath = "src\crypto\macs\KMac.cs"
42884308
SubType = "Code"
42894309
BuildAction = "Compile"
42904310
/>
42914311
<File
4292-
RelPath = "src\crypto\macs\SkeinMac.cs"
4312+
RelPath = "src\crypto\macs\Poly1305.cs"
42934313
SubType = "Code"
42944314
BuildAction = "Compile"
42954315
/>
42964316
<File
4297-
RelPath = "src\crypto\macs\ISO9797Alg3Mac.cs"
4317+
RelPath = "src\crypto\macs\SipHash.cs"
4318+
SubType = "Code"
4319+
BuildAction = "Compile"
4320+
/>
4321+
<File
4322+
RelPath = "src\crypto\macs\SkeinMac.cs"
42984323
SubType = "Code"
42994324
BuildAction = "Compile"
43004325
/>
@@ -4413,6 +4438,11 @@
44134438
SubType = "Code"
44144439
BuildAction = "Compile"
44154440
/>
4441+
<File
4442+
RelPath = "src\crypto\modes\gcm\Tables4kGcmMultiplier.cs"
4443+
SubType = "Code"
4444+
BuildAction = "Compile"
4445+
/>
44164446
<File
44174447
RelPath = "src\crypto\modes\gcm\Tables64kGcmMultiplier.cs"
44184448
SubType = "Code"
@@ -6833,6 +6863,11 @@
68336863
SubType = "Code"
68346864
BuildAction = "Compile"
68356865
/>
6866+
<File
6867+
RelPath = "src\math\raw\Bits.cs"
6868+
SubType = "Code"
6869+
BuildAction = "Compile"
6870+
/>
68366871
<File
68376872
RelPath = "src\math\raw\Interleave.cs"
68386873
SubType = "Code"
@@ -7643,6 +7678,11 @@
76437678
SubType = "Code"
76447679
BuildAction = "Compile"
76457680
/>
7681+
<File
7682+
RelPath = "src\util\Longs.cs"
7683+
SubType = "Code"
7684+
BuildAction = "Compile"
7685+
/>
76467686
<File
76477687
RelPath = "src\util\MemoableResetException.cs"
76487688
SubType = "Code"
@@ -8234,6 +8274,10 @@
82348274
RelPath = "test\data\cms\sigs\SignedMSPkcs7.sig"
82358275
BuildAction = "EmbeddedResource"
82368276
/>
8277+
<File
8278+
RelPath = "test\data\crypto\nist_ecc.txt"
8279+
BuildAction = "EmbeddedResource"
8280+
/>
82378281
<File
82388282
RelPath = "test\data\crypto\SHA3TestVectors.txt"
82398283
BuildAction = "EmbeddedResource"
@@ -11747,6 +11791,11 @@
1174711791
SubType = "Code"
1174811792
BuildAction = "Compile"
1174911793
/>
11794+
<File
11795+
RelPath = "test\src\asn1\test\KMacParamsTest.cs"
11796+
SubType = "Code"
11797+
BuildAction = "Compile"
11798+
/>
1175011799
<File
1175111800
RelPath = "test\src\asn1\test\LDSSecurityObjectUnitTest.cs"
1175211801
SubType = "Code"
@@ -12202,6 +12251,11 @@
1220212251
SubType = "Code"
1220312252
BuildAction = "Compile"
1220412253
/>
12254+
<File
12255+
RelPath = "test\src\crypto\test\CSHAKETest.cs"
12256+
SubType = "Code"
12257+
BuildAction = "Compile"
12258+
/>
1220512259
<File
1220612260
RelPath = "test\src\crypto\test\CTSTest.cs"
1220712261
SubType = "Code"
@@ -12327,6 +12381,16 @@
1232712381
SubType = "Code"
1232812382
BuildAction = "Compile"
1232912383
/>
12384+
<File
12385+
RelPath = "test\src\crypto\test\KMACTest.cs"
12386+
SubType = "Code"
12387+
BuildAction = "Compile"
12388+
/>
12389+
<File
12390+
RelPath = "test\src\crypto\test\NistEccTest.cs"
12391+
SubType = "Code"
12392+
BuildAction = "Compile"
12393+
/>
1233012394
<File
1233112395
RelPath = "test\src\crypto\test\OCBTest.cs"
1233212396
SubType = "Code"
@@ -13632,6 +13696,11 @@
1363213696
SubType = "Code"
1363313697
BuildAction = "Compile"
1363413698
/>
13699+
<File
13700+
RelPath = "test\src\tsp\test\NewTspTest.cs"
13701+
SubType = "Code"
13702+
BuildAction = "Compile"
13703+
/>
1363513704
<File
1363613705
RelPath = "test\src\tsp\test\TSPTest.cs"
1363713706
SubType = "Code"
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
using Org.BouncyCastle.Utilities;
2+
using System;
3+
4+
5+
namespace Org.BouncyCastle.Asn1.Nist
6+
{
7+
/// <summary>
8+
/// KMACwithSHAKE128-params ::= SEQUENCE {
9+
/// kMACOutputLength INTEGER DEFAULT 256, -- Output length in bits
10+
/// customizationString OCTET STRING DEFAULT ''H
11+
/// }
12+
/// </summary>
13+
public class KMacWithShake128Params : Asn1Encodable
14+
{
15+
private static readonly byte[] EMPTY_STRING = new byte[0];
16+
private static readonly int DEF_LENGTH = 256;
17+
18+
private readonly int outputLength;
19+
private readonly byte[] customizationString;
20+
21+
public KMacWithShake128Params(int outputLength)
22+
{
23+
this.outputLength = outputLength;
24+
this.customizationString = EMPTY_STRING;
25+
}
26+
27+
public KMacWithShake128Params(int outputLength, byte[] customizationString)
28+
{
29+
this.outputLength = outputLength;
30+
this.customizationString = Arrays.Clone(customizationString);
31+
}
32+
33+
public static KMacWithShake128Params GetInstance(object o)
34+
{
35+
if (o is KMacWithShake128Params)
36+
{
37+
return (KMacWithShake128Params)o;
38+
}
39+
else if (o != null)
40+
{
41+
return new KMacWithShake128Params(Asn1Sequence.GetInstance(o));
42+
}
43+
44+
return null;
45+
}
46+
47+
private KMacWithShake128Params(Asn1Sequence seq)
48+
{
49+
if (seq.Count > 2)
50+
throw new InvalidOperationException("sequence size greater than 2");
51+
52+
if (seq.Count == 2)
53+
{
54+
this.outputLength = DerInteger.GetInstance(seq[0]).IntValueExact;
55+
this.customizationString = Arrays.Clone(Asn1OctetString.GetInstance(seq[1]).GetOctets());
56+
}
57+
else if (seq.Count == 1)
58+
{
59+
if (seq[0] is DerInteger)
60+
{
61+
this.outputLength = DerInteger.GetInstance(seq[0]).IntValueExact;
62+
this.customizationString = EMPTY_STRING;
63+
}
64+
else
65+
{
66+
this.outputLength = DEF_LENGTH;
67+
this.customizationString = Arrays.Clone(Asn1OctetString.GetInstance(seq[0]).GetOctets());
68+
}
69+
}
70+
else
71+
{
72+
this.outputLength = DEF_LENGTH;
73+
this.customizationString = EMPTY_STRING;
74+
}
75+
}
76+
77+
public int OutputLength
78+
{
79+
get { return outputLength; }
80+
}
81+
82+
public byte[] CustomizationString
83+
{
84+
get { return Arrays.Clone(customizationString); }
85+
}
86+
87+
public override Asn1Object ToAsn1Object()
88+
{
89+
Asn1EncodableVector v = new Asn1EncodableVector();
90+
if (outputLength != DEF_LENGTH)
91+
{
92+
v.Add(new DerInteger(outputLength));
93+
}
94+
95+
if (customizationString.Length != 0)
96+
{
97+
v.Add(new DerOctetString(CustomizationString));
98+
}
99+
100+
return new DerSequence(v);
101+
}
102+
}
103+
}

0 commit comments

Comments
 (0)