├── .gitignore ├── .gitmodules ├── ARCHITECTURE.md ├── Android ├── Mono.Security.NewTls.Android │ ├── Assets │ │ └── AboutAssets.txt │ ├── MainActivity.cs │ ├── Mono.Security.NewTls.Android.csproj │ ├── Properties │ │ ├── AndroidManifest.xml │ │ └── AssemblyInfo.cs │ └── packages.config ├── Mono.Security.NewTls.TestProvider │ └── Mono.Security.NewTls.TestProvider.csproj ├── Mono.Security.NewTls │ ├── Mono.Security.NewTls.csproj │ └── Resources │ │ ├── AboutResources.txt │ │ ├── Resource.designer.cs │ │ └── values │ │ └── Strings.xml └── Mono.Security.Providers.NewTls │ ├── Mono.Security.Providers.NewTls.csproj │ └── Resources │ ├── AboutResources.txt │ ├── Resource.designer.cs │ └── values │ └── Strings.xml ├── Console └── Mono.Security.NewTls.Console │ ├── ConsoleDependencyProvider.cs │ ├── Mono.Security.NewTls.Console.csproj │ └── Properties │ └── AssemblyInfo.cs ├── IOS ├── Mono.Security.NewTls.iOS │ ├── AppDelegate.cs │ ├── Entitlements.plist │ ├── Info.plist │ ├── Main.cs │ ├── MobileDependencyProvider.cs │ ├── Mono.Security.NewTls.iOS.csproj │ ├── Resources │ │ ├── Images.xcassets │ │ │ └── AppIcons.appiconset │ │ │ │ └── Contents.json │ │ └── LaunchScreen.xib │ └── packages.config └── Mono.Security.NewTls │ └── Mono.Security.NewTls.csproj ├── Mac ├── Mono.Security.Interface │ └── Mono.Security.Interface.csproj ├── Mono.Security.NewTls.Mac │ ├── BuiltinTestServer.cs │ ├── Info.plist │ ├── MacDependencyProvider.cs │ ├── Mono.Security.NewTls.Mac.csproj │ └── Properties │ │ └── AssemblyInfo.cs └── Mono.Security.NewTls │ └── Mono.Security.NewTls.csproj ├── Makefile.native ├── MartinsPlayground.mdw ├── MartinsPlayground ├── .gitignore ├── Instrumentation │ ├── Framework │ │ ├── IMonoClientAndServerParameters.cs │ │ ├── IMonoClientParameters.cs │ │ ├── IMonoServerParameters.cs │ │ ├── MonoClientAndServerParameters.cs │ │ ├── MonoClientParameters.cs │ │ └── MonoServerParameters.cs │ └── Tests │ │ ├── CloseNotifyTest.cs │ │ └── SimpleInstrumentationTest.cs ├── MartinsPlayground.csproj ├── MartinsPlayground.snk ├── MartinsPlayground.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── martin.xcuserdatad │ │ └── WorkspaceSettings.xcsettings ├── NativeConsoleTest │ ├── NativeConsoleTest.xcodeproj │ │ ├── project.pbxproj │ │ └── xcuserdata │ │ │ └── martin.xcuserdatad │ │ │ └── xcschemes │ │ │ ├── NativeConsoleTest.xcscheme │ │ │ └── xcschememanagement.plist │ └── NativeConsoleTest │ │ └── main.c └── README.Playground ├── Mono.Security.NewTls.Android.sln ├── Mono.Security.NewTls.DotNetConsole ├── DotNetDependencyProvider.cs ├── Mono.Security.NewTls.DotNetConsole.csproj ├── Mono.Security.NewTls.DotNetConsole │ ├── DotNetCryptoProvider.cs │ └── HashAlgorithmWrapper.cs └── Properties │ └── AssemblyInfo.cs ├── Mono.Security.NewTls.Instrumentation ├── Mono.Security.NewTls.Instrumentation.csproj ├── Mono.Security.NewTls │ ├── ClientCertificateParameters.cs │ ├── ClientCertificateType.cs │ ├── ContentType.cs │ ├── DebugHelper.cs │ ├── DisposeContext.cs │ ├── HandshakeHashType.cs │ ├── HandshakeInstrumentType.cs │ ├── IHashAlgorithm.cs │ ├── ILogger.cs │ ├── ITlsContext.cs │ ├── Instrumentation.cs │ ├── InstrumentationEventSink.cs │ ├── NamedCurve.cs │ ├── RenegotiationFlags.cs │ ├── SecurityStatus.cs │ ├── SettingsProvider.cs │ ├── SignatureAlgorithmType.cs │ ├── SignatureAndHashAlgorithm.cs │ ├── SignatureParameters.cs │ ├── SignatureProvider.cs │ ├── TlsStream.cs │ └── UserSettings.cs └── Properties │ └── AssemblyInfo.cs ├── Mono.Security.NewTls.Mac.sln ├── Mono.Security.NewTls.TestFramework ├── Mono.Security.NewTls.ConnectionFramework │ ├── IConnectionProviderExtensions.cs │ ├── IMonoTlsProviderExtensions.cs │ ├── InstrumentationConnectionExtension.cs │ └── InstrumentationHelpers.cs ├── Mono.Security.NewTls.TestFeatures │ ├── CipherInstrumentParametersAttribute.cs │ ├── CipherInstrumentTestRunnerAttribute.cs │ ├── GenericConnectionInstrumentParametersAttribute.cs │ ├── GenericConnectionInstrumentTestRunnerAttribute.cs │ ├── InstrumentationCategoryAttribute.cs │ ├── InstrumentationConnectionFlagsAttribute.cs │ ├── InstrumentationConnectionProviderAttribute.cs │ ├── InstrumentationTestFeatures.cs │ ├── IsSupportedConstraint.cs │ ├── RenegotiationAttribute.cs │ ├── RenegotiationInstrumentParametersAttribute.cs │ ├── RenegotiationInstrumentTestRunnerAttribute.cs │ ├── SImpleConnectionTestRunnerAttribute.cs │ ├── SignatureInstrumentParametersAttribute.cs │ ├── SignatureInstrumentTestRunnerAttribute.cs │ └── SimpleConnectionParametersAttribute.cs ├── Mono.Security.NewTls.TestFramework.csproj ├── Mono.Security.NewTls.TestFramework │ ├── CipherInstrumentParameters.cs │ ├── CipherInstrumentTestRunner.cs │ ├── CipherInstrumentType.cs │ ├── ConnectionInstrument.cs │ ├── ConnectionInstrumentConnectionHandler.cs │ ├── ConnectionInstrumentParameters.cs │ ├── ConnectionInstrumentTestRunner.cs │ ├── ConnectionInstrumentType.cs │ ├── ConnectionType.cs │ ├── CryptoProviderType.cs │ ├── CryptoTestParameters.cs │ ├── GenericConnectionInstrumentParameters.cs │ ├── GenericConnectionInstrumentTestRunner.cs │ ├── GenericConnectionInstrumentType.cs │ ├── ICryptoProvider.cs │ ├── IEncryptionTestHost.cs │ ├── IHashTestHost.cs │ ├── IRandomNumberGenerator.cs │ ├── InstrumentationCategory.cs │ ├── InstrumentationConnectionFilter.cs │ ├── InstrumentationConnectionFlags.cs │ ├── InstrumentationConnectionHandler.cs │ ├── InstrumentationConnectionProvider.cs │ ├── InstrumentationParameters.cs │ ├── InstrumentationProvider.cs │ ├── InstrumentationTestRunner.cs │ ├── RenegotiationInstrumentConnectionHandler.cs │ ├── RenegotiationInstrumentParameters.cs │ ├── RenegotiationInstrumentTestRunner.cs │ ├── RenegotiationInstrumentType.cs │ ├── SignatureInstrument.cs │ ├── SignatureInstrumentParameters.cs │ ├── SignatureInstrumentTestRunner.cs │ ├── SignatureInstrumentType.cs │ ├── SimpleConnectionParameters.cs │ ├── SimpleConnectionTestRunner.cs │ └── SimpleConnectionType.cs └── Properties │ └── AssemblyInfo.cs ├── Mono.Security.NewTls.TestProvider ├── .gitignore ├── Mono.Security.NewTls.TestProvider.projitems ├── Mono.Security.NewTls.TestProvider.shproj ├── Mono.Security.NewTls.TestProvider │ ├── CryptoProvider.cs │ ├── MonoCryptoProvider.cs │ ├── MonoTlsProviderExtensions.cs │ ├── NativeCryptoHashType.cs │ ├── NativeCryptoProvider.cs │ ├── NativeOpenSsl.cs │ ├── NativeOpenSslError.cs │ ├── NativeOpenSslException.cs │ ├── NativeOpenSslProtocol.cs │ ├── OpenSslClient.cs │ ├── OpenSslConnection.cs │ ├── OpenSslConnectionProvider.cs │ ├── OpenSslConnectionProviderFactory.cs │ ├── OpenSslServer.cs │ └── SymmetricAlgorithmProxy.cs └── NewTlsDependencyProvider.cs ├── Mono.Security.NewTls.Tests ├── Mono.Security.NewTls.Tests.csproj ├── Mono.Security.NewTls.Tests │ ├── CipherTest.cs │ ├── HashTest.cs │ ├── MartinTest.cs │ ├── SelectCiphersTest.cs │ ├── SimpleConnectionTests.cs │ ├── TestCbcBlockCipher-Generated.cs │ ├── TestCbcBlockCipher.cs │ ├── TestConnectionInstruments.cs │ ├── TestGaloisCounterCipher.cs │ ├── TestGaloisCounterGipher-Generated.cs │ ├── TestHttps.cs │ ├── TestRenegotiation.cs │ ├── TestSignatureAlgorithms.cs │ └── TestSslStream.cs ├── NewTlsTestFeatures.cs └── Properties │ └── AssemblyInfo.cs ├── Mono.Security.NewTls.iOS.sln ├── Mono.Security.NewTls.sln ├── Mono.Security.NewTls ├── .gitignore ├── BouncyCastle │ ├── crypto │ │ ├── CryptoException.cs │ │ ├── DataLengthException.cs │ │ ├── IBlockCipher.cs │ │ ├── ICipherParameters.cs │ │ ├── IDigest.cs │ │ ├── IMac.cs │ │ ├── InvalidCipherTextException.cs │ │ ├── digests │ │ │ ├── GeneralDigest.cs │ │ │ ├── LongDigest.cs │ │ │ ├── NullDigest.cs │ │ │ ├── Sha256Digest.cs │ │ │ ├── Sha384Digest.cs │ │ │ ├── Sha512Digest.cs │ │ │ └── ShortenedDigest.cs │ │ ├── engines │ │ │ ├── AesEngine.cs │ │ │ ├── AesFastEngine.cs │ │ │ └── AesLightEngine.cs │ │ ├── macs │ │ │ └── HMac.cs │ │ ├── modes │ │ │ ├── CbcBlockCipher.cs │ │ │ ├── GCMBlockCipher.cs │ │ │ ├── IAeadBlockCipher.cs │ │ │ └── gcm │ │ │ │ ├── BasicGcmExponentiator.cs │ │ │ │ ├── BasicGcmMultiplier.cs │ │ │ │ ├── GcmUtilities.cs │ │ │ │ ├── IGcmExponentiator.cs │ │ │ │ ├── IGcmMultiplier.cs │ │ │ │ ├── Tables1kGcmExponentiator.cs │ │ │ │ ├── Tables64kGcmMultiplier.cs │ │ │ │ └── Tables8kGcmMultiplier.cs │ │ ├── parameters │ │ │ ├── AEADParameters.cs │ │ │ ├── ECDomainParameters.cs │ │ │ ├── KeyParameter.cs │ │ │ └── ParametersWithIV.cs │ │ └── util │ │ │ └── Pack.cs │ ├── math │ │ ├── BigInteger.cs │ │ └── ec │ │ │ ├── ECAlgorithms.cs │ │ │ ├── ECCurve.cs │ │ │ ├── ECFieldElement.cs │ │ │ ├── ECPoint.cs │ │ │ ├── IntArray.cs │ │ │ ├── abc │ │ │ ├── SimpleBigDecimal.cs │ │ │ ├── Tnaf.cs │ │ │ └── ZTauElement.cs │ │ │ ├── multiplier │ │ │ ├── ECMultiplier.cs │ │ │ ├── FpNafMultiplier.cs │ │ │ ├── PreCompInfo.cs │ │ │ ├── ReferenceMultiplier.cs │ │ │ ├── WNafMultiplier.cs │ │ │ ├── WNafPreCompInfo.cs │ │ │ ├── WTauNafMultiplier.cs │ │ │ └── WTauNafPreCompInfo.cs │ │ │ └── x9 │ │ │ └── X9IntegerConverter.cs │ └── util │ │ ├── Arrays.cs │ │ ├── Strings.cs │ │ └── encoders │ │ ├── Hex.cs │ │ ├── HexEncoder.cs │ │ └── IEncoder.cs ├── Mono.Security.Cryptography │ ├── ASN1.cs │ ├── HashAlgorithmProvider.cs │ ├── MD5CryptoServiceProvider.cs │ ├── MD5SHA1.cs │ ├── PKCS1.cs │ ├── RSASslSignatureDeformatter.cs │ ├── RSASslSignatureFormatter.cs │ ├── SHA1CryptoServiceProvider.cs │ ├── SHA224.cs │ ├── SHA224Managed.cs │ ├── SHA256Managed.cs │ ├── SHA384Managed.cs │ ├── SHA512Managed.cs │ └── SHAConstants.cs ├── Mono.Security.NewTls.Cipher │ ├── BlockCipher.cs │ ├── BlockCipherWithHMac.cs │ ├── CbcBlockCipher.cs │ ├── CipherSuite.cs │ ├── CipherSuiteCollection.cs │ ├── CipherSuiteFactory.cs │ ├── CryptoParameters.cs │ ├── DiffieHellmanKeyExchange.cs │ ├── EllipticCurveKeyExchange.cs │ ├── GaloisCounterCipher.cs │ ├── HMac.cs │ ├── HandshakeHash.cs │ ├── KeyExchange.cs │ ├── PseudoRandomFunction.cs │ ├── PseudoRandomFunctionTls10.cs │ ├── PseudoRandomFunctionTls12.cs │ ├── RSAKeyExchange.cs │ ├── SecureRandomGenerator.cs │ ├── Signature.cs │ ├── SignatureHelper.cs │ ├── SignatureTls10.cs │ ├── SignatureTls11.cs │ ├── SignatureTls12.cs │ ├── TlsCipherSuite10.cs │ ├── TlsCipherSuite11.cs │ └── TlsCipherSuite12.cs ├── Mono.Security.NewTls.EC │ ├── ECCurveType.cs │ ├── NamedCurveHelper.cs │ ├── SecNamedCurves.cs │ ├── SecObjectIdentifiers.cs │ ├── X9ECParameters.cs │ ├── X9ECParametersHolder.cs │ └── X9ObjectIdentifiers.cs ├── Mono.Security.NewTls.Extensions │ ├── ExtensionType.cs │ ├── RenegotiationExtension.cs │ ├── ServerNameExtension.cs │ ├── SignatureAlgorithmsExtension.cs │ ├── TlsExtension.cs │ └── TlsExtensionCollection.cs ├── Mono.Security.NewTls.Handshake │ ├── HandshakeMessage.cs │ ├── HandshakeType.cs │ ├── Message.cs │ ├── TlsCertificate.cs │ ├── TlsCertificateRequest.cs │ ├── TlsCertificateVerify.cs │ ├── TlsChangeCipherSpec.cs │ ├── TlsClientHello.cs │ ├── TlsClientKeyExchange.cs │ ├── TlsFinished.cs │ ├── TlsHelloRequest.cs │ ├── TlsServerHello.cs │ ├── TlsServerHelloDone.cs │ └── TlsServerKeyExchange.cs ├── Mono.Security.NewTls.Negotiation │ ├── ClientConnection.cs │ ├── ClientKeyExchange.cs │ ├── NegotiationHandler.cs │ ├── NegotiationState.cs │ ├── ServerConnection.cs │ ├── ServerFinished.cs │ └── ServerHello.cs ├── Mono.Security.NewTls.csproj ├── Mono.Security.NewTls │ ├── CertificateManager.cs │ ├── HandshakeParameters.cs │ ├── MonoNewTlsStream.cs │ ├── Session.cs │ ├── TlsConfiguration.cs │ └── TlsContext.cs └── Properties │ └── AssemblyInfo.cs ├── NativeOpenSsl ├── .gitignore ├── NativeCryptoTest.c ├── NativeCryptoTest.h ├── NativeOpenSsl.c ├── NativeOpenSsl.h └── NativeOpenSsl.xcodeproj │ ├── project.pbxproj │ └── xcuserdata │ └── martin.xcuserdatad │ └── xcschemes │ ├── NativeOpenSsl.xcscheme │ └── xcschememanagement.plist ├── README.Setup.md ├── README.TestFramework.md ├── README.md ├── filelist.pl └── new-tls.snk /.gitignore: -------------------------------------------------------------------------------- 1 | packages 2 | bin 3 | obj 4 | .DS_Store 5 | *.userprefs 6 | /lib/ 7 | TestResult.xml 8 | project.xcworkspace 9 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "external/web-tests"] 2 | path = external/web-tests 3 | url = git@github.com:xamarin/web-tests.git 4 | branch = stable 5 | -------------------------------------------------------------------------------- /Android/Mono.Security.NewTls.Android/Assets/AboutAssets.txt: -------------------------------------------------------------------------------- 1 | Any raw assets you want to be deployed with your application can be placed in 2 | this directory (and child directories) and given a Build Action of "AndroidAsset". 3 | 4 | These files will be deployed with your package and will be accessible using Android's 5 | AssetManager, like this: 6 | 7 | public class ReadAsset : Activity 8 | { 9 | protected override void OnCreate (Bundle bundle) 10 | { 11 | base.OnCreate (bundle); 12 | 13 | InputStream input = Assets.Open ("my_asset.txt"); 14 | } 15 | } 16 | 17 | Additionally, some Android functions will automatically load asset files: 18 | 19 | Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf"); 20 | -------------------------------------------------------------------------------- /Android/Mono.Security.NewTls.Android/MainActivity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Android.App; 4 | using Android.OS; 5 | 6 | namespace Mono.Security.NewTls.Android 7 | { 8 | using TestProvider; 9 | using Xamarin.Forms; 10 | using Xamarin.Forms.Platform.Android; 11 | using Xamarin.AsyncTests; 12 | using Xamarin.AsyncTests.Framework; 13 | using Xamarin.AsyncTests.Portable; 14 | using Xamarin.AsyncTests.Mobile; 15 | 16 | [Activity (Label = "Mono.Security.NewTls.Android", MainLauncher = true)] 17 | public class MainActivity : FormsApplicationActivity 18 | { 19 | public TestFramework Framework { 20 | get; 21 | private set; 22 | } 23 | 24 | protected override void OnCreate (Bundle bundle) 25 | { 26 | base.OnCreate (bundle); 27 | 28 | Forms.Init (this, bundle); 29 | 30 | DependencyInjector.RegisterAssembly (typeof(NewTlsDependencyProvider).Assembly); 31 | 32 | Framework = TestFramework.GetLocalFramework (typeof(NewTlsDependencyProvider).Assembly); 33 | 34 | LoadApplication (new MobileTestApp (Framework)); 35 | } 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /Android/Mono.Security.NewTls.Android/Properties/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Android/Mono.Security.NewTls.Android/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using Android.App; 4 | 5 | // Information about this assembly is defined by the following attributes. 6 | // Change them to the values specific to your project. 7 | 8 | [assembly: AssemblyTitle ("Mono.Security.NewTls.Android")] 9 | [assembly: AssemblyDescription ("")] 10 | [assembly: AssemblyConfiguration ("")] 11 | [assembly: AssemblyCompany ("Xamarin")] 12 | [assembly: AssemblyProduct ("")] 13 | [assembly: AssemblyCopyright ("Xamarin, Inc.")] 14 | [assembly: AssemblyTrademark ("")] 15 | [assembly: AssemblyCulture ("")] 16 | 17 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 18 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 19 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 20 | 21 | [assembly: AssemblyVersion ("1.0.0")] 22 | 23 | // The following attributes are used to specify the signing key for the assembly, 24 | // if desired. See the Mono documentation for more information about signing. 25 | 26 | //[assembly: AssemblyDelaySign(false)] 27 | //[assembly: AssemblyKeyFile("")] 28 | 29 | -------------------------------------------------------------------------------- /Android/Mono.Security.NewTls.Android/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Android/Mono.Security.NewTls/Resources/AboutResources.txt: -------------------------------------------------------------------------------- 1 | Images, layout descriptions, binary blobs and string dictionaries can be included 2 | in your application as resource files. Various Android APIs are designed to 3 | operate on the resource IDs instead of dealing with images, strings or binary blobs 4 | directly. 5 | 6 | For example, a sample Android app that contains a user interface layout (main.axml), 7 | an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png) 8 | would keep its resources in the "Resources" directory of the application: 9 | 10 | Resources/ 11 | drawable/ 12 | icon.png 13 | 14 | layout/ 15 | main.axml 16 | 17 | values/ 18 | strings.xml 19 | 20 | In order to get the build system to recognize Android resources, set the build action to 21 | "AndroidResource". The native Android APIs do not operate directly with filenames, but 22 | instead operate on resource IDs. When you compile an Android application that uses resources, 23 | the build system will package the resources for distribution and generate a class called "R" 24 | (this is an Android convention) that contains the tokens for each one of the resources 25 | included. For example, for the above Resources layout, this is what the R class would expose: 26 | 27 | public class R { 28 | public class drawable { 29 | public const int icon = 0x123; 30 | } 31 | 32 | public class layout { 33 | public const int main = 0x456; 34 | } 35 | 36 | public class strings { 37 | public const int first_string = 0xabc; 38 | public const int second_string = 0xbcd; 39 | } 40 | } 41 | 42 | You would then use R.drawable.icon to reference the drawable/icon.png file, or R.layout.main 43 | to reference the layout/main.axml file, or R.strings.first_string to reference the first 44 | string in the dictionary file values/strings.xml. 45 | -------------------------------------------------------------------------------- /Android/Mono.Security.NewTls/Resources/Resource.designer.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable 1591 2 | // ------------------------------------------------------------------------------ 3 | // 4 | // This code was generated by a tool. 5 | // Mono Runtime Version: 4.0.30319.17020 6 | // 7 | // Changes to this file may cause incorrect behavior and will be lost if 8 | // the code is regenerated. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | 12 | [assembly: Android.Runtime.ResourceDesignerAttribute("Mono.Security.NewTls.Android.Resource", IsApplication=false)] 13 | 14 | namespace Mono.Security.NewTls.Android 15 | { 16 | 17 | 18 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")] 19 | public partial class Resource 20 | { 21 | 22 | static Resource() 23 | { 24 | global::Android.Runtime.ResourceIdManager.UpdateIdValues(); 25 | } 26 | 27 | public partial class Attribute 28 | { 29 | 30 | static Attribute() 31 | { 32 | global::Android.Runtime.ResourceIdManager.UpdateIdValues(); 33 | } 34 | 35 | private Attribute() 36 | { 37 | } 38 | } 39 | 40 | public partial class String 41 | { 42 | 43 | // aapt resource value: 0x7f020000 44 | public static int library_name = 2130837504; 45 | 46 | static String() 47 | { 48 | global::Android.Runtime.ResourceIdManager.UpdateIdValues(); 49 | } 50 | 51 | private String() 52 | { 53 | } 54 | } 55 | } 56 | } 57 | #pragma warning restore 1591 58 | -------------------------------------------------------------------------------- /Android/Mono.Security.NewTls/Resources/values/Strings.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | Mono.Security.NewTls.Android 4 | 5 | -------------------------------------------------------------------------------- /Android/Mono.Security.Providers.NewTls/Resources/AboutResources.txt: -------------------------------------------------------------------------------- 1 | Images, layout descriptions, binary blobs and string dictionaries can be included 2 | in your application as resource files. Various Android APIs are designed to 3 | operate on the resource IDs instead of dealing with images, strings or binary blobs 4 | directly. 5 | 6 | For example, a sample Android app that contains a user interface layout (main.axml), 7 | an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png) 8 | would keep its resources in the "Resources" directory of the application: 9 | 10 | Resources/ 11 | drawable/ 12 | icon.png 13 | 14 | layout/ 15 | main.axml 16 | 17 | values/ 18 | strings.xml 19 | 20 | In order to get the build system to recognize Android resources, set the build action to 21 | "AndroidResource". The native Android APIs do not operate directly with filenames, but 22 | instead operate on resource IDs. When you compile an Android application that uses resources, 23 | the build system will package the resources for distribution and generate a class called "R" 24 | (this is an Android convention) that contains the tokens for each one of the resources 25 | included. For example, for the above Resources layout, this is what the R class would expose: 26 | 27 | public class R { 28 | public class drawable { 29 | public const int icon = 0x123; 30 | } 31 | 32 | public class layout { 33 | public const int main = 0x456; 34 | } 35 | 36 | public class strings { 37 | public const int first_string = 0xabc; 38 | public const int second_string = 0xbcd; 39 | } 40 | } 41 | 42 | You would then use R.drawable.icon to reference the drawable/icon.png file, or R.layout.main 43 | to reference the layout/main.axml file, or R.strings.first_string to reference the first 44 | string in the dictionary file values/strings.xml. 45 | -------------------------------------------------------------------------------- /Android/Mono.Security.Providers.NewTls/Resources/Resource.designer.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable 1591 2 | // ------------------------------------------------------------------------------ 3 | // 4 | // This code was generated by a tool. 5 | // Mono Runtime Version: 4.0.30319.17020 6 | // 7 | // Changes to this file may cause incorrect behavior and will be lost if 8 | // the code is regenerated. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | 12 | [assembly: Android.Runtime.ResourceDesignerAttribute("Mono.Security.Providers.NewTls.Resource", IsApplication=false)] 13 | 14 | namespace Mono.Security.Providers.NewTls 15 | { 16 | 17 | 18 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")] 19 | public partial class Resource 20 | { 21 | 22 | static Resource() 23 | { 24 | global::Android.Runtime.ResourceIdManager.UpdateIdValues(); 25 | } 26 | 27 | public partial class Attribute 28 | { 29 | 30 | static Attribute() 31 | { 32 | global::Android.Runtime.ResourceIdManager.UpdateIdValues(); 33 | } 34 | 35 | private Attribute() 36 | { 37 | } 38 | } 39 | 40 | public partial class String 41 | { 42 | 43 | // aapt resource value: 0x7f020000 44 | public static int library_name = 2130837504; 45 | 46 | static String() 47 | { 48 | global::Android.Runtime.ResourceIdManager.UpdateIdValues(); 49 | } 50 | 51 | private String() 52 | { 53 | } 54 | } 55 | } 56 | } 57 | #pragma warning restore 1591 58 | -------------------------------------------------------------------------------- /Android/Mono.Security.Providers.NewTls/Resources/values/Strings.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | Mono.Security.Providers.NewTls 4 | 5 | -------------------------------------------------------------------------------- /Console/Mono.Security.NewTls.Console/ConsoleDependencyProvider.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ConsoleMain.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2015 Xamarin, Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using Xamarin.AsyncTests; 28 | using Xamarin.AsyncTests.Console; 29 | using Xamarin.WebTests.ConnectionFramework; 30 | using Xamarin.WebTests.TestProvider; 31 | using Mono.Security.NewTls.TestProvider; 32 | 33 | [assembly: AsyncTestSuite (typeof (Mono.Security.NewTls.Tests.NewTlsTestFeatures), true)] 34 | 35 | namespace Mono.Security.NewTls.Console 36 | { 37 | public class ConsoleDependencyProvider 38 | { 39 | static void Main (string[] args) 40 | { 41 | DependencyInjector.RegisterAssembly (typeof(NewTlsDependencyProvider).Assembly); 42 | DependencyInjector.RegisterAssembly (typeof(WebDependencyProvider).Assembly); 43 | DependencyInjector.RegisterCollection (new OpenSslConnectionProviderFactory ()); 44 | Program.Run (typeof (ConsoleDependencyProvider).Assembly, args); 45 | } 46 | } 47 | } 48 | 49 | -------------------------------------------------------------------------------- /Console/Mono.Security.NewTls.Console/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // 2 | // AssemblyInfo.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2015 Xamarin, Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System.Reflection; 27 | using System.Runtime.CompilerServices; 28 | 29 | // Information about this assembly is defined by the following attributes. 30 | // Change them to the values specific to your project. 31 | 32 | [assembly: AssemblyTitle ("Mono.Security.NewTls.TestProvider")] 33 | [assembly: AssemblyDescription ("")] 34 | [assembly: AssemblyConfiguration ("")] 35 | [assembly: AssemblyCompany ("Xamarin")] 36 | [assembly: AssemblyProduct ("")] 37 | [assembly: AssemblyCopyright ("Xamarin, Inc.")] 38 | [assembly: AssemblyTrademark ("")] 39 | [assembly: AssemblyCulture ("")] 40 | 41 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 42 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 43 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 44 | 45 | [assembly: AssemblyVersion (Xamarin.AsyncTests.VersionInfo.Version)] 46 | 47 | // The following attributes are used to specify the signing key for the assembly, 48 | // if desired. See the Mono documentation for more information about signing. 49 | 50 | //[assembly: AssemblyDelaySign(false)] 51 | //[assembly: AssemblyKeyFile("")] 52 | 53 | -------------------------------------------------------------------------------- /IOS/Mono.Security.NewTls.iOS/AppDelegate.cs: -------------------------------------------------------------------------------- 1 |  // 2 | // AppDelegate.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2015 Xamarin, Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using System.Linq; 28 | using System.Collections.Generic; 29 | 30 | using Foundation; 31 | using UIKit; 32 | using Xamarin.AsyncTests; 33 | 34 | namespace Mono.Security.NewTls.iOS 35 | { 36 | using TestProvider; 37 | using Xamarin.Forms; 38 | using Xamarin.Forms.Platform.iOS; 39 | using Xamarin.AsyncTests; 40 | using Xamarin.AsyncTests.Framework; 41 | using Xamarin.AsyncTests.Portable; 42 | using Xamarin.AsyncTests.Mobile; 43 | 44 | [Register("AppDelegate")] 45 | public partial class AppDelegate : FormsApplicationDelegate 46 | { 47 | public TestFramework Framework { 48 | get; 49 | private set; 50 | } 51 | 52 | public override bool FinishedLaunching (UIApplication app, NSDictionary options) 53 | { 54 | Forms.Init(); 55 | 56 | Framework = MobileDependencyProvider.GetFramework (); 57 | 58 | LoadApplication (new MobileTestApp (Framework)); 59 | 60 | return base.FinishedLaunching (app, options); 61 | } 62 | } 63 | } 64 | 65 | -------------------------------------------------------------------------------- /IOS/Mono.Security.NewTls.iOS/Entitlements.plist: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /IOS/Mono.Security.NewTls.iOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDisplayName 6 | MonoSecurityNewTls 7 | CFBundleIdentifier 8 | com.xamarin.Mono.Security.NewTls.iOS 9 | CFBundleShortVersionString 10 | 1.0 11 | CFBundleVersion 12 | 1.0 13 | LSRequiresIPhoneOS 14 | 15 | MinimumOSVersion 16 | 8.0 17 | UIDeviceFamily 18 | 19 | 1 20 | 2 21 | 22 | UILaunchStoryboardName 23 | LaunchScreen 24 | UIMainNibFile 25 | LaunchScreen 26 | UIMainNibFile~ipad 27 | LaunchScreen 28 | UIRequiredDeviceCapabilities 29 | 30 | armv7 31 | 32 | UISupportedInterfaceOrientations 33 | 34 | UIInterfaceOrientationPortrait 35 | UIInterfaceOrientationLandscapeLeft 36 | UIInterfaceOrientationLandscapeRight 37 | 38 | UISupportedInterfaceOrientations~ipad 39 | 40 | UIInterfaceOrientationPortrait 41 | UIInterfaceOrientationPortraitUpsideDown 42 | UIInterfaceOrientationLandscapeLeft 43 | UIInterfaceOrientationLandscapeRight 44 | 45 | XSAppIconAssets 46 | Resources/Images.xcassets/AppIcons.appiconset 47 | 48 | 49 | -------------------------------------------------------------------------------- /IOS/Mono.Security.NewTls.iOS/Main.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Main.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2015 Xamarin, Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using System.Collections.Generic; 28 | using System.Linq; 29 | 30 | using Foundation; 31 | using UIKit; 32 | 33 | namespace Mono.Security.NewTls.iOS 34 | { 35 | public class Application 36 | { 37 | // This is the main entry point of the application. 38 | static void Main (string[] args) 39 | { 40 | // if you want to use a different Application Delegate class from "AppDelegate" 41 | // you can specify it here. 42 | UIApplication.Main (args, null, "AppDelegate"); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /IOS/Mono.Security.NewTls.iOS/MobileDependencyProvider.cs: -------------------------------------------------------------------------------- 1 | // 2 | // MobileDependencyProvider.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2015 Xamarin, Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using Xamarin.AsyncTests; 28 | using Xamarin.WebTests.TestProvider; 29 | using Mono.Security.NewTls.TestProvider; 30 | using Mono.Security.NewTls.TestFramework; 31 | using Mono.Security.NewTls.Tests; 32 | 33 | [assembly: AsyncTestSuite (typeof (Mono.Security.NewTls.Tests.NewTlsTestFeatures), true)] 34 | 35 | namespace Mono.Security.NewTls.iOS 36 | { 37 | using Xamarin.AsyncTests; 38 | using Xamarin.AsyncTests.Framework; 39 | 40 | public class MobileDependencyProvider 41 | { 42 | public static TestFramework GetFramework () 43 | { 44 | DependencyInjector.RegisterAssembly (typeof(WebDependencyProvider).Assembly); 45 | DependencyInjector.RegisterAssembly (typeof(NewTlsDependencyProvider).Assembly); 46 | 47 | return TestFramework.GetLocalFramework (typeof(NewTlsTestFeatures).Assembly); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /IOS/Mono.Security.NewTls.iOS/Resources/Images.xcassets/AppIcons.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "size": "29x29", 5 | "scale": "1x", 6 | "idiom": "iphone" 7 | }, 8 | { 9 | "size": "29x29", 10 | "scale": "2x", 11 | "idiom": "iphone" 12 | }, 13 | { 14 | "size": "29x29", 15 | "scale": "3x", 16 | "idiom": "iphone" 17 | }, 18 | { 19 | "size": "40x40", 20 | "scale": "2x", 21 | "idiom": "iphone" 22 | }, 23 | { 24 | "size": "40x40", 25 | "scale": "3x", 26 | "idiom": "iphone" 27 | }, 28 | { 29 | "size": "57x57", 30 | "scale": "1x", 31 | "idiom": "iphone" 32 | }, 33 | { 34 | "size": "57x57", 35 | "scale": "2x", 36 | "idiom": "iphone" 37 | }, 38 | { 39 | "size": "60x60", 40 | "scale": "2x", 41 | "idiom": "iphone" 42 | }, 43 | { 44 | "size": "60x60", 45 | "scale": "3x", 46 | "idiom": "iphone" 47 | }, 48 | { 49 | "size": "29x29", 50 | "scale": "1x", 51 | "idiom": "ipad" 52 | }, 53 | { 54 | "size": "29x29", 55 | "scale": "2x", 56 | "idiom": "ipad" 57 | }, 58 | { 59 | "size": "40x40", 60 | "scale": "1x", 61 | "idiom": "ipad" 62 | }, 63 | { 64 | "size": "40x40", 65 | "scale": "2x", 66 | "idiom": "ipad" 67 | }, 68 | { 69 | "size": "50x50", 70 | "scale": "1x", 71 | "idiom": "ipad" 72 | }, 73 | { 74 | "size": "50x50", 75 | "scale": "2x", 76 | "idiom": "ipad" 77 | }, 78 | { 79 | "size": "72x72", 80 | "scale": "1x", 81 | "idiom": "ipad" 82 | }, 83 | { 84 | "size": "72x72", 85 | "scale": "2x", 86 | "idiom": "ipad" 87 | }, 88 | { 89 | "size": "76x76", 90 | "scale": "1x", 91 | "idiom": "ipad" 92 | }, 93 | { 94 | "size": "76x76", 95 | "scale": "2x", 96 | "idiom": "ipad" 97 | }, 98 | { 99 | "size": "120x120", 100 | "scale": "1x", 101 | "idiom": "car" 102 | } 103 | ], 104 | "info": { 105 | "version": 1, 106 | "author": "xcode" 107 | } 108 | } -------------------------------------------------------------------------------- /IOS/Mono.Security.NewTls.iOS/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Mac/Mono.Security.NewTls.Mac/BuiltinTestServer.cs: -------------------------------------------------------------------------------- 1 | // 2 | // BuiltinTestServer.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2015 Xamarin, Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using System.Threading; 28 | using System.Threading.Tasks; 29 | 30 | namespace Mono.Security.NewTls.TestProvider 31 | { 32 | using Xamarin.AsyncTests.MacUI; 33 | using Xamarin.AsyncTests.Remoting; 34 | using Xamarin.AsyncTests.Framework; 35 | 36 | class BuiltinTestServer : IBuiltinTestServer 37 | { 38 | public Task Start (CancellationToken cancellationToken) 39 | { 40 | var framework = TestFramework.GetLocalFramework (typeof(BuiltinTestServer).Assembly); 41 | var app = AppDelegate.Instance.MacUI; 42 | return TestServer.StartLocal (app, framework, cancellationToken); 43 | } 44 | } 45 | } 46 | 47 | -------------------------------------------------------------------------------- /Mac/Mono.Security.NewTls.Mac/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleName 6 | Mono.Security.NewTls.TestProvider 7 | CFBundleVersion 8 | 1 9 | LSMinimumSystemVersion 10 | 10.6 11 | NSMainNibFile 12 | MainMenu 13 | NSPrincipalClass 14 | NSApplication 15 | CFBundlePackageType 16 | APPL 17 | LSApplicationCategoryType 18 | public.app-category.utilities 19 | CFBundleDisplayName 20 | Mono TLS Tests 21 | CFBundleIdentifier 22 | com.xamarin.newtls.MacUI 23 | CFBundleShortVersionString 24 | 1.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /Mac/Mono.Security.NewTls.Mac/MacDependencyProvider.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Program.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2015 Xamarin, Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using Xamarin.AsyncTests; 28 | using Xamarin.AsyncTests.MacUI; 29 | using Xamarin.WebTests.TestProvider; 30 | 31 | using AppKit; 32 | 33 | [assembly: AsyncTestSuite (typeof (Mono.Security.NewTls.Tests.NewTlsTestFeatures), true)] 34 | 35 | namespace Mono.Security.NewTls.Mac 36 | { 37 | using TestProvider; 38 | using Tests; 39 | 40 | public class MacDependencyProvider 41 | { 42 | static void Main (string[] args) 43 | { 44 | DependencyInjector.RegisterAssembly (typeof(WebDependencyProvider).Assembly); 45 | DependencyInjector.RegisterAssembly (typeof(NewTlsDependencyProvider).Assembly); 46 | DependencyInjector.RegisterDependency (() => new BuiltinTestServer ()); 47 | 48 | NSApplication.Init (); 49 | NSApplication.Main (args); 50 | } 51 | } 52 | } 53 | 54 | -------------------------------------------------------------------------------- /Mac/Mono.Security.NewTls.Mac/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // 2 | // AssemblyInfo.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2015 Xamarin, Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System.Reflection; 27 | using System.Runtime.CompilerServices; 28 | 29 | // Information about this assembly is defined by the following attributes. 30 | // Change them to the values specific to your project. 31 | 32 | [assembly: AssemblyTitle ("Mono.Security.NewTls.TestProvider")] 33 | [assembly: AssemblyDescription ("")] 34 | [assembly: AssemblyConfiguration ("")] 35 | [assembly: AssemblyCompany ("Xamarin")] 36 | [assembly: AssemblyProduct ("")] 37 | [assembly: AssemblyCopyright ("Xamarin, Inc.")] 38 | [assembly: AssemblyTrademark ("")] 39 | [assembly: AssemblyCulture ("")] 40 | 41 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 42 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 43 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 44 | 45 | [assembly: AssemblyVersion (Xamarin.AsyncTests.VersionInfo.Version)] 46 | 47 | // The following attributes are used to specify the signing key for the assembly, 48 | // if desired. See the Mono documentation for more information about signing. 49 | 50 | //[assembly: AssemblyDelaySign(false)] 51 | //[assembly: AssemblyKeyFile("")] 52 | 53 | -------------------------------------------------------------------------------- /Makefile.native: -------------------------------------------------------------------------------- 1 | PROJECT = NativeOpenSsl/NativeOpenSsl.xcodeproj 2 | TARGET = NativeOpenSsl 3 | 4 | all: 5 | xcodebuild -project $(PROJECT) -target $(TARGET) 6 | 7 | clean: 8 | -rm -f lib/*.dylib 9 | xcodebuild -project $(PROJECT) -target $(TARGET) clean 10 | -------------------------------------------------------------------------------- /MartinsPlayground.mdw: -------------------------------------------------------------------------------- 1 | 2 | 3 | MartinsPlayground.sln 4 | external/web-tests/Xamarin.WebTests.sln 5 | MartinsPlayground.Android.sln 6 | MartinsPlayground.iOS.sln 7 | MartinsPlayground.Mac.sln 8 | 9 | -------------------------------------------------------------------------------- /MartinsPlayground/.gitignore: -------------------------------------------------------------------------------- 1 | lib/ 2 | *.xcuserstate 3 | xcshareddata 4 | -------------------------------------------------------------------------------- /MartinsPlayground/Instrumentation/Framework/IMonoClientAndServerParameters.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mono.Security.Instrumentation.Framework 4 | { 5 | public interface IMonoClientAndServerParameters : IMonoClientParameters, IMonoServerParameters 6 | { 7 | } 8 | } 9 | 10 | -------------------------------------------------------------------------------- /MartinsPlayground/Instrumentation/Framework/IMonoClientParameters.cs: -------------------------------------------------------------------------------- 1 | using Mono.Security.NewTls; 2 | using Mono.Security.NewTls.Instrumentation; 3 | using Mono.Security.NewTls.TestFramework; 4 | 5 | namespace Mono.Security.Instrumentation.Framework 6 | { 7 | using Framework; 8 | 9 | public interface IMonoClientParameters : IClientParameters 10 | { 11 | ClientCertificateParameters ClientCertificateParameters { 12 | get; set; 13 | } 14 | 15 | InstrumentCollection ClientInstrumentation { 16 | get; 17 | } 18 | } 19 | } 20 | 21 | -------------------------------------------------------------------------------- /MartinsPlayground/Instrumentation/Framework/IMonoServerParameters.cs: -------------------------------------------------------------------------------- 1 | using Mono.Security.NewTls; 2 | using Mono.Security.NewTls.Instrumentation; 3 | using Mono.Security.NewTls.TestFramework; 4 | 5 | namespace Mono.Security.Instrumentation.Framework 6 | { 7 | using Framework; 8 | 9 | public interface IMonoServerParameters : IServerParameters 10 | { 11 | InstrumentCollection ServerInstrumentation { 12 | get; 13 | } 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /MartinsPlayground/Instrumentation/Framework/MonoClientAndServerParameters.cs: -------------------------------------------------------------------------------- 1 | using Mono.Security.NewTls; 2 | using Mono.Security.NewTls.Instrumentation; 3 | using Mono.Security.NewTls.TestFramework; 4 | 5 | namespace Mono.Security.Instrumentation.Framework 6 | { 7 | using Framework; 8 | 9 | public class MonoClientAndServerParameters : ClientAndServerParameters, IMonoClientAndServerParameters 10 | { 11 | public MonoClientAndServerParameters (string identifier, IServerCertificate certificate) 12 | : base (identifier, certificate) 13 | { 14 | } 15 | 16 | public ClientCertificateParameters ClientCertificateParameters { 17 | get; set; 18 | } 19 | 20 | InstrumentCollection clientInstrumentation; 21 | InstrumentCollection serverInstrumentation; 22 | 23 | public InstrumentCollection ClientInstrumentation { 24 | get { 25 | if (clientInstrumentation == null) 26 | clientInstrumentation = new InstrumentCollection (); 27 | return clientInstrumentation; 28 | } 29 | } 30 | 31 | public InstrumentCollection ServerInstrumentation { 32 | get { 33 | if (serverInstrumentation == null) 34 | serverInstrumentation = new InstrumentCollection (); 35 | return serverInstrumentation; 36 | } 37 | } 38 | } 39 | } 40 | 41 | -------------------------------------------------------------------------------- /MartinsPlayground/Instrumentation/Framework/MonoClientParameters.cs: -------------------------------------------------------------------------------- 1 | using Mono.Security.NewTls; 2 | using Mono.Security.NewTls.Instrumentation; 3 | using Mono.Security.NewTls.TestFramework; 4 | 5 | namespace Mono.Security.Instrumentation.Framework 6 | { 7 | using Framework; 8 | 9 | public class MonoClientParameters : ClientParameters, IMonoClientParameters 10 | { 11 | public MonoClientParameters (string identifier) 12 | : base (identifier) 13 | { 14 | } 15 | 16 | public ClientCertificateParameters ClientCertificateParameters { 17 | get; set; 18 | } 19 | 20 | public InstrumentCollection ClientInstrumentation { 21 | get; set; 22 | } 23 | } 24 | } 25 | 26 | -------------------------------------------------------------------------------- /MartinsPlayground/Instrumentation/Framework/MonoServerParameters.cs: -------------------------------------------------------------------------------- 1 | using Mono.Security.NewTls; 2 | using Mono.Security.NewTls.Instrumentation; 3 | using Mono.Security.NewTls.TestFramework; 4 | 5 | namespace Mono.Security.Instrumentation.Framework 6 | { 7 | using Framework; 8 | 9 | public class MonoServerParameters : ServerParameters, IMonoServerParameters 10 | { 11 | public MonoServerParameters (string identifier, IServerCertificate certificate) 12 | : base (identifier, certificate) 13 | { 14 | } 15 | 16 | public InstrumentCollection ServerInstrumentation { 17 | get; set; 18 | } 19 | } 20 | } 21 | 22 | -------------------------------------------------------------------------------- /MartinsPlayground/MartinsPlayground.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mono/mono-tls/bdcc934db2fdd97ca6d437969f0b963728fe3667/MartinsPlayground/MartinsPlayground.snk -------------------------------------------------------------------------------- /MartinsPlayground/MartinsPlayground.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /MartinsPlayground/MartinsPlayground.xcworkspace/xcuserdata/martin.xcuserdatad/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildLocationStyle 6 | UseAppPreferences 7 | CustomBuildLocationType 8 | RelativeToDerivedData 9 | DerivedDataLocationStyle 10 | Default 11 | IssueFilterStyle 12 | ShowActiveSchemeOnly 13 | LiveSourceIssuesEnabled 14 | 15 | SnapshotAutomaticallyBeforeSignificantChanges 16 | 17 | SnapshotLocationStyle 18 | Default 19 | 20 | 21 | -------------------------------------------------------------------------------- /MartinsPlayground/NativeConsoleTest/NativeConsoleTest.xcodeproj/xcuserdata/martin.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | NativeConsoleTest.xcscheme 8 | 9 | orderHint 10 | 1 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 5B31F1D81A29202A001BA250 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /MartinsPlayground/NativeConsoleTest/NativeConsoleTest/main.c: -------------------------------------------------------------------------------- 1 | // 2 | // main.c 3 | // ConsoleTest 4 | // 5 | // Created by Martin Baulig on 27/11/14. 6 | // Copyright (c) 2014 Xamarin. All rights reserved. 7 | // 8 | 9 | #include 10 | #include "../../NativeOpenSsl/NativeOpenSsl.h" 11 | 12 | static void 13 | load_certificate(NativeOpenSsl *ptr, const char *certfile, const char *keyfile) 14 | { 15 | native_openssl_load_certificate_2(ptr, certfile); 16 | native_openssl_load_private_key_2(ptr, keyfile); 17 | native_openssl_create_context(ptr, 0); 18 | } 19 | 20 | int main 21 | (int argc, const char * argv[]) 22 | { 23 | unsigned char ip[4] = { 0x7f, 0x00, 0x00, 0x01 }; 24 | NativeOpenSsl *ptr; 25 | int ret; 26 | 27 | ptr = native_openssl_initialize (); 28 | 29 | if (argc == 2) { 30 | load_certificate(ptr, argv[0], argv[1]); 31 | native_openssl_bind(ptr, ip, 4433); 32 | native_openssl_accept(ptr); 33 | } else { 34 | native_openssl_connect(ptr, ip, 4433); 35 | } 36 | 37 | native_openssl_write(ptr, "TEST\n", 0, 5); 38 | 39 | return ret; 40 | } 41 | -------------------------------------------------------------------------------- /MartinsPlayground/README.Playground: -------------------------------------------------------------------------------- 1 | Martin's Playground 2 | =================== 3 | 4 | Ignore, this directory will go away very shortly. 5 | 6 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.DotNetConsole/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // 2 | // AssemblyInfo.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2015 Xamarin, Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System.Reflection; 27 | using System.Runtime.CompilerServices; 28 | 29 | // Information about this assembly is defined by the following attributes. 30 | // Change them to the values specific to your project. 31 | 32 | [assembly: AssemblyTitle ("Mono.Security.NewTls.DotNetConsole")] 33 | [assembly: AssemblyDescription ("")] 34 | [assembly: AssemblyConfiguration ("")] 35 | [assembly: AssemblyCompany ("Xamarin")] 36 | [assembly: AssemblyProduct ("")] 37 | [assembly: AssemblyCopyright ("Xamarin, Inc.")] 38 | [assembly: AssemblyTrademark ("")] 39 | [assembly: AssemblyCulture ("")] 40 | 41 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 42 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 43 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 44 | 45 | [assembly: AssemblyVersion (Xamarin.AsyncTests.VersionInfo.Version)] 46 | 47 | // The following attributes are used to specify the signing key for the assembly, 48 | // if desired. See the Mono documentation for more information about signing. 49 | 50 | //[assembly: AssemblyDelaySign(false)] 51 | //[assembly: AssemblyKeyFile("")] 52 | 53 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.Instrumentation/Mono.Security.NewTls/ClientCertificateType.cs: -------------------------------------------------------------------------------- 1 | namespace Mono.Security.NewTls 2 | { 3 | public enum ClientCertificateType 4 | { 5 | RsaSign = 1, 6 | DsaSign = 2, 7 | RsaFixedDh = 3, 8 | DssFixedDh = 4, 9 | 10 | RsaEphemeralDh_Reserved = 5, 11 | DssEphemeralDh_Reserved = 6, 12 | FortezzaDms_Reserved = 20, 13 | 14 | Unknown = 255 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.Instrumentation/Mono.Security.NewTls/ContentType.cs: -------------------------------------------------------------------------------- 1 | // Transport Security Layer (TLS) 2 | // Copyright (c) 2003-2004 Carlos Guzman Alvarez 3 | 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining 6 | // a copy of this software and associated documentation files (the 7 | // "Software"), to deal in the Software without restriction, including 8 | // without limitation the rights to use, copy, modify, merge, publish, 9 | // distribute, sublicense, and/or sell copies of the Software, and to 10 | // permit persons to whom the Software is furnished to do so, subject to 11 | // the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | // 24 | 25 | using System; 26 | 27 | namespace Mono.Security.NewTls 28 | { 29 | public enum ContentType : byte 30 | { 31 | ChangeCipherSpec = 20, 32 | Alert = 21, 33 | Handshake = 22, 34 | ApplicationData = 23, 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.Instrumentation/Mono.Security.NewTls/HandshakeHashType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mono.Security.NewTls 4 | { 5 | public enum HandshakeHashType 6 | { 7 | MD5SHA1, 8 | SHA256, 9 | SHA384 10 | } 11 | } 12 | 13 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.Instrumentation/Mono.Security.NewTls/HandshakeInstrumentType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // HandshakeInstrumentType.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2015 Xamarin, Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | 28 | namespace Mono.Security.NewTls 29 | { 30 | public enum HandshakeInstrumentType 31 | { 32 | TestCompleted, 33 | DontSendAlerts, 34 | CloseServerConnection, 35 | FragmentHandshakeMessages, 36 | RequestServerRenegotiation, 37 | SendBlobAfterReceivingFinish, 38 | SendBlobBeforeHelloRequest, 39 | SendBlobAfterHelloRequest, 40 | SendDuplicateHelloRequest, 41 | FragmentServerHello, 42 | SendBlobBeforeRenegotiatingHello, 43 | AskForClientCertificate, 44 | RequireClientCertificate, 45 | OverrideServerCertificateSelection, 46 | OverrideClientCertificateSelection 47 | } 48 | } 49 | 50 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.Instrumentation/Mono.Security.NewTls/IHashAlgorithm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Mono.Security.Interface; 3 | 4 | namespace Mono.Security.NewTls 5 | { 6 | public interface IHashAlgorithm : IDisposable 7 | { 8 | int HashSize { 9 | get; 10 | } 11 | 12 | HashAlgorithmType Algorithm { 13 | get; 14 | } 15 | 16 | void TransformBlock (byte[] inputBuffer, int inputOffset, int inputCount); 17 | 18 | byte[] GetRunningHash (); 19 | 20 | void Reset (); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.Instrumentation/Mono.Security.NewTls/ILogger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mono.Security.NewTls 4 | { 5 | public interface ILogger 6 | { 7 | void LogDebug (int level, string format, params object[] args); 8 | 9 | void LogMessage (string format, params object[] args); 10 | 11 | void LogError (string message, Exception error); 12 | } 13 | } 14 | 15 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.Instrumentation/Mono.Security.NewTls/ITlsContext.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ITlsContext.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2015 Xamarin, Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using Mono.Security.Interface; 28 | 29 | namespace Mono.Security.NewTls 30 | { 31 | public interface ITlsContext 32 | { 33 | bool IsServer { 34 | get; 35 | } 36 | 37 | SettingsProvider SettingsProvider { 38 | get; 39 | } 40 | 41 | bool IsAlgorithmSupported (SignatureAndHashAlgorithm algorithm); 42 | 43 | bool? AskForClientCertificate { 44 | get; 45 | } 46 | 47 | bool HasNegotiatedProtocol { 48 | get; 49 | } 50 | 51 | TlsProtocolCode NegotiatedProtocol { 52 | get; 53 | } 54 | 55 | bool HasCurrentSignatureParameters { 56 | get; 57 | } 58 | 59 | SignatureParameters CurrentSignatureParameters { 60 | get; 61 | } 62 | 63 | bool HasClientCertificateParameters { 64 | get; 65 | } 66 | 67 | ClientCertificateParameters ClientCertificateParameters { 68 | get; 69 | } 70 | } 71 | } 72 | 73 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.Instrumentation/Mono.Security.NewTls/InstrumentationEventSink.cs: -------------------------------------------------------------------------------- 1 | // 2 | // InstrumentationEventSink.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2015 Xamarin, Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | 28 | namespace Mono.Security.NewTls 29 | { 30 | public interface InstrumentationEventSink 31 | { 32 | void StartRenegotiation (ITlsContext context); 33 | 34 | void RenegotiationCompleted (ITlsContext context); 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.Instrumentation/Mono.Security.NewTls/NamedCurve.cs: -------------------------------------------------------------------------------- 1 | namespace Mono.Security.NewTls 2 | { 3 | /// 4 | /// RFC 4492 5.1.1 5 | /// The named curves defined here are those specified in SEC 2 [13]. Note that many of 6 | /// these curves are also recommended in ANSI X9.62 [7] and FIPS 186-2 [11]. Values 0xFE00 7 | /// through 0xFEFF are reserved for private use. Values 0xFF01 and 0xFF02 indicate that the 8 | /// client supports arbitrary prime and characteristic-2 curves, respectively (the curve 9 | /// parameters must be encoded explicitly in ECParameters). 10 | /// 11 | public enum NamedCurve : int 12 | { 13 | sect163k1 = 1, 14 | sect163r1 = 2, 15 | sect163r2 = 3, 16 | sect193r1 = 4, 17 | sect193r2 = 5, 18 | sect233k1 = 6, 19 | sect233r1 = 7, 20 | sect239k1 = 8, 21 | sect283k1 = 9, 22 | sect283r1 = 10, 23 | sect409k1 = 11, 24 | sect409r1 = 12, 25 | sect571k1 = 13, 26 | sect571r1 = 14, 27 | secp160k1 = 15, 28 | secp160r1 = 16, 29 | secp160r2 = 17, 30 | secp192k1 = 18, 31 | secp192r1 = 19, 32 | secp224k1 = 20, 33 | secp224r1 = 21, 34 | secp256k1 = 22, 35 | secp256r1 = 23, 36 | secp384r1 = 24, 37 | secp521r1 = 25, 38 | 39 | /* 40 | * reserved (0xFE00..0xFEFF) 41 | */ 42 | 43 | arbitrary_explicit_prime_curves = 0xFF01, 44 | arbitrary_explicit_char2_curves = 0xFF02, 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.Instrumentation/Mono.Security.NewTls/RenegotiationFlags.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mono.Security.NewTls 4 | { 5 | [Flags] 6 | public enum RenegotiationFlags 7 | { 8 | DisallowRenegotiation = 1, 9 | SecureRenegotiation = 2, 10 | 11 | SendClientHelloExtension = 16, 12 | SendCipherSpecCode = 32, 13 | 14 | AbortHandshakeIfUnsupported = 64, 15 | AbortOnHelloRequest = 128 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.Instrumentation/Mono.Security.NewTls/SignatureAlgorithmType.cs: -------------------------------------------------------------------------------- 1 | namespace Mono.Security.NewTls 2 | { 3 | public enum SignatureAlgorithmType 4 | { 5 | Anonymous = 0, 6 | Rsa = 1, 7 | Dsa = 2, 8 | ECDsa = 3, 9 | Unknown = 255 10 | } 11 | } 12 | 13 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.Instrumentation/Mono.Security.NewTls/SignatureAndHashAlgorithm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Mono.Security.Interface; 3 | 4 | namespace Mono.Security.NewTls 5 | { 6 | public struct SignatureAndHashAlgorithm 7 | { 8 | public readonly HashAlgorithmType Hash; 9 | public readonly SignatureAlgorithmType Signature; 10 | 11 | public SignatureAndHashAlgorithm (HashAlgorithmType hash, SignatureAlgorithmType signature) 12 | { 13 | Hash = hash; 14 | Signature = signature; 15 | } 16 | 17 | public SignatureAndHashAlgorithm (HashAlgorithmType hash) 18 | { 19 | Hash = hash; 20 | Signature = SignatureAlgorithmType.Rsa; 21 | } 22 | 23 | public override int GetHashCode () 24 | { 25 | return Hash.GetHashCode (); 26 | } 27 | 28 | public override bool Equals (object obj) 29 | { 30 | var other = (SignatureAndHashAlgorithm)obj; 31 | return other.Hash == Hash && other.Signature == Signature; 32 | } 33 | 34 | public override string ToString () 35 | { 36 | return string.Format ("[SignatureAndHashAlgorithm: {0} {1}]", Hash, Signature); 37 | } 38 | } 39 | } 40 | 41 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.Instrumentation/Mono.Security.NewTls/TlsStream.cs: -------------------------------------------------------------------------------- 1 | // 2 | // TlsStream2.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2014 Xamarin Inc. (http://www.xamarin.com) 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using Mono.Security.Interface; 28 | 29 | namespace Mono.Security.NewTls 30 | { 31 | public class TlsStream : TlsBuffer 32 | { 33 | const int ChunkSize = 16384; 34 | 35 | bool finished; 36 | 37 | public void MakeRoom (int size) 38 | { 39 | MakeRoomInternal (size); 40 | } 41 | 42 | protected override void MakeRoomInternal (int size) 43 | { 44 | if (Position + size <= EndOffset) 45 | return; 46 | if (finished) 47 | throw new InvalidOperationException (); 48 | var expandBy = ((size + ChunkSize - 1) / ChunkSize) * ChunkSize; 49 | var newBuffer = new byte [Size + expandBy]; 50 | if (Buffer != null) 51 | System.Buffer.BlockCopy (Buffer, 0, newBuffer, 0, Position); 52 | 53 | SetBuffer (newBuffer, 0, newBuffer.Length); 54 | } 55 | 56 | public int Length { 57 | get { return finished ? Size : Position; } 58 | } 59 | 60 | public void Finish () 61 | { 62 | finished = true; 63 | SetBuffer (Buffer, 0, Position); 64 | Position = 0; 65 | } 66 | } 67 | } 68 | 69 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.Instrumentation/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // Information about this assembly is defined by the following attributes. 5 | // Change them to the values specific to your project. 6 | 7 | [assembly: AssemblyTitle ("Mono.Security.NewTls.Instrumentation")] 8 | [assembly: AssemblyDescription ("")] 9 | [assembly: AssemblyConfiguration ("")] 10 | [assembly: AssemblyCompany ("")] 11 | [assembly: AssemblyProduct ("")] 12 | [assembly: AssemblyCopyright ("")] 13 | [assembly: AssemblyTrademark ("")] 14 | [assembly: AssemblyCulture ("")] 15 | 16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 19 | 20 | [assembly: AssemblyVersion ("1.0.*")] 21 | 22 | // The following attributes are used to specify the signing key for the assembly, 23 | // if desired. See the Mono documentation for more information about signing. 24 | 25 | //[assembly: AssemblyDelaySign(false)] 26 | //[assembly: AssemblyKeyFile("")] 27 | 28 | [assembly: InternalsVisibleTo ("Mono.Security.NewTls, PublicKey=002400000480000094000000060200000024000052534131000400001100000003336d6aed41624ca156ab579881fe90a576f1dfec48378fc94e4e440f4556776224e2d70c18996d91f36227f539fdb44340e07651f1455a489b29a7e6219a8f85e52b0f8588b4f8a857746a8468d37b556223d1452f3fcbaf0f269cdf1900ceb68f69485dc5887750d19571030c732331e00387d9b813a9ad52891087301793")] 29 | [assembly: InternalsVisibleTo ("Mono.Security.NewTls.TestProvider, PublicKey=002400000480000094000000060200000024000052534131000400001100000003336d6aed41624ca156ab579881fe90a576f1dfec48378fc94e4e440f4556776224e2d70c18996d91f36227f539fdb44340e07651f1455a489b29a7e6219a8f85e52b0f8588b4f8a857746a8468d37b556223d1452f3fcbaf0f269cdf1900ceb68f69485dc5887750d19571030c732331e00387d9b813a9ad52891087301793")] 30 | [assembly: InternalsVisibleTo ("Mono.Security.NewTls.DotNetConsole, PublicKey=002400000480000094000000060200000024000052534131000400001100000003336d6aed41624ca156ab579881fe90a576f1dfec48378fc94e4e440f4556776224e2d70c18996d91f36227f539fdb44340e07651f1455a489b29a7e6219a8f85e52b0f8588b4f8a857746a8468d37b556223d1452f3fcbaf0f269cdf1900ceb68f69485dc5887750d19571030c732331e00387d9b813a9ad52891087301793")] 31 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.TestFramework/Mono.Security.NewTls.ConnectionFramework/IConnectionProviderExtensions.cs: -------------------------------------------------------------------------------- 1 | // 2 | // IConnectionProviderExtensions.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com) 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using Xamarin.AsyncTests; 28 | using Xamarin.WebTests.ConnectionFramework; 29 | 30 | namespace Mono.Security.NewTls.ConnectionFramework 31 | { 32 | public interface IConnectionProviderExtensions : IExtensionObject 33 | { 34 | bool SupportsInstrumentation { 35 | get; 36 | } 37 | } 38 | } 39 | 40 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.TestFramework/Mono.Security.NewTls.ConnectionFramework/IMonoTlsProviderExtensions.cs: -------------------------------------------------------------------------------- 1 | // 2 | // IMonoTlsProviderExtensions.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com) 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using System.Threading; 28 | using System.Threading.Tasks; 29 | using Xamarin.AsyncTests; 30 | using Mono.Security.Interface; 31 | 32 | namespace Mono.Security.NewTls.ConnectionFramework 33 | { 34 | public interface IMonoTlsProviderExtensions : IExtensionObject 35 | { 36 | bool IsNewTls { 37 | get; 38 | } 39 | 40 | bool SupportsInstrumentation { 41 | get; 42 | } 43 | 44 | bool SupportsConnectionInfo { 45 | get; 46 | } 47 | 48 | bool SupportsRenegotiation { 49 | get; 50 | } 51 | 52 | MonoTlsConnectionInfo GetConnectionInfo (IMonoSslStream stream); 53 | 54 | Task Shutdown (IMonoSslStream stream); 55 | 56 | Task RequestRenegotiation (IMonoSslStream stream); 57 | } 58 | } 59 | 60 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.TestFramework/Mono.Security.NewTls.ConnectionFramework/InstrumentationHelpers.cs: -------------------------------------------------------------------------------- 1 | // 2 | // InstrumentationHelpers.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com) 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using Mono.Security.Interface; 28 | using Xamarin.AsyncTests; 29 | using Xamarin.WebTests.ConnectionFramework; 30 | using Xamarin.WebTests.MonoConnectionFramework; 31 | 32 | namespace Mono.Security.NewTls.ConnectionFramework 33 | { 34 | using TestFramework; 35 | 36 | public static class InstrumentationHelpers 37 | { 38 | public static void InstallInstrumentationProvider (this MonoConnection connection, InstrumentationProvider provider) 39 | { 40 | var extension = (InstrumentationConnectionExtension)connection.ConnectionExtensions; 41 | extension.InstrumentationProvider = provider; 42 | } 43 | 44 | public static IMonoTlsProviderExtensions GetTlsProviderExtension (this ConnectionProvider provider) 45 | { 46 | var tlsProvider = ((MonoConnectionProvider)provider).MonoTlsProvider; 47 | return DependencyInjector.GetExtension (tlsProvider); 48 | } 49 | } 50 | } 51 | 52 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.TestFramework/Mono.Security.NewTls.TestFeatures/CipherInstrumentTestRunnerAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // CipherInstrumentTestRunnerAttribute.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2015 Xamarin, Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using Xamarin.AsyncTests; 28 | using Xamarin.AsyncTests.Portable; 29 | using Xamarin.AsyncTests.Constraints; 30 | using Xamarin.WebTests.TestFramework; 31 | using Xamarin.WebTests.TestRunners; 32 | using Xamarin.WebTests.ConnectionFramework; 33 | 34 | namespace Mono.Security.NewTls.TestFeatures 35 | { 36 | using TestFramework; 37 | 38 | [AttributeUsage (AttributeTargets.Class, AllowMultiple = false)] 39 | public class CipherInstrumentTestRunnerAttribute : TestHostAttribute, ITestHost 40 | { 41 | public CipherInstrumentTestRunnerAttribute () 42 | : base (typeof (CipherInstrumentTestRunnerAttribute), TestFlags.Hidden | TestFlags.PathHidden) 43 | { 44 | } 45 | 46 | public CipherInstrumentTestRunner CreateInstance (TestContext ctx) 47 | { 48 | return ConnectionTestHelper.CreateTestRunner ( 49 | ctx, (s, c, p, a) => new CipherInstrumentTestRunner (s, c, p, a)); 50 | } 51 | } 52 | } 53 | 54 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.TestFramework/Mono.Security.NewTls.TestFeatures/InstrumentationCategoryAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // InstrumentationCategoryAttribute.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2015 Xamarin, Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using Xamarin.AsyncTests; 28 | 29 | namespace Mono.Security.NewTls.TestFeatures 30 | { 31 | using TestFramework; 32 | 33 | public class InstrumentationCategoryAttribute : FixedTestParameterAttribute 34 | { 35 | public override Type Type { 36 | get { return typeof(InstrumentationCategory); } 37 | } 38 | 39 | public override object Value { 40 | get { return Category; } 41 | } 42 | 43 | public override string Identifier { 44 | get { return identifier; } 45 | } 46 | 47 | public InstrumentationCategory Category { 48 | get { return category; } 49 | } 50 | 51 | readonly string identifier; 52 | readonly InstrumentationCategory category; 53 | 54 | public InstrumentationCategoryAttribute (InstrumentationCategory category) 55 | { 56 | this.category = category; 57 | this.identifier = Type.Name; 58 | } 59 | } 60 | } 61 | 62 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.TestFramework/Mono.Security.NewTls.TestFeatures/InstrumentationConnectionFlagsAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // InstrumentationConnectionFlagsAttribute.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2015 Xamarin, Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using Xamarin.AsyncTests; 28 | 29 | namespace Mono.Security.NewTls.TestFeatures 30 | { 31 | using TestFramework; 32 | 33 | [AttributeUsage (AttributeTargets.Method, AllowMultiple = false)] 34 | public class InstrumentationConnectionFlagsAttribute : FixedTestParameterAttribute 35 | { 36 | public override Type Type { 37 | get { return typeof(InstrumentationConnectionFlags); } 38 | } 39 | 40 | public override object Value { 41 | get { return flags; } 42 | } 43 | 44 | public override string Identifier { 45 | get { return identifier; } 46 | } 47 | 48 | public InstrumentationConnectionFlags Flags { 49 | get { return flags; } 50 | } 51 | 52 | readonly string identifier; 53 | readonly InstrumentationConnectionFlags flags; 54 | 55 | public InstrumentationConnectionFlagsAttribute (InstrumentationConnectionFlags flags) 56 | { 57 | this.flags = flags; 58 | this.identifier = Type.Name; 59 | } 60 | } 61 | } 62 | 63 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.TestFramework/Mono.Security.NewTls.TestFeatures/IsSupportedConstraint.cs: -------------------------------------------------------------------------------- 1 | // 2 | // IsSupportedConstraint.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2015 Xamarin, Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using Xamarin.AsyncTests; 28 | using Xamarin.AsyncTests.Constraints; 29 | 30 | namespace Mono.Security.NewTls.TestFeatures 31 | { 32 | public class IsSupportedConstraint : Constraint 33 | { 34 | Func func; 35 | 36 | public IsSupportedConstraint (Func func) 37 | { 38 | this.func = func; 39 | } 40 | 41 | #region implemented abstract members of Constraint 42 | 43 | public override bool Evaluate (object actual, out string message) 44 | { 45 | if (func ((T)actual)) { 46 | message = null; 47 | return true; 48 | } 49 | 50 | message = string.Format ("Unsupported: '{0}'.", actual); 51 | return false; 52 | } 53 | 54 | public override string Print () 55 | { 56 | return string.Format ("IsSupported({0})", typeof(T).Name); 57 | } 58 | 59 | #endregion 60 | } 61 | } 62 | 63 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.TestFramework/Mono.Security.NewTls.TestFeatures/RenegotiationAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // RenegotiationAttribute.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2015 Xamarin, Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using Xamarin.AsyncTests; 28 | 29 | namespace Mono.Security.NewTls.TestFeatures 30 | { 31 | [AttributeUsage (AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false)] 32 | public class RenegotiationAttribute : TestCategoryAttribute 33 | { 34 | public static readonly TestCategory Instance = new TestCategory ("Renegotiation") { IsExplicit = true }; 35 | 36 | public override TestCategory Category { 37 | get { return Instance; } 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.TestFramework/Mono.Security.NewTls.TestFeatures/SImpleConnectionTestRunnerAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // SimpleConnectionTestRunnerAttribute.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2015 Xamarin, Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using Xamarin.AsyncTests; 28 | using Xamarin.AsyncTests.Portable; 29 | using Xamarin.AsyncTests.Constraints; 30 | using Xamarin.WebTests.TestFramework; 31 | using Xamarin.WebTests.TestRunners; 32 | using Xamarin.WebTests.ConnectionFramework; 33 | 34 | namespace Mono.Security.NewTls.TestFeatures 35 | { 36 | using TestFramework; 37 | 38 | [AttributeUsage (AttributeTargets.Class, AllowMultiple = false)] 39 | public class SimpleConnectionTestRunnerAttribute : TestHostAttribute, ITestHost 40 | { 41 | public SimpleConnectionTestRunnerAttribute () 42 | : base (typeof (SimpleConnectionTestRunnerAttribute), TestFlags.Hidden | TestFlags.PathHidden) 43 | { 44 | } 45 | 46 | public SimpleConnectionTestRunner CreateInstance (TestContext ctx) 47 | { 48 | return ConnectionTestHelper.CreateTestRunner ( 49 | ctx, (s, c, p, a) => new SimpleConnectionTestRunner (s, c, p, a)); 50 | } 51 | } 52 | } 53 | 54 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.TestFramework/Mono.Security.NewTls.TestFeatures/SignatureInstrumentTestRunnerAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // SignatureInstrumentTestRunnerAttribute.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2015 Xamarin, Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using Xamarin.AsyncTests; 28 | using Xamarin.AsyncTests.Portable; 29 | using Xamarin.AsyncTests.Constraints; 30 | using Xamarin.WebTests.TestFramework; 31 | using Xamarin.WebTests.TestRunners; 32 | using Xamarin.WebTests.ConnectionFramework; 33 | 34 | namespace Mono.Security.NewTls.TestFeatures 35 | { 36 | using TestFramework; 37 | 38 | [AttributeUsage (AttributeTargets.Class, AllowMultiple = false)] 39 | public class SignatureInstrumentTestRunnerAttribute : TestHostAttribute, ITestHost 40 | { 41 | public SignatureInstrumentTestRunnerAttribute () 42 | : base (typeof (SignatureInstrumentTestRunnerAttribute), TestFlags.Hidden | TestFlags.PathHidden) 43 | { 44 | } 45 | 46 | public SignatureInstrumentTestRunner CreateInstance (TestContext ctx) 47 | { 48 | return ConnectionTestHelper.CreateTestRunner ( 49 | ctx, (s, c, p, a) => new SignatureInstrumentTestRunner (s, c, p, a)); 50 | } 51 | } 52 | } 53 | 54 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.TestFramework/Mono.Security.NewTls.TestFramework/CipherInstrumentParameters.cs: -------------------------------------------------------------------------------- 1 | // 2 | // CipherInstrumentParameters.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2015 Xamarin, Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using System.Collections.Generic; 28 | using System.Security.Cryptography.X509Certificates; 29 | using Xamarin.AsyncTests; 30 | using Xamarin.WebTests.ConnectionFramework; 31 | 32 | namespace Mono.Security.NewTls.TestFramework 33 | { 34 | using TestFeatures; 35 | 36 | [CipherInstrumentParameters] 37 | public class CipherInstrumentParameters : InstrumentationParameters 38 | { 39 | public CipherInstrumentType Type { 40 | get; 41 | private set; 42 | } 43 | 44 | public CipherInstrumentParameters (InstrumentationCategory category, CipherInstrumentType type, string identifier, X509Certificate certificate) 45 | : base (category, identifier, certificate) 46 | { 47 | Type = type; 48 | } 49 | 50 | protected CipherInstrumentParameters (CipherInstrumentParameters other) 51 | : base (other) 52 | { 53 | Type = other.Type; 54 | } 55 | 56 | public override ConnectionParameters DeepClone () 57 | { 58 | return new CipherInstrumentParameters (this); 59 | } 60 | } 61 | } 62 | 63 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.TestFramework/Mono.Security.NewTls.TestFramework/CipherInstrumentType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // CipherInstrumentType.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2015 Xamarin, Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | 28 | namespace Mono.Security.NewTls.TestFramework 29 | { 30 | public enum CipherInstrumentType 31 | { 32 | SelectClientCipher, 33 | SelectServerCipher, 34 | InvalidCipher 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.TestFramework/Mono.Security.NewTls.TestFramework/ConnectionInstrument.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ConnectionInstrument.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2015 Xamarin, Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using Xamarin.AsyncTests; 28 | 29 | namespace Mono.Security.NewTls.TestFramework 30 | { 31 | public class ConnectionInstrument : SettingsProvider 32 | { 33 | public InstrumentationEventSink EventSink { 34 | get; set; 35 | } 36 | 37 | public ConnectionInstrument (UserSettings settings) 38 | : base (settings) 39 | { 40 | } 41 | } 42 | } 43 | 44 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.TestFramework/Mono.Security.NewTls.TestFramework/ConnectionInstrumentType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ConnectionInstrumentType.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2015 Xamarin, Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | 28 | namespace Mono.Security.NewTls.TestFramework 29 | { 30 | public enum ConnectionInstrumentType 31 | { 32 | MartinTest, 33 | MartinClientPuppy, 34 | MartinServerPuppy 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.TestFramework/Mono.Security.NewTls.TestFramework/ConnectionType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mono.Security.NewTls.TestFramework 4 | { 5 | [Flags] 6 | public enum ConnectionType 7 | { 8 | None = 0, 9 | 10 | MonoClient = 1 << 1, 11 | DotNetClient = 1 << 2, 12 | OpenSslClient = 1 << 3, 13 | 14 | MonoServer = 1 << 8, 15 | DotNetServer = 1 << 9, 16 | OpenSslServer = 1 << 10, 17 | 18 | ClientMask = MonoClient | DotNetClient | OpenSslClient, 19 | ServerMask = MonoServer | DotNetServer | OpenSslServer 20 | } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.TestFramework/Mono.Security.NewTls.TestFramework/CryptoProviderType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // CryptoProviderType.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2015 Xamarin, Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | 28 | namespace Mono.Security.NewTls.TestFramework 29 | { 30 | public enum CryptoProviderType 31 | { 32 | DotNet, 33 | Mono, 34 | OpenSsl 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.TestFramework/Mono.Security.NewTls.TestFramework/GenericConnectionInstrumentType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // GenericConnectionInstrumentType.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2015 Xamarin, Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | 28 | namespace Mono.Security.NewTls.TestFramework 29 | { 30 | public enum GenericConnectionInstrumentType 31 | { 32 | FragmentHandshakeMessages, 33 | SendBlobAfterReceivingFinish, 34 | 35 | InvalidServerCertificateV1, 36 | InvalidServerCertificateRsa512, 37 | ServerProvidesInvalidCertificate, 38 | 39 | InvalidClientCertificateV1, 40 | InvalidClientCertificateRsa512, 41 | ClientProvidesInvalidCertificate, 42 | 43 | RequireRsaKeyExchange, 44 | RsaKeyExchangeNotAllowed, 45 | RequireDheKeyExchange, 46 | DheKeyExchangeNotAllowed, 47 | 48 | ClientCertificateRequiresRsaKeyExchange, 49 | ClientCertificateRequiresDheKeyExchange, 50 | 51 | ClientCertificateInvalidForRsa, 52 | ClientProvidesCertificateThatsInvalidForRsa, 53 | ClientCertificateInvalidForDhe, 54 | ClientProvidesCertificateThatsInvalidForDhe, 55 | 56 | MartinTest, 57 | MartinClientPuppy, 58 | MartinServerPuppy 59 | } 60 | } 61 | 62 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.TestFramework/Mono.Security.NewTls.TestFramework/ICryptoProvider.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ICryptoProvider.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2015 Xamarin, Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using Xamarin.AsyncTests; 28 | 29 | namespace Mono.Security.NewTls.TestFramework 30 | { 31 | public interface ICryptoProvider : ISingletonInstance 32 | { 33 | IRandomNumberGenerator GetRandomNumberGenerator (); 34 | 35 | bool IsSupported (CryptoProviderType type, bool needsEncryption); 36 | 37 | IHashTestHost GetHashTestHost (CryptoProviderType type); 38 | 39 | IEncryptionTestHost GetEncryptionTestHost (CryptoProviderType type, CryptoTestParameters parameters); 40 | } 41 | } 42 | 43 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.TestFramework/Mono.Security.NewTls.TestFramework/IEncryptionTestHost.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ICryptoTestHost2.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2015 Xamarin, Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using Mono.Security.Interface; 28 | 29 | namespace Mono.Security.NewTls.TestFramework 30 | { 31 | public interface IEncryptionTestHost : IHashTestHost 32 | { 33 | CryptoTestParameters Parameters { 34 | get; 35 | } 36 | 37 | void EncryptRecord (ContentType contentType, IBufferOffsetSize input, TlsStream output); 38 | 39 | IBufferOffsetSize Encrypt (IBufferOffsetSize input); 40 | 41 | int Encrypt (IBufferOffsetSize input, IBufferOffsetSize output); 42 | 43 | IBufferOffsetSize Decrypt (IBufferOffsetSize input); 44 | 45 | int Decrypt (IBufferOffsetSize input, IBufferOffsetSize output); 46 | 47 | int BlockSize { 48 | get; 49 | } 50 | 51 | int GetEncryptedSize (int size); 52 | 53 | int MinExtraEncryptedBytes { 54 | get; 55 | } 56 | 57 | int MaxExtraEncryptedBytes { 58 | get; 59 | } 60 | } 61 | } 62 | 63 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.TestFramework/Mono.Security.NewTls.TestFramework/IHashTestHost.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ICryptoTestProvider.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2015 Xamarin, Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using Xamarin.AsyncTests; 28 | using Mono.Security.Interface; 29 | 30 | namespace Mono.Security.NewTls.TestFramework 31 | { 32 | public interface IHashTestHost : ITestInstance, IRandomNumberGenerator 33 | { 34 | byte[] TestPRF (HandshakeHashType algorithm, byte[] secret, string seed, byte[] data, int length); 35 | 36 | byte[] TestDigest (HandshakeHashType algorithm, byte[] data); 37 | 38 | byte[] TestHMac (HandshakeHashType algorithm, byte[] key, byte[] data); 39 | 40 | bool SupportsHashAlgorithms { 41 | get; 42 | } 43 | 44 | bool IsAlgorithmSupported (HashAlgorithmType algorithm); 45 | 46 | IHashAlgorithm CreateAlgorithm (HashAlgorithmType algorithm); 47 | } 48 | } 49 | 50 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.TestFramework/Mono.Security.NewTls.TestFramework/IRandomNumberGenerator.cs: -------------------------------------------------------------------------------- 1 | // 2 | // IRandomNumberGenerator.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2015 Xamarin, Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | 28 | namespace Mono.Security.NewTls.TestFramework 29 | { 30 | public interface IRandomNumberGenerator 31 | { 32 | byte[] GetRandomBytes (int count); 33 | } 34 | } 35 | 36 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.TestFramework/Mono.Security.NewTls.TestFramework/InstrumentationCategory.cs: -------------------------------------------------------------------------------- 1 | // 2 | // InstrumentationCategory.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2015 Xamarin, Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | 28 | namespace Mono.Security.NewTls.TestFramework 29 | { 30 | public enum InstrumentationCategory 31 | { 32 | #region Inherited from MonoConnectionTestCategory 33 | 34 | ClientConnection, 35 | ServerConnection, 36 | Connection, 37 | 38 | CertificateChecks, 39 | 40 | SimpleMonoClient, 41 | SimpleMonoServer, 42 | SimpleMonoConnection, 43 | MonoProtocolVersions, 44 | 45 | SelectClientCipher, 46 | SelectServerCipher, 47 | SelectCipher, 48 | 49 | MartinTestClient, 50 | MartinTestServer, 51 | MartinTest, 52 | 53 | #endregion 54 | 55 | AllClientSignatureAlgorithms, 56 | AllServerSignatureAlgorithms, 57 | 58 | ClientSignatureParameters, 59 | ServerSignatureParameters, 60 | 61 | SignatureAlgorithms, 62 | 63 | ClientRenegotiation, 64 | ServerRenegotiation, 65 | Renegotiation, 66 | } 67 | } 68 | 69 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.TestFramework/Mono.Security.NewTls.TestFramework/InstrumentationConnectionFlags.cs: -------------------------------------------------------------------------------- 1 | // 2 | // InstrumentationConnectionFlags.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2015 Xamarin, Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | 28 | namespace Mono.Security.NewTls.TestFramework 29 | { 30 | [Flags] 31 | public enum InstrumentationConnectionFlags 32 | { 33 | #region Inherited from MonoConnectionTestFlags 34 | 35 | None = 0, 36 | 37 | RequireMonoClient = 1, 38 | RequireMonoServer = 2, 39 | RequireMono = RequireMonoClient | RequireMonoServer, 40 | 41 | ManualClient = 4, 42 | ManualServer = 8, 43 | 44 | RequireTls12 = 16, 45 | RequireEcDhe = 32, 46 | 47 | #endregion 48 | 49 | ClientInstrumentation = 1024, 50 | ServerInstrumentation = 2048, 51 | Instrumentation = ClientInstrumentation | ServerInstrumentation, 52 | } 53 | } 54 | 55 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.TestFramework/Mono.Security.NewTls.TestFramework/InstrumentationParameters.cs: -------------------------------------------------------------------------------- 1 | // 2 | // InstrumentationParameters.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2015 Xamarin, Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using System.Collections.Generic; 28 | using System.Security.Cryptography.X509Certificates; 29 | using Mono.Security.Interface; 30 | using Xamarin.AsyncTests; 31 | using Xamarin.WebTests.ConnectionFramework; 32 | using Xamarin.WebTests.MonoTestFramework; 33 | 34 | namespace Mono.Security.NewTls.TestFramework 35 | { 36 | public abstract class InstrumentationParameters : MonoConnectionTestParameters 37 | { 38 | new public InstrumentationCategory Category { 39 | get { return (InstrumentationCategory)base.Category; } 40 | } 41 | 42 | new public InstrumentationConnectionFlags ConnectionFlags { 43 | get { return (InstrumentationConnectionFlags)base.ConnectionFlags; } 44 | set { base.ConnectionFlags = (MonoConnectionTestFlags)value; } 45 | } 46 | 47 | public InstrumentationParameters (InstrumentationCategory category, string identifier, X509Certificate certificate) 48 | : base ((MonoConnectionTestCategory)category, identifier, certificate) 49 | { 50 | } 51 | 52 | protected InstrumentationParameters (InstrumentationParameters other) 53 | : base (other) 54 | { 55 | } 56 | } 57 | } 58 | 59 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.TestFramework/Mono.Security.NewTls.TestFramework/InstrumentationProvider.cs: -------------------------------------------------------------------------------- 1 | // 2 | // InstrumentationProvider.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2015 Xamarin, Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using Xamarin.AsyncTests; 28 | using Mono.Security.Interface; 29 | 30 | namespace Mono.Security.NewTls.TestFramework 31 | { 32 | public interface InstrumentationProvider 33 | { 34 | Instrumentation CreateInstrument (TestContext ctx, MonoTlsSettings settings); 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.TestFramework/Mono.Security.NewTls.TestFramework/RenegotiationInstrumentType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // RenegotiationInstrumentType.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2015 Xamarin, Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | 28 | namespace Mono.Security.NewTls.TestFramework 29 | { 30 | public enum RenegotiationInstrumentType 31 | { 32 | RequestRenegotiation, 33 | SendBlobBeforeHelloRequest, 34 | SendBlobAfterHelloRequest, 35 | SendBlobBeforeAndAfterHelloRequest, 36 | SendDuplicateHelloRequest, 37 | 38 | RequestServerRenegotiation, 39 | RequestServerRenegotiationWithPendingRead, 40 | SendBlobBeforeRenegotiatingHello, 41 | SendBlobBeforeRenegotiatingHelloNoPendingRead, 42 | 43 | RequestClientRenegotiation, 44 | RequestClientRenegotiationWithPendingWrite, 45 | 46 | MartinTest 47 | } 48 | } 49 | 50 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.TestFramework/Mono.Security.NewTls.TestFramework/SignatureInstrumentType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // SignatureInstrumentType.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2015 Xamarin, Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | 28 | namespace Mono.Security.NewTls.TestFramework 29 | { 30 | public enum SignatureInstrumentType 31 | { 32 | ClientSignatureAlgorithmAndCipher, 33 | ServerSignatureAlgorithmAndCipher, 34 | 35 | NoClientSignatureAlgorithms, 36 | VerifyClientSignatureAlgorithms, 37 | ClientProvidesSomeUnsupportedSignatureAlgorithms, 38 | ClientProvidesNoSupportedSignatureAlgorithms, 39 | Tls10WithRsaExchange, 40 | Tls10WithDheExchange, 41 | 42 | ServerUsesUnsupportedSignatureAlgorithm, 43 | ServerUsesUnsupportedSignatureAlgorithm2, 44 | 45 | ServerSendsCertificateParametersWithoutAlgorithms, 46 | ServerSendsCertificateParametersWithSomeUnsupportedAlgorithms, 47 | ServerSendsCertificateParametersWithNoSupportedAlgorithms, 48 | ClientSendsCertificateVerifyWithUnrequestedAlgorithm, 49 | CertificateVerifySignatureAlgorithmSelectionOrder, 50 | CertificateVerifySignatureAlgorithmSelectionOrder2 51 | } 52 | } 53 | 54 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.TestFramework/Mono.Security.NewTls.TestFramework/SimpleConnectionParameters.cs: -------------------------------------------------------------------------------- 1 | // 2 | // SimpleConnectionParameters.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2015 Xamarin, Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using System.Collections.Generic; 28 | using System.Security.Cryptography.X509Certificates; 29 | using Xamarin.AsyncTests; 30 | using Xamarin.WebTests.ConnectionFramework; 31 | 32 | namespace Mono.Security.NewTls.TestFramework 33 | { 34 | using TestFeatures; 35 | 36 | [SimpleConnectionParameters] 37 | public class SimpleConnectionParameters : InstrumentationParameters 38 | { 39 | public SimpleConnectionType Type { 40 | get; 41 | private set; 42 | } 43 | 44 | public SimpleConnectionParameters (InstrumentationCategory category, SimpleConnectionType type, string identifier, X509Certificate certificate) 45 | : base (category, identifier, certificate) 46 | { 47 | Type = type; 48 | } 49 | 50 | protected SimpleConnectionParameters (SimpleConnectionParameters other) 51 | : base (other) 52 | { 53 | Type = other.Type; 54 | } 55 | 56 | public override ConnectionParameters DeepClone () 57 | { 58 | return new SimpleConnectionParameters (this); 59 | } 60 | } 61 | } 62 | 63 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.TestFramework/Mono.Security.NewTls.TestFramework/SimpleConnectionType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // SimpleConnectionType.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2015 Xamarin, Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | 28 | namespace Mono.Security.NewTls.TestFramework 29 | { 30 | public enum SimpleConnectionType 31 | { 32 | Simple, 33 | ValidateCertificate, 34 | 35 | SimpleTls10, 36 | SimpleTls11, 37 | SimpleTls12, 38 | 39 | SelectCiphersTls10, 40 | SelectCiphersTls11, 41 | SelectCiphersTls12, 42 | 43 | RequestClientCertificate, 44 | RequireClientCertificateRSA, 45 | RequireClientCertificateDHE, 46 | 47 | CipherSelectionOrder, 48 | CipherSelectionOrder2, 49 | 50 | MartinTest 51 | } 52 | } 53 | 54 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.TestFramework/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // 2 | // AssemblyInfo.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2015 Xamarin, Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System.Reflection; 27 | using System.Runtime.CompilerServices; 28 | 29 | // Information about this assembly is defined by the following attributes. 30 | // Change them to the values specific to your project. 31 | 32 | [assembly: AssemblyTitle ("Mono.Security.NewTls.TestFramework")] 33 | [assembly: AssemblyDescription ("")] 34 | [assembly: AssemblyConfiguration ("")] 35 | [assembly: AssemblyCompany ("Xamarin")] 36 | [assembly: AssemblyProduct ("")] 37 | [assembly: AssemblyCopyright ("Xamarin, Inc.")] 38 | [assembly: AssemblyTrademark ("")] 39 | [assembly: AssemblyCulture ("")] 40 | 41 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 42 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 43 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 44 | 45 | [assembly: AssemblyVersion (Xamarin.AsyncTests.VersionInfo.Version)] 46 | 47 | // The following attributes are used to specify the signing key for the assembly, 48 | // if desired. See the Mono documentation for more information about signing. 49 | 50 | //[assembly: AssemblyDelaySign(false)] 51 | //[assembly: AssemblyKeyFile("")] 52 | 53 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.TestProvider/.gitignore: -------------------------------------------------------------------------------- 1 | /lib/ 2 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.TestProvider/Mono.Security.NewTls.TestProvider.projitems: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 5 | true 6 | {C0AB21A9-9053-49F2-9B4C-C90CF22263A0} 7 | 8 | 9 | Mono.Security.NewTls.TestProvider 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.TestProvider/Mono.Security.NewTls.TestProvider.shproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {C0AB21A9-9053-49F2-9B4C-C90CF22263A0} 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.TestProvider/Mono.Security.NewTls.TestProvider/MonoTlsProviderExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | using Mono.Security.Interface; 5 | using Mono.Security.Providers.NewTls; 6 | 7 | namespace Mono.Security.NewTls.TestProvider 8 | { 9 | using ConnectionFramework; 10 | 11 | class MonoTlsProviderExtensions : IMonoTlsProviderExtensions 12 | { 13 | MonoTlsProvider provider; 14 | NewTlsProvider newTls; 15 | 16 | public MonoTlsProviderExtensions (MonoTlsProvider provider) 17 | { 18 | this.provider = provider; 19 | global::System.Console.WriteLine ("PROVIDER: {0} {1}", provider.ID, provider); 20 | newTls = provider as NewTlsProvider; 21 | } 22 | 23 | public MonoTlsProvider Object { 24 | get { return provider; } 25 | } 26 | 27 | public bool IsNewTls { 28 | get { return newTls != null; } 29 | } 30 | 31 | public bool SupportsRenegotiation { 32 | get { return newTls != null; } 33 | } 34 | 35 | public bool SupportsInstrumentation { 36 | get { return newTls != null; } 37 | } 38 | 39 | public bool SupportsMonoExtensions { 40 | get { return newTls != null; } 41 | } 42 | 43 | public bool SupportsConnectionInfo { 44 | get { return true; } 45 | } 46 | 47 | public MonoTlsConnectionInfo GetConnectionInfo (IMonoSslStream stream) 48 | { 49 | return stream.GetConnectionInfo (); 50 | } 51 | 52 | public Task Shutdown (IMonoSslStream stream) 53 | { 54 | return ((MonoNewTlsStream)stream).Shutdown (); 55 | } 56 | 57 | public Task RequestRenegotiation (IMonoSslStream stream) 58 | { 59 | return ((MonoNewTlsStream)stream).RequestRenegotiation (); 60 | } 61 | } 62 | } 63 | 64 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.TestProvider/Mono.Security.NewTls.TestProvider/NativeCryptoHashType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // NativeCryptoHashType.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2015 Xamarin, Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | 28 | namespace Mono.Security.NewTls.TestProvider 29 | { 30 | // Keep in sync with the native code 31 | public enum NativeCryptoHashType 32 | { 33 | SHA256, 34 | SHA384 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.TestProvider/Mono.Security.NewTls.TestProvider/NativeOpenSslError.cs: -------------------------------------------------------------------------------- 1 | // 2 | // NativeOpenSslError.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2014 Xamarin Inc. (http://www.xamarin.com) 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | 28 | namespace Mono.Security.NewTls.TestProvider 29 | { 30 | // Keep in sync with the native code 31 | public enum NativeOpenSslError 32 | { 33 | OK, 34 | SOCKET, 35 | SSL_CONNECT, 36 | SSL_ACCEPT, 37 | PKCS12_LOAD, 38 | PKCS12_VERIFY, 39 | PKCS12_PARSE, 40 | INVALID_CERT, 41 | INVALID_PKEY, 42 | PKEY_DOES_NOT_MATCH, 43 | CREATE_CONTEXT, 44 | CREATE_CONNECTION, 45 | INVALID_CIPHER, 46 | UNKNOWN_CURVE_NAME, 47 | INVALID_CURVE 48 | } 49 | } 50 | 51 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.TestProvider/Mono.Security.NewTls.TestProvider/NativeOpenSslException.cs: -------------------------------------------------------------------------------- 1 | // 2 | // NativeOpenSslException.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2014 Xamarin Inc. (http://www.xamarin.com) 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | 28 | namespace Mono.Security.NewTls.TestProvider 29 | { 30 | public class NativeOpenSslException : Exception 31 | { 32 | public NativeOpenSslException (NativeOpenSslError error) 33 | : base (error.ToString ()) 34 | { 35 | } 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.TestProvider/Mono.Security.NewTls.TestProvider/NativeOpenSslProtocol.cs: -------------------------------------------------------------------------------- 1 | // 2 | // NativeOpenSslProtocol.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2015 Xamarin, Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | 28 | namespace Mono.Security.NewTls.TestProvider 29 | { 30 | // Keep in sync with the native code 31 | public enum NativeOpenSslProtocol 32 | { 33 | TLS10, 34 | TLS11, 35 | TLS12 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.TestProvider/Mono.Security.NewTls.TestProvider/OpenSslClient.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Net; 4 | using System.Text; 5 | using System.Linq; 6 | using System.Threading; 7 | using System.Threading.Tasks; 8 | using System.Diagnostics; 9 | using System.Collections.Generic; 10 | using System.Security.Cryptography.X509Certificates; 11 | using Mono.Security.NewTls.TestFramework; 12 | using Xamarin.AsyncTests; 13 | using Xamarin.AsyncTests.Portable; 14 | using Xamarin.WebTests.Server; 15 | using Xamarin.WebTests.ConnectionFramework; 16 | using Xamarin.WebTests.MonoConnectionFramework; 17 | using Xamarin.WebTests.MonoTestFramework; 18 | 19 | namespace Mono.Security.NewTls.TestProvider 20 | { 21 | using TestFramework; 22 | 23 | public class OpenSslClient : OpenSslConnection, IMonoClient 24 | { 25 | public MonoConnectionParameters MonoParameters { 26 | get { return base.Parameters as MonoConnectionParameters; } 27 | } 28 | 29 | public OpenSslClient (OpenSslConnectionProvider provider, ConnectionParameters parameters) 30 | : base (provider, parameters) 31 | { 32 | } 33 | 34 | protected override bool IsServer { 35 | get { return false; } 36 | } 37 | 38 | protected override void Initialize () 39 | { 40 | ; 41 | } 42 | 43 | protected override void CreateConnection (TestContext ctx) 44 | { 45 | var endpoint = GetEndPoint (); 46 | if (Parameters.ClientCertificate != null) { 47 | var provider = DependencyInjector.Get (); 48 | string password; 49 | var data = provider.GetRawCertificateData (Parameters.ClientCertificate, out password); 50 | openssl.SetCertificate (data, password); 51 | } 52 | 53 | if (MonoParameters != null) 54 | SelectCiphers (ctx, MonoParameters.ClientCiphers); 55 | 56 | openssl.Connect (endpoint); 57 | } 58 | 59 | protected override void Stop () 60 | { 61 | base.Stop (); 62 | } 63 | } 64 | } 65 | 66 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.TestProvider/Mono.Security.NewTls.TestProvider/OpenSslConnectionProviderFactory.cs: -------------------------------------------------------------------------------- 1 | #if !__MOBILE__ 2 | // 3 | // OpenSslConnectionProviderFactory.cs 4 | // 5 | // Author: 6 | // Martin Baulig 7 | // 8 | // Copyright (c) 2015 Xamarin, Inc. 9 | // 10 | // Permission is hereby granted, free of charge, to any person obtaining a copy 11 | // of this software and associated documentation files (the "Software"), to deal 12 | // in the Software without restriction, including without limitation the rights 13 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | // copies of the Software, and to permit persons to whom the Software is 15 | // furnished to do so, subject to the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be included in 18 | // all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 26 | // THE SOFTWARE. 27 | using System; 28 | using System.Net; 29 | using System.Net.Security; 30 | using Xamarin.AsyncTests; 31 | using Xamarin.WebTests.ConnectionFramework; 32 | using Xamarin.WebTests.Server; 33 | 34 | using MSI = Mono.Security.Interface; 35 | 36 | namespace Mono.Security.NewTls.TestProvider 37 | { 38 | using TestFramework; 39 | 40 | class OpenSslConnectionProviderFactory : IConnectionProviderFactoryExtension 41 | { 42 | OpenSslConnectionProvider openSslConnectionProvider; 43 | 44 | public void Initialize (ConnectionProviderFactory factory, IDefaultConnectionSettings settings) 45 | { 46 | openSslConnectionProvider = new OpenSslConnectionProvider (factory); 47 | factory.Install (openSslConnectionProvider); 48 | } 49 | } 50 | } 51 | #endif 52 | 53 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.TestProvider/Mono.Security.NewTls.TestProvider/OpenSslServer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Net; 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | using System.Diagnostics; 7 | using System.Collections.Generic; 8 | using System.Security.Cryptography.X509Certificates; 9 | using Mono.Security.NewTls.TestFramework; 10 | using Mono.Security.NewTls.TestProvider; 11 | using Xamarin.AsyncTests; 12 | using Xamarin.WebTests.Server; 13 | using Xamarin.WebTests.ConnectionFramework; 14 | using Xamarin.WebTests.MonoConnectionFramework; 15 | using Xamarin.WebTests.MonoTestFramework; 16 | 17 | namespace Mono.Security.NewTls.TestProvider 18 | { 19 | public class OpenSslServer : OpenSslConnection, IMonoServer 20 | { 21 | public MonoConnectionParameters MonoParameters { 22 | get { return base.Parameters as MonoConnectionParameters; } 23 | } 24 | 25 | public OpenSslServer (OpenSslConnectionProvider provider, ConnectionParameters parameters) 26 | : base (provider, parameters) 27 | { 28 | } 29 | 30 | protected override bool IsServer { 31 | get { return true; } 32 | } 33 | 34 | protected override void Initialize () 35 | { 36 | var endpoint = GetEndPoint (); 37 | if (!IPAddress.IsLoopback (endpoint.Address) && endpoint.Address != IPAddress.Any) 38 | throw new InvalidOperationException (); 39 | 40 | var provider = DependencyInjector.Get (); 41 | 42 | string password; 43 | var data = provider.GetRawCertificateData (Parameters.ServerCertificate, out password); 44 | openssl.SetCertificate (data, password); 45 | openssl.Bind (endpoint); 46 | } 47 | 48 | protected override void CreateConnection (TestContext ctx) 49 | { 50 | if (MonoParameters != null) 51 | SelectCiphers (ctx, MonoParameters.ServerCiphers); 52 | 53 | openssl.Accept (); 54 | } 55 | } 56 | } 57 | 58 | -------------------------------------------------------------------------------- /Mono.Security.NewTls.Tests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // 2 | // AssemblyInfo.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2015 Xamarin, Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System.Reflection; 27 | using System.Runtime.CompilerServices; 28 | 29 | // Information about this assembly is defined by the following attributes. 30 | // Change them to the values specific to your project. 31 | 32 | [assembly: AssemblyTitle ("Mono.Security.NewTls.Tests")] 33 | [assembly: AssemblyDescription ("")] 34 | [assembly: AssemblyConfiguration ("")] 35 | [assembly: AssemblyCompany ("Xamarin")] 36 | [assembly: AssemblyProduct ("")] 37 | [assembly: AssemblyCopyright ("Xamarin, Inc.")] 38 | [assembly: AssemblyTrademark ("")] 39 | [assembly: AssemblyCulture ("")] 40 | 41 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 42 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 43 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 44 | 45 | [assembly: AssemblyVersion (Xamarin.AsyncTests.VersionInfo.Version)] 46 | 47 | // The following attributes are used to specify the signing key for the assembly, 48 | // if desired. See the Mono documentation for more information about signing. 49 | 50 | //[assembly: AssemblyDelaySign(false)] 51 | //[assembly: AssemblyKeyFile("")] 52 | 53 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/.gitignore: -------------------------------------------------------------------------------- 1 | /packages/ 2 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/BouncyCastle/crypto/CryptoException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Org.BouncyCastle.Crypto 4 | { 5 | public class CryptoException 6 | : Exception 7 | { 8 | public CryptoException() 9 | { 10 | } 11 | 12 | public CryptoException( 13 | string message) 14 | : base(message) 15 | { 16 | } 17 | 18 | public CryptoException( 19 | string message, 20 | Exception exception) 21 | : base(message, exception) 22 | { 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/BouncyCastle/crypto/DataLengthException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Org.BouncyCastle.Crypto 4 | { 5 | /** 6 | * this exception is thrown if a buffer that is meant to have output 7 | * copied into it turns out to be too short, or if we've been given 8 | * insufficient input. In general this exception will Get thrown rather 9 | * than an ArrayOutOfBounds exception. 10 | */ 11 | public class DataLengthException 12 | : CryptoException 13 | { 14 | /** 15 | * base constructor. 16 | */ 17 | public DataLengthException() 18 | { 19 | } 20 | 21 | /** 22 | * create a DataLengthException with the given message. 23 | * 24 | * @param message the message to be carried with the exception. 25 | */ 26 | public DataLengthException( 27 | string message) 28 | : base(message) 29 | { 30 | } 31 | 32 | public DataLengthException( 33 | string message, 34 | Exception exception) 35 | : base(message, exception) 36 | { 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/BouncyCastle/crypto/IBlockCipher.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Org.BouncyCastle.Crypto 4 | { 5 | /// Base interface for a symmetric key block cipher. 6 | public interface IBlockCipher 7 | { 8 | /// The name of the algorithm this cipher implements. 9 | string AlgorithmName { get; } 10 | 11 | /// Initialise the cipher. 12 | /// Initialise for encryption if true, for decryption if false. 13 | /// The key or other data required by the cipher. 14 | void Init(bool forEncryption, ICipherParameters parameters); 15 | 16 | /// The block size for this cipher, in bytes. 17 | int GetBlockSize(); 18 | 19 | /// Indicates whether this cipher can handle partial blocks. 20 | bool IsPartialBlockOkay { get; } 21 | 22 | /// Process a block. 23 | /// The input buffer. 24 | /// The offset into inBuf that the input block begins. 25 | /// The output buffer. 26 | /// The offset into outBuf to write the output block. 27 | /// If input block is wrong size, or outBuf too small. 28 | /// The number of bytes processed and produced. 29 | int ProcessBlock(byte[] inBuf, int inOff, byte[] outBuf, int outOff); 30 | 31 | /// 32 | /// Reset the cipher to the same state as it was after the last init (if there was one). 33 | /// 34 | void Reset(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/BouncyCastle/crypto/ICipherParameters.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Org.BouncyCastle.Crypto 4 | { 5 | /** 6 | * all parameter classes implement this. 7 | */ 8 | public interface ICipherParameters 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/BouncyCastle/crypto/IDigest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Org.BouncyCastle.Crypto 4 | { 5 | /** 6 | * interface that a message digest conforms to. 7 | */ 8 | public interface IDigest 9 | { 10 | /** 11 | * return the algorithm name 12 | * 13 | * @return the algorithm name 14 | */ 15 | string AlgorithmName { get; } 16 | 17 | /** 18 | * return the size, in bytes, of the digest produced by this message digest. 19 | * 20 | * @return the size, in bytes, of the digest produced by this message digest. 21 | */ 22 | int GetDigestSize(); 23 | 24 | /** 25 | * return the size, in bytes, of the internal buffer used by this digest. 26 | * 27 | * @return the size, in bytes, of the internal buffer used by this digest. 28 | */ 29 | int GetByteLength(); 30 | 31 | /** 32 | * update the message digest with a single byte. 33 | * 34 | * @param inByte the input byte to be entered. 35 | */ 36 | void Update(byte input); 37 | 38 | /** 39 | * update the message digest with a block of bytes. 40 | * 41 | * @param input the byte array containing the data. 42 | * @param inOff the offset into the byte array where the data starts. 43 | * @param len the length of the data. 44 | */ 45 | void BlockUpdate(byte[] input, int inOff, int length); 46 | 47 | /** 48 | * Close the digest, producing the final digest value. The doFinal 49 | * call leaves the digest reset. 50 | * 51 | * @param output the array the digest is to be copied into. 52 | * @param outOff the offset into the out array the digest is to start at. 53 | */ 54 | int DoFinal(byte[] output, int outOff); 55 | 56 | /** 57 | * reset the digest back to it's initial state. 58 | */ 59 | void Reset(); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/BouncyCastle/crypto/InvalidCipherTextException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Org.BouncyCastle.Crypto 4 | { 5 | /** 6 | * this exception is thrown whenever we find something we don't expect in a 7 | * message. 8 | */ 9 | public class InvalidCipherTextException 10 | : CryptoException 11 | { 12 | /** 13 | * base constructor. 14 | */ 15 | public InvalidCipherTextException() 16 | { 17 | } 18 | 19 | /** 20 | * create a InvalidCipherTextException with the given message. 21 | * 22 | * @param message the message to be carried with the exception. 23 | */ 24 | public InvalidCipherTextException( 25 | string message) 26 | : base(message) 27 | { 28 | } 29 | 30 | public InvalidCipherTextException( 31 | string message, 32 | Exception exception) 33 | : base(message, exception) 34 | { 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/BouncyCastle/crypto/digests/NullDigest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace Org.BouncyCastle.Crypto.Digests 5 | { 6 | public class NullDigest : IDigest 7 | { 8 | private readonly MemoryStream bOut = new MemoryStream(); 9 | 10 | public string AlgorithmName 11 | { 12 | get { return "NULL"; } 13 | } 14 | 15 | public int GetByteLength() 16 | { 17 | // TODO Is this okay? 18 | return 0; 19 | } 20 | 21 | public int GetDigestSize() 22 | { 23 | return (int) bOut.Length; 24 | } 25 | 26 | public void Update(byte b) 27 | { 28 | bOut.WriteByte(b); 29 | } 30 | 31 | public void BlockUpdate(byte[] inBytes, int inOff, int len) 32 | { 33 | bOut.Write(inBytes, inOff, len); 34 | } 35 | 36 | public int DoFinal(byte[] outBytes, int outOff) 37 | { 38 | byte[] res = bOut.ToArray(); 39 | res.CopyTo(outBytes, outOff); 40 | Reset(); 41 | return res.Length; 42 | } 43 | 44 | public void Reset() 45 | { 46 | bOut.SetLength(0); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/BouncyCastle/crypto/digests/Sha384Digest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Org.BouncyCastle.Crypto.Utilities; 4 | 5 | namespace Org.BouncyCastle.Crypto.Digests 6 | { 7 | /** 8 | * Draft FIPS 180-2 implementation of SHA-384. Note: As this is 9 | * based on a draft this implementation is subject to change. 10 | * 11 | *
12 |      *         block  word  digest
13 |      * SHA-1   512    32    160
14 |      * SHA-256 512    32    256
15 |      * SHA-384 1024   64    384
16 |      * SHA-512 1024   64    512
17 |      * 
18 | */ 19 | public class Sha384Digest 20 | : LongDigest 21 | { 22 | private const int DigestLength = 48; 23 | 24 | public Sha384Digest() 25 | { 26 | } 27 | 28 | /** 29 | * Copy constructor. This will copy the state of the provided 30 | * message digest. 31 | */ 32 | public Sha384Digest( 33 | Sha384Digest t) 34 | : base(t) 35 | { 36 | } 37 | 38 | public override string AlgorithmName 39 | { 40 | get { return "SHA-384"; } 41 | } 42 | 43 | public override int GetDigestSize() 44 | { 45 | return DigestLength; 46 | } 47 | 48 | public override int DoFinal( 49 | byte[] output, 50 | int outOff) 51 | { 52 | Finish(); 53 | 54 | Pack.UInt64_To_BE(H1, output, outOff); 55 | Pack.UInt64_To_BE(H2, output, outOff + 8); 56 | Pack.UInt64_To_BE(H3, output, outOff + 16); 57 | Pack.UInt64_To_BE(H4, output, outOff + 24); 58 | Pack.UInt64_To_BE(H5, output, outOff + 32); 59 | Pack.UInt64_To_BE(H6, output, outOff + 40); 60 | 61 | Reset(); 62 | 63 | return DigestLength; 64 | } 65 | 66 | /** 67 | * reset the chaining variables 68 | */ 69 | public override void Reset() 70 | { 71 | base.Reset(); 72 | 73 | /* SHA-384 initial hash value 74 | * The first 64 bits of the fractional parts of the square roots 75 | * of the 9th through 16th prime numbers 76 | */ 77 | H1 = 0xcbbb9d5dc1059ed8; 78 | H2 = 0x629a292a367cd507; 79 | H3 = 0x9159015a3070dd17; 80 | H4 = 0x152fecd8f70e5939; 81 | H5 = 0x67332667ffc00b31; 82 | H6 = 0x8eb44a8768581511; 83 | H7 = 0xdb0c2e0d64f98fa7; 84 | H8 = 0x47b5481dbefa4fa4; 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/BouncyCastle/crypto/digests/ShortenedDigest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Org.BouncyCastle.Crypto; 3 | 4 | namespace Org.BouncyCastle.Crypto.Digests 5 | { 6 | /** 7 | * Wrapper class that reduces the output length of a particular digest to 8 | * only the first n bytes of the digest function. 9 | */ 10 | public class ShortenedDigest 11 | : IDigest 12 | { 13 | private IDigest baseDigest; 14 | private int length; 15 | 16 | /** 17 | * Base constructor. 18 | * 19 | * @param baseDigest underlying digest to use. 20 | * @param length length in bytes of the output of doFinal. 21 | * @exception ArgumentException if baseDigest is null, or length is greater than baseDigest.GetDigestSize(). 22 | */ 23 | public ShortenedDigest( 24 | IDigest baseDigest, 25 | int length) 26 | { 27 | if (baseDigest == null) 28 | { 29 | throw new ArgumentNullException("baseDigest"); 30 | } 31 | 32 | if (length > baseDigest.GetDigestSize()) 33 | { 34 | throw new ArgumentException("baseDigest output not large enough to support length"); 35 | } 36 | 37 | this.baseDigest = baseDigest; 38 | this.length = length; 39 | } 40 | 41 | public string AlgorithmName 42 | { 43 | get { return baseDigest.AlgorithmName + "(" + length * 8 + ")"; } 44 | } 45 | 46 | public int GetDigestSize() 47 | { 48 | return length; 49 | } 50 | 51 | public void Update(byte input) 52 | { 53 | baseDigest.Update(input); 54 | } 55 | 56 | public void BlockUpdate(byte[] input, int inOff, int length) 57 | { 58 | baseDigest.BlockUpdate(input, inOff, length); 59 | } 60 | 61 | public int DoFinal(byte[] output, int outOff) 62 | { 63 | byte[] tmp = new byte[baseDigest.GetDigestSize()]; 64 | 65 | baseDigest.DoFinal(tmp, 0); 66 | 67 | Array.Copy(tmp, 0, output, outOff, length); 68 | 69 | return length; 70 | } 71 | 72 | public void Reset() 73 | { 74 | baseDigest.Reset(); 75 | } 76 | 77 | public int GetByteLength() 78 | { 79 | return baseDigest.GetByteLength(); 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/BouncyCastle/crypto/modes/gcm/BasicGcmExponentiator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Org.BouncyCastle.Utilities; 4 | 5 | namespace Org.BouncyCastle.Crypto.Modes.Gcm 6 | { 7 | public class BasicGcmExponentiator 8 | : IGcmExponentiator 9 | { 10 | private byte[] x; 11 | 12 | public void Init(byte[] x) 13 | { 14 | this.x = Arrays.Clone(x); 15 | } 16 | 17 | public void ExponentiateX(long pow, byte[] output) 18 | { 19 | // Initial value is little-endian 1 20 | byte[] y = GcmUtilities.OneAsBytes(); 21 | 22 | if (pow > 0) 23 | { 24 | byte[] powX = Arrays.Clone(x); 25 | do 26 | { 27 | if ((pow & 1L) != 0) 28 | { 29 | GcmUtilities.Multiply(y, powX); 30 | } 31 | GcmUtilities.Multiply(powX, powX); 32 | pow >>= 1; 33 | } 34 | while (pow > 0); 35 | } 36 | 37 | Array.Copy(y, 0, output, 0, 16); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/BouncyCastle/crypto/modes/gcm/BasicGcmMultiplier.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Org.BouncyCastle.Crypto.Modes.Gcm 4 | { 5 | public class BasicGcmMultiplier 6 | : IGcmMultiplier 7 | { 8 | private byte[] H; 9 | 10 | public void Init(byte[] H) 11 | { 12 | this.H = (byte[])H.Clone(); 13 | } 14 | 15 | public void MultiplyH(byte[] x) 16 | { 17 | GcmUtilities.Multiply(x, H); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/BouncyCastle/crypto/modes/gcm/IGcmExponentiator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Org.BouncyCastle.Crypto.Modes.Gcm 4 | { 5 | public interface IGcmExponentiator 6 | { 7 | void Init(byte[] x); 8 | void ExponentiateX(long pow, byte[] output); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/BouncyCastle/crypto/modes/gcm/IGcmMultiplier.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Org.BouncyCastle.Crypto.Modes.Gcm 4 | { 5 | public interface IGcmMultiplier 6 | { 7 | void Init(byte[] H); 8 | void MultiplyH(byte[] x); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/BouncyCastle/crypto/modes/gcm/Tables1kGcmExponentiator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Org.BouncyCastle.Utilities; 4 | 5 | namespace Org.BouncyCastle.Crypto.Modes.Gcm 6 | { 7 | public class Tables1kGcmExponentiator 8 | : IGcmExponentiator 9 | { 10 | // A lookup table of the power-of-two powers of 'x' 11 | private byte[][] lookupPowX2 = new byte[64][]; 12 | 13 | public void Init(byte[] x) 14 | { 15 | // Initial value is little-endian 1 16 | lookupPowX2[0] = new byte[16]; 17 | lookupPowX2[0][0] = (byte)0x80; 18 | 19 | lookupPowX2[1] = Arrays.Clone(x); 20 | 21 | for (int i = 2; i != 64; ++i) 22 | { 23 | byte[] tmp = Arrays.Clone(lookupPowX2[i - 1]); 24 | GcmUtilities.Multiply(tmp, tmp); 25 | lookupPowX2[i] = tmp; 26 | } 27 | } 28 | 29 | public void ExponentiateX(long pow, byte[] output) 30 | { 31 | // Initial value is little-endian 1 32 | byte[] y = GcmUtilities.OneAsBytes(); 33 | int powX2 = 1; 34 | 35 | while (pow > 0) 36 | { 37 | if ((pow & 1L) != 0) 38 | { 39 | GcmUtilities.Multiply(y, lookupPowX2[powX2]); 40 | } 41 | ++powX2; 42 | pow >>= 1; 43 | } 44 | 45 | Array.Copy(y, 0, output, 0, 16); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/BouncyCastle/crypto/modes/gcm/Tables64kGcmMultiplier.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Org.BouncyCastle.Crypto.Utilities; 4 | 5 | namespace Org.BouncyCastle.Crypto.Modes.Gcm 6 | { 7 | public class Tables64kGcmMultiplier 8 | : IGcmMultiplier 9 | { 10 | private readonly uint[][][] M = new uint[16][][]; 11 | 12 | public void Init(byte[] H) 13 | { 14 | M[0] = new uint[256][]; 15 | M[0][0] = new uint[4]; 16 | M[0][128] = GcmUtilities.AsUints(H); 17 | for (int j = 64; j >= 1; j >>= 1) 18 | { 19 | uint[] tmp = (uint[])M[0][j + j].Clone(); 20 | GcmUtilities.MultiplyP(tmp); 21 | M[0][j] = tmp; 22 | } 23 | for (int i = 0;;) 24 | { 25 | for (int j = 2; j < 256; j += j) 26 | { 27 | for (int k = 1; k < j; ++k) 28 | { 29 | uint[] tmp = (uint[])M[i][j].Clone(); 30 | GcmUtilities.Xor(tmp, M[i][k]); 31 | M[i][j + k] = tmp; 32 | } 33 | } 34 | 35 | if (++i == 16) return; 36 | 37 | M[i] = new uint[256][]; 38 | M[i][0] = new uint[4]; 39 | for (int j = 128; j > 0; j >>= 1) 40 | { 41 | uint[] tmp = (uint[])M[i - 1][j].Clone(); 42 | GcmUtilities.MultiplyP8(tmp); 43 | M[i][j] = tmp; 44 | } 45 | } 46 | } 47 | 48 | public void MultiplyH(byte[] x) 49 | { 50 | uint[] z = new uint[4]; 51 | for (int i = 0; i != 16; ++i) 52 | { 53 | //GcmUtilities.Xor(z, M[i][x[i]]); 54 | uint[] m = M[i][x[i]]; 55 | z[0] ^= m[0]; 56 | z[1] ^= m[1]; 57 | z[2] ^= m[2]; 58 | z[3] ^= m[3]; 59 | } 60 | 61 | Pack.UInt32_To_BE(z[0], x, 0); 62 | Pack.UInt32_To_BE(z[1], x, 4); 63 | Pack.UInt32_To_BE(z[2], x, 8); 64 | Pack.UInt32_To_BE(z[3], x, 12); 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/BouncyCastle/crypto/modes/gcm/Tables8kGcmMultiplier.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Org.BouncyCastle.Crypto.Utilities; 4 | 5 | namespace Org.BouncyCastle.Crypto.Modes.Gcm 6 | { 7 | public class Tables8kGcmMultiplier 8 | : IGcmMultiplier 9 | { 10 | private readonly uint[][][] M = new uint[32][][]; 11 | 12 | public void Init(byte[] H) 13 | { 14 | M[0] = new uint[16][]; 15 | M[1] = new uint[16][]; 16 | M[0][0] = new uint[4]; 17 | M[1][0] = new uint[4]; 18 | M[1][8] = GcmUtilities.AsUints(H); 19 | 20 | for (int j = 4; j >= 1; j >>= 1) 21 | { 22 | uint[] tmp = (uint[])M[1][j + j].Clone(); 23 | GcmUtilities.MultiplyP(tmp); 24 | M[1][j] = tmp; 25 | } 26 | 27 | { 28 | uint[] tmp = (uint[])M[1][1].Clone(); 29 | GcmUtilities.MultiplyP(tmp); 30 | M[0][8] = tmp; 31 | } 32 | 33 | for (int j = 4; j >= 1; j >>= 1) 34 | { 35 | uint[] tmp = (uint[])M[0][j + j].Clone(); 36 | GcmUtilities.MultiplyP(tmp); 37 | M[0][j] = tmp; 38 | } 39 | 40 | for (int i = 0;;) 41 | { 42 | for (int j = 2; j < 16; j += j) 43 | { 44 | for (int k = 1; k < j; ++k) 45 | { 46 | uint[] tmp = (uint[])M[i][j].Clone(); 47 | GcmUtilities.Xor(tmp, M[i][k]); 48 | M[i][j + k] = tmp; 49 | } 50 | } 51 | 52 | if (++i == 32) return; 53 | 54 | if (i > 1) 55 | { 56 | M[i] = new uint[16][]; 57 | M[i][0] = new uint[4]; 58 | for(int j = 8; j > 0; j >>= 1) 59 | { 60 | uint[] tmp = (uint[])M[i - 2][j].Clone(); 61 | GcmUtilities.MultiplyP8(tmp); 62 | M[i][j] = tmp; 63 | } 64 | } 65 | } 66 | } 67 | 68 | public void MultiplyH(byte[] x) 69 | { 70 | uint[] z = new uint[4]; 71 | for (int i = 15; i >= 0; --i) 72 | { 73 | //GcmUtilities.Xor(z, M[i + i][x[i] & 0x0f]); 74 | uint[] m = M[i + i][x[i] & 0x0f]; 75 | z[0] ^= m[0]; 76 | z[1] ^= m[1]; 77 | z[2] ^= m[2]; 78 | z[3] ^= m[3]; 79 | //GcmUtilities.Xor(z, M[i + i + 1][(x[i] & 0xf0) >> 4]); 80 | m = M[i + i + 1][(x[i] & 0xf0) >> 4]; 81 | z[0] ^= m[0]; 82 | z[1] ^= m[1]; 83 | z[2] ^= m[2]; 84 | z[3] ^= m[3]; 85 | } 86 | 87 | Pack.UInt32_To_BE(z[0], x, 0); 88 | Pack.UInt32_To_BE(z[1], x, 4); 89 | Pack.UInt32_To_BE(z[2], x, 8); 90 | Pack.UInt32_To_BE(z[3], x, 12); 91 | } 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/BouncyCastle/crypto/parameters/AEADParameters.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Org.BouncyCastle.Crypto.Parameters 4 | { 5 | public class AeadParameters 6 | : ICipherParameters 7 | { 8 | private readonly byte[] associatedText; 9 | private readonly byte[] nonce; 10 | private readonly KeyParameter key; 11 | private readonly int macSize; 12 | 13 | /** 14 | * Base constructor. 15 | * 16 | * @param key key to be used by underlying cipher 17 | * @param macSize macSize in bits 18 | * @param nonce nonce to be used 19 | * @param associatedText associated text, if any 20 | */ 21 | public AeadParameters( 22 | KeyParameter key, 23 | int macSize, 24 | byte[] nonce, 25 | byte[] associatedText) 26 | { 27 | this.key = key; 28 | this.nonce = nonce; 29 | this.macSize = macSize; 30 | this.associatedText = associatedText; 31 | } 32 | 33 | public virtual KeyParameter Key 34 | { 35 | get { return key; } 36 | } 37 | 38 | public virtual int MacSize 39 | { 40 | get { return macSize; } 41 | } 42 | 43 | public virtual byte[] GetAssociatedText() 44 | { 45 | return associatedText; 46 | } 47 | 48 | public virtual byte[] GetNonce() 49 | { 50 | return nonce; 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/BouncyCastle/crypto/parameters/KeyParameter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Org.BouncyCastle.Crypto; 4 | 5 | namespace Org.BouncyCastle.Crypto.Parameters 6 | { 7 | public class KeyParameter 8 | : ICipherParameters 9 | { 10 | private readonly byte[] key; 11 | 12 | public KeyParameter( 13 | byte[] key) 14 | { 15 | if (key == null) 16 | throw new ArgumentNullException("key"); 17 | 18 | this.key = (byte[]) key.Clone(); 19 | } 20 | 21 | public KeyParameter( 22 | byte[] key, 23 | int keyOff, 24 | int keyLen) 25 | { 26 | if (key == null) 27 | throw new ArgumentNullException("key"); 28 | if (keyOff < 0 || keyOff > key.Length) 29 | throw new ArgumentOutOfRangeException("keyOff"); 30 | if (keyLen < 0 || (keyOff + keyLen) > key.Length) 31 | throw new ArgumentOutOfRangeException("keyLen"); 32 | 33 | this.key = new byte[keyLen]; 34 | Array.Copy(key, keyOff, this.key, 0, keyLen); 35 | } 36 | 37 | public byte[] GetKey() 38 | { 39 | return (byte[]) key.Clone(); 40 | } 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/BouncyCastle/crypto/parameters/ParametersWithIV.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Org.BouncyCastle.Crypto.Parameters 4 | { 5 | public class ParametersWithIV 6 | : ICipherParameters 7 | { 8 | private readonly ICipherParameters parameters; 9 | private readonly byte[] iv; 10 | 11 | public ParametersWithIV( 12 | ICipherParameters parameters, 13 | byte[] iv) 14 | : this(parameters, iv, 0, iv.Length) 15 | { 16 | } 17 | 18 | public ParametersWithIV( 19 | ICipherParameters parameters, 20 | byte[] iv, 21 | int ivOff, 22 | int ivLen) 23 | { 24 | if (parameters == null) 25 | throw new ArgumentNullException("parameters"); 26 | if (iv == null) 27 | throw new ArgumentNullException("iv"); 28 | 29 | this.parameters = parameters; 30 | this.iv = new byte[ivLen]; 31 | Array.Copy(iv, ivOff, this.iv, 0, ivLen); 32 | } 33 | 34 | public byte[] GetIV() 35 | { 36 | return (byte[]) iv.Clone(); 37 | } 38 | 39 | public ICipherParameters Parameters 40 | { 41 | get { return parameters; } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/BouncyCastle/math/ec/ECAlgorithms.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Org.BouncyCastle.Math; 4 | 5 | namespace Org.BouncyCastle.Math.EC 6 | { 7 | public class ECAlgorithms 8 | { 9 | public static ECPoint SumOfTwoMultiplies(ECPoint P, BigInteger a, 10 | ECPoint Q, BigInteger b) 11 | { 12 | ECCurve c = P.Curve; 13 | if (!c.Equals(Q.Curve)) 14 | throw new ArgumentException("P and Q must be on same curve"); 15 | 16 | // Point multiplication for Koblitz curves (using WTNAF) beats Shamir's trick 17 | if (c is F2mCurve) 18 | { 19 | F2mCurve f2mCurve = (F2mCurve) c; 20 | if (f2mCurve.IsKoblitz) 21 | { 22 | return P.Multiply(a).Add(Q.Multiply(b)); 23 | } 24 | } 25 | 26 | return ImplShamirsTrick(P, a, Q, b); 27 | } 28 | 29 | /* 30 | * "Shamir's Trick", originally due to E. G. Straus 31 | * (Addition chains of vectors. American Mathematical Monthly, 32 | * 71(7):806-808, Aug./Sept. 1964) 33 | * 34 | * Input: The points P, Q, scalar k = (km?, ... , k1, k0) 35 | * and scalar l = (lm?, ... , l1, l0). 36 | * Output: R = k * P + l * Q. 37 | * 1: Z <- P + Q 38 | * 2: R <- O 39 | * 3: for i from m-1 down to 0 do 40 | * 4: R <- R + R {point doubling} 41 | * 5: if (ki = 1) and (li = 0) then R <- R + P end if 42 | * 6: if (ki = 0) and (li = 1) then R <- R + Q end if 43 | * 7: if (ki = 1) and (li = 1) then R <- R + Z end if 44 | * 8: end for 45 | * 9: return R 46 | */ 47 | public static ECPoint ShamirsTrick( 48 | ECPoint P, 49 | BigInteger k, 50 | ECPoint Q, 51 | BigInteger l) 52 | { 53 | if (!P.Curve.Equals(Q.Curve)) 54 | throw new ArgumentException("P and Q must be on same curve"); 55 | 56 | return ImplShamirsTrick(P, k, Q, l); 57 | } 58 | 59 | private static ECPoint ImplShamirsTrick(ECPoint P, BigInteger k, 60 | ECPoint Q, BigInteger l) 61 | { 62 | int m = System.Math.Max(k.BitLength, l.BitLength); 63 | ECPoint Z = P.Add(Q); 64 | ECPoint R = P.Curve.Infinity; 65 | 66 | for (int i = m - 1; i >= 0; --i) 67 | { 68 | R = R.Twice(); 69 | 70 | if (k.TestBit(i)) 71 | { 72 | if (l.TestBit(i)) 73 | { 74 | R = R.Add(Z); 75 | } 76 | else 77 | { 78 | R = R.Add(P); 79 | } 80 | } 81 | else 82 | { 83 | if (l.TestBit(i)) 84 | { 85 | R = R.Add(Q); 86 | } 87 | } 88 | } 89 | 90 | return R; 91 | } 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/BouncyCastle/math/ec/abc/ZTauElement.cs: -------------------------------------------------------------------------------- 1 | namespace Org.BouncyCastle.Math.EC.Abc 2 | { 3 | /** 4 | * Class representing an element of Z[τ]. Let 5 | * λ be an element of Z[τ]. Then 6 | * λ is given as λ = u + vτ. The 7 | * components u and v may be used directly, there 8 | * are no accessor methods. 9 | * Immutable class. 10 | */ 11 | internal class ZTauElement 12 | { 13 | /** 14 | * The "real" part of λ. 15 | */ 16 | public readonly BigInteger u; 17 | 18 | /** 19 | * The "τ-adic" part of λ. 20 | */ 21 | public readonly BigInteger v; 22 | 23 | /** 24 | * Constructor for an element λ of 25 | * Z[τ]. 26 | * @param u The "real" part of λ. 27 | * @param v The "τ-adic" part of 28 | * λ. 29 | */ 30 | public ZTauElement(BigInteger u, BigInteger v) 31 | { 32 | this.u = u; 33 | this.v = v; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/BouncyCastle/math/ec/multiplier/ECMultiplier.cs: -------------------------------------------------------------------------------- 1 | namespace Org.BouncyCastle.Math.EC.Multiplier 2 | { 3 | /** 4 | * Interface for classes encapsulating a point multiplication algorithm 5 | * for ECPoints. 6 | */ 7 | internal interface ECMultiplier 8 | { 9 | /** 10 | * Multiplies the ECPoint p by k, i.e. 11 | * p is added k times to itself. 12 | * @param p The ECPoint to be multiplied. 13 | * @param k The factor by which p i multiplied. 14 | * @return p multiplied by k. 15 | */ 16 | ECPoint Multiply(ECPoint p, BigInteger k, PreCompInfo preCompInfo); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/BouncyCastle/math/ec/multiplier/FpNafMultiplier.cs: -------------------------------------------------------------------------------- 1 | namespace Org.BouncyCastle.Math.EC.Multiplier 2 | { 3 | /** 4 | * Class implementing the NAF (Non-Adjacent Form) multiplication algorithm. 5 | */ 6 | internal class FpNafMultiplier 7 | : ECMultiplier 8 | { 9 | /** 10 | * D.3.2 pg 101 11 | * @see org.bouncycastle.math.ec.multiplier.ECMultiplier#multiply(org.bouncycastle.math.ec.ECPoint, java.math.BigInteger) 12 | */ 13 | public ECPoint Multiply(ECPoint p, BigInteger k, PreCompInfo preCompInfo) 14 | { 15 | // TODO Probably should try to add this 16 | // BigInteger e = k.Mod(n); // n == order of p 17 | BigInteger e = k; 18 | BigInteger h = e.Multiply(BigInteger.Three); 19 | 20 | ECPoint neg = p.Negate(); 21 | ECPoint R = p; 22 | 23 | for (int i = h.BitLength - 2; i > 0; --i) 24 | { 25 | R = R.Twice(); 26 | 27 | bool hBit = h.TestBit(i); 28 | bool eBit = e.TestBit(i); 29 | 30 | if (hBit != eBit) 31 | { 32 | R = R.Add(hBit ? p : neg); 33 | } 34 | } 35 | 36 | return R; 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/BouncyCastle/math/ec/multiplier/PreCompInfo.cs: -------------------------------------------------------------------------------- 1 | namespace Org.BouncyCastle.Math.EC.Multiplier 2 | { 3 | /** 4 | * Interface for classes storing precomputation data for multiplication 5 | * algorithms. Used as a Memento (see GOF patterns) for 6 | * WNafMultiplier. 7 | */ 8 | internal interface PreCompInfo 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/BouncyCastle/math/ec/multiplier/ReferenceMultiplier.cs: -------------------------------------------------------------------------------- 1 | namespace Org.BouncyCastle.Math.EC.Multiplier 2 | { 3 | internal class ReferenceMultiplier 4 | : ECMultiplier 5 | { 6 | /** 7 | * Simple shift-and-add multiplication. Serves as reference implementation 8 | * to verify (possibly faster) implementations in 9 | * {@link org.bouncycastle.math.ec.ECPoint ECPoint}. 10 | * 11 | * @param p The point to multiply. 12 | * @param k The factor by which to multiply. 13 | * @return The result of the point multiplication k * p. 14 | */ 15 | public ECPoint Multiply(ECPoint p, BigInteger k, PreCompInfo preCompInfo) 16 | { 17 | ECPoint q = p.Curve.Infinity; 18 | int t = k.BitLength; 19 | for (int i = 0; i < t; i++) 20 | { 21 | if (k.TestBit(i)) 22 | { 23 | q = q.Add(p); 24 | } 25 | p = p.Twice(); 26 | } 27 | return q; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/BouncyCastle/math/ec/multiplier/WNafPreCompInfo.cs: -------------------------------------------------------------------------------- 1 | namespace Org.BouncyCastle.Math.EC.Multiplier 2 | { 3 | /** 4 | * Class holding precomputation data for the WNAF (Window Non-Adjacent Form) 5 | * algorithm. 6 | */ 7 | internal class WNafPreCompInfo 8 | : PreCompInfo 9 | { 10 | /** 11 | * Array holding the precomputed ECPoints used for the Window 12 | * NAF multiplication in 13 | * {@link org.bouncycastle.math.ec.multiplier.WNafMultiplier.multiply() 14 | * WNafMultiplier.multiply()}. 15 | */ 16 | private ECPoint[] preComp = null; 17 | 18 | /** 19 | * Holds an ECPoint representing twice(this). Used for the 20 | * Window NAF multiplication in 21 | * {@link org.bouncycastle.math.ec.multiplier.WNafMultiplier.multiply() 22 | * WNafMultiplier.multiply()}. 23 | */ 24 | private ECPoint twiceP = null; 25 | 26 | internal ECPoint[] GetPreComp() 27 | { 28 | return preComp; 29 | } 30 | 31 | internal void SetPreComp(ECPoint[] preComp) 32 | { 33 | this.preComp = preComp; 34 | } 35 | 36 | internal ECPoint GetTwiceP() 37 | { 38 | return twiceP; 39 | } 40 | 41 | internal void SetTwiceP(ECPoint twiceThis) 42 | { 43 | this.twiceP = twiceThis; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/BouncyCastle/math/ec/multiplier/WTauNafPreCompInfo.cs: -------------------------------------------------------------------------------- 1 | namespace Org.BouncyCastle.Math.EC.Multiplier 2 | { 3 | /** 4 | * Class holding precomputation data for the WTNAF (Window 5 | * τ-adic Non-Adjacent Form) algorithm. 6 | */ 7 | internal class WTauNafPreCompInfo 8 | : PreCompInfo 9 | { 10 | /** 11 | * Array holding the precomputed F2mPoints used for the 12 | * WTNAF multiplication in 13 | * {@link org.bouncycastle.math.ec.multiplier.WTauNafMultiplier.multiply() 14 | * WTauNafMultiplier.multiply()}. 15 | */ 16 | private readonly F2mPoint[] preComp; 17 | 18 | /** 19 | * Constructor for WTauNafPreCompInfo 20 | * @param preComp Array holding the precomputed F2mPoints 21 | * used for the WTNAF multiplication in 22 | * {@link org.bouncycastle.math.ec.multiplier.WTauNafMultiplier.multiply() 23 | * WTauNafMultiplier.multiply()}. 24 | */ 25 | internal WTauNafPreCompInfo(F2mPoint[] preComp) 26 | { 27 | this.preComp = preComp; 28 | } 29 | 30 | /** 31 | * @return the array holding the precomputed F2mPoints 32 | * used for the WTNAF multiplication in 33 | * {@link org.bouncycastle.math.ec.multiplier.WTauNafMultiplier.multiply() 34 | * WTauNafMultiplier.multiply()}. 35 | */ 36 | internal F2mPoint[] GetPreComp() 37 | { 38 | return preComp; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/BouncyCastle/math/ec/x9/X9IntegerConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Org.BouncyCastle.Math; 4 | using Org.BouncyCastle.Math.EC; 5 | 6 | namespace Org.BouncyCastle.Asn1.X9 7 | { 8 | public sealed class X9IntegerConverter 9 | { 10 | private X9IntegerConverter() 11 | { 12 | } 13 | 14 | public static int GetByteLength( 15 | ECFieldElement fe) 16 | { 17 | return (fe.FieldSize + 7) / 8; 18 | } 19 | 20 | public static int GetByteLength( 21 | ECCurve c) 22 | { 23 | return (c.FieldSize + 7) / 8; 24 | } 25 | 26 | public static byte[] IntegerToBytes( 27 | BigInteger s, 28 | int qLength) 29 | { 30 | byte[] bytes = s.ToByteArrayUnsigned(); 31 | 32 | if (qLength < bytes.Length) 33 | { 34 | byte[] tmp = new byte[qLength]; 35 | Array.Copy(bytes, bytes.Length - tmp.Length, tmp, 0, tmp.Length); 36 | return tmp; 37 | } 38 | else if (qLength > bytes.Length) 39 | { 40 | byte[] tmp = new byte[qLength]; 41 | Array.Copy(bytes, 0, tmp, tmp.Length - bytes.Length, bytes.Length); 42 | return tmp; 43 | } 44 | 45 | return bytes; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/BouncyCastle/util/encoders/IEncoder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace Org.BouncyCastle.Utilities.Encoders 5 | { 6 | /** 7 | * Encode and decode byte arrays (typically from binary to 7-bit ASCII 8 | * encodings). 9 | */ 10 | public interface IEncoder 11 | { 12 | int Encode(byte[] data, int off, int length, Stream outStream); 13 | 14 | int Decode(byte[] data, int off, int length, Stream outStream); 15 | 16 | int DecodeString(string data, Stream outStream); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/Mono.Security.Cryptography/SHA224.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Mono.Security.Cryptography SHA224 Class implementation 3 | // 4 | // Authors: 5 | // Sebastien Pouliot 6 | // 7 | // Copyright (C) 2004 Novell, Inc (http://www.novell.com) 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | using System.Security.Cryptography; 30 | 31 | namespace Mono.Security.Cryptography { 32 | 33 | internal abstract class SHA224 : HashAlgorithm 34 | { 35 | public SHA224 () 36 | { 37 | // SHA-224 hash length are 224 bits long 38 | HashSizeValue = 224; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/Mono.Security.NewTls.Cipher/BlockCipher.cs: -------------------------------------------------------------------------------- 1 | // 2 | // BlockCipher.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2014 Xamarin Inc. (http://www.xamarin.com) 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using System.Security.Cryptography; 28 | using Mono.Security.Interface; 29 | 30 | namespace Mono.Security.NewTls.Cipher 31 | { 32 | public abstract class BlockCipher : CryptoParameters 33 | { 34 | public byte BlockSize { 35 | get; 36 | private set; 37 | } 38 | 39 | public BlockCipher (bool isServer, TlsProtocolCode protocol, CipherSuite cipher) 40 | : base (isServer, protocol, cipher) 41 | { 42 | BlockSize = cipher.BlockSize; 43 | } 44 | } 45 | } 46 | 47 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/Mono.Security.NewTls.Cipher/PseudoRandomFunctionTls12.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Tls12PRF.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2014 Xamarin Inc. (http://www.xamarin.com) 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using System.Text; 28 | using System.Security.Cryptography; 29 | using Mono.Security.Interface; 30 | 31 | namespace Mono.Security.NewTls.Cipher 32 | { 33 | public class PseudoRandomFunctionTls12 : PseudoRandomFunction 34 | { 35 | public HandshakeHashType HandshakeHashType { 36 | get; 37 | private set; 38 | } 39 | 40 | public PseudoRandomFunctionTls12 (HandshakeHashType hashType) 41 | { 42 | HandshakeHashType = hashType; 43 | } 44 | 45 | protected override SecureBuffer PRF (DisposeContext d, SecureBuffer secret, string label, SecureBuffer data, int length) 46 | { 47 | return Expand (d, HMac.Create (HandshakeHashType, secret), label, data, length); 48 | } 49 | } 50 | } 51 | 52 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/Mono.Security.NewTls.Cipher/SignatureTls11.cs: -------------------------------------------------------------------------------- 1 | // 2 | // SignatureTls11.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2015 Xamarin, Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using Mono.Security.Interface; 28 | 29 | namespace Mono.Security.NewTls.Cipher 30 | { 31 | class SignatureTls11 : SignatureTls10 32 | { 33 | public override TlsProtocolCode Protocol { 34 | get { return TlsProtocolCode.Tls11; } 35 | } 36 | 37 | public SignatureTls11 (TlsBuffer incoming) 38 | : base (incoming) 39 | { 40 | } 41 | 42 | public SignatureTls11 () 43 | { 44 | } 45 | } 46 | } 47 | 48 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/Mono.Security.NewTls.EC/ECCurveType.cs: -------------------------------------------------------------------------------- 1 | namespace Mono.Security.NewTls.EC 2 | { 3 | /// 4 | /// RFC 4492 5.4 5 | /// 6 | public enum ECCurveType : byte 7 | { 8 | /** 9 | * Indicates the elliptic curve domain parameters are conveyed verbosely, and the 10 | * underlying finite field is a prime field. 11 | */ 12 | explicit_prime = 1, 13 | 14 | /** 15 | * Indicates the elliptic curve domain parameters are conveyed verbosely, and the 16 | * underlying finite field is a characteristic-2 field. 17 | */ 18 | explicit_char2 = 2, 19 | 20 | /** 21 | * Indicates that a named curve is used. This option SHOULD be used when applicable. 22 | */ 23 | named_curve = 3, 24 | 25 | /* 26 | * Values 248 through 255 are reserved for private use. 27 | */ 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/Mono.Security.NewTls.EC/NamedCurveHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using BCA = Org.BouncyCastle.Asn1; 3 | using Org.BouncyCastle.Crypto.Parameters; 4 | 5 | namespace Mono.Security.NewTls.EC 6 | { 7 | internal static class NamedCurveHelper 8 | { 9 | internal static ECDomainParameters GetECParameters (NamedCurve namedCurve) 10 | { 11 | if (!Enum.IsDefined (typeof(NamedCurve), namedCurve)) 12 | return null; 13 | 14 | string curveName = namedCurve.ToString (); 15 | 16 | // Lazily created the first time a particular curve is accessed 17 | X9ECParameters ecP = SecNamedCurves.GetByName (curveName); 18 | 19 | if (ecP == null) 20 | return null; 21 | 22 | // It's a bit inefficient to do this conversion every time 23 | return new ECDomainParameters (ecP.Curve, ecP.G, ecP.N, ecP.H, ecP.GetSeed ()); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/Mono.Security.NewTls.EC/X9ECParameters.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Org.BouncyCastle.Math; 4 | using Org.BouncyCastle.Math.EC; 5 | 6 | namespace Mono.Security.NewTls.EC 7 | { 8 | /* 9 | * ASN.1 def for Elliptic-Curve ECParameters structure. See 10 | * X9.62, for further details. 11 | */ 12 | public class X9ECParameters 13 | { 14 | private ECCurve curve; 15 | private ECPoint g; 16 | private BigInteger n; 17 | private BigInteger h; 18 | private byte[] seed; 19 | 20 | public X9ECParameters ( 21 | ECCurve curve, 22 | ECPoint g, 23 | BigInteger n) 24 | : this (curve, g, n, BigInteger.One, null) 25 | { 26 | } 27 | 28 | public X9ECParameters ( 29 | ECCurve curve, 30 | ECPoint g, 31 | BigInteger n, 32 | BigInteger h) 33 | : this (curve, g, n, h, null) 34 | { 35 | } 36 | 37 | public X9ECParameters ( 38 | ECCurve curve, 39 | ECPoint g, 40 | BigInteger n, 41 | BigInteger h, 42 | byte[] seed) 43 | { 44 | this.curve = curve; 45 | this.g = g; 46 | this.n = n; 47 | this.h = h; 48 | this.seed = seed; 49 | } 50 | 51 | public ECCurve Curve { 52 | get { return curve; } 53 | } 54 | 55 | public ECPoint G { 56 | get { return g; } 57 | } 58 | 59 | public BigInteger N { 60 | get { return n; } 61 | } 62 | 63 | public BigInteger H { 64 | get { 65 | if (h == null) { 66 | // TODO - this should be calculated, it will cause issues with custom curves. 67 | return BigInteger.One; 68 | } 69 | 70 | return h; 71 | } 72 | } 73 | 74 | public byte[] GetSeed () 75 | { 76 | return seed; 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/Mono.Security.NewTls.EC/X9ECParametersHolder.cs: -------------------------------------------------------------------------------- 1 | namespace Mono.Security.NewTls.EC 2 | { 3 | internal abstract class X9ECParametersHolder 4 | { 5 | private X9ECParameters parameters; 6 | 7 | public X9ECParameters Parameters { 8 | get { 9 | if (parameters == null) { 10 | parameters = CreateParameters (); 11 | } 12 | 13 | return parameters; 14 | } 15 | } 16 | 17 | protected abstract X9ECParameters CreateParameters (); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/Mono.Security.NewTls.Extensions/ExtensionType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mono.Security.NewTls.Extensions 4 | { 5 | public enum ExtensionType : short 6 | { 7 | ServerName = 0x0000, 8 | SignatureAlgorithms = 0x000d, 9 | Renegotiation = unchecked ((short)0xff01) 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/Mono.Security.NewTls.Extensions/ServerNameExtension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net; 3 | using System.Text; 4 | using Mono.Security.Interface; 5 | 6 | namespace Mono.Security.NewTls.Extensions 7 | { 8 | public class ServerNameExtension : TlsExtension 9 | { 10 | public override ExtensionType ExtensionType { 11 | get { return ExtensionType.ServerName; } 12 | } 13 | 14 | public string ServerName { 15 | get; 16 | private set; 17 | } 18 | 19 | public ServerNameExtension (TlsBuffer incoming) 20 | { 21 | if (incoming.Remaining == 0) 22 | return; 23 | var length = incoming.ReadInt16 (); 24 | if (length != incoming.Remaining) 25 | throw new TlsException (AlertDescription.DecodeError); 26 | var type = incoming.ReadByte (); 27 | if (type != 0x00) 28 | throw new TlsException (AlertDescription.IlegalParameter, "Unknown NameType in ServerName extension"); 29 | var nameLength = incoming.ReadInt16 (); 30 | if (nameLength + 3 != length) 31 | throw new TlsException (AlertDescription.DecodeError); 32 | ServerName = Encoding.ASCII.GetString (incoming.ReadBytes (nameLength)); 33 | } 34 | 35 | public ServerNameExtension (string host) 36 | { 37 | if (!IsLegalHostName (host)) 38 | throw new InvalidOperationException (); 39 | ServerName = host; 40 | } 41 | 42 | internal static bool IsLegalHostName (string host) 43 | { 44 | if (string.IsNullOrEmpty (host)) 45 | return false; 46 | IPAddress addr; 47 | if (IPAddress.TryParse (host, out addr)) 48 | return false; 49 | return true; 50 | } 51 | 52 | public override void Encode (TlsBuffer buffer) 53 | { 54 | var asciiName = Encoding.ASCII.GetBytes (ServerName); 55 | 56 | buffer.Write ((short)ExtensionType); 57 | buffer.Write ((short)(asciiName.Length + 5)); // ServerNameList 58 | buffer.Write ((short)(asciiName.Length + 3)); // ServerList 59 | buffer.Write ((byte)0x00); // HostName 60 | buffer.Write ((short)asciiName.Length); 61 | buffer.Write (asciiName); 62 | } 63 | 64 | public override bool ProcessClient (TlsContext context) 65 | { 66 | return false; 67 | } 68 | 69 | public override TlsExtension ProcessServer (TlsContext context) 70 | { 71 | return null; 72 | } 73 | } 74 | } 75 | 76 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/Mono.Security.NewTls.Extensions/SignatureAlgorithmsExtension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Mono.Security.Interface; 4 | 5 | namespace Mono.Security.NewTls.Extensions 6 | { 7 | using Cipher; 8 | 9 | public class SignatureAlgorithmsExtension : TlsExtension 10 | { 11 | public override ExtensionType ExtensionType { 12 | get { return ExtensionType.SignatureAlgorithms; } 13 | } 14 | 15 | public SignatureParameters SignatureParameters { 16 | get; 17 | private set; 18 | } 19 | 20 | public SignatureAlgorithmsExtension (TlsBuffer incoming) 21 | { 22 | var length = incoming.ReadInt16 (); 23 | if ((length % 2) != 0) 24 | throw new TlsException (AlertDescription.DecodeError); 25 | 26 | SignatureParameters = new SignatureParameters (); 27 | 28 | var count = length >> 1; 29 | for (int i = 0; i < count; i++) { 30 | SignatureParameters.SignatureAndHashAlgorithms.Add (SignatureHelper.DecodeSignatureAndHashAlgorithm (incoming)); 31 | } 32 | } 33 | 34 | public SignatureAlgorithmsExtension (SignatureParameters parameters) 35 | { 36 | SignatureParameters = parameters; 37 | } 38 | 39 | public override void Encode (TlsBuffer buffer) 40 | { 41 | var algorithms = SignatureParameters.SignatureAndHashAlgorithms; 42 | buffer.Write ((short)ExtensionType); 43 | buffer.Write ((short)(algorithms.Count * 2 + 2)); 44 | buffer.Write ((short)(algorithms.Count * 2)); 45 | foreach (var algorithm in algorithms) 46 | SignatureHelper.EncodeSignatureAndHashAlgorithm (algorithm, buffer); 47 | } 48 | 49 | public override bool ProcessClient (TlsContext context) 50 | { 51 | // We must never get this from a server. 52 | throw new TlsException (AlertDescription.UnsupportedExtension); 53 | } 54 | 55 | public override TlsExtension ProcessServer (TlsContext context) 56 | { 57 | context.Session.SignatureParameters = SignatureParameters; 58 | return null; 59 | } 60 | } 61 | } 62 | 63 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/Mono.Security.NewTls.Extensions/TlsExtension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Mono.Security.Interface; 3 | 4 | namespace Mono.Security.NewTls.Extensions 5 | { 6 | public abstract class TlsExtension 7 | { 8 | public abstract ExtensionType ExtensionType { 9 | get; 10 | } 11 | 12 | public abstract void Encode (TlsBuffer buffer); 13 | 14 | public abstract bool ProcessClient (TlsContext context); 15 | 16 | public abstract TlsExtension ProcessServer (TlsContext context); 17 | } 18 | } 19 | 20 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/Mono.Security.NewTls.Handshake/HandshakeMessage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Mono.Security.Interface; 3 | 4 | namespace Mono.Security.NewTls.Handshake 5 | { 6 | internal abstract class HandshakeMessage : Message 7 | { 8 | public HandshakeMessage (HandshakeType type) 9 | : base (ContentType.Handshake, type) 10 | { 11 | } 12 | 13 | public IBufferOffsetSize EncodeMessage () 14 | { 15 | var stream = new TlsStream (); 16 | stream.Write (0); 17 | Encode (stream); 18 | 19 | var length = stream.Position - 4; 20 | 21 | stream.Buffer [0] = (byte)Type; 22 | // Length as an Int24 in Network Order 23 | stream.Buffer[1] = (byte) (length >> 16); 24 | stream.Buffer[2] = (byte) (length >> 8); 25 | stream.Buffer[3] = (byte) length; 26 | 27 | stream.Finish (); 28 | 29 | return stream.GetRemaining (); 30 | } 31 | 32 | protected abstract void Encode (TlsStream stream); 33 | 34 | public static HandshakeMessage ReadMessage (TlsContext context, HandshakeType handshakeType, TlsBuffer incoming) 35 | { 36 | HandshakeMessage message; 37 | switch (handshakeType) { 38 | case HandshakeType.HelloRequest: 39 | message = new TlsHelloRequest (); 40 | break; 41 | case HandshakeType.ServerHello: 42 | return new TlsServerHello (context, incoming); 43 | case HandshakeType.Certificate: 44 | return new TlsCertificate (incoming); 45 | case HandshakeType.ServerHelloDone: 46 | message = new TlsServerHelloDone (); 47 | break; 48 | case HandshakeType.Finished: 49 | return new TlsFinished (incoming); 50 | case HandshakeType.ClientHello: 51 | return new TlsClientHello (context, incoming); 52 | case HandshakeType.ClientKeyExchange: 53 | return new TlsClientKeyExchange (context, incoming); 54 | case HandshakeType.CertificateRequest: 55 | return new TlsCertificateRequest (context.NegotiatedProtocol, incoming); 56 | case HandshakeType.CertificateVerify: 57 | return new TlsCertificateVerify (context.NegotiatedProtocol, incoming); 58 | case HandshakeType.ServerKeyExchange: 59 | return new TlsServerKeyExchange (context, incoming); 60 | default: 61 | throw new TlsException (AlertDescription.UnexpectedMessage, "Unknown server handshake message received: {0}", handshakeType); 62 | } 63 | 64 | message.Read (incoming); 65 | return message; 66 | } 67 | } 68 | } 69 | 70 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/Mono.Security.NewTls.Handshake/HandshakeType.cs: -------------------------------------------------------------------------------- 1 | // Transport Security Layer (TLS) 2 | // Copyright (c) 2003-2004 Carlos Guzman Alvarez 3 | 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining 6 | // a copy of this software and associated documentation files (the 7 | // "Software"), to deal in the Software without restriction, including 8 | // without limitation the rights to use, copy, modify, merge, publish, 9 | // distribute, sublicense, and/or sell copies of the Software, and to 10 | // permit persons to whom the Software is furnished to do so, subject to 11 | // the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | // 24 | 25 | using System; 26 | 27 | namespace Mono.Security.NewTls.Handshake 28 | { 29 | [Serializable] 30 | internal enum HandshakeType : byte 31 | { 32 | HelloRequest = 0, 33 | ClientHello = 1, 34 | ServerHello = 2, 35 | Certificate = 11, 36 | ServerKeyExchange = 12, 37 | CertificateRequest = 13, 38 | ServerHelloDone = 14, 39 | CertificateVerify = 15, 40 | ClientKeyExchange = 16, 41 | Finished = 20, 42 | ChanceCipherSpec = 254, 43 | None = 255 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/Mono.Security.NewTls.Handshake/Message.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Mono.Security.Interface; 3 | 4 | namespace Mono.Security.NewTls.Handshake 5 | { 6 | internal abstract class Message 7 | { 8 | public HandshakeType Type { 9 | get; 10 | private set; 11 | } 12 | 13 | public ContentType ContentType { 14 | get; 15 | private set; 16 | } 17 | 18 | public Message (ContentType contentType, HandshakeType type) 19 | { 20 | ContentType = contentType; 21 | Type = type; 22 | } 23 | 24 | protected abstract void Read (TlsBuffer incoming); 25 | } 26 | } 27 | 28 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/Mono.Security.NewTls.Handshake/TlsCertificate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Mono.Security.Interface; 3 | 4 | namespace Mono.Security.NewTls.Handshake 5 | { 6 | using X509; 7 | 8 | class TlsCertificate : HandshakeMessage 9 | { 10 | public TlsCertificate (X509CertificateCollection certificates) 11 | : base (HandshakeType.Certificate) 12 | { 13 | Certificates = certificates; 14 | } 15 | 16 | public TlsCertificate (TlsBuffer incoming) 17 | : base (HandshakeType.Certificate) 18 | { 19 | Certificates = new X509CertificateCollection (); 20 | Read (incoming); 21 | } 22 | 23 | public X509CertificateCollection Certificates { 24 | get; 25 | private set; 26 | } 27 | 28 | protected override void Read (TlsBuffer incoming) 29 | { 30 | var length = incoming.ReadInt24 (); 31 | var endOffset = incoming.Position + length; 32 | 33 | while (incoming.Position < endOffset) { 34 | var certLength = incoming.ReadInt24 (); 35 | if (certLength == 0) 36 | break; 37 | 38 | var buffer = incoming.ReadBytes (certLength); 39 | 40 | // Create a new X509 Certificate 41 | var certificate = new X509Certificate (buffer); 42 | Certificates.Add (certificate); 43 | } 44 | 45 | if (incoming.Position != endOffset || incoming.Remaining != 0) 46 | throw new TlsException (AlertDescription.DecodeError); 47 | 48 | } 49 | 50 | protected override void Encode (TlsStream stream) 51 | { 52 | var startPosition = stream.Position; 53 | stream.WriteInt24 (-1); 54 | 55 | foreach (var certificate in Certificates) { 56 | var data = certificate.RawData; 57 | 58 | stream.WriteInt24 (data.Length); 59 | stream.Write (data); 60 | } 61 | 62 | var endPosition = stream.Position; 63 | stream.Position = startPosition; 64 | stream.WriteInt24 ((int)(endPosition - startPosition - 3)); 65 | stream.Position = endPosition; 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/Mono.Security.NewTls.Handshake/TlsCertificateVerify.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Mono.Security.Interface; 3 | 4 | namespace Mono.Security.NewTls.Handshake 5 | { 6 | using Cipher; 7 | 8 | class TlsCertificateVerify : HandshakeMessage 9 | { 10 | public TlsCertificateVerify (Signature signature) 11 | : base (HandshakeType.CertificateVerify) 12 | { 13 | Signature = signature; 14 | } 15 | 16 | public TlsCertificateVerify (TlsProtocolCode protocol, TlsBuffer incoming) 17 | : base (HandshakeType.CertificateVerify) 18 | { 19 | Protocol = protocol; 20 | Read (incoming); 21 | } 22 | 23 | public TlsProtocolCode Protocol { 24 | get; 25 | private set; 26 | } 27 | 28 | public Signature Signature { 29 | get; 30 | private set; 31 | } 32 | 33 | protected override void Read (TlsBuffer incoming) 34 | { 35 | Signature = Signature.Read (Protocol, incoming); 36 | } 37 | 38 | protected override void Encode (TlsStream stream) 39 | { 40 | Signature.Write (stream); 41 | } 42 | } 43 | } 44 | 45 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/Mono.Security.NewTls.Handshake/TlsChangeCipherSpec.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Mono.Security.Interface; 3 | 4 | namespace Mono.Security.NewTls.Handshake 5 | { 6 | class TlsChangeCipherSpec : Message 7 | { 8 | public TlsChangeCipherSpec () 9 | : base (ContentType.ChangeCipherSpec, HandshakeType.ChanceCipherSpec) 10 | { 11 | } 12 | 13 | protected override void Read (TlsBuffer incoming) 14 | { 15 | var message = incoming.ReadByte (); 16 | if (message != 1 || incoming.Remaining != 0) 17 | throw new TlsException (AlertDescription.DecodeError, "Received invalid ChangeCipherSpec message"); 18 | } 19 | } 20 | } 21 | 22 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/Mono.Security.NewTls.Handshake/TlsClientKeyExchange.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Security.Cryptography; 3 | using Mono.Security.Cryptography; 4 | using Mono.Security.Interface; 5 | 6 | namespace Mono.Security.NewTls.Handshake 7 | { 8 | using Cipher; 9 | 10 | class TlsClientKeyExchange : HandshakeMessage 11 | { 12 | public TlsClientKeyExchange (TlsContext context, TlsBuffer incoming) 13 | : base (HandshakeType.ClientKeyExchange) 14 | { 15 | KeyExchange = KeyExchange.Create (context.NegotiatedProtocol, context.Session.PendingCrypto.Cipher.ExchangeAlgorithmType); 16 | Read (incoming); 17 | } 18 | 19 | public TlsClientKeyExchange (KeyExchange keyExchange) 20 | : base (HandshakeType.ClientKeyExchange) 21 | { 22 | KeyExchange = keyExchange; 23 | } 24 | 25 | public KeyExchange KeyExchange { 26 | get; 27 | private set; 28 | } 29 | 30 | protected override void Read (TlsBuffer incoming) 31 | { 32 | KeyExchange.ReadClient (incoming); 33 | } 34 | 35 | protected override void Encode (TlsStream stream) 36 | { 37 | KeyExchange.WriteClient (stream); 38 | } 39 | } 40 | } 41 | 42 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/Mono.Security.NewTls.Handshake/TlsFinished.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Mono.Security.Cryptography; 3 | using System.Security.Cryptography; 4 | using Mono.Security.Interface; 5 | 6 | namespace Mono.Security.NewTls.Handshake 7 | { 8 | class TlsFinished : HandshakeMessage 9 | { 10 | public TlsFinished (TlsBuffer incoming) 11 | : base (HandshakeType.Finished) 12 | { 13 | Read (incoming); 14 | } 15 | 16 | public TlsFinished (SecureBuffer hash) 17 | : base (HandshakeType.Finished) 18 | { 19 | Hash = hash; 20 | } 21 | 22 | public SecureBuffer Hash { 23 | get; 24 | private set; 25 | } 26 | 27 | internal const string ClientSeed = "client finished"; 28 | internal const string ServerSeed = "server finished"; 29 | 30 | protected override void Read (TlsBuffer incoming) 31 | { 32 | Hash = new SecureBuffer (incoming.ReadBytes (12)); 33 | if (incoming.Remaining != 0) 34 | throw new TlsException (AlertDescription.DecodeError); 35 | } 36 | 37 | protected override void Encode (TlsStream stream) 38 | { 39 | stream.Write (Hash.Buffer); 40 | } 41 | } 42 | } 43 | 44 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/Mono.Security.NewTls.Handshake/TlsHelloRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Mono.Security.Interface; 3 | 4 | namespace Mono.Security.NewTls.Handshake 5 | { 6 | class TlsHelloRequest : HandshakeMessage 7 | { 8 | public TlsHelloRequest () 9 | : base (HandshakeType.HelloRequest) 10 | { 11 | } 12 | 13 | protected override void Encode (TlsStream stream) 14 | { 15 | } 16 | 17 | protected override void Read (TlsBuffer incoming) 18 | { 19 | if (incoming.Remaining != 0) 20 | throw new TlsException (AlertDescription.DecodeError); 21 | } 22 | } 23 | } 24 | 25 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/Mono.Security.NewTls.Handshake/TlsServerHelloDone.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Mono.Security.Interface; 3 | 4 | namespace Mono.Security.NewTls.Handshake 5 | { 6 | class TlsServerHelloDone : HandshakeMessage 7 | { 8 | public TlsServerHelloDone () 9 | : base (HandshakeType.ServerHelloDone) 10 | { 11 | } 12 | 13 | protected override void Read (TlsBuffer incoming) 14 | { 15 | if (incoming.Remaining != 0) 16 | throw new TlsException (AlertDescription.DecodeError); 17 | } 18 | 19 | protected override void Encode (TlsStream stream) 20 | { 21 | } 22 | } 23 | } 24 | 25 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/Mono.Security.NewTls.Handshake/TlsServerKeyExchange.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Security.Cryptography; 3 | using Mono.Security.Cryptography; 4 | using Mono.Security.Interface; 5 | 6 | namespace Mono.Security.NewTls.Handshake 7 | { 8 | using Cipher; 9 | 10 | class TlsServerKeyExchange : HandshakeMessage 11 | { 12 | public TlsServerKeyExchange (TlsContext context, TlsBuffer incoming) 13 | : base (HandshakeType.ServerKeyExchange) 14 | { 15 | KeyExchange = KeyExchange.Create (context.NegotiatedProtocol, context.Session.PendingCrypto.Cipher.ExchangeAlgorithmType); 16 | Read (incoming); 17 | } 18 | 19 | public TlsServerKeyExchange (KeyExchange keyExchange) 20 | : base (HandshakeType.ServerKeyExchange) 21 | { 22 | KeyExchange = keyExchange; 23 | } 24 | 25 | public KeyExchange KeyExchange { 26 | get; 27 | private set; 28 | } 29 | 30 | protected override void Read (TlsBuffer incoming) 31 | { 32 | KeyExchange.ReadServer (incoming); 33 | 34 | if (incoming.Remaining != 0) 35 | throw new TlsException (AlertDescription.DecodeError); 36 | } 37 | 38 | protected override void Encode (TlsStream stream) 39 | { 40 | KeyExchange.WriteServer (stream); 41 | } 42 | } 43 | } 44 | 45 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/Mono.Security.NewTls.Negotiation/NegotiationState.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mono.Security.NewTls.Negotiation 4 | { 5 | public enum NegotiationState 6 | { 7 | InitialClientConnection, 8 | RenegotiatingClientConnection, 9 | ClientKeyExchange, 10 | InitialServerConnection, 11 | RenegotiatingServerConnection, 12 | ServerFinished, 13 | ServerHello 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /Mono.Security.NewTls/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // 2 | // AssemblyInfo.cs 3 | // 4 | // Author: 5 | // Martin Baulig 6 | // 7 | // Copyright (c) 2015 Xamarin, Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using System.Reflection; 28 | using System.Resources; 29 | using System.Security; 30 | using System.Security.Permissions; 31 | using System.Runtime.CompilerServices; 32 | using System.Runtime.InteropServices; 33 | 34 | // General Information about the system assembly 35 | 36 | [assembly: AssemblyVersion ("1.0.*")] 37 | 38 | [assembly: AssemblyCompany ("Xamarin")] 39 | [assembly: AssemblyCopyright ("(c) 2015 Xamarin")] 40 | [assembly: AssemblyDescription ("Mono.Security.NewTls.dll")] 41 | [assembly: AssemblyProduct ("MONO TLS")] 42 | [assembly: AssemblyTitle ("Mono.Security.NewTls.dll")] 43 | [assembly: CLSCompliant (false)] 44 | [assembly: ComVisible (false)] 45 | [assembly: NeutralResourcesLanguage ("en-US")] 46 | 47 | -------------------------------------------------------------------------------- /NativeOpenSsl/.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | -------------------------------------------------------------------------------- /NativeOpenSsl/NativeCryptoTest.h: -------------------------------------------------------------------------------- 1 | // 2 | // NativeCryptoTest.h 3 | // NativeOpenSsl 4 | // 5 | // Created by Martin Baulig on 12/2/14. 6 | // Copyright (c) 2014 Martin Baulig. All rights reserved. 7 | // 8 | 9 | #ifndef __NativeOpenSsl__NativeCryptoTest__ 10 | #define __NativeOpenSsl__NativeCryptoTest__ 11 | 12 | #include 13 | 14 | typedef enum { 15 | NATIVE_CRYPTO_HASH_TYPE_SHA256, 16 | NATIVE_CRYPTO_HASH_TYPE_SHA384 17 | } NativeCryptoHashType; 18 | 19 | void 20 | native_crypto_test_init (void); 21 | 22 | int 23 | native_crypto_test_PRF (NativeCryptoHashType type, 24 | const void *seed1, int seed1_len, 25 | const void *seed2, int seed2_len, 26 | const void *seed3, int seed3_len, 27 | const void *seed4, int seed4_len, 28 | const void *seed5, int seed5_len, 29 | const unsigned char *sec, int slen, 30 | unsigned char *out1, 31 | unsigned char *out2, int olen); 32 | 33 | int 34 | native_crypto_test_HMac (NativeCryptoHashType type, 35 | const void *seed1, int seed1_len, 36 | const void *seed2, int seed2_len, 37 | const void *seed3, int seed3_len, 38 | const void *seed4, int seed4_len, 39 | const void *seed5, int seed5_len, 40 | const unsigned char *sec, int slen, 41 | unsigned char *out, int olen); 42 | 43 | int 44 | native_crypto_test_digest (NativeCryptoHashType type, const void *data, int data_len, 45 | unsigned char *out, int olen); 46 | 47 | #endif /* defined(__NativeOpenSsl__NativeCryptoTest__) */ 48 | -------------------------------------------------------------------------------- /NativeOpenSsl/NativeOpenSsl.xcodeproj/xcuserdata/martin.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | NativeOpenSsl.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 5B31F1C81A292003001BA250 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Mono TLS 2 | ======== 3 | 4 | This module contains a pure managed implementation of the TLS 1.2, 1.1 and 1.0 protocols that 5 | is pluggable into Mono's 4.4 stack. 6 | 7 | Please note that the code in this module is not ready yet, it has NOT BEEN SECURITY AUDITED 8 | AND NO GUARANTEE ABOUT SECURITY OR STABILITY can be made! 9 | 10 | You are very welcome to use this module to test the new TLS code, find bugs, problems, 11 | security issues, anything in it - but do not use it in production environment until it is ready. 12 | 13 | See [ARCHITECTURE.md](https://github.com/mono/mono-tls/blob/master/ARCHITECTURE.md) for 14 | an overview of the project, build instructions additional more information. 15 | 16 | Build 17 | ===== 18 | 19 | To build this module, open the solution .sln file in this directory and compile it. 20 | 21 | Last changed October 21st, 2015 22 | Martin Baulig 23 | -------------------------------------------------------------------------------- /filelist.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -wT 2 | use strict; 3 | 4 | my $prefix = "..\\..\\Mono.Security.NewTls"; 5 | 6 | while (my $line = <>) { 7 | chop $line; 8 | next unless $line =~ m,,; 9 | my $file = $1; 10 | print " \n $file\n \n"; 11 | } -------------------------------------------------------------------------------- /new-tls.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mono/mono-tls/bdcc934db2fdd97ca6d437969f0b963728fe3667/new-tls.snk --------------------------------------------------------------------------------