Skip to content

Commit

Permalink
Merge branch 'master' into netstandard
Browse files Browse the repository at this point in the history
  • Loading branch information
clairernovotny committed Dec 17, 2020
2 parents 9c8ab17 + 60e3a22 commit 581230c
Show file tree
Hide file tree
Showing 49 changed files with 8,001 additions and 954 deletions.
13 changes: 13 additions & 0 deletions crypto/Contributors.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@
<h2>The Bouncy Castle Cryptographic C#&reg; API</h2>
<p>
<h3>Donors</h3>
<p>
The following people and organisations donated financially to help with the release of 1.8.9:
<br />&nbsp;<br />
loligans and Encryptomatic LLC
</p>
<p>
The following people and organisations donated financially to help with the release of 1.8.8:
<br />&nbsp;<br />
jey4554, Manual Corona, and Encryptomatic LLC
</p>
<p>
The following people and organisations donated financially to help with the release of 1.8.5:
<br />&nbsp;<br />
Expand Down Expand Up @@ -151,6 +161,9 @@ <h3>Code Contributors:</h3>
</li>
<li>
<p>bkalakrishnan (https://github.com/bkalakrishnan) - reported issue with SecureRandom.NextDouble and advised how to fix.</p>
</li>
<li>
<p>BlackthornYugen (https://github.com/BlackthornYugen) - contributed unit tests for NIST ECC..</p>
</li>
</ul>
</body>
Expand Down
2 changes: 1 addition & 1 deletion crypto/NBuild.build
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<property name="dist-path" value="./dist"/>

<!-- Version -->
<property name="version" value="1.8.8"/>
<property name="version" value="1.8.9"/>
<property name="name" value="BouncyCastle.Crypto"/>

<property name="OPTIONAL_STRONG_NAME" value="" />
Expand Down
22 changes: 22 additions & 0 deletions crypto/Readme.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ <h3><a class="mozTocH3" name="mozTocId685176"></a>Contents:<br/></h3>
<li>
<a href="#mozTocId3413">Notes:</a>
<ol>
<li>
<a href="#mozTocId85323">Release 1.8.9</a>
<li>
<a href="#mozTocId85322">Release 1.8.8</a>
<li>
Expand Down Expand Up @@ -304,6 +306,26 @@ <h3><a class="mozTocH3" name="mozTocId358608"></a>For first time users.</h3>
<hr style="WIDTH: 100%; HEIGHT: 2px">
<h3><a class="mozTocH3" name="mozTocId3413"></a>Notes:</h3>

<h4><a class="mozTocH4" name="mozTocId85323"></a>Release 1.8.9, Tuesday December 8, 2020</h4>

<h5>Defects Fixed</h5>
<ul>
<li>The TimeStampToken generator is now using PkcsObjectIdentifiers.IdAASigningCertificateV2 for the generating SigningCertificateV2.</li>
</ul>
<h5>Additional Features and Functionality</h5>
<ul>
<li>Added CSHAKE digest and KMAC.</li>
<li>Added support for PKCS#5 Scheme 2 to Pkcs12Store.</li>
<li>Improved performance for GCM.</li>
</ul>
<h5>Additional Notes</h5>
<ul>
<li>
See the (cumulative) list of GitHub pull requests that we have accepted at
<a href="https://github.com/bcgit/bc-csharp/pulls?q=is%3Apr+is%3Aclosed">bcgit/bc-csharp</a>.
</li>
</ul>

<h4><a class="mozTocH4" name="mozTocId85322"></a>Release 1.8.8, Monday September 21, 2020</h4>

<h5>Additional Features and Functionality</h5>
Expand Down
77 changes: 73 additions & 4 deletions crypto/crypto.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -1483,6 +1483,16 @@
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "src\asn1\nist\KMACwithSHAKE128_params.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "src\asn1\nist\KMACwithSHAKE256_params.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "src\asn1\nist\NISTNamedCurves.cs"
SubType = "Code"
Expand Down Expand Up @@ -3563,6 +3573,11 @@
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "src\crypto\digests\CSHAKEDigest.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "src\crypto\digests\DSTU7564Digest.cs"
SubType = "Code"
Expand Down Expand Up @@ -3718,6 +3733,11 @@
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "src\crypto\digests\XofUtils.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "src\crypto\ec\CustomNamedCurves.cs"
SubType = "Code"
Expand Down Expand Up @@ -4279,22 +4299,27 @@
BuildAction = "Compile"
/>
<File
RelPath = "src\crypto\macs\Poly1305.cs"
RelPath = "src\crypto\macs\ISO9797Alg3Mac.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "src\crypto\macs\SipHash.cs"
RelPath = "src\crypto\macs\KMac.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "src\crypto\macs\SkeinMac.cs"
RelPath = "src\crypto\macs\Poly1305.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "src\crypto\macs\ISO9797Alg3Mac.cs"
RelPath = "src\crypto\macs\SipHash.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "src\crypto\macs\SkeinMac.cs"
SubType = "Code"
BuildAction = "Compile"
/>
Expand Down Expand Up @@ -4413,6 +4438,11 @@
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "src\crypto\modes\gcm\Tables4kGcmMultiplier.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "src\crypto\modes\gcm\Tables64kGcmMultiplier.cs"
SubType = "Code"
Expand Down Expand Up @@ -6833,6 +6863,11 @@
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "src\math\raw\Bits.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "src\math\raw\Interleave.cs"
SubType = "Code"
Expand Down Expand Up @@ -7643,6 +7678,11 @@
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "src\util\Longs.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "src\util\MemoableResetException.cs"
SubType = "Code"
Expand Down Expand Up @@ -8234,6 +8274,10 @@
RelPath = "test\data\cms\sigs\SignedMSPkcs7.sig"
BuildAction = "EmbeddedResource"
/>
<File
RelPath = "test\data\crypto\nist_ecc.txt"
BuildAction = "EmbeddedResource"
/>
<File
RelPath = "test\data\crypto\SHA3TestVectors.txt"
BuildAction = "EmbeddedResource"
Expand Down Expand Up @@ -11747,6 +11791,11 @@
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "test\src\asn1\test\KMacParamsTest.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "test\src\asn1\test\LDSSecurityObjectUnitTest.cs"
SubType = "Code"
Expand Down Expand Up @@ -12202,6 +12251,11 @@
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "test\src\crypto\test\CSHAKETest.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "test\src\crypto\test\CTSTest.cs"
SubType = "Code"
Expand Down Expand Up @@ -12327,6 +12381,16 @@
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "test\src\crypto\test\KMACTest.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "test\src\crypto\test\NistEccTest.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "test\src\crypto\test\OCBTest.cs"
SubType = "Code"
Expand Down Expand Up @@ -13632,6 +13696,11 @@
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "test\src\tsp\test\NewTspTest.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "test\src\tsp\test\TSPTest.cs"
SubType = "Code"
Expand Down
103 changes: 103 additions & 0 deletions crypto/src/asn1/nist/KMACwithSHAKE128_params.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
using Org.BouncyCastle.Utilities;
using System;


namespace Org.BouncyCastle.Asn1.Nist
{
/// <summary>
/// KMACwithSHAKE128-params ::= SEQUENCE {
/// kMACOutputLength INTEGER DEFAULT 256, -- Output length in bits
/// customizationString OCTET STRING DEFAULT ''H
/// }
/// </summary>
public class KMacWithShake128Params : Asn1Encodable
{
private static readonly byte[] EMPTY_STRING = new byte[0];
private static readonly int DEF_LENGTH = 256;

private readonly int outputLength;
private readonly byte[] customizationString;

public KMacWithShake128Params(int outputLength)
{
this.outputLength = outputLength;
this.customizationString = EMPTY_STRING;
}

public KMacWithShake128Params(int outputLength, byte[] customizationString)
{
this.outputLength = outputLength;
this.customizationString = Arrays.Clone(customizationString);
}

public static KMacWithShake128Params GetInstance(object o)
{
if (o is KMacWithShake128Params)
{
return (KMacWithShake128Params)o;
}
else if (o != null)
{
return new KMacWithShake128Params(Asn1Sequence.GetInstance(o));
}

return null;
}

private KMacWithShake128Params(Asn1Sequence seq)
{
if (seq.Count > 2)
throw new InvalidOperationException("sequence size greater than 2");

if (seq.Count == 2)
{
this.outputLength = DerInteger.GetInstance(seq[0]).IntValueExact;
this.customizationString = Arrays.Clone(Asn1OctetString.GetInstance(seq[1]).GetOctets());
}
else if (seq.Count == 1)
{
if (seq[0] is DerInteger)
{
this.outputLength = DerInteger.GetInstance(seq[0]).IntValueExact;
this.customizationString = EMPTY_STRING;
}
else
{
this.outputLength = DEF_LENGTH;
this.customizationString = Arrays.Clone(Asn1OctetString.GetInstance(seq[0]).GetOctets());
}
}
else
{
this.outputLength = DEF_LENGTH;
this.customizationString = EMPTY_STRING;
}
}

public int OutputLength
{
get { return outputLength; }
}

public byte[] CustomizationString
{
get { return Arrays.Clone(customizationString); }
}

public override Asn1Object ToAsn1Object()
{
Asn1EncodableVector v = new Asn1EncodableVector();
if (outputLength != DEF_LENGTH)
{
v.Add(new DerInteger(outputLength));
}

if (customizationString.Length != 0)
{
v.Add(new DerOctetString(CustomizationString));
}

return new DerSequence(v);
}
}
}
Loading

0 comments on commit 581230c

Please sign in to comment.