From b7039a1a635e7b74765d44d2caf8cc2c5f66a6bc Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Tue, 14 Oct 2014 14:50:29 -0400 Subject: Added Visual Studio 2010 project/solution files for .NET 2.0 and Xamarin Android/iOS --- crypto/BouncyCastle.Android.csproj | 1355 ++++++++++++++++++++++++++++++++++++ 1 file changed, 1355 insertions(+) create mode 100644 crypto/BouncyCastle.Android.csproj (limited to 'crypto/BouncyCastle.Android.csproj') diff --git a/crypto/BouncyCastle.Android.csproj b/crypto/BouncyCastle.Android.csproj new file mode 100644 index 000000000..de74d5999 --- /dev/null +++ b/crypto/BouncyCastle.Android.csproj @@ -0,0 +1,1355 @@ + + + + Debug + AnyCPU + 10.0.0 + 2.0 + {A0D302CB-8866-4AB1-98B9-F0772EABF5DF} + {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Library + Org.BouncyCastle + Resources + Assets + False + BouncyCastle + v2.3 + + + true + full + false + bin\Debug\lib\MonoAndroid + obj\Debug\lib\MonoAndroid + DEBUG;TRACE;INCLUDE_IDEA;STRONG_NAME;__MOBILE__;__ANDROID__; + prompt + 4 + None + false + + + full + true + bin\Release\lib\MonoAndroid + obj\Release\lib\MonoAndroid + TRACE;INCLUDE_IDEA;STRONG_NAME;__MOBILE__;__ANDROID__; + prompt + 4 + false + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit 1.5.1 From 32f3459c02f3175f843359a71e085ba0f528e850 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Sun, 23 Nov 2014 10:21:30 -0500 Subject: Updated Visual Studio 2010 project files --- crypto/BouncyCastle.Android.csproj | 11 +++++++++++ crypto/BouncyCastle.csproj | 11 +++++++++++ crypto/BouncyCastle.iOS.csproj | 11 +++++++++++ 3 files changed, 33 insertions(+) (limited to 'crypto/BouncyCastle.Android.csproj') diff --git a/crypto/BouncyCastle.Android.csproj b/crypto/BouncyCastle.Android.csproj index de74d5999..7c4c243fb 100644 --- a/crypto/BouncyCastle.Android.csproj +++ b/crypto/BouncyCastle.Android.csproj @@ -908,6 +908,7 @@ + @@ -917,6 +918,16 @@ + + + + + + + + + + diff --git a/crypto/BouncyCastle.csproj b/crypto/BouncyCastle.csproj index 86c57df0c..c7199a1bc 100644 --- a/crypto/BouncyCastle.csproj +++ b/crypto/BouncyCastle.csproj @@ -902,6 +902,7 @@ + @@ -911,6 +912,16 @@ + + + + + + + + + + diff --git a/crypto/BouncyCastle.iOS.csproj b/crypto/BouncyCastle.iOS.csproj index cc3de9e55..0dcb9c9af 100644 --- a/crypto/BouncyCastle.iOS.csproj +++ b/crypto/BouncyCastle.iOS.csproj @@ -902,6 +902,7 @@ + @@ -911,6 +912,16 @@ + + + + + + + + + + -- cgit 1.5.1 From 440edd8dd1b167e43a0e531dc26204dca42488b5 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Tue, 17 Feb 2015 09:48:01 -0500 Subject: Added TlsPskIdentityManager.cs to the build --- crypto/BouncyCastle.Android.csproj | 1 + crypto/BouncyCastle.csproj | 1 + crypto/BouncyCastle.iOS.csproj | 1 + 3 files changed, 3 insertions(+) (limited to 'crypto/BouncyCastle.Android.csproj') diff --git a/crypto/BouncyCastle.Android.csproj b/crypto/BouncyCastle.Android.csproj index 7c4c243fb..db03b75be 100644 --- a/crypto/BouncyCastle.Android.csproj +++ b/crypto/BouncyCastle.Android.csproj @@ -1001,6 +1001,7 @@ + diff --git a/crypto/BouncyCastle.csproj b/crypto/BouncyCastle.csproj index c7199a1bc..1a43de126 100644 --- a/crypto/BouncyCastle.csproj +++ b/crypto/BouncyCastle.csproj @@ -995,6 +995,7 @@ + diff --git a/crypto/BouncyCastle.iOS.csproj b/crypto/BouncyCastle.iOS.csproj index 35d8f495f..45a7dfaab 100644 --- a/crypto/BouncyCastle.iOS.csproj +++ b/crypto/BouncyCastle.iOS.csproj @@ -996,6 +996,7 @@ + -- cgit 1.5.1 From b0db8810e52d60d2adfe98a495351052c87616a1 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Sat, 28 Mar 2015 11:49:37 -0400 Subject: Updated Visual Studio 2010 project files --- crypto/BouncyCastle.Android.csproj | 104 +++++++++++++++++++++++++++++------- crypto/BouncyCastle.csproj | 104 +++++++++++++++++++++++++++++------- crypto/BouncyCastle.iOS.csproj | 105 ++++++++++++++++++++++++++++++------- 3 files changed, 255 insertions(+), 58 deletions(-) (limited to 'crypto/BouncyCastle.Android.csproj') diff --git a/crypto/BouncyCastle.Android.csproj b/crypto/BouncyCastle.Android.csproj index 8a201b824..05eef369d 100644 --- a/crypto/BouncyCastle.Android.csproj +++ b/crypto/BouncyCastle.Android.csproj @@ -3,7 +3,7 @@ Debug AnyCPU - 10.0.0 + 8.0.30703 2.0 {A0D302CB-8866-4AB1-98B9-F0772EABF5DF} {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} @@ -129,6 +129,8 @@ + + @@ -667,6 +669,7 @@ + @@ -676,7 +679,6 @@ - @@ -766,8 +768,8 @@ - + @@ -904,7 +906,7 @@ - + @@ -951,8 +953,8 @@ - + @@ -996,10 +998,10 @@ - + @@ -1035,8 +1037,8 @@ - + @@ -1045,8 +1047,6 @@ - - @@ -1056,11 +1056,20 @@ - - - - - + + + + + + + + + + + + + + @@ -1093,6 +1102,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1125,6 +1182,19 @@ + + + + + + + + + + + + + @@ -1368,14 +1438,10 @@ - - - - - + diff --git a/crypto/BouncyCastle.csproj b/crypto/BouncyCastle.csproj index ee05e159a..668648ccc 100644 --- a/crypto/BouncyCastle.csproj +++ b/crypto/BouncyCastle.csproj @@ -3,7 +3,7 @@ Debug AnyCPU - 10.0.0 + 8.0.30703 2.0 {4C235092-820C-4DEB-9074-D356FB797D8B} Library @@ -123,6 +123,8 @@ + + @@ -661,6 +663,7 @@ + @@ -670,7 +673,6 @@ - @@ -760,8 +762,8 @@ - + @@ -898,7 +900,7 @@ - + @@ -945,8 +947,8 @@ - + @@ -990,10 +992,10 @@ - + @@ -1029,8 +1031,8 @@ - + @@ -1039,8 +1041,6 @@ - - @@ -1050,11 +1050,20 @@ - - - - - + + + + + + + + + + + + + + @@ -1087,6 +1096,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1119,6 +1176,19 @@ + + + + + + + + + + + + + @@ -1362,14 +1432,10 @@ - - - - - + diff --git a/crypto/BouncyCastle.iOS.csproj b/crypto/BouncyCastle.iOS.csproj index 7e6830fe6..372153436 100644 --- a/crypto/BouncyCastle.iOS.csproj +++ b/crypto/BouncyCastle.iOS.csproj @@ -3,7 +3,7 @@ Debug AnyCPU - 10.0.0 + 8.0.30703 2.0 {0249241C-205E-4AC0-828B-90F822359B9E} {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} @@ -124,6 +124,8 @@ + + @@ -662,6 +664,7 @@ + @@ -671,7 +674,6 @@ - @@ -761,8 +763,8 @@ - + @@ -899,7 +901,7 @@ - + @@ -946,8 +948,8 @@ - + @@ -991,10 +993,10 @@ - + @@ -1030,8 +1032,8 @@ - + @@ -1040,8 +1042,6 @@ - - @@ -1051,11 +1051,20 @@ - - - - - + + + + + + + + + + + + + + @@ -1088,6 +1097,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1120,6 +1177,19 @@ + + + + + + + + + + + + + @@ -1363,15 +1433,10 @@ - - - - - - + -- cgit 1.5.1 From 3ce61b5ebe84b928e1c067c0e2d5b0e53f834137 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Sat, 18 Apr 2015 21:22:01 +0700 Subject: Port recent Java updates --- crypto/BouncyCastle.Android.csproj | 4 ++ crypto/BouncyCastle.csproj | 4 ++ crypto/BouncyCastle.iOS.csproj | 4 ++ crypto/crypto.csproj | 20 ++++++ crypto/src/bcpg/ECDHPublicBCPGKey.cs | 102 ++++++++++++++++++++++++++++++ crypto/src/bcpg/ECDsaPublicBCPGKey.cs | 34 ++++++++++ crypto/src/bcpg/ECPublicBCPGKey.cs | 97 ++++++++++++++++++++++++++++ crypto/src/bcpg/ECSecretBCPGKey.cs | 56 ++++++++++++++++ crypto/src/bcpg/PublicKeyPacket.cs | 6 ++ crypto/src/bcpg/SignaturePacket.cs | 5 ++ crypto/src/crypto/modes/CcmBlockCipher.cs | 11 ++-- crypto/src/openpgp/PgpPublicKey.cs | 5 ++ 12 files changed, 343 insertions(+), 5 deletions(-) create mode 100644 crypto/src/bcpg/ECDHPublicBCPGKey.cs create mode 100644 crypto/src/bcpg/ECDsaPublicBCPGKey.cs create mode 100644 crypto/src/bcpg/ECPublicBCPGKey.cs create mode 100644 crypto/src/bcpg/ECSecretBCPGKey.cs (limited to 'crypto/BouncyCastle.Android.csproj') diff --git a/crypto/BouncyCastle.Android.csproj b/crypto/BouncyCastle.Android.csproj index 05eef369d..51f7f19a2 100644 --- a/crypto/BouncyCastle.Android.csproj +++ b/crypto/BouncyCastle.Android.csproj @@ -486,6 +486,10 @@ + + + + diff --git a/crypto/BouncyCastle.csproj b/crypto/BouncyCastle.csproj index 668648ccc..117af8d95 100644 --- a/crypto/BouncyCastle.csproj +++ b/crypto/BouncyCastle.csproj @@ -480,6 +480,10 @@ + + + + diff --git a/crypto/BouncyCastle.iOS.csproj b/crypto/BouncyCastle.iOS.csproj index 372153436..a1d3b15a1 100644 --- a/crypto/BouncyCastle.iOS.csproj +++ b/crypto/BouncyCastle.iOS.csproj @@ -481,6 +481,10 @@ + + + + diff --git a/crypto/crypto.csproj b/crypto/crypto.csproj index cb00f9912..0a0e2c1da 100644 --- a/crypto/crypto.csproj +++ b/crypto/crypto.csproj @@ -2323,6 +2323,26 @@ SubType = "Code" BuildAction = "Compile" /> + + + + Base class for an ECDH Public Key. + public class ECDHPublicBcpgKey + : ECPublicBcpgKey + { + private byte reserved; + private byte hashFunctionId; + private byte symAlgorithmId; + + /// The stream to read the packet from. + public ECDHPublicBcpgKey( + BcpgInputStream bcpgIn) + : base(bcpgIn) + { + int length = bcpgIn.ReadByte(); + byte[] kdfParameters = new byte[length]; + if (kdfParameters.Length != 3) + throw new InvalidOperationException("kdf parameters size of 3 expected."); + + bcpgIn.ReadFully(kdfParameters); + + reserved = kdfParameters[0]; + hashFunctionId = kdfParameters[1]; + symAlgorithmId = kdfParameters[2]; + + VerifyHashAlgorithm(); + VerifySymmetricKeyAlgorithm(); + } + + public ECDHPublicBcpgKey( + DerObjectIdentifier oid, + ECPoint point, + int hashAlgorithm, + int symmetricKeyAlgorithm) + : base(oid, point) + { + reserved = 1; + hashFunctionId = (byte)hashAlgorithm; + symAlgorithmId = (byte)symmetricKeyAlgorithm; + + VerifyHashAlgorithm(); + VerifySymmetricKeyAlgorithm(); + } + + public virtual byte Reserved + { + get { return reserved; } + } + + public virtual byte HashAlgorithm + { + get { return hashFunctionId; } + } + + public virtual byte SymmetricKeyAlgorithm + { + get { return symAlgorithmId; } + } + + public override void Encode( + BcpgOutputStream bcpgOut) + { + base.Encode(bcpgOut); + bcpgOut.WriteByte(0x3); + bcpgOut.WriteByte(reserved); + bcpgOut.WriteByte(hashFunctionId); + bcpgOut.WriteByte(symAlgorithmId); + } + + private void VerifyHashAlgorithm() + { + switch ((HashAlgorithmTag)hashFunctionId) + { + case HashAlgorithmTag.Sha256: + case HashAlgorithmTag.Sha384: + case HashAlgorithmTag.Sha512: + break; + default: + throw new InvalidOperationException("Hash algorithm must be SHA-256 or stronger."); + } + } + + private void VerifySymmetricKeyAlgorithm() + { + switch ((SymmetricKeyAlgorithmTag)symAlgorithmId) + { + case SymmetricKeyAlgorithmTag.Aes128: + case SymmetricKeyAlgorithmTag.Aes192: + case SymmetricKeyAlgorithmTag.Aes256: + break; + default: + throw new InvalidOperationException("Symmetric key algorithm must be AES-128 or stronger."); + } + } + } +} diff --git a/crypto/src/bcpg/ECDsaPublicBCPGKey.cs b/crypto/src/bcpg/ECDsaPublicBCPGKey.cs new file mode 100644 index 000000000..5f0c8ac55 --- /dev/null +++ b/crypto/src/bcpg/ECDsaPublicBCPGKey.cs @@ -0,0 +1,34 @@ +using System; + +using Org.BouncyCastle.Asn1; +using Org.BouncyCastle.Math; +using Org.BouncyCastle.Math.EC; + +namespace Org.BouncyCastle.Bcpg +{ + /// Base class for an ECDSA Public Key. + public class ECDsaPublicBcpgKey + : ECPublicBcpgKey + { + /// The stream to read the packet from. + protected internal ECDsaPublicBcpgKey( + BcpgInputStream bcpgIn) + : base(bcpgIn) + { + } + + public ECDsaPublicBcpgKey( + DerObjectIdentifier oid, + ECPoint point) + : base(oid, point) + { + } + + public ECDsaPublicBcpgKey( + DerObjectIdentifier oid, + BigInteger encodedPoint) + : base(oid, encodedPoint) + { + } + } +} diff --git a/crypto/src/bcpg/ECPublicBCPGKey.cs b/crypto/src/bcpg/ECPublicBCPGKey.cs new file mode 100644 index 000000000..f328f9dc3 --- /dev/null +++ b/crypto/src/bcpg/ECPublicBCPGKey.cs @@ -0,0 +1,97 @@ +using System; +using System.IO; + +using Org.BouncyCastle.Asn1; +using Org.BouncyCastle.Math; +using Org.BouncyCastle.Math.EC; + +namespace Org.BouncyCastle.Bcpg +{ + /// Base class for an EC Public Key. + public abstract class ECPublicBcpgKey + : BcpgObject, IBcpgKey + { + internal DerObjectIdentifier oid; + internal BigInteger point; + + /// The stream to read the packet from. + protected ECPublicBcpgKey( + BcpgInputStream bcpgIn) + { + this.oid = DerObjectIdentifier.GetInstance(Asn1Object.FromByteArray(ReadBytesOfEncodedLength(bcpgIn))); + this.point = new MPInteger(bcpgIn).Value; + } + + protected ECPublicBcpgKey( + DerObjectIdentifier oid, + ECPoint point) + { + this.point = new BigInteger(1, point.GetEncoded()); + this.oid = oid; + } + + protected ECPublicBcpgKey( + DerObjectIdentifier oid, + BigInteger encodedPoint) + { + this.point = encodedPoint; + this.oid = oid; + } + + /// The format, as a string, always "PGP". + public string Format + { + get { return "PGP"; } + } + + /// Return the standard PGP encoding of the key. + public override byte[] GetEncoded() + { + try + { + return base.GetEncoded(); + } + catch (IOException) + { + return null; + } + } + + public override void Encode( + BcpgOutputStream bcpgOut) + { + byte[] oid = this.oid.GetEncoded(); + bcpgOut.Write(oid, 1, oid.Length - 1); + + MPInteger point = new MPInteger(this.point); + bcpgOut.WriteObject(point); + } + + public virtual BigInteger EncodedPoint + { + get { return point; } + } + + public virtual DerObjectIdentifier CurveOid + { + get { return oid; } + } + + protected static byte[] ReadBytesOfEncodedLength( + BcpgInputStream bcpgIn) + { + int length = bcpgIn.ReadByte(); + if (length == 0 || length == 0xFF) + { + throw new IOException("future extensions not yet implemented."); + } + + byte[] buffer = new byte[length + 2]; + bcpgIn.ReadFully(buffer, 2, buffer.Length - 2); + buffer[0] = (byte)0x06; + buffer[1] = (byte)length; + + return buffer; + } + } +} diff --git a/crypto/src/bcpg/ECSecretBCPGKey.cs b/crypto/src/bcpg/ECSecretBCPGKey.cs new file mode 100644 index 000000000..22e0a3473 --- /dev/null +++ b/crypto/src/bcpg/ECSecretBCPGKey.cs @@ -0,0 +1,56 @@ +using System; + +using Org.BouncyCastle.Asn1; +using Org.BouncyCastle.Math; + +namespace Org.BouncyCastle.Bcpg +{ + /// Base class for an EC Secret Key. + public class ECSecretBcpgKey + : BcpgObject, IBcpgKey + { + internal MPInteger x; + + public ECSecretBcpgKey( + BcpgInputStream bcpgIn) + { + this.x = new MPInteger(bcpgIn); + } + + public ECSecretBcpgKey( + BigInteger x) + { + this.x = new MPInteger(x); + } + + /// The format, as a string, always "PGP". + public string Format + { + get { return "PGP"; } + } + + /// Return the standard PGP encoding of the key. + public override byte[] GetEncoded() + { + try + { + return base.GetEncoded(); + } + catch (Exception) + { + return null; + } + } + + public override void Encode( + BcpgOutputStream bcpgOut) + { + bcpgOut.WriteObject(x); + } + + public virtual BigInteger X + { + get { return x.Value; } + } + } +} diff --git a/crypto/src/bcpg/PublicKeyPacket.cs b/crypto/src/bcpg/PublicKeyPacket.cs index a45aeb469..cea5c8ed2 100644 --- a/crypto/src/bcpg/PublicKeyPacket.cs +++ b/crypto/src/bcpg/PublicKeyPacket.cs @@ -44,6 +44,12 @@ namespace Org.BouncyCastle.Bcpg case PublicKeyAlgorithmTag.ElGamalGeneral: key = new ElGamalPublicBcpgKey(bcpgIn); break; + case PublicKeyAlgorithmTag.EC: + key = new ECDHPublicBcpgKey(bcpgIn); + break; + case PublicKeyAlgorithmTag.ECDsa: + key = new ECDsaPublicBcpgKey(bcpgIn); + break; default: throw new IOException("unknown PGP public key algorithm encountered"); } diff --git a/crypto/src/bcpg/SignaturePacket.cs b/crypto/src/bcpg/SignaturePacket.cs index 605ce84c4..5b91c15a3 100644 --- a/crypto/src/bcpg/SignaturePacket.cs +++ b/crypto/src/bcpg/SignaturePacket.cs @@ -146,6 +146,11 @@ namespace Org.BouncyCastle.Bcpg MPInteger y = new MPInteger(bcpgIn); signature = new MPInteger[]{ p, g, y }; break; + case PublicKeyAlgorithmTag.ECDsa: + MPInteger ecR = new MPInteger(bcpgIn); + MPInteger ecS = new MPInteger(bcpgIn); + signature = new MPInteger[]{ ecR, ecS }; + break; default: if (keyAlgorithm >= PublicKeyAlgorithmTag.Experimental_1 && keyAlgorithm <= PublicKeyAlgorithmTag.Experimental_11) { diff --git a/crypto/src/crypto/modes/CcmBlockCipher.cs b/crypto/src/crypto/modes/CcmBlockCipher.cs index e0b1e6b54..19e273d7c 100644 --- a/crypto/src/crypto/modes/CcmBlockCipher.cs +++ b/crypto/src/crypto/modes/CcmBlockCipher.cs @@ -268,9 +268,10 @@ namespace Org.BouncyCastle.Crypto.Modes outputLen = inLen + macSize; Check.OutputLength(output, outOff, outputLen, "Output buffer too short."); - calculateMac(input, inOff, inLen, macBlock); + CalculateMac(input, inOff, inLen, macBlock); - ctrCipher.ProcessBlock(macBlock, 0, macBlock, 0); // S0 + byte[] encMac = new byte[BlockSize]; + ctrCipher.ProcessBlock(macBlock, 0, encMac, 0); // S0 while (inIndex < (inOff + inLen - BlockSize)) // S1... { @@ -287,7 +288,7 @@ namespace Org.BouncyCastle.Crypto.Modes Array.Copy(block, 0, output, outIndex, inLen + inOff - inIndex); - Array.Copy(macBlock, 0, output, outOff + inLen, macSize); + Array.Copy(encMac, 0, output, outOff + inLen, macSize); } else { @@ -323,7 +324,7 @@ namespace Org.BouncyCastle.Crypto.Modes byte[] calculatedMacBlock = new byte[BlockSize]; - calculateMac(output, outOff, outputLen, calculatedMacBlock); + CalculateMac(output, outOff, outputLen, calculatedMacBlock); if (!Arrays.ConstantTimeAreEqual(macBlock, calculatedMacBlock)) throw new InvalidCipherTextException("mac check in CCM failed"); @@ -332,7 +333,7 @@ namespace Org.BouncyCastle.Crypto.Modes return outputLen; } - private int calculateMac(byte[] data, int dataOff, int dataLen, byte[] macBlock) + private int CalculateMac(byte[] data, int dataOff, int dataLen, byte[] macBlock) { IMac cMac = new CbcBlockCipherMac(cipher, macSize * 8); diff --git a/crypto/src/openpgp/PgpPublicKey.cs b/crypto/src/openpgp/PgpPublicKey.cs index 249b94ea6..5bde2c8fe 100644 --- a/crypto/src/openpgp/PgpPublicKey.cs +++ b/crypto/src/openpgp/PgpPublicKey.cs @@ -2,6 +2,7 @@ using System; using System.Collections; using System.IO; +using Org.BouncyCastle.Asn1.X9; using Org.BouncyCastle.Crypto; using Org.BouncyCastle.Crypto.IO; using Org.BouncyCastle.Crypto.Parameters; @@ -104,6 +105,10 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp { this.keyStrength = ((ElGamalPublicBcpgKey)key).P.BitLength; } + else if (key is ECPublicBcpgKey) + { + this.keyStrength = ECNamedCurveTable.GetByOid(((ECPublicBcpgKey)key).CurveOid).Curve.FieldSize; + } } } -- cgit 1.5.1 From bb1849f93d2872dce69a5141a55061da1b9b9562 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Tue, 16 Jun 2015 16:45:17 -0400 Subject: Bumped minimum Android version to 4.0.3 (was: 2.3.3) --- crypto/BouncyCastle.Android.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crypto/BouncyCastle.Android.csproj') diff --git a/crypto/BouncyCastle.Android.csproj b/crypto/BouncyCastle.Android.csproj index 51f7f19a2..e5000145b 100644 --- a/crypto/BouncyCastle.Android.csproj +++ b/crypto/BouncyCastle.Android.csproj @@ -13,7 +13,7 @@ Assets False BouncyCastle - v2.3 + v4.0.3 true -- cgit 1.5.1 From 590a2d904433ef87b4dc7c331d5e802a389b35a0 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Fri, 26 Jun 2015 20:22:29 -0400 Subject: Updated Visual Studio 2010 project files --- crypto/BouncyCastle.Android.csproj | 7 +++++++ crypto/BouncyCastle.csproj | 7 +++++++ crypto/BouncyCastle.iOS.csproj | 7 +++++++ 3 files changed, 21 insertions(+) (limited to 'crypto/BouncyCastle.Android.csproj') diff --git a/crypto/BouncyCastle.Android.csproj b/crypto/BouncyCastle.Android.csproj index e5000145b..1c2f3e6ac 100644 --- a/crypto/BouncyCastle.Android.csproj +++ b/crypto/BouncyCastle.Android.csproj @@ -1045,6 +1045,7 @@ + @@ -1126,6 +1127,12 @@ + + + + + + diff --git a/crypto/BouncyCastle.csproj b/crypto/BouncyCastle.csproj index 117af8d95..acb24726e 100644 --- a/crypto/BouncyCastle.csproj +++ b/crypto/BouncyCastle.csproj @@ -1039,6 +1039,7 @@ + @@ -1120,6 +1121,12 @@ + + + + + + diff --git a/crypto/BouncyCastle.iOS.csproj b/crypto/BouncyCastle.iOS.csproj index a1d3b15a1..0a68e8238 100644 --- a/crypto/BouncyCastle.iOS.csproj +++ b/crypto/BouncyCastle.iOS.csproj @@ -1040,6 +1040,7 @@ + @@ -1121,6 +1122,12 @@ + + + + + + -- cgit 1.5.1 From dffff172063680043e110e4567e910774be35dd6 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Fri, 26 Jun 2015 21:02:15 -0400 Subject: Strong-name the assemblies in the newer way --- crypto/BouncyCastle.Android.csproj | 10 ++++++++-- crypto/BouncyCastle.csproj | 10 ++++++++-- crypto/BouncyCastle.iOS.csproj | 10 ++++++++-- crypto/src/AssemblyInfo.cs | 33 --------------------------------- 4 files changed, 24 insertions(+), 39 deletions(-) (limited to 'crypto/BouncyCastle.Android.csproj') diff --git a/crypto/BouncyCastle.Android.csproj b/crypto/BouncyCastle.Android.csproj index 1c2f3e6ac..a2a4d5a71 100644 --- a/crypto/BouncyCastle.Android.csproj +++ b/crypto/BouncyCastle.Android.csproj @@ -21,7 +21,7 @@ false bin\Debug\lib\MonoAndroid obj\Debug\lib\MonoAndroid - DEBUG;TRACE;INCLUDE_IDEA;STRONG_NAME;__MOBILE__;__ANDROID__; + DEBUG;TRACE;INCLUDE_IDEA;__MOBILE__;__ANDROID__; prompt 4 None @@ -32,12 +32,18 @@ true bin\Release\lib\MonoAndroid obj\Release\lib\MonoAndroid - TRACE;INCLUDE_IDEA;STRONG_NAME;__MOBILE__;__ANDROID__; + TRACE;INCLUDE_IDEA;__MOBILE__;__ANDROID__; prompt 4 false false + + true + + + ..\BouncyCastle.snk + diff --git a/crypto/BouncyCastle.csproj b/crypto/BouncyCastle.csproj index acb24726e..bebc2a95f 100644 --- a/crypto/BouncyCastle.csproj +++ b/crypto/BouncyCastle.csproj @@ -17,7 +17,7 @@ false bin\Debug\lib\net20 obj\Debug\lib\net20 - DEBUG;TRACE;INCLUDE_IDEA;STRONG_NAME + DEBUG;TRACE;INCLUDE_IDEA; prompt 4 false @@ -26,13 +26,19 @@ true bin\Release\lib\net20 obj\Release\lib\net20 - TRACE;INCLUDE_IDEA;STRONG_NAME + TRACE;INCLUDE_IDEA; doc\BouncyCastle.xml prompt 4 false 1591 + + true + + + ..\BouncyCastle.snk + diff --git a/crypto/BouncyCastle.iOS.csproj b/crypto/BouncyCastle.iOS.csproj index 0a68e8238..18fd1c1d6 100644 --- a/crypto/BouncyCastle.iOS.csproj +++ b/crypto/BouncyCastle.iOS.csproj @@ -19,7 +19,7 @@ false bin\Debug\lib\Xamarin.iOS obj\Debug\lib\Xamarin.iOS - DEBUG;TRACE;INCLUDE_IDEA;STRONG_NAME;__MOBILE__;__IOS__; + DEBUG;TRACE;INCLUDE_IDEA;__MOBILE__;__IOS__; prompt 4 false @@ -28,11 +28,17 @@ true bin\Release\lib\Xamarin.iOS obj\Release\lib\Xamarin.iOS - TRACE;INCLUDE_IDEA;STRONG_NAME;__MOBILE__;__IOS__; + TRACE;INCLUDE_IDEA;__MOBILE__;__IOS__; prompt 4 false + + true + + + ..\BouncyCastle.snk + diff --git a/crypto/src/AssemblyInfo.cs b/crypto/src/AssemblyInfo.cs index 4a813bc5a..caabbc55c 100644 --- a/crypto/src/AssemblyInfo.cs +++ b/crypto/src/AssemblyInfo.cs @@ -31,39 +31,6 @@ using System.Runtime.InteropServices; [assembly: AssemblyVersion("1.8.*")] -// -// In order to sign your assembly you must specify a key to use. Refer to the -// Microsoft .NET Framework documentation for more information on assembly signing. -// -// Use the attributes below to control which key is used for signing. -// -// Notes: -// (*) If no key is specified, the assembly is not signed. -// (*) KeyName refers to a key that has been installed in the Crypto Service -// Provider (CSP) on your machine. KeyFile refers to a file which contains -// a key. -// (*) If the KeyFile and the KeyName values are both specified, the -// following processing occurs: -// (1) If the KeyName can be found in the CSP, that key is used. -// (2) If the KeyName does not exist and the KeyFile does exist, the key -// in the KeyFile is installed into the CSP and used. -// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. -// When specifying the KeyFile, the location of the KeyFile should be -// relative to the project output directory which is -// %Project Directory%\obj\. For example, if your KeyFile is -// located in the project directory, you would specify the AssemblyKeyFile -// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] -// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework -// documentation for more information on this. -// -[assembly: AssemblyDelaySign(false)] -#if STRONG_NAME -[assembly: AssemblyKeyFile(@"../BouncyCastle.snk")] -#else -[assembly: AssemblyKeyFile("")] -#endif -[assembly: AssemblyKeyName("")] - [assembly: CLSCompliant(true)] [assembly: ComVisible(false)] -- cgit 1.5.1 From 67f22caf3fa9d20364f5994b7d666370600d63ec Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Sun, 11 Oct 2015 10:37:20 -0400 Subject: Updated VS 2010 projects --- crypto/BouncyCastle.Android.csproj | 4 ++++ crypto/BouncyCastle.csproj | 4 ++++ crypto/BouncyCastle.iOS.csproj | 4 ++++ crypto/test/UnitTests.csproj | 4 ++++ 4 files changed, 16 insertions(+) (limited to 'crypto/BouncyCastle.Android.csproj') diff --git a/crypto/BouncyCastle.Android.csproj b/crypto/BouncyCastle.Android.csproj index a2a4d5a71..697d7013e 100644 --- a/crypto/BouncyCastle.Android.csproj +++ b/crypto/BouncyCastle.Android.csproj @@ -645,6 +645,7 @@ + @@ -669,6 +670,7 @@ + @@ -686,6 +688,7 @@ + @@ -889,6 +892,7 @@ + diff --git a/crypto/BouncyCastle.csproj b/crypto/BouncyCastle.csproj index bebc2a95f..72d9d6607 100644 --- a/crypto/BouncyCastle.csproj +++ b/crypto/BouncyCastle.csproj @@ -639,6 +639,7 @@ + @@ -663,6 +664,7 @@ + @@ -680,6 +682,7 @@ + @@ -883,6 +886,7 @@ + diff --git a/crypto/BouncyCastle.iOS.csproj b/crypto/BouncyCastle.iOS.csproj index 18fd1c1d6..5463434b2 100644 --- a/crypto/BouncyCastle.iOS.csproj +++ b/crypto/BouncyCastle.iOS.csproj @@ -640,6 +640,7 @@ + @@ -664,6 +665,7 @@ + @@ -681,6 +683,7 @@ + @@ -884,6 +887,7 @@ + diff --git a/crypto/test/UnitTests.csproj b/crypto/test/UnitTests.csproj index 3fd7154d9..c6345b7e5 100644 --- a/crypto/test/UnitTests.csproj +++ b/crypto/test/UnitTests.csproj @@ -187,6 +187,7 @@ + @@ -245,6 +246,7 @@ + @@ -407,6 +409,8 @@ + + -- cgit 1.5.1 From 1fdd3185a216d0d68ba9d2d658f76e43e2139f2e Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Sat, 17 Oct 2015 11:04:30 -0400 Subject: Updated Visual Studio 2010 project files --- crypto/BouncyCastle.Android.csproj | 13 +++++++++++++ crypto/BouncyCastle.csproj | 13 +++++++++++++ crypto/BouncyCastle.iOS.csproj | 13 +++++++++++++ crypto/test/UnitTests.csproj | 13 +++++++++++++ 4 files changed, 52 insertions(+) (limited to 'crypto/BouncyCastle.Android.csproj') diff --git a/crypto/BouncyCastle.Android.csproj b/crypto/BouncyCastle.Android.csproj index 697d7013e..666035e5d 100644 --- a/crypto/BouncyCastle.Android.csproj +++ b/crypto/BouncyCastle.Android.csproj @@ -536,6 +536,7 @@ + @@ -634,6 +635,7 @@ + @@ -641,9 +643,14 @@ + + + + + @@ -809,6 +816,7 @@ + @@ -913,6 +921,7 @@ + @@ -1255,6 +1264,7 @@ + @@ -1272,6 +1282,8 @@ + + @@ -1389,6 +1401,7 @@ + diff --git a/crypto/BouncyCastle.csproj b/crypto/BouncyCastle.csproj index 72d9d6607..f8c0e03f7 100644 --- a/crypto/BouncyCastle.csproj +++ b/crypto/BouncyCastle.csproj @@ -530,6 +530,7 @@ + @@ -628,6 +629,7 @@ + @@ -635,9 +637,14 @@ + + + + + @@ -803,6 +810,7 @@ + @@ -907,6 +915,7 @@ + @@ -1249,6 +1258,7 @@ + @@ -1266,6 +1276,8 @@ + + @@ -1383,6 +1395,7 @@ + diff --git a/crypto/BouncyCastle.iOS.csproj b/crypto/BouncyCastle.iOS.csproj index 5463434b2..d1c125ef8 100644 --- a/crypto/BouncyCastle.iOS.csproj +++ b/crypto/BouncyCastle.iOS.csproj @@ -531,6 +531,7 @@ + @@ -629,6 +630,7 @@ + @@ -636,9 +638,14 @@ + + + + + @@ -804,6 +811,7 @@ + @@ -908,6 +916,7 @@ + @@ -1250,6 +1259,7 @@ + @@ -1267,6 +1277,8 @@ + + @@ -1384,6 +1396,7 @@ + diff --git a/crypto/test/UnitTests.csproj b/crypto/test/UnitTests.csproj index c6345b7e5..4a562a01a 100644 --- a/crypto/test/UnitTests.csproj +++ b/crypto/test/UnitTests.csproj @@ -261,6 +261,7 @@ + @@ -279,6 +280,7 @@ + @@ -324,8 +326,13 @@ + + + + + @@ -1058,6 +1065,8 @@ + + @@ -1078,6 +1087,10 @@ + + + + -- cgit 1.5.1 From 9108ef34bceef174f96e72a863ab80883c43f1da Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Sun, 18 Oct 2015 11:37:46 -0400 Subject: Updated Visual Studio 2010 project files --- crypto/BouncyCastle.Android.csproj | 7 +++++++ crypto/BouncyCastle.csproj | 7 +++++++ crypto/BouncyCastle.iOS.csproj | 7 +++++++ crypto/test/UnitTests.csproj | 4 ++++ 4 files changed, 25 insertions(+) (limited to 'crypto/BouncyCastle.Android.csproj') diff --git a/crypto/BouncyCastle.Android.csproj b/crypto/BouncyCastle.Android.csproj index 666035e5d..2d8dd0cf9 100644 --- a/crypto/BouncyCastle.Android.csproj +++ b/crypto/BouncyCastle.Android.csproj @@ -667,6 +667,13 @@ + + + + + + + diff --git a/crypto/BouncyCastle.csproj b/crypto/BouncyCastle.csproj index f8c0e03f7..959027f68 100644 --- a/crypto/BouncyCastle.csproj +++ b/crypto/BouncyCastle.csproj @@ -661,6 +661,13 @@ + + + + + + + diff --git a/crypto/BouncyCastle.iOS.csproj b/crypto/BouncyCastle.iOS.csproj index d1c125ef8..38ce14d70 100644 --- a/crypto/BouncyCastle.iOS.csproj +++ b/crypto/BouncyCastle.iOS.csproj @@ -662,6 +662,13 @@ + + + + + + + diff --git a/crypto/test/UnitTests.csproj b/crypto/test/UnitTests.csproj index 4a562a01a..3ef8c4db6 100644 --- a/crypto/test/UnitTests.csproj +++ b/crypto/test/UnitTests.csproj @@ -138,6 +138,10 @@ + + + + -- cgit 1.5.1