diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2021-10-18 01:39:56 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2021-10-18 01:39:56 +0700 |
commit | 414380883367c5bb2d250da5937f44f742cba281 (patch) | |
tree | 19c82f09c3f6eca73085bf1bc0a953e026dde71b | |
parent | .NET 1.1 fixes (diff) | |
download | BouncyCastle.NET-ed25519-414380883367c5bb2d250da5937f44f742cba281.tar.xz |
PORTABLE fixes
-rw-r--r-- | crypto/src/bcpg/BcpgInputStream.cs | 7 | ||||
-rw-r--r-- | crypto/src/tls/HandshakeMessageInput.cs | 4 | ||||
-rw-r--r-- | crypto/test/src/cmp/test/ProtectedMessageTest.cs | 6 | ||||
-rw-r--r-- | crypto/test/src/tsp/test/NewTspTest.cs | 3 |
4 files changed, 15 insertions, 5 deletions
diff --git a/crypto/src/bcpg/BcpgInputStream.cs b/crypto/src/bcpg/BcpgInputStream.cs index 38b5382ad..5efef193a 100644 --- a/crypto/src/bcpg/BcpgInputStream.cs +++ b/crypto/src/bcpg/BcpgInputStream.cs @@ -196,7 +196,12 @@ namespace Org.BouncyCastle.Bcpg else { PartialInputStream pis = new PartialInputStream(this, partial, bodyLen); - objStream = new BcpgInputStream(new BufferedStream(pis)); +#if NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE + Stream buf = pis; +#else + Stream buf = new BufferedStream(pis); +#endif + objStream = new BcpgInputStream(buf); } switch (tag) diff --git a/crypto/src/tls/HandshakeMessageInput.cs b/crypto/src/tls/HandshakeMessageInput.cs index c15112cc0..8d9a291d7 100644 --- a/crypto/src/tls/HandshakeMessageInput.cs +++ b/crypto/src/tls/HandshakeMessageInput.cs @@ -13,7 +13,11 @@ namespace Org.BouncyCastle.Tls private readonly int m_offset; internal HandshakeMessageInput(byte[] buf, int offset, int length) +#if PORTABLE + : base(buf, offset, length, false) +#else : base(buf, offset, length, false, true) +#endif { #if PORTABLE this.m_offset = 0; diff --git a/crypto/test/src/cmp/test/ProtectedMessageTest.cs b/crypto/test/src/cmp/test/ProtectedMessageTest.cs index 034463310..22e4b1c85 100644 --- a/crypto/test/src/cmp/test/ProtectedMessageTest.cs +++ b/crypto/test/src/cmp/test/ProtectedMessageTest.cs @@ -73,9 +73,9 @@ namespace Org.BouncyCastle.Cmp.Tests rsaKeyPairGenerator.Init(new RsaKeyGenerationParameters(BigInteger.ValueOf(65537), new SecureRandom(), 2048, 100)); AsymmetricCipherKeyPair rsaKeyPair = rsaKeyPairGenerator.GenerateKeyPair(); - doNotBeforeNotAfterTest(rsaKeyPair, new DateTime(1, 1, 1, 0, 0, 1), new DateTime(1, 1, 1, 0, 0, 10)); - doNotBeforeNotAfterTest(rsaKeyPair, DateTime.MinValue, new DateTime(1, 1, 1, 0, 0, 10)); - doNotBeforeNotAfterTest(rsaKeyPair, new DateTime(1, 1, 1, 0, 0, 1), DateTime.MinValue); + doNotBeforeNotAfterTest(rsaKeyPair, MakeUtcDateTime(1, 1, 1, 0, 0, 1), MakeUtcDateTime(1, 1, 1, 0, 0, 10)); + doNotBeforeNotAfterTest(rsaKeyPair, DateTime.MinValue, MakeUtcDateTime(1, 1, 1, 0, 0, 10)); + doNotBeforeNotAfterTest(rsaKeyPair, MakeUtcDateTime(1, 1, 1, 0, 0, 1), DateTime.MinValue); } private void doNotBeforeNotAfterTest(AsymmetricCipherKeyPair kp, DateTime notBefore, DateTime notAfter) diff --git a/crypto/test/src/tsp/test/NewTspTest.cs b/crypto/test/src/tsp/test/NewTspTest.cs index 4c9da7edb..6bc03b8c2 100644 --- a/crypto/test/src/tsp/test/NewTspTest.cs +++ b/crypto/test/src/tsp/test/NewTspTest.cs @@ -17,6 +17,7 @@ using Org.BouncyCastle.Crypto.Operators; using Org.BouncyCastle.Math; using Org.BouncyCastle.Utilities; using Org.BouncyCastle.Utilities.Date; +using Org.BouncyCastle.Utilities.Test; using Org.BouncyCastle.X509; using Org.BouncyCastle.X509.Store; @@ -24,7 +25,7 @@ namespace Org.BouncyCastle.Tsp.Tests { public class NewTspTest { - private static DateTime UnixEpoch = new DateTime(1970, 1, 1, 0, 0, 0); + private static DateTime UnixEpoch = SimpleTest.MakeUtcDateTime(1970, 1, 1, 0, 0, 0); [Test] public void TestGeneral() |