From 5b52d806789a59c2c2484808961dcebd22cfae19 Mon Sep 17 00:00:00 2001 From: Oren Novotny Date: Sun, 4 Dec 2016 19:24:33 -0500 Subject: Convert projects over to cross-compiled net4, netstandard 1.0, netstandard 1.3 and Profile328 PCL. Add CI build and authenticode signing. --- BouncyCastle-PCL.sln | 46 - BouncyCastle.Mobile.sln | 38 - BouncyCastle.sln | 37 +- GitVersionConfig.yaml | 11 + License.html | 39 + Portable.BouncyCastle.nuspec | 132 +- README.md | 9 + appveyor.yml | 28 + crypto.tests.Net45/Properties/AssemblyInfo.cs | 36 - crypto.tests.Net45/crypto.tests.Net45.csproj | 92 -- crypto.tests.Net45/packages.config | 5 - crypto/BouncyCastle.Android.csproj | 1518 -------------------- crypto/BouncyCastle.csproj | 1512 ------------------- crypto/BouncyCastle.iOS.csproj | 1513 ------------------- crypto/crypto.Net45.csproj | 54 - crypto/crypto.dotnet.csproj | 98 -- crypto/crypto.dotnet.project.json | 17 - crypto/crypto.pcl.csproj | 106 -- crypto/crypto.pcl2.csproj | 92 -- crypto/src/asn1/DerUTCTime.cs | 2 +- crypto/src/asn1/util/Dump.cs | 2 +- crypto/src/cms/CMSEnvelopedDataStreamGenerator.cs | 2 +- crypto/src/cms/CMSProcessableFile.cs | 8 +- crypto/src/cms/CMSSignedDataStreamGenerator.cs | 86 +- crypto/src/crypto.csproj | 73 + crypto/src/crypto/engines/NaccacheSternEngine.cs | 6 +- .../generators/NaccacheSternKeyPairGenerator.cs | 8 +- crypto/src/crypto/prng/ThreadedSeedGenerator.cs | 132 +- crypto/src/openpgp/PgpLiteralDataGenerator.cs | 2 +- crypto/src/openpgp/PgpUtilities.cs | 2 +- crypto/src/pkcs/Pkcs12Store.cs | 174 +-- crypto/src/util/zlib/ZDeflaterOutputStream.cs | 2 +- crypto/test/UnitTests.csproj | 1285 ----------------- crypto/test/crypto.test.csproj | 45 + crypto/test/lib/nunit.core.dll | Bin 139264 -> 0 bytes crypto/test/lib/nunit.core.interfaces.dll | Bin 61440 -> 0 bytes crypto/test/lib/nunit.framework.dll | Bin 139264 -> 0 bytes csharp.sln | 29 - scripts/Sign-Package.ps1 | 25 + scripts/SignClient.json | 13 + 40 files changed, 518 insertions(+), 6761 deletions(-) delete mode 100644 BouncyCastle-PCL.sln delete mode 100644 BouncyCastle.Mobile.sln create mode 100644 GitVersionConfig.yaml create mode 100644 License.html create mode 100644 appveyor.yml delete mode 100644 crypto.tests.Net45/Properties/AssemblyInfo.cs delete mode 100644 crypto.tests.Net45/crypto.tests.Net45.csproj delete mode 100644 crypto.tests.Net45/packages.config delete mode 100644 crypto/BouncyCastle.Android.csproj delete mode 100644 crypto/BouncyCastle.csproj delete mode 100644 crypto/BouncyCastle.iOS.csproj delete mode 100644 crypto/crypto.Net45.csproj delete mode 100644 crypto/crypto.dotnet.csproj delete mode 100644 crypto/crypto.dotnet.project.json delete mode 100644 crypto/crypto.pcl.csproj delete mode 100644 crypto/crypto.pcl2.csproj create mode 100644 crypto/src/crypto.csproj delete mode 100644 crypto/test/UnitTests.csproj create mode 100644 crypto/test/crypto.test.csproj delete mode 100644 crypto/test/lib/nunit.core.dll delete mode 100644 crypto/test/lib/nunit.core.interfaces.dll delete mode 100644 crypto/test/lib/nunit.framework.dll delete mode 100644 csharp.sln create mode 100644 scripts/Sign-Package.ps1 create mode 100644 scripts/SignClient.json diff --git a/BouncyCastle-PCL.sln b/BouncyCastle-PCL.sln deleted file mode 100644 index afd9396fa..000000000 --- a/BouncyCastle-PCL.sln +++ /dev/null @@ -1,46 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.24606.1 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{43196EF9-B75F-4ABB-8967-DAFD621A7D05}" - ProjectSection(SolutionItems) = preProject - Portable.BouncyCastle.nuspec = Portable.BouncyCastle.nuspec - README.md = README.md - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "crypto.pcl", "Crypto\crypto.pcl.csproj", "{38872A5F-E87E-4FAD-B109-8EB7B2E6A4A0}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "crypto.tests.Net45", "crypto.tests.Net45\crypto.tests.Net45.csproj", "{45473847-8AF8-4BAF-B768-442C6875B8CE}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "crypto.pcl2", "crypto\crypto.pcl2.csproj", "{38872A5F-E87E-4FAD-B109-8EB7B2E6A4A1}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "crypto.dotnet", "crypto\crypto.dotnet.csproj", "{38872A5F-E87E-4FAD-B109-8EB7B2E6A4A2}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {38872A5F-E87E-4FAD-B109-8EB7B2E6A4A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {38872A5F-E87E-4FAD-B109-8EB7B2E6A4A0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {38872A5F-E87E-4FAD-B109-8EB7B2E6A4A0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {38872A5F-E87E-4FAD-B109-8EB7B2E6A4A0}.Release|Any CPU.Build.0 = Release|Any CPU - {45473847-8AF8-4BAF-B768-442C6875B8CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {45473847-8AF8-4BAF-B768-442C6875B8CE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {45473847-8AF8-4BAF-B768-442C6875B8CE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {45473847-8AF8-4BAF-B768-442C6875B8CE}.Release|Any CPU.Build.0 = Release|Any CPU - {38872A5F-E87E-4FAD-B109-8EB7B2E6A4A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {38872A5F-E87E-4FAD-B109-8EB7B2E6A4A1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {38872A5F-E87E-4FAD-B109-8EB7B2E6A4A1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {38872A5F-E87E-4FAD-B109-8EB7B2E6A4A1}.Release|Any CPU.Build.0 = Release|Any CPU - {38872A5F-E87E-4FAD-B109-8EB7B2E6A4A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {38872A5F-E87E-4FAD-B109-8EB7B2E6A4A2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {38872A5F-E87E-4FAD-B109-8EB7B2E6A4A2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {38872A5F-E87E-4FAD-B109-8EB7B2E6A4A2}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/BouncyCastle.Mobile.sln b/BouncyCastle.Mobile.sln deleted file mode 100644 index 0b41d742d..000000000 --- a/BouncyCastle.Mobile.sln +++ /dev/null @@ -1,38 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BouncyCastle", "crypto\BouncyCastle.csproj", "{4C235092-820C-4DEB-9074-D356FB797D8B}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BouncyCastle.iOS", "crypto\BouncyCastle.iOS.csproj", "{0249241C-205E-4AC0-828B-90F822359B9E}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BouncyCastle.Android", "crypto\BouncyCastle.Android.csproj", "{A0D302CB-8866-4AB1-98B9-F0772EABF5DF}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests", "crypto\test\UnitTests.csproj", "{D4EB669D-7C88-48C0-A480-C5CC73A7369B}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {0249241C-205E-4AC0-828B-90F822359B9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0249241C-205E-4AC0-828B-90F822359B9E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0249241C-205E-4AC0-828B-90F822359B9E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0249241C-205E-4AC0-828B-90F822359B9E}.Release|Any CPU.Build.0 = Release|Any CPU - {4C235092-820C-4DEB-9074-D356FB797D8B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4C235092-820C-4DEB-9074-D356FB797D8B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4C235092-820C-4DEB-9074-D356FB797D8B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4C235092-820C-4DEB-9074-D356FB797D8B}.Release|Any CPU.Build.0 = Release|Any CPU - {A0D302CB-8866-4AB1-98B9-F0772EABF5DF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A0D302CB-8866-4AB1-98B9-F0772EABF5DF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A0D302CB-8866-4AB1-98B9-F0772EABF5DF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A0D302CB-8866-4AB1-98B9-F0772EABF5DF}.Release|Any CPU.Build.0 = Release|Any CPU - {D4EB669D-7C88-48C0-A480-C5CC73A7369B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D4EB669D-7C88-48C0-A480-C5CC73A7369B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D4EB669D-7C88-48C0-A480-C5CC73A7369B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D4EB669D-7C88-48C0-A480-C5CC73A7369B}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(MonoDevelopProperties) = preSolution - StartupItem = crypto\BouncyCastle.csproj - EndGlobalSection -EndGlobal diff --git a/BouncyCastle.sln b/BouncyCastle.sln index 588f3d8ca..4b7303f13 100644 --- a/BouncyCastle.sln +++ b/BouncyCastle.sln @@ -1,9 +1,18 @@  -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BouncyCastle", "crypto\BouncyCastle.csproj", "{4C235092-820C-4DEB-9074-D356FB797D8B}" +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.25920.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{43196EF9-B75F-4ABB-8967-DAFD621A7D05}" + ProjectSection(SolutionItems) = preProject + appveyor.yml = appveyor.yml + Portable.BouncyCastle.nuspec = Portable.BouncyCastle.nuspec + README.md = README.md + EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests", "crypto\test\UnitTests.csproj", "{D4EB669D-7C88-48C0-A480-C5CC73A7369B}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "crypto", "crypto\src\crypto.csproj", "{60F6E5B2-8CE6-4817-89B6-369AAE1C6187}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "crypto.test", "crypto\test\crypto.test.csproj", "{8EAF3F18-33E6-47A6-B299-4584822399B6}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -11,16 +20,16 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {4C235092-820C-4DEB-9074-D356FB797D8B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4C235092-820C-4DEB-9074-D356FB797D8B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4C235092-820C-4DEB-9074-D356FB797D8B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4C235092-820C-4DEB-9074-D356FB797D8B}.Release|Any CPU.Build.0 = Release|Any CPU - {D4EB669D-7C88-48C0-A480-C5CC73A7369B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D4EB669D-7C88-48C0-A480-C5CC73A7369B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D4EB669D-7C88-48C0-A480-C5CC73A7369B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D4EB669D-7C88-48C0-A480-C5CC73A7369B}.Release|Any CPU.Build.0 = Release|Any CPU + {60F6E5B2-8CE6-4817-89B6-369AAE1C6187}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {60F6E5B2-8CE6-4817-89B6-369AAE1C6187}.Debug|Any CPU.Build.0 = Debug|Any CPU + {60F6E5B2-8CE6-4817-89B6-369AAE1C6187}.Release|Any CPU.ActiveCfg = Release|Any CPU + {60F6E5B2-8CE6-4817-89B6-369AAE1C6187}.Release|Any CPU.Build.0 = Release|Any CPU + {8EAF3F18-33E6-47A6-B299-4584822399B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8EAF3F18-33E6-47A6-B299-4584822399B6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8EAF3F18-33E6-47A6-B299-4584822399B6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8EAF3F18-33E6-47A6-B299-4584822399B6}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection - GlobalSection(MonoDevelopProperties) = preSolution - StartupItem = crypto\BouncyCastle.csproj + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE EndGlobalSection EndGlobal diff --git a/GitVersionConfig.yaml b/GitVersionConfig.yaml new file mode 100644 index 000000000..cc130d91c --- /dev/null +++ b/GitVersionConfig.yaml @@ -0,0 +1,11 @@ +tag-prefix: 'pcl-[vV]' +legacy-semver-padding: 0 +branches: + pcl: + mode: ContinuousDeployment + tag: beta + increment: Inherit + netstandard: + mode: ContinuousDeployment + tag: beta + increment: Inherit \ No newline at end of file diff --git a/License.html b/License.html new file mode 100644 index 000000000..0dae3a978 --- /dev/null +++ b/License.html @@ -0,0 +1,39 @@ + + + + + License + + +

The Bouncy Castle Cryptographic C#® API

+

License:

+The Bouncy Castle License
+Copyright (c) 2000-2011 The Legion Of The Bouncy Castle +(http://www.bouncycastle.org)
+Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), to deal in the +Software without restriction, including without limitation the rights to use, copy, modify, merge, +publish, distribute, sub license, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software.
+THE SOFTWARE IS PROVIDED "AS IS", +WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+INCLUDING BUT NOT LIMITED TO THE +WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+PURPOSE AND NONINFRINGEMENT. IN NO +EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+
+
+ + diff --git a/Portable.BouncyCastle.nuspec b/Portable.BouncyCastle.nuspec index c58a23a80..825139bc0 100644 --- a/Portable.BouncyCastle.nuspec +++ b/Portable.BouncyCastle.nuspec @@ -1,109 +1,55 @@  - + Portable.BouncyCastle - 1.8.0-rc3 + 1.8.1.1 Bouncy Castle PCL Oren Novotny onovotny - https://github.com/onovotny/BouncyCastle-PCL + https://github.com/onovotny/bc-csharp false - BouncyCastle.Crypto is a cryptography API providing: - -Generation and parsing of PKCS#12 files. - -X.509: Generators and parsers for V1 and V3 certificates, V2 CRLs and attribute certificates. - -PBE algorithms supported by PBEUtil: PBEwithMD2andDES-CBC, PBEwithMD2andRC2-CBC, PBEwithMD5andDES-CBC, PBEwithMD5andRC2-CBC, PBEwithSHA1andDES-CBC, PBEwithSHA1andRC2-CBC, PBEwithSHA-1and128bitRC4, PBEwithSHA-1and40bitRC4, PBEwithSHA-1and3-keyDESEDE-CBC, PBEwithSHA-1and2-keyDESEDE-CBC, PBEwithSHA-1and128bitRC2-CBC, PBEwithSHA-1and40bitRC2-CBC, PBEwithHmacSHA-1, PBEwithHmacSHA-224, PBEwithHmacSHA-256, PBEwithHmacRIPEMD128, PBEwithHmacRIPEMD160, and PBEwithHmacRIPEMD256. - -Signature algorithms supported by SignerUtilities: MD2withRSA, MD4withRSA, MD5withRSA, RIPEMD128withRSA, RIPEMD160withRSA, RIPEMD256withRSA, SHA-1withRSA, SHA-224withRSA, SHA-256withRSAandMGF1, SHA-384withRSAandMGF1, SHA-512withRSAandMGF1, SHA-1withDSA, and SHA-1withECDSA. - -Symmetric key algorithms: AES, Blowfish, Camellia, CAST5, CAST6, DESede, DES, GOST28147, HC-128, HC-256, IDEA, NaccacheStern, RC2, RC4, RC5-32, RC5-64, RC6, Rijndael, Serpent, Skipjack, TEA/XTEA, Twofish, and VMPC. - -Symmetric key modes: CBC, CFB, CTS, GOFB, OFB, OpenPGPCFB, and SIC (or CTR). - -Symmetric key paddings: ISO10126d2, ISO7816d4, PKCS#5/7, TBC, X.923, and Zero Byte. - -Asymmetric key algorithms: RSA (with blinding), ElGamal, DSA, ECDSA. - -Asymmetric key paddings/encodings: ISO9796d1, OAEP, and PKCS#1. - -Digests: GOST3411, MD2, MD4, MD5, RIPEMD128, RIPEMD160, RIPEMD256, RIPEMD320, SHA-1, SHA-224, SHA-256, SHA-384, SHA-512, Tiger, and Whirlpool. - -Signer mechanisms: DSA, ECDSA, ECGOST3410, GOST3410, ISO9796d2, PSS, RSA. - -Key Agreement: Diffie-Hellman and EC-DH. - -Macs: CBCBlockCipher, CFBBlockCipher, GOST28147, HMac, and ISO9797 Alg. 3. - -PBE generators: PKCS#12, and PKCS#5 - schemes 1 and 2. - -OpenPGP (RFC 2440) - -Cryptographic Message Syntax (CMS, RFC 3852), including streaming API. - -Online Certificate Status Protocol (OCSP, RFC 2560). - -Time Stamp Protocol (TSP, RFC 3161). - -TLS/SSL Client with support for client side authentication. - - Support for .NET 4, Windows Phone 8, Windows Phone App 8.1, Windows 8, MonoTouch, MonoAndroid, Xamarin.iOS, Core CLR - + + Support for .NET 4, WP 8 SL, WP 8.1, Windows 8, MonoTouch, MonoAndroid, Xamarin.iOS, Core CLR + + IMPORTANT: The Serpent cipher as of 1.8.0 is incompatible with the behaviour of Serpent in earlier releases; it has been modified to conform to the standard byte-order interpretation for blocks (and keys). The previous behaviour is available from 1.8.0 as the "Tnepres" cipher. See BMA-52 for more information if this may affect you. + + Crypto features: + - Generation and parsing of PKCS-12 files. + - X.509: Generators and parsers for V1 and V3 certificates, V2 CRLs and attribute certificates. + - PBE algorithms supported by PbeUtilities: PBEwithMD2andDES-CBC, PBEwithMD2andRC2-CBC, PBEwithMD5andDES-CBC, PBEwithMD5andRC2-CBC, PBEwithSHA1andDES-CBC, PBEwithSHA1andRC2-CBC, PBEwithSHA-1and128bitRC4, PBEwithSHA-1and40bitRC4, PBEwithSHA-1and3-keyDESEDE-CBC, PBEwithSHA-1and2-keyDESEDE-CBC, PBEwithSHA-1and128bitRC2-CBC, PBEwithSHA-1and40bitRC2-CBC, PBEwithHmacSHA-1, PBEwithHmacSHA-224, PBEwithHmacSHA-256, PBEwithHmacRIPEMD128, PBEwithHmacRIPEMD160, and PBEwithHmacRIPEMD256. + - Signature algorithms supported by SignerUtilities: MD2withRSA, MD4withRSA, MD5withRSA, RIPEMD128withRSA, RIPEMD160withECDSA, RIPEMD160withRSA, RIPEMD256withRSA, SHA-1withRSA, SHA-224withRSA, SHA-256withRSAandMGF1, SHA-384withRSAandMGF1, SHA-512withRSAandMGF1, SHA-1withDSA, and SHA-1withECDSA. + - Symmetric key algorithms: AES, Blowfish, Camellia, CAST5, CAST6, ChaCha, DES, DESede, GOST28147, HC-128, HC-256, IDEA, ISAAC, Noekeon, RC2, RC4, RC5-32, RC5-64, RC6, Rijndael, Salsa20, SEED, Serpent, Skipjack, TEA/XTEA, Threefish, Tnepres, Twofish, VMPC and XSalsa20. + - Symmetric key modes: CBC, CFB, CTS, GOFB, OFB, OpenPGPCFB, and SIC (or CTR). + - Symmetric key paddings: ISO10126d2, ISO7816d4, PKCS-5/7, TBC, X.923, and Zero Byte. + - Asymmetric key algorithms: ElGamal, DSA, ECDSA, NaccacheStern and RSA (with blinding). + - Asymmetric key paddings/encodings: ISO9796d1, OAEP, and PKCS-1. + - AEAD block cipher modes: CCM, EAX, GCM and OCB. + - Digests: GOST3411, Keccak, MD2, MD4, MD5, RIPEMD128, RIPEMD160, RIPEMD256, RIPEMD320, SHA-1, SHA-224, SHA-256, SHA-384, SHA-512, SHA3, Tiger, and Whirlpool. + - XOFs: SHAKE. + - Signer mechanisms: DSA, ECDSA, ECGOST3410, ECNR, GOST3410, ISO9796d2, PSS, RSA, X9.31-1998. + - Key Agreement: Diffie-Hellman, EC-DH, EC-MQV, J-PAKE, SRP-6a. + - Macs: CBCBlockCipher, CFBBlockCipher, CMAC, GMAC, GOST28147, HMac, ISO9797 Alg. 3, Poly1305, SipHash, SkeinMac, VMPCMAC. + - PBE generators: PKCS-12, and PKCS-5 - schemes 1 and 2. + - OpenPGP (RFC 4880) + - Cryptographic Message Syntax (CMS, RFC 3852), including streaming API. + - Online Certificate Status Protocol (OCSP, RFC 2560). + - Time Stamp Protocol (TSP, RFC 3161). + - TLS/DTLS client/server up to version 1.2, with support for the most common ciphersuites and extensions, and many less common ones. Non-blocking API available. + - Elliptic Curve Cryptography: support for generic F2m and Fp curves, high-performance custom implementations for many standardized curves. + - Reading/writing of PEM files, including RSA and DSA keys, with a variety of encryptions. + - PKIX certificate path validation + en-US - bouncycastle, cryptography, encryption, security, PCL, wp8, wpa81, coreclr, dotnet, dnx, uwp, sl5, monotouch, monoandroid, xamarin, xamarin.ios + bouncycastle, cryptography, encryption, security, PCL, wp8, wpa81, coreclr, netstandard, dnx, uwp, sl5, monotouch, monoandroid, xamarin, xamarin.ios - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - + \ No newline at end of file diff --git a/README.md b/README.md index 270d9cca5..7a84e08d3 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,12 @@ +BouncyCastle-PCL +================ + +PCL Version of BouncyCastle targeting .NET Framework 4, Silverlight 5, Windows 8, Windows Phone App 8.1, MonoTouch, MonoAndroid + +This version also supports .NET Core and CoreCLR + +================ + # The Bouncy Castle Crypto Package For C Sharp The Bouncy Castle Crypto package is a C\# implementation of cryptographic algorithms and protocols, it was developed by the Legion of the Bouncy Castle, a registered Australian Charity, with a little help! The Legion, and the latest goings on with this package, can be found at [http://www.bouncycastle.org](http://www.bouncycastle.org). In addition to providing basic cryptography algorithms, the package also provides support for CMS, TSP, X.509 certificate generation and a variety of other standards such as OpenPGP. diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 000000000..9c11af418 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,28 @@ +configuration: Release +image: Visual Studio 2017 RC + +environment: + SignClientSecret: + secure: S26+NphAhj/vo5ZdHd/N/4toty3ztdNGmuNdvAB57W1oIVQEHVKqAVuhTD8B9ATy + +install: + - cmd: appveyor DownloadFile https://dist.nuget.org/win-x86-commandline/v3.5.0/NuGet.exe + - cmd: nuget install gitlink -SolutionDir %APPVEYOR_BUILD_FOLDER% -Verbosity quiet -ExcludeVersion + - cmd: nuget install GitVersion.CommandLine -SolutionDir %APPVEYOR_BUILD_FOLDER% -Verbosity quiet -ExcludeVersion + - cmd: nuget install SignClient -Version 0.5.0-beta4 -SolutionDir %APPVEYOR_BUILD_FOLDER% -Verbosity quiet -ExcludeVersion -pre + +assembly_info: + patch: false + +before_build: + - cmd: '.\packages\GitVersion.CommandLine\tools\GitVersion.exe /l console /output buildserver /updateAssemblyInfo' + +build_script: + - cmd: dotnet restore BouncyCastle.sln + - cmd: dotnet build BouncyCastle.sln -c Release + +after_build: + - cmd: '.\packages\gitlink\lib\net45\GitLink.exe . -f BouncyCastle.sln -u https://github.com/onovotny/bc-csharp -c Release -s %APPVEYOR_REPO_COMMIT% -errorsaswarnings' + - cmd: nuget pack Portable.BouncyCastle.nuspec -version "%GitVersion_NuGetVersion%" -prop "target=%CONFIGURATION%" + - ps: '.\scripts\Sign-Package.ps1' + - ps: 'cmd /c "appveyor PushArtifact Portable.BouncyCastle.%GitVersion_NuGetVersion%.nupkg";if($lastexitcode -ne 0){$lastexitcode = 0}' \ No newline at end of file diff --git a/crypto.tests.Net45/Properties/AssemblyInfo.cs b/crypto.tests.Net45/Properties/AssemblyInfo.cs deleted file mode 100644 index 52472faf8..000000000 --- a/crypto.tests.Net45/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("crypto.tests.Net45")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("crypto.tests.Net45")] -[assembly: AssemblyCopyright("Copyright © 2014")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("22ae3209-5ce9-448c-9212-04b9e8f6361e")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/crypto.tests.Net45/crypto.tests.Net45.csproj b/crypto.tests.Net45/crypto.tests.Net45.csproj deleted file mode 100644 index de668a83d..000000000 --- a/crypto.tests.Net45/crypto.tests.Net45.csproj +++ /dev/null @@ -1,92 +0,0 @@ - - - - - Debug - AnyCPU - {45473847-8AF8-4BAF-B768-442C6875B8CE} - Library - Properties - crypto.tests - crypto.tests.Net45 - v4.5 - 512 - - - true - full - false - bin\Debug\ - TRACE;DEBUG;LIB;PORTABLE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE;LIB;PORTABLE - prompt - 4 - - - - ..\packages\NUnitTestAdapter.2.0.0\lib\nunit.core.dll - False - - - ..\packages\NUnitTestAdapter.2.0.0\lib\nunit.core.interfaces.dll - False - - - ..\packages\NUnit.2.6.4\lib\nunit.framework.dll - True - - - ..\packages\NUnitTestAdapter.2.0.0\lib\nunit.util.dll - False - - - ..\packages\NUnitTestAdapter.2.0.0\lib\NUnit.VisualStudio.TestAdapter.dll - False - - - - - - - - - - - - - - - %(RecursiveDir)%(Filename)%(Extension) - - - %(RecursiveDir)%(Filename)%(Extension) - - - - - {38872a5f-e87e-4fad-b109-8eb7b2e6a4a0} - crypto.pcl - - - - - - - - - - - \ No newline at end of file diff --git a/crypto.tests.Net45/packages.config b/crypto.tests.Net45/packages.config deleted file mode 100644 index 1f8800b2c..000000000 --- a/crypto.tests.Net45/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/crypto/BouncyCastle.Android.csproj b/crypto/BouncyCastle.Android.csproj deleted file mode 100644 index 13ca4f05c..000000000 --- a/crypto/BouncyCastle.Android.csproj +++ /dev/null @@ -1,1518 +0,0 @@ - - - - Debug - AnyCPU - AnyCPU - 8.0.30703 - 2.0 - {A0D302CB-8866-4AB1-98B9-F0772EABF5DF} - {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Library - Org.BouncyCastle - Resources - Assets - False - BouncyCastle - v4.0.3 - - - true - full - false - bin\Debug\lib\MonoAndroid - obj\Debug\lib\MonoAndroid - DEBUG;TRACE;INCLUDE_IDEA;__MOBILE__;__ANDROID__; - prompt - 4 - None - false - - - full - true - bin\Release\lib\MonoAndroid - obj\Release\lib\MonoAndroid - TRACE;INCLUDE_IDEA;__MOBILE__;__ANDROID__; - prompt - 4 - false - false - - - true - - - ..\BouncyCastle.snk - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/crypto/BouncyCastle.csproj b/crypto/BouncyCastle.csproj deleted file mode 100644 index f72c9c527..000000000 --- a/crypto/BouncyCastle.csproj +++ /dev/null @@ -1,1512 +0,0 @@ - - - - Debug - AnyCPU - AnyCPU - 8.0.30703 - 2.0 - {4C235092-820C-4DEB-9074-D356FB797D8B} - Library - Org.BouncyCastle - BouncyCastle - v2.0 - - - true - full - false - bin\Debug\lib\net20 - obj\Debug\lib\net20 - DEBUG;TRACE;INCLUDE_IDEA; - prompt - 4 - false - - - true - bin\Release\lib\net20 - obj\Release\lib\net20 - TRACE;INCLUDE_IDEA; - doc\BouncyCastle.xml - prompt - 4 - false - 1591 - - - true - - - ..\BouncyCastle.snk - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/crypto/BouncyCastle.iOS.csproj b/crypto/BouncyCastle.iOS.csproj deleted file mode 100644 index b3bf7b4fa..000000000 --- a/crypto/BouncyCastle.iOS.csproj +++ /dev/null @@ -1,1513 +0,0 @@ - - - - Debug - AnyCPU - AnyCPU - 8.0.30703 - 2.0 - {0249241C-205E-4AC0-828B-90F822359B9E} - {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Library - Org.BouncyCastle - Resources - BouncyCastle - Xamarin.iOS - - - true - full - false - bin\Debug\lib\Xamarin.iOS - obj\Debug\lib\Xamarin.iOS - DEBUG;TRACE;INCLUDE_IDEA;__MOBILE__;__IOS__; - prompt - 4 - false - - - true - bin\Release\lib\Xamarin.iOS - obj\Release\lib\Xamarin.iOS - TRACE;INCLUDE_IDEA;__MOBILE__;__IOS__; - prompt - 4 - false - - - true - - - ..\BouncyCastle.snk - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/crypto/crypto.Net45.csproj b/crypto/crypto.Net45.csproj deleted file mode 100644 index 14b3581f5..000000000 --- a/crypto/crypto.Net45.csproj +++ /dev/null @@ -1,54 +0,0 @@ - - - - - Debug - AnyCPU - {45473847-8AF8-4BAF-B768-442C6875B8CF} - Library - Properties - crypto - crypto - v2.0 - 512 - - - - true - full - false - bin\Debug\ - TRACE;DEBUG;LIB;PCL;SILVERLIGHT - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE;LIB;PCL;SILVERLIGHT - prompt - 4 - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/crypto/crypto.dotnet.csproj b/crypto/crypto.dotnet.csproj deleted file mode 100644 index d9ae0db87..000000000 --- a/crypto/crypto.dotnet.csproj +++ /dev/null @@ -1,98 +0,0 @@ - - - - Local - 7.10.3077 - 2.0 - {38872A5F-E87E-4FAD-B109-8EB7B2E6A4A2} - Debug - AnyCPU - - - crypto - ..\BouncyCastle.snk - JScript - Grid - IE50 - false - Library - crypto - OnBuildSuccess - - v5.0 - {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - - - 14.0 - - - - - bin\dotnet\Debug\ - obj\dotnet\Debug\ - false - 285212672 - false - - TRACE;DEBUG;PORTABLE;NO_THREADS;NEW_REFLECTION;SYS_RUNTIME;DOTNET - doc\dotnet\crypto.xml - true - 4096 - false - 1591 - false - false - false - false - 4 - full - prompt - - - bin\dotnet\Release\ - obj\dotnet\Release\ - false - 285212672 - false - - TRACE;PORTABLE;NO_THREADS;NEW_REFLECTION;SYS_RUNTIME;DOTNET - doc\dotnet\crypto.xml - true - 4096 - false - 1591 - true - false - false - false - 4 - pdbonly - prompt - - - true - - - - - - - - dotnet;uap10.0;net46 - - - - BouncyCastle.snk - - - - - - - - - - - - - \ No newline at end of file diff --git a/crypto/crypto.dotnet.project.json b/crypto/crypto.dotnet.project.json deleted file mode 100644 index e80002612..000000000 --- a/crypto/crypto.dotnet.project.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "supports": { - "net46.app": {}, - "uwp.10.0.app": {}, - "dnxcore50.app": {} - }, - "dependencies": { - "Microsoft.NETCore": "5.0.0", - "Microsoft.NETCore.Portable.Compatibility": "1.0.0", - "NuSpec.ReferenceGenerator": "1.3.4" - }, - "frameworks": { - "dotnet": { - "imports": "portable-net452+win81" - } - } -} \ No newline at end of file diff --git a/crypto/crypto.pcl.csproj b/crypto/crypto.pcl.csproj deleted file mode 100644 index 1c3735177..000000000 --- a/crypto/crypto.pcl.csproj +++ /dev/null @@ -1,106 +0,0 @@ - - - - Local - 7.10.3077 - 2.0 - {38872A5F-E87E-4FAD-B109-8EB7B2E6A4A0} - Debug - AnyCPU - - - crypto - ..\BouncyCastle.snk - JScript - Grid - IE50 - false - Library - crypto - OnBuildSuccess - - - - v4.0 - - - 12.0 - {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Profile328 - false - 10.0 - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - true - - - bin\pcl\Debug\ - obj\pcl\Debug\ - false - 285212672 - false - - TRACE;DEBUG;PORTABLE;NO_THREADS - doc\pcl\crypto.xml - true - 4096 - false - 1591 - false - false - false - false - 4 - full - prompt - - - bin\pcl\Release\ - obj\pcl\Release\ - false - 285212672 - false - - TRACE;PORTABLE;NO_THREADS - doc\pcl\crypto.xml - true - 4096 - false - 1591 - true - false - false - false - 4 - pdbonly - prompt - - - true - - - - - - - - BouncyCastle.snk - - - - - - - - \ No newline at end of file diff --git a/crypto/crypto.pcl2.csproj b/crypto/crypto.pcl2.csproj deleted file mode 100644 index 4edf1139e..000000000 --- a/crypto/crypto.pcl2.csproj +++ /dev/null @@ -1,92 +0,0 @@ - - - - Local - 7.10.3077 - 2.0 - {38872A5F-E87E-4FAD-B109-8EB7B2E6A4A1} - Debug - AnyCPU - - - crypto - ..\BouncyCastle.snk - JScript - Grid - IE50 - false - Library - crypto - OnBuildSuccess - - v4.5 - {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Profile259 - 10.0 - - - - - bin\pcl2\Debug\ - obj\pcl2\Debug\ - false - 285212672 - false - - TRACE;DEBUG;PORTABLE;NO_THREADS;NEW_REFLECTION;SYS_RUNTIME - doc\pcl2\crypto.xml - true - 4096 - false - 1591 - false - false - false - false - 4 - full - prompt - - - bin\pcl2\Release\ - obj\pcl2\Release\ - false - 285212672 - false - - TRACE;PORTABLE;NO_THREADS;NEW_REFLECTION;SYS_RUNTIME - doc\pcl2\crypto.xml - true - 4096 - false - 1591 - true - false - false - false - 4 - pdbonly - prompt - - - true - - - - - - - - - - - - BouncyCastle.snk - - - - - - - - \ No newline at end of file diff --git a/crypto/src/asn1/DerUTCTime.cs b/crypto/src/asn1/DerUTCTime.cs index 99af8bf6b..5d058619d 100644 --- a/crypto/src/asn1/DerUTCTime.cs +++ b/crypto/src/asn1/DerUTCTime.cs @@ -93,7 +93,7 @@ namespace Org.BouncyCastle.Asn1 #endif } - internal DerUtcTime( + internal DerUtcTime( byte[] bytes) { // diff --git a/crypto/src/asn1/util/Dump.cs b/crypto/src/asn1/util/Dump.cs index e313fe879..acae5f1dc 100644 --- a/crypto/src/asn1/util/Dump.cs +++ b/crypto/src/asn1/util/Dump.cs @@ -12,7 +12,7 @@ namespace Org.BouncyCastle.Asn1.Utilities { } - public static void Main(string[] args) + public static void MainOld(string[] args) { FileStream fIn = File.OpenRead(args[0]); Asn1InputStream bIn = new Asn1InputStream(fIn); diff --git a/crypto/src/cms/CMSEnvelopedDataStreamGenerator.cs b/crypto/src/cms/CMSEnvelopedDataStreamGenerator.cs index 8e6d2729b..e0822aa8b 100644 --- a/crypto/src/cms/CMSEnvelopedDataStreamGenerator.cs +++ b/crypto/src/cms/CMSEnvelopedDataStreamGenerator.cs @@ -287,7 +287,7 @@ namespace Org.BouncyCastle.Cms // TODO Parent context(s) should really be closed explicitly - _eiGen.Close(); + _eiGen.Close(); if (_outer.unprotectedAttributeGenerator != null) { diff --git a/crypto/src/cms/CMSProcessableFile.cs b/crypto/src/cms/CMSProcessableFile.cs index c74d2a846..1b2d8fc49 100644 --- a/crypto/src/cms/CMSProcessableFile.cs +++ b/crypto/src/cms/CMSProcessableFile.cs @@ -1,4 +1,4 @@ -#if !PORTABLE || DOTNET +#if !PORTABLE || NETSTANDARD1_3 using System; using System.IO; @@ -15,7 +15,7 @@ namespace Org.BouncyCastle.Cms { private const int DefaultBufSize = 32 * 1024; - private readonly FileInfo _file; + private readonly FileInfo _file; private readonly int _bufSize; public CmsProcessableFile(FileInfo file) @@ -29,7 +29,7 @@ namespace Org.BouncyCastle.Cms _bufSize = bufSize; } - public virtual Stream GetInputStream() + public virtual Stream GetInputStream() { return new FileStream(_file.FullName, FileMode.Open, FileAccess.Read, FileShare.Read, _bufSize); } @@ -41,7 +41,7 @@ namespace Org.BouncyCastle.Cms Platform.Dispose(inStr); } - /// The file handle + /// The file handle [Obsolete] public virtual object GetContent() { diff --git a/crypto/src/cms/CMSSignedDataStreamGenerator.cs b/crypto/src/cms/CMSSignedDataStreamGenerator.cs index d0ab7428a..55fde90df 100644 --- a/crypto/src/cms/CMSSignedDataStreamGenerator.cs +++ b/crypto/src/cms/CMSSignedDataStreamGenerator.cs @@ -834,61 +834,61 @@ namespace Org.BouncyCastle.Cms _eiGen.Close(); - outer._digests.Clear(); // clear the current preserved digest state + outer._digests.Clear(); // clear the current preserved digest state - if (outer._certs.Count > 0) - { - Asn1Set certs = CmsUtilities.CreateBerSetFromList(outer._certs); + if (outer._certs.Count > 0) + { + Asn1Set certs = CmsUtilities.CreateBerSetFromList(outer._certs); - WriteToGenerator(_sigGen, new BerTaggedObject(false, 0, certs)); - } + WriteToGenerator(_sigGen, new BerTaggedObject(false, 0, certs)); + } - if (outer._crls.Count > 0) - { - Asn1Set crls = CmsUtilities.CreateBerSetFromList(outer._crls); + if (outer._crls.Count > 0) + { + Asn1Set crls = CmsUtilities.CreateBerSetFromList(outer._crls); - WriteToGenerator(_sigGen, new BerTaggedObject(false, 1, crls)); - } + WriteToGenerator(_sigGen, new BerTaggedObject(false, 1, crls)); + } - // - // Calculate the digest hashes - // - foreach (DictionaryEntry de in outer._messageDigests) - { - outer._messageHashes.Add(de.Key, DigestUtilities.DoFinal((IDigest)de.Value)); - } + // + // Calculate the digest hashes + // + foreach (DictionaryEntry de in outer._messageDigests) + { + outer._messageHashes.Add(de.Key, DigestUtilities.DoFinal((IDigest)de.Value)); + } - // TODO If the digest OIDs for precalculated signers weren't mixed in with - // the others, we could fill in outer._digests here, instead of SignerInfoGenerator.Generate + // TODO If the digest OIDs for precalculated signers weren't mixed in with + // the others, we could fill in outer._digests here, instead of SignerInfoGenerator.Generate - // - // collect all the SignerInfo objects - // + // + // collect all the SignerInfo objects + // Asn1EncodableVector signerInfos = new Asn1EncodableVector(); - // + // // add the generated SignerInfo objects // - { - foreach (DigestAndSignerInfoGeneratorHolder holder in outer._signerInfs) - { - AlgorithmIdentifier digestAlgorithm = holder.DigestAlgorithm; + { + foreach (DigestAndSignerInfoGeneratorHolder holder in outer._signerInfs) + { + AlgorithmIdentifier digestAlgorithm = holder.DigestAlgorithm; - byte[] calculatedDigest = (byte[])outer._messageHashes[ - Helper.GetDigestAlgName(holder.digestOID)]; - outer._digests[holder.digestOID] = calculatedDigest.Clone(); + byte[] calculatedDigest = (byte[])outer._messageHashes[ + Helper.GetDigestAlgName(holder.digestOID)]; + outer._digests[holder.digestOID] = calculatedDigest.Clone(); - signerInfos.Add(holder.signerInf.Generate(_contentOID, digestAlgorithm, calculatedDigest)); - } - } + signerInfos.Add(holder.signerInf.Generate(_contentOID, digestAlgorithm, calculatedDigest)); + } + } - // + // // add the precalculated SignerInfo objects. // - { - foreach (SignerInformation signer in outer._signers) - { - // TODO Verify the content type and calculated digest match the precalculated SignerInfo + { + foreach (SignerInformation signer in outer._signers) + { + // TODO Verify the content type and calculated digest match the precalculated SignerInfo // if (!signer.ContentType.Equals(_contentOID)) // { // // TODO The precalculated content type did not match - error? @@ -907,11 +907,11 @@ namespace Org.BouncyCastle.Cms // } // } - signerInfos.Add(signer.ToSignerInfo()); - } - } + signerInfos.Add(signer.ToSignerInfo()); + } + } - WriteToGenerator(_sigGen, new DerSet(signerInfos)); + WriteToGenerator(_sigGen, new DerSet(signerInfos)); _sigGen.Close(); _sGen.Close(); diff --git a/crypto/src/crypto.csproj b/crypto/src/crypto.csproj new file mode 100644 index 000000000..30d331468 --- /dev/null +++ b/crypto/src/crypto.csproj @@ -0,0 +1,73 @@ + + + + netstandard1.3;netstandard1.0;portable-net4+sl5+wp8+win8+wpa81;net4 + BouncyCastle.Crypto + crypto + ..\..\BouncyCastle.snk + true + false + false + false + false + false + false + false + false + false + false + false + + + .NETPortable + v4.0 + Profile328 + + + true + 1591;618;672 + + + $(DefineConstants);PORTABLE;NO_THREADS;NEW_REFLECTION;SYS_RUNTIME + + + $(DefineConstants);PORTABLE;NO_THREADS;NEW_REFLECTION;SYS_RUNTIME;DOTNET + + + $(DefineConstants);LIB + + + $(DefineConstants);PORTABLE;NO_THREADS + + + + + + BouncyCastle.snk + + + + + 1.0.0-alpha-20161104-2 + All + + + + + 1.6.0 + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/crypto/src/crypto/engines/NaccacheSternEngine.cs b/crypto/src/crypto/engines/NaccacheSternEngine.cs index 64665c1d4..fe2d78da6 100644 --- a/crypto/src/crypto/engines/NaccacheSternEngine.cs +++ b/crypto/src/crypto/engines/NaccacheSternEngine.cs @@ -20,7 +20,7 @@ namespace Org.BouncyCastle.Crypto.Engines private IList[] lookup = null; - public string AlgorithmName + public string AlgorithmName { get { return "NaccacheStern"; } } @@ -78,7 +78,7 @@ namespace Org.BouncyCastle.Crypto.Engines set {} } - /** + /** * Returns the input block size of this algorithm. * * @see org.bouncycastle.crypto.AsymmetricBlockCipher#GetInputBlockSize() @@ -261,7 +261,7 @@ namespace Org.BouncyCastle.Crypto.Engines BigInteger m1m2Crypt = m1Crypt.Multiply(m2Crypt); m1m2Crypt = m1m2Crypt.Mod(key.Modulus); - //byte[] output = key.Modulus.ToByteArray(); + //byte[] output = key.Modulus.ToByteArray(); //Array.Clear(output, 0, output.Length); byte[] output = new byte[key.Modulus.BitLength / 8 + 1]; diff --git a/crypto/src/crypto/generators/NaccacheSternKeyPairGenerator.cs b/crypto/src/crypto/generators/NaccacheSternKeyPairGenerator.cs index 618ca9a1c..d68106844 100644 --- a/crypto/src/crypto/generators/NaccacheSternKeyPairGenerator.cs +++ b/crypto/src/crypto/generators/NaccacheSternKeyPairGenerator.cs @@ -52,7 +52,7 @@ namespace Org.BouncyCastle.Crypto.Generators SecureRandom rand = param.Random; int certainty = param.Certainty; - IList smallPrimes = findFirstPrimes(param.CountSmallPrimes); + IList smallPrimes = findFirstPrimes(param.CountSmallPrimes); smallPrimes = permuteList(smallPrimes, rand); @@ -87,7 +87,7 @@ namespace Org.BouncyCastle.Crypto.Generators long tries = 0; - BigInteger _2au = a.Multiply(u).ShiftLeft(1); + BigInteger _2au = a.Multiply(u).ShiftLeft(1); BigInteger _2bv = b.Multiply(v).ShiftLeft(1); for (;;) @@ -132,7 +132,7 @@ namespace Org.BouncyCastle.Crypto.Generators BigInteger g; tries = 0; - for (;;) + for (;;) { // TODO After the first loop, just regenerate one randomly-selected gPart each time? IList gParts = Platform.CreateArrayList(); @@ -205,7 +205,7 @@ namespace Org.BouncyCastle.Crypto.Generators break; } - return new AsymmetricCipherKeyPair(new NaccacheSternKeyParameters(false, g, n, sigma.BitLength), + return new AsymmetricCipherKeyPair(new NaccacheSternKeyParameters(false, g, n, sigma.BitLength), new NaccacheSternPrivateKeyParameters(g, n, sigma.BitLength, smallPrimes, phi_n)); } diff --git a/crypto/src/crypto/prng/ThreadedSeedGenerator.cs b/crypto/src/crypto/prng/ThreadedSeedGenerator.cs index 0a38e5f5a..499aab267 100644 --- a/crypto/src/crypto/prng/ThreadedSeedGenerator.cs +++ b/crypto/src/crypto/prng/ThreadedSeedGenerator.cs @@ -7,16 +7,16 @@ using System.Threading.Tasks; namespace Org.BouncyCastle.Crypto.Prng { - /** - * A thread based seed generator - one source of randomness. - *

- * Based on an idea from Marcus Lippert. - *

- */ - public class ThreadedSeedGenerator - { - private class SeedGenerator - { + /** + * A thread based seed generator - one source of randomness. + *

+ * Based on an idea from Marcus Lippert. + *

+ */ + public class ThreadedSeedGenerator + { + private class SeedGenerator + { #if NETCF_1_0 // No volatile keyword, but all fields implicitly volatile anyway private int counter = 0; @@ -26,18 +26,18 @@ namespace Org.BouncyCastle.Crypto.Prng private volatile bool stop = false; #endif - private void Run(object ignored) - { - while (!this.stop) - { - this.counter++; - } - } + private void Run(object ignored) + { + while (!this.stop) + { + this.counter++; + } + } - public byte[] GenerateSeed( + public byte[] GenerateSeed( int numBytes, bool fast) - { + { #if SILVERLIGHT || PORTABLE return DoGenerateSeed(numBytes, fast); #else @@ -59,71 +59,71 @@ namespace Org.BouncyCastle.Crypto.Prng bool fast) { this.counter = 0; - this.stop = false; + this.stop = false; - byte[] result = new byte[numBytes]; - int last = 0; - int end = fast ? numBytes : numBytes * 8; + byte[] result = new byte[numBytes]; + int last = 0; + int end = fast ? numBytes : numBytes * 8; #if NO_THREADS Task.Factory.StartNew(() => Run(null), TaskCreationOptions.None); #else - ThreadPool.QueueUserWorkItem(new WaitCallback(Run)); + ThreadPool.QueueUserWorkItem(new WaitCallback(Run)); #endif - for (int i = 0; i < end; i++) - { - while (this.counter == last) - { - try - { + for (int i = 0; i < end; i++) + { + while (this.counter == last) + { + try + { #if PORTABLE new AutoResetEvent(false).WaitOne(1); #else - Thread.Sleep(1); + Thread.Sleep(1); #endif - } - catch (Exception) - { - // ignore - } - } + } + catch (Exception) + { + // ignore + } + } - last = this.counter; + last = this.counter; - if (fast) - { + if (fast) + { result[i] = (byte)last; - } - else - { - int bytepos = i / 8; + } + else + { + int bytepos = i / 8; result[bytepos] = (byte)((result[bytepos] << 1) | (last & 1)); - } - } + } + } - this.stop = true; + this.stop = true; - return result; - } - } + return result; + } + } - /** - * Generate seed bytes. Set fast to false for best quality. - *

- * If fast is set to true, the code should be round about 8 times faster when - * generating a long sequence of random bytes. 20 bytes of random values using - * the fast mode take less than half a second on a Nokia e70. If fast is set to false, - * it takes round about 2500 ms. - *

- * @param numBytes the number of bytes to generate - * @param fast true if fast mode should be used - */ - public byte[] GenerateSeed( + /** + * Generate seed bytes. Set fast to false for best quality. + *

+ * If fast is set to true, the code should be round about 8 times faster when + * generating a long sequence of random bytes. 20 bytes of random values using + * the fast mode take less than half a second on a Nokia e70. If fast is set to false, + * it takes round about 2500 ms. + *

+ * @param numBytes the number of bytes to generate + * @param fast true if fast mode should be used + */ + public byte[] GenerateSeed( int numBytes, bool fast) - { - return new SeedGenerator().GenerateSeed(numBytes, fast); - } - } + { + return new SeedGenerator().GenerateSeed(numBytes, fast); + } + } } diff --git a/crypto/src/openpgp/PgpLiteralDataGenerator.cs b/crypto/src/openpgp/PgpLiteralDataGenerator.cs index 7672659ca..217d7149e 100644 --- a/crypto/src/openpgp/PgpLiteralDataGenerator.cs +++ b/crypto/src/openpgp/PgpLiteralDataGenerator.cs @@ -141,7 +141,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp return new WrappedGeneratorStream(this, pkOut); } -#if !PORTABLE || DOTNET +#if !PORTABLE || NETSTANDARD1_3 /// ///

/// Open a literal data packet for the passed in FileInfo object, returning diff --git a/crypto/src/openpgp/PgpUtilities.cs b/crypto/src/openpgp/PgpUtilities.cs index 055f99636..d9e7882fa 100644 --- a/crypto/src/openpgp/PgpUtilities.cs +++ b/crypto/src/openpgp/PgpUtilities.cs @@ -347,7 +347,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp return MakeKey(algorithm, keyBytes); } -#if !PORTABLE || DOTNET +#if !PORTABLE || NETSTANDARD1_3 ///

Write out the passed in file as a literal data packet. public static void WriteFileToLiteralData( Stream output, diff --git a/crypto/src/pkcs/Pkcs12Store.cs b/crypto/src/pkcs/Pkcs12Store.cs index e65788733..52760f89b 100644 --- a/crypto/src/pkcs/Pkcs12Store.cs +++ b/crypto/src/pkcs/Pkcs12Store.cs @@ -113,88 +113,88 @@ namespace Org.BouncyCastle.Pkcs { AsymmetricKeyParameter privKey = PrivateKeyFactory.CreateKey(privKeyInfo); - IDictionary attributes = Platform.CreateHashtable(); + IDictionary attributes = Platform.CreateHashtable(); AsymmetricKeyEntry keyEntry = new AsymmetricKeyEntry(privKey, attributes); - string alias = null; - Asn1OctetString localId = null; + string alias = null; + Asn1OctetString localId = null; if (bagAttributes != null) - { + { foreach (Asn1Sequence sq in bagAttributes) - { + { DerObjectIdentifier aOid = DerObjectIdentifier.GetInstance(sq[0]); Asn1Set attrSet = Asn1Set.GetInstance(sq[1]); - Asn1Encodable attr = null; - - if (attrSet.Count > 0) - { - // TODO We should be adding all attributes in the set - attr = attrSet[0]; - - // TODO We might want to "merge" attribute sets with - // the same OID - currently, differing values give an error - if (attributes.Contains(aOid.Id)) - { - // OK, but the value has to be the same - if (!attributes[aOid.Id].Equals(attr)) - throw new IOException("attempt to add existing attribute with different value"); - } - else - { - attributes.Add(aOid.Id, attr); - } - - if (aOid.Equals(PkcsObjectIdentifiers.Pkcs9AtFriendlyName)) - { - alias = ((DerBmpString)attr).GetString(); - // TODO Do these in a separate loop, just collect aliases here + Asn1Encodable attr = null; + + if (attrSet.Count > 0) + { + // TODO We should be adding all attributes in the set + attr = attrSet[0]; + + // TODO We might want to "merge" attribute sets with + // the same OID - currently, differing values give an error + if (attributes.Contains(aOid.Id)) + { + // OK, but the value has to be the same + if (!attributes[aOid.Id].Equals(attr)) + throw new IOException("attempt to add existing attribute with different value"); + } + else + { + attributes.Add(aOid.Id, attr); + } + + if (aOid.Equals(PkcsObjectIdentifiers.Pkcs9AtFriendlyName)) + { + alias = ((DerBmpString)attr).GetString(); + // TODO Do these in a separate loop, just collect aliases here keys[alias] = keyEntry; - } - else if (aOid.Equals(PkcsObjectIdentifiers.Pkcs9AtLocalKeyID)) - { - localId = (Asn1OctetString)attr; - } - } - } - } + } + else if (aOid.Equals(PkcsObjectIdentifiers.Pkcs9AtLocalKeyID)) + { + localId = (Asn1OctetString)attr; + } + } + } + } - if (localId != null) - { - string name = Hex.ToHexString(localId.GetOctets()); + if (localId != null) + { + string name = Hex.ToHexString(localId.GetOctets()); - if (alias == null) - { + if (alias == null) + { keys[name] = keyEntry; - } - else - { - // TODO There may have been more than one alias - localIds[alias] = name; - } - } - else - { + } + else + { + // TODO There may have been more than one alias + localIds[alias] = name; + } + } + else + { unmarkedKeyEntry = keyEntry; - } - } + } + } protected virtual void LoadPkcs8ShroudedKeyBag(EncryptedPrivateKeyInfo encPrivKeyInfo, Asn1Set bagAttributes, char[] password, bool wrongPkcs12Zero) - { + { if (password != null) - { + { PrivateKeyInfo privInfo = PrivateKeyInfoFactory.CreatePrivateKeyInfo( password, wrongPkcs12Zero, encPrivKeyInfo); LoadKeyBag(privInfo, bagAttributes); - } - } + } + } public void Load( Stream input, char[] password) - { + { if (input == null) throw new ArgumentNullException("input"); @@ -204,7 +204,7 @@ namespace Org.BouncyCastle.Pkcs bool wrongPkcs12Zero = false; if (password != null && bag.MacData != null) // check the mac code - { + { MacData mData = bag.MacData; DigestInfo dInfo = mData.Mac; AlgorithmIdentifier algId = dInfo.AlgorithmID; @@ -217,7 +217,7 @@ namespace Org.BouncyCastle.Pkcs byte[] dig = dInfo.GetDigest(); if (!Arrays.ConstantTimeAreEqual(mac, dig)) - { + { if (password.Length > 0) throw new IOException("PKCS12 key store MAC invalid - wrong password or corrupted file."); @@ -228,8 +228,8 @@ namespace Org.BouncyCastle.Pkcs throw new IOException("PKCS12 key store MAC invalid - wrong password or corrupted file."); wrongPkcs12Zero = true; - } - } + } + } keys.Clear(); localIds.Clear(); @@ -238,37 +238,37 @@ namespace Org.BouncyCastle.Pkcs IList certBags = Platform.CreateArrayList(); if (info.ContentType.Equals(PkcsObjectIdentifiers.Data)) - { + { byte[] octs = ((Asn1OctetString)info.Content).GetOctets(); AuthenticatedSafe authSafe = new AuthenticatedSafe( (Asn1Sequence) Asn1OctetString.FromByteArray(octs)); ContentInfo[] cis = authSafe.GetContentInfo(); foreach (ContentInfo ci in cis) - { + { DerObjectIdentifier oid = ci.ContentType; byte[] octets = null; if (oid.Equals(PkcsObjectIdentifiers.Data)) - { + { octets = ((Asn1OctetString)ci.Content).GetOctets(); } else if (oid.Equals(PkcsObjectIdentifiers.EncryptedData)) - { + { if (password != null) - { + { EncryptedData d = EncryptedData.GetInstance(ci.Content); octets = CryptPbeData(false, d.EncryptionAlgorithm, password, wrongPkcs12Zero, d.Content.GetOctets()); - } - } - else - { + } + } + else + { // TODO Other data types - } + } if (octets != null) - { + { Asn1Sequence seq = (Asn1Sequence)Asn1Object.FromByteArray(octets); foreach (Asn1Sequence subSeq in seq) @@ -276,14 +276,14 @@ namespace Org.BouncyCastle.Pkcs SafeBag b = new SafeBag(subSeq); if (b.BagID.Equals(PkcsObjectIdentifiers.CertBag)) - { + { certBags.Add(b); - } + } else if (b.BagID.Equals(PkcsObjectIdentifiers.Pkcs8ShroudedKeyBag)) - { + { LoadPkcs8ShroudedKeyBag(EncryptedPrivateKeyInfo.GetInstance(b.BagValue), b.BagAttributes, password, wrongPkcs12Zero); - } + } else if (b.BagID.Equals(PkcsObjectIdentifiers.KeyBag)) { LoadKeyBag(PrivateKeyInfo.GetInstance(b.BagValue), b.BagAttributes); @@ -291,9 +291,9 @@ namespace Org.BouncyCastle.Pkcs else { // TODO Other bag types - } } } + } } } @@ -732,7 +732,7 @@ namespace Org.BouncyCastle.Pkcs { bagOid = PkcsObjectIdentifiers.Pkcs8ShroudedKeyBag; bagData = EncryptedPrivateKeyInfoFactory.CreateEncryptedPrivateKeyInfo( - keyAlgorithm, password, kSalt, MinIterations, privKey.Key); + keyAlgorithm, password, kSalt, MinIterations, privKey.Key); } Asn1EncodableVector kName = new Asn1EncodableVector(); @@ -942,7 +942,7 @@ namespace Org.BouncyCastle.Pkcs else { byte[] certBytes = CryptPbeData(true, cAlgId, password, false, certBagsEncoding); - EncryptedData cInfo = new EncryptedData(PkcsObjectIdentifiers.Data, cAlgId, new BerOctetString(certBytes)); + EncryptedData cInfo = new EncryptedData(PkcsObjectIdentifiers.Data, cAlgId, new BerOctetString(certBytes)); certsInfo = new ContentInfo(PkcsObjectIdentifiers.EncryptedData, cInfo.ToAsn1Object()); } @@ -959,15 +959,15 @@ namespace Org.BouncyCastle.Pkcs MacData macData = null; if (password != null) { - byte[] mSalt = new byte[20]; - random.NextBytes(mSalt); + byte[] mSalt = new byte[20]; + random.NextBytes(mSalt); - byte[] mac = CalculatePbeMac(OiwObjectIdentifiers.IdSha1, - mSalt, MinIterations, password, false, data); + byte[] mac = CalculatePbeMac(OiwObjectIdentifiers.IdSha1, + mSalt, MinIterations, password, false, data); - AlgorithmIdentifier algId = new AlgorithmIdentifier( - OiwObjectIdentifiers.IdSha1, DerNull.Instance); - DigestInfo dInfo = new DigestInfo(algId, mac); + AlgorithmIdentifier algId = new AlgorithmIdentifier( + OiwObjectIdentifiers.IdSha1, DerNull.Instance); + DigestInfo dInfo = new DigestInfo(algId, mac); macData = new MacData(dInfo, mSalt, MinIterations); } diff --git a/crypto/src/util/zlib/ZDeflaterOutputStream.cs b/crypto/src/util/zlib/ZDeflaterOutputStream.cs index d0f0bcb8d..d0978942a 100644 --- a/crypto/src/util/zlib/ZDeflaterOutputStream.cs +++ b/crypto/src/util/zlib/ZDeflaterOutputStream.cs @@ -135,7 +135,7 @@ namespace Org.BouncyCastle.Utilities.Zlib { z.free(); z=null; } - + #if PORTABLE protected override void Dispose(bool disposing) { diff --git a/crypto/test/UnitTests.csproj b/crypto/test/UnitTests.csproj deleted file mode 100644 index b4c53092b..000000000 --- a/crypto/test/UnitTests.csproj +++ /dev/null @@ -1,1285 +0,0 @@ - - - - Debug - AnyCPU - 9.0.21022 - 2.0 - {D4EB669D-7C88-48C0-A480-C5CC73A7369B} - Library - UnitTests - UnitTests - v2.0 - - - true - full - false - bin\Debug - DEBUG;SEPARATE_UNIT_TESTS - prompt - 4 - false - 219 - - - full - true - bin\Release - prompt - 4 - false - 219 - - - - - lib\nunit.framework.dll - - - lib\nunit.core.interfaces.dll - - - lib\nunit.core.dll - - - - - - {4C235092-820C-4DEB-9074-D356FB797D8B} - BouncyCastle - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/crypto/test/crypto.test.csproj b/crypto/test/crypto.test.csproj new file mode 100644 index 000000000..9984f3ac8 --- /dev/null +++ b/crypto/test/crypto.test.csproj @@ -0,0 +1,45 @@ + + + + net462;netcoreapp1.1 + $(DefineConstants);LIB + + + Exe + $(PackageTargetFallback);dotnet5.6;portable-net45+win8 + $(DefineConstants);PORTABLE + + + + + + + + 1.0.0-alpha-20161104-2 + All + + + 15.0.0-preview-20161123-03 + + + 3.5.0 + + + 3.6.0 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/crypto/test/lib/nunit.core.dll b/crypto/test/lib/nunit.core.dll deleted file mode 100644 index 8d99c637d..000000000 Binary files a/crypto/test/lib/nunit.core.dll and /dev/null differ diff --git a/crypto/test/lib/nunit.core.interfaces.dll b/crypto/test/lib/nunit.core.interfaces.dll deleted file mode 100644 index 70a76b21c..000000000 Binary files a/crypto/test/lib/nunit.core.interfaces.dll and /dev/null differ diff --git a/crypto/test/lib/nunit.framework.dll b/crypto/test/lib/nunit.framework.dll deleted file mode 100644 index ba484ba8c..000000000 Binary files a/crypto/test/lib/nunit.framework.dll and /dev/null differ diff --git a/csharp.sln b/csharp.sln deleted file mode 100644 index ce64a084a..000000000 --- a/csharp.sln +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 8.00 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "crypto", "crypto\crypto.csproj", "{38872A5F-E87E-4FAD-B109-8EB7B2E6A4A0}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "crypto-test", "crypto-test\crypto-test.csproj", "{C857AD68-8F1B-4C7A-A76B-3DC03CBE4FB0}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - Debug = Debug - Release = Release - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {38872A5F-E87E-4FAD-B109-8EB7B2E6A4A0}.Debug.ActiveCfg = Debug|.NET - {38872A5F-E87E-4FAD-B109-8EB7B2E6A4A0}.Debug.Build.0 = Debug|.NET - {38872A5F-E87E-4FAD-B109-8EB7B2E6A4A0}.Release.ActiveCfg = Release|.NET - {38872A5F-E87E-4FAD-B109-8EB7B2E6A4A0}.Release.Build.0 = Release|.NET - {C857AD68-8F1B-4C7A-A76B-3DC03CBE4FB0}.Debug.ActiveCfg = Debug|.NET - {C857AD68-8F1B-4C7A-A76B-3DC03CBE4FB0}.Debug.Build.0 = Debug|.NET - {C857AD68-8F1B-4C7A-A76B-3DC03CBE4FB0}.Release.ActiveCfg = Release|.NET - {C857AD68-8F1B-4C7A-A76B-3DC03CBE4FB0}.Release.Build.0 = Release|.NET - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal diff --git a/scripts/Sign-Package.ps1 b/scripts/Sign-Package.ps1 new file mode 100644 index 000000000..0491883af --- /dev/null +++ b/scripts/Sign-Package.ps1 @@ -0,0 +1,25 @@ +$currentDirectory = split-path $MyInvocation.MyCommand.Definition + +# See if we have the ClientSecret available +if([string]::IsNullOrEmpty($env:SignClientSecret)){ + Write-Host "Client Secret not found, not signing packages" + return; +} + +# Setup Variables we need to pass into the sign client tool + +$appSettings = "$currentDirectory\SignClient.json" + +$appPath = "$currentDirectory\..\packages\SignClient\tools\SignClient.dll" + +$nupgks = ls $currentDirectory\..\*.nupkg | Select -ExpandProperty FullName + +foreach ($nupkg in $nupgks){ + Write-Host "Submitting $nupkg for signing" + + dotnet $appPath 'zip' -c $appSettings -i $nupkg -s $env:SignClientSecret -n 'Portable.BouncyCastle' -d 'Portable.BouncyCastle' -u 'https://github.com/onovotny/bc-sharp' + + Write-Host "Finished signing $nupkg" +} + +Write-Host "Sign-package complete" \ No newline at end of file diff --git a/scripts/SignClient.json b/scripts/SignClient.json new file mode 100644 index 000000000..e4f68415a --- /dev/null +++ b/scripts/SignClient.json @@ -0,0 +1,13 @@ +{ + "SignClient": { + "AzureAd": { + "AADInstance": "https://login.microsoftonline.com/", + "ClientId": "eedcc7e7-c92c-42ff-9217-3ec939207bd8", + "TenantId": "71048637-3782-41a3-b6b2-6f4ac8a25ae0" + }, + "Service": { + "Url": "https://oren-sign-service.azurewebsites.net/", + "ResourceId": "https://novotny.org/SignService" + } + } +} \ No newline at end of file -- cgit 1.5.1