Skip to content

Commit

Permalink
PORTABLE fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdettman committed Oct 17, 2021
1 parent 4e7e7f5 commit 4143808
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
7 changes: 6 additions & 1 deletion crypto/src/bcpg/BcpgInputStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,12 @@ public Packet ReadPacket()
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)
Expand Down
4 changes: 4 additions & 0 deletions crypto/src/tls/HandshakeMessageInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ public sealed class HandshakeMessageInput
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;
Expand Down
6 changes: 3 additions & 3 deletions crypto/test/src/cmp/test/ProtectedMessageTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ public void TestNotBeforeNotAfter()
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)
Expand Down
3 changes: 2 additions & 1 deletion crypto/test/src/tsp/test/NewTspTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@
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;

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()
Expand Down

0 comments on commit 4143808

Please sign in to comment.