Skip to content

Commit 3e6afab

Browse files
committed
Fix .NET 1.1 build
1 parent 661a878 commit 3e6afab

File tree

3 files changed

+40
-25
lines changed

3 files changed

+40
-25
lines changed

crypto/crypto.csproj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3268,6 +3268,11 @@
32683268
SubType = "Code"
32693269
BuildAction = "Compile"
32703270
/>
3271+
<File
3272+
RelPath = "src\crypto\IDigestFactory.cs"
3273+
SubType = "Code"
3274+
BuildAction = "Compile"
3275+
/>
32713276
<File
32723277
RelPath = "src\crypto\IDSA.cs"
32733278
SubType = "Code"
@@ -4423,6 +4428,11 @@
44234428
SubType = "Code"
44244429
BuildAction = "Compile"
44254430
/>
4431+
<File
4432+
RelPath = "src\crypto\operators\Asn1DigestFactory.cs"
4433+
SubType = "Code"
4434+
BuildAction = "Compile"
4435+
/>
44264436
<File
44274437
RelPath = "src\crypto\operators\Asn1KeyWrapper.cs"
44284438
SubType = "Code"

crypto/src/crypto/IDigestFactory.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
using System;
2+
13
namespace Org.BouncyCastle.Crypto
24
{
35
/// <summary>
Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
using Org.BouncyCastle.Asn1;
1+
using System;
2+
using System.IO;
3+
4+
using Org.BouncyCastle.Asn1;
25
using Org.BouncyCastle.Asn1.X509;
36
using Org.BouncyCastle.Crypto.IO;
47
using Org.BouncyCastle.Security;
5-
using System;
6-
using System.IO;
7-
88

99
namespace Org.BouncyCastle.Crypto.Operators
1010
{
1111
public class Asn1DigestFactory : IDigestFactory
1212
{
13-
1413
public static Asn1DigestFactory Get(DerObjectIdentifier oid)
1514
{
1615
return new Asn1DigestFactory(DigestUtilities.GetDigest(oid), oid);
@@ -22,46 +21,50 @@ public static Asn1DigestFactory Get(String mechanism)
2221
return new Asn1DigestFactory(DigestUtilities.GetDigest(oid), oid);
2322
}
2423

25-
26-
private IDigest digest;
27-
private DerObjectIdentifier oid;
24+
private readonly IDigest mDigest;
25+
private readonly DerObjectIdentifier mOid;
2826

2927
public Asn1DigestFactory(IDigest digest, DerObjectIdentifier oid)
3028
{
31-
this.digest = digest;
32-
this.oid = oid;
29+
this.mDigest = digest;
30+
this.mOid = oid;
3331
}
3432

35-
public object AlgorithmDetails => new AlgorithmIdentifier(oid);
33+
public virtual object AlgorithmDetails
34+
{
35+
get { return new AlgorithmIdentifier(mOid); }
36+
}
3637

37-
public int DigestLength => digest.GetDigestSize();
38+
public virtual int DigestLength
39+
{
40+
get { return mDigest.GetDigestSize(); }
41+
}
3842

39-
public IStreamCalculator CreateCalculator() => new DfDigestStream(digest);
40-
43+
public virtual IStreamCalculator CreateCalculator()
44+
{
45+
return new DfDigestStream(mDigest);
46+
}
4147
}
4248

43-
4449
internal class DfDigestStream : IStreamCalculator
4550
{
46-
47-
private DigestSink stream;
51+
private readonly DigestSink mStream;
4852

4953
public DfDigestStream(IDigest digest)
5054
{
51-
stream = new DigestSink(digest);
55+
this.mStream = new DigestSink(digest);
5256
}
5357

54-
public Stream Stream => stream;
58+
public Stream Stream
59+
{
60+
get { return mStream; }
61+
}
5562

5663
public object GetResult()
5764
{
58-
byte[] result = new byte[stream.Digest.GetDigestSize()];
59-
stream.Digest.DoFinal(result, 0);
65+
byte[] result = new byte[mStream.Digest.GetDigestSize()];
66+
mStream.Digest.DoFinal(result, 0);
6067
return new SimpleBlockResult(result);
6168
}
62-
6369
}
64-
65-
66-
6770
}

0 commit comments

Comments
 (0)