├── .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 | *