Repository: ignite Updated Branches: refs/heads/ignite-3345 22f85e3b1 -> 7e8aa9468
IGNITE-3111 .NET: Configure SSL without Spring - cleanup * Remove unused members from ISslContextFactory * Fix namespaces * Remove unused files * Cleanup tests Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/600542d5 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/600542d5 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/600542d5 Branch: refs/heads/ignite-3345 Commit: 600542d53e22a80f8f2f3d6b640fd6d19c015d32 Parents: f897370 Author: Pavel Tupitsin <pavel.tupit...@aurea.com> Authored: Fri Feb 16 23:36:01 2018 +0300 Committer: Pavel Tupitsin <pavel.tupit...@aurea.com> Committed: Fri Feb 16 23:36:01 2018 +0300 ---------------------------------------------------------------------- .../Apache.Ignite.Core.Tests.DotNetCore.csproj | 10 ++ .../Apache.Ignite.Core.Tests.csproj | 29 +--- .../Config/KeyStore/client.jks | Bin 3232 -> 0 bytes .../Config/KeyStore/client.pem | 69 -------- .../Config/KeyStore/client.pfx | Bin 3148 -> 0 bytes .../Config/KeyStore/generate.sh | 99 ----------- .../Config/KeyStore/server.pem | 69 -------- .../Config/KeyStore/server.pfx | Bin 3148 -> 0 bytes .../Apache.Ignite.Core.Tests/Config/ssl.xml | 65 ++++++++ .../Config/start-test-grid1-ssl.xml | 65 -------- .../Config/start-test-grid1.xml | 55 ------ .../Config/start-test-grid2.xml | 46 ----- .../Config/start-test-grid3.xml | 44 ----- .../IgniteConfigurationSerializerTest.cs | 2 +- .../Ssl/SslConfigurationTest.cs | 77 +++------ .../Apache.Ignite.Core.DotNetCore.csproj | 15 +- .../Apache.Ignite.Core.csproj | 6 +- .../Cluster/Ssl/ISslContextFactory.cs | 35 ---- .../Cluster/Ssl/SslContextFactory.cs | 166 ------------------- .../Apache.Ignite.Core/IgniteConfiguration.cs | 4 +- .../Impl/Cluster/Ssl/SslFactorySerializer.cs | 58 ------- .../Impl/Ssl/SslFactorySerializer.cs | 65 ++++++++ .../Ssl/ISslContextFactory.cs | 32 ++++ .../Apache.Ignite.Core/Ssl/SslContextFactory.cs | 166 +++++++++++++++++++ 24 files changed, 375 insertions(+), 802 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/600542d5/modules/platforms/dotnet/Apache.Ignite.Core.Tests.DotNetCore/Apache.Ignite.Core.Tests.DotNetCore.csproj ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests.DotNetCore/Apache.Ignite.Core.Tests.DotNetCore.csproj b/modules/platforms/dotnet/Apache.Ignite.Core.Tests.DotNetCore/Apache.Ignite.Core.Tests.DotNetCore.csproj index 67ece47..e14be00 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests.DotNetCore/Apache.Ignite.Core.Tests.DotNetCore.csproj +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests.DotNetCore/Apache.Ignite.Core.Tests.DotNetCore.csproj @@ -130,6 +130,7 @@ <Compile Include="..\Apache.Ignite.Core.Tests\Services\ServicesTestAsync.cs" Link="Services\ServicesTestAsync.cs" /> <Compile Include="..\Apache.Ignite.Core.Tests\TaskExtensions.cs" Link="Common\TaskExtensions.cs" /> <Compile Include="..\Apache.Ignite.Core.Tests\TestUtils.Common.cs" Link="Common\TestUtils.Common.cs" /> + <Compile Include="..\Apache.Ignite.Core.Tests\Ssl\SslConfigurationTest.cs" Link="Common\SslConfigurationTest.cs" /> </ItemGroup> <ItemGroup> @@ -160,6 +161,15 @@ <Content Include="..\Apache.Ignite.Core.Tests\Config\spring-test.xml" Link="Config\spring-test.xml"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </Content> + <Content Include="..\Apache.Ignite.Core.Tests\Config\ssl.xml" Link="Config\ssl.xml"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </Content> + <Content Include="..\Apache.Ignite.Core.Tests\Config\KeyStore\server.jks" Link="Config\KeyStore\server.jks"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </Content> + <Content Include="..\Apache.Ignite.Core.Tests\Config\KeyStore\trust.jks" Link="Config\KeyStore\trust.jks"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </Content> </ItemGroup> <ItemGroup> http://git-wip-us.apache.org/repos/asf/ignite/blob/600542d5/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj index 91e8ed4..bd9a6a5 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj @@ -456,16 +456,7 @@ <Content Include="Config\reconnect-test.xml"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </Content> - <Content Include="Config\start-test-grid1-ssl.xml"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </Content> - <Content Include="Config\start-test-grid1.xml"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </Content> - <Content Include="Config\start-test-grid2.xml"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </Content> - <Content Include="Config\start-test-grid3.xml"> + <Content Include="Config\ssl.xml"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </Content> </ItemGroup> @@ -477,27 +468,9 @@ <ItemGroup> <None Include="Apache.Ignite.Core.Tests.nunit" /> <None Include="Apache.Ignite.Core.Tests.snk" /> - <None Include="Config\KeyStore\client.jks"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="Config\KeyStore\client.pem"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="Config\KeyStore\client.pfx"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="Config\KeyStore\generate.sh"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> <None Include="Config\KeyStore\server.jks"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> - <None Include="Config\KeyStore\server.pem"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="Config\KeyStore\server.pfx"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> <None Include="Config\KeyStore\trust.jks"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> http://git-wip-us.apache.org/repos/asf/ignite/blob/600542d5/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/KeyStore/client.jks ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/KeyStore/client.jks b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/KeyStore/client.jks deleted file mode 100644 index 1875c71..0000000 Binary files a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/KeyStore/client.jks and /dev/null differ http://git-wip-us.apache.org/repos/asf/ignite/blob/600542d5/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/KeyStore/client.pem ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/KeyStore/client.pem b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/KeyStore/client.pem deleted file mode 100644 index a71a87e..0000000 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/KeyStore/client.pem +++ /dev/null @@ -1,69 +0,0 @@ -Bag Attributes - friendlyName: client - localKeyID: 54 69 6D 65 20 31 33 33 39 32 33 39 38 35 39 34 34 36 -Key Attributes: <No Attributes> ------BEGIN RSA PRIVATE KEY----- -Proc-Type: 4,ENCRYPTED -DEK-Info: DES-EDE3-CBC,CE61EDD98349D0C7 - -Kzl16sj8R7YUXPCEZCqCrY4LSAjiKCRFNOagEehvN9Jpswcz4JbatoFmvVvOCgBF -7kkeCaALhfM5a+46uynZ1sOOFUOn8fUFgguN3lLInWfm6vTuXDPslg0/tRNI0YqW -ujfxyzrm1/k4RX0oLzRE1jZr69VZsBmZndkz9nkz3anWKLE7X/VIFV6U/N6YNPch -BG1Fxpt/HtM9p3B5wNDSjCVaeNP1ROKe3APLRY6k+SppTuntHV5q9Ni82r1l3ahU -zf2QvocSy9MLh+bGusJGHyJJAGuwPHm6ytPwbXGHn5xe4HPIno28j9kN7EL1ZoUs -q0PhipAkFrGIM4zg6nAwVdzY5iGySDQ3fWpz2MkrKMDRftBwA3o/M321NBUW9/2X -l+XmjXcJd0dEOslGxveb6UXLL2YvYszjQXRR4dCV/40bMJL3umRhVSay0NteoXfY -82rQchm2NHKOiDfB4RpD8JJtVQeDSMXc9TH5y2Ua7FZND60JXtFpdnfCVfVZuBJm -yBafyIsXR7EQzLG4z28Dvp4fs42A3JkF+e9Aq6Y6MmYA1wsvIKKT9HKEifqKmbgG -4E9WOZn5IWi4ZJ44VAwN/uBGrLm//3OjByeB9y8vszNbyY8dQ8x5XqnF/IzIvgqc -uKA8xuLAkTFmgRGQ/lmMDR+iMhet5dCtg9Orb9tYVL55JAb/OfsCX0LTJ3Y2RmIx -CaFpkUP7KKYD+69ajnFCxvfGnGxyBkf+JeuDYIZVFklVT9SUtL9RJh26jUdvHt2A -LQerBl8UCkVbPxsxYjdawvxuBNTD6tSRykM8zwtWcvIubp+gxE7png== ------END RSA PRIVATE KEY----- -Bag Attributes - friendlyName: 1.2.840.113549.1.9.1=#1613636c69656e7440677269646761696e2e636f6d,CN=client,OU=Dev,O=GridGain,ST=SPb,C=RU - localKeyID: 54 69 6D 65 20 31 33 33 39 32 33 39 38 35 39 34 34 36 -subject=/C=RU/ST=SPb/O=GridGain/OU=Dev/CN=client/emailAddress=cli...@gridgain.com -issuer=/C=RU/ST=SPb/L=SPb/O=GridGain/OU=Dev/CN=ca/emailAddress=c...@gridgain.com ------BEGIN CERTIFICATE----- -MIIC2TCCAkKgAwIBAgIBJDANBgkqhkiG9w0BAQUFADB3MQswCQYDVQQGEwJSVTEM -MAoGA1UECBMDU1BiMQwwCgYDVQQHEwNTUGIxETAPBgNVBAoTCEdyaWRHYWluMQww -CgYDVQQLEwNEZXYxCzAJBgNVBAMTAmNhMR4wHAYJKoZIhvcNAQkBFg9jYUBncmlk -Z2Fpbi5jb20wHhcNMTIwNjA5MTEwNDE3WhcNMzIwNjA5MTEwNDE3WjBxMQswCQYD -VQQGEwJSVTEMMAoGA1UECBMDU1BiMREwDwYDVQQKEwhHcmlkR2FpbjEMMAoGA1UE -CxMDRGV2MQ8wDQYDVQQDEwZjbGllbnQxIjAgBgkqhkiG9w0BCQEWE2NsaWVudEBn -cmlkZ2Fpbi5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANIHHcYiA+CP -EBPKNZJ6mtvN4d9Yj43B5/hzs/TK3e4XImLsMhXaElYtrXQX/SDK7Zv5zdj6AkKH -QkJ9BT8Jw7wvOQx/v4Qxrl+gTgcf6gjk6DvzqMlZUwH+ohbALj2TWsy9y+0uHKal -EVrHpbYeB9TGpD+3NHwO/CG4SySk/Y4nAgMBAAGjezB5MAkGA1UdEwQCMAAwLAYJ -YIZIAYb4QgENBB8WHU9wZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMB0GA1Ud -DgQWBBRD/TKyBQyoVxqEupLzUB8hDrSF6DAfBgNVHSMEGDAWgBS1+Ah4ZG58tImL -KqLVX+xBKbeFUTANBgkqhkiG9w0BAQUFAAOBgQCL2vhjwcJkA1OJGuXsuO2/87Zu -HMa7gc4pm+Iol1B1gD2ksQEAU2dz/adD3369H7gZdHuk3RYPeYmD5Ppp9eECDsXc -gNWrNYaqcSTYWRAUe1/St7vB9HzPdOm/eADfQaMnal6fmjfpzTgg65A/2w4GCsqt -RL98pvdAft8v5WSx7A== ------END CERTIFICATE----- -Bag Attributes - friendlyName: 1.2.840.113549.1.9.1=#160f636140677269646761696e2e636f6d,CN=ca,OU=Dev,O=GridGain,L=SPb,ST=SPb,C=RU -subject=/C=RU/ST=SPb/L=SPb/O=GridGain/OU=Dev/CN=ca/emailAddress=c...@gridgain.com -issuer=/C=RU/ST=SPb/L=SPb/O=GridGain/OU=Dev/CN=ca/emailAddress=c...@gridgain.com ------BEGIN CERTIFICATE----- -MIIDSTCCArKgAwIBAgIJAKmuj925215OMA0GCSqGSIb3DQEBBQUAMHcxCzAJBgNV -BAYTAlJVMQwwCgYDVQQIEwNTUGIxDDAKBgNVBAcTA1NQYjERMA8GA1UEChMIR3Jp -ZEdhaW4xDDAKBgNVBAsTA0RldjELMAkGA1UEAxMCY2ExHjAcBgkqhkiG9w0BCQEW -D2NhQGdyaWRnYWluLmNvbTAeFw0xMjA2MDkwNjU1MTJaFw0zMjA2MDQwNjU1MTJa -MHcxCzAJBgNVBAYTAlJVMQwwCgYDVQQIEwNTUGIxDDAKBgNVBAcTA1NQYjERMA8G -A1UEChMIR3JpZEdhaW4xDDAKBgNVBAsTA0RldjELMAkGA1UEAxMCY2ExHjAcBgkq -hkiG9w0BCQEWD2NhQGdyaWRnYWluLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAw -gYkCgYEAtd16DCObyM63NKF/cvRcE+8cr1dc3c7mSnTEQ61WfqPJ2QqsQAB6e+5+ -q9Np1SaJyqFTTag6483ibrU+DkGPGgEXndRHtQHQPbStWsf47DBBW2bMi6+bkPox -Cp6BhYO1DQUG5tP9CQ/g32mLQLB7LH0KtS1JcKpAClCjjWZC8b8CAwEAAaOB3DCB -2TAdBgNVHQ4EFgQUtfgIeGRufLSJiyqi1V/sQSm3hVEwgakGA1UdIwSBoTCBnoAU -tfgIeGRufLSJiyqi1V/sQSm3hVGhe6R5MHcxCzAJBgNVBAYTAlJVMQwwCgYDVQQI -EwNTUGIxDDAKBgNVBAcTA1NQYjERMA8GA1UEChMIR3JpZEdhaW4xDDAKBgNVBAsT -A0RldjELMAkGA1UEAxMCY2ExHjAcBgkqhkiG9w0BCQEWD2NhQGdyaWRnYWluLmNv -bYIJAKmuj925215OMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAhrzd -qusVLHO3wtyu0o+EAFyoDv5avCBTFsQLeDDPMyfDcEO6wfxhTanfH8C7gZc0rRnv -2nbkVbfortHIOfU2wch5gClju0cXSTIXSKOAWPIMp3HLxC/l+KpFo3epFz0rsMVB -M1ymOOdRDdAcTxcTTGY7WJXquEM3ZbT5Gh4RLDk= ------END CERTIFICATE----- http://git-wip-us.apache.org/repos/asf/ignite/blob/600542d5/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/KeyStore/client.pfx ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/KeyStore/client.pfx b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/KeyStore/client.pfx deleted file mode 100644 index 494a63e..0000000 Binary files a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/KeyStore/client.pfx and /dev/null differ http://git-wip-us.apache.org/repos/asf/ignite/blob/600542d5/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/KeyStore/generate.sh ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/KeyStore/generate.sh b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/KeyStore/generate.sh deleted file mode 100644 index 9b1d6fa..0000000 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/KeyStore/generate.sh +++ /dev/null @@ -1,99 +0,0 @@ -#!/bin/sh -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Initialize openssl & CA. -# -# Instruction: https://access.redhat.com/documentation/en-US/Red_Hat_JBoss_Fuse/6.0/html/Web_Services_Security_Guide/files/i305191.html -# - -# Path to CA certificate. -ca_cert=/usr/ssl/ca/ca.pem - -# -# Create artifacts for specified name: key pair-> cert request -> ca-signed certificate. -# Save private key and CA-signed certificate into key storages: PEM, JKS, PFX (PKCS12). -# -# param $1 Artifact name. -# param $2 Password for all keys and storages. -# -function createStore { - artifact=$1 - pwd=$2 - - echo - echo Clean up all old artifacts: ${artifact}.* - rm -f ${artifact}.* - - echo - echo Generate a certificate and private key pair for ${artifact}. - keytool -genkey -keyalg RSA -keysize 1024 -dname "emailAddress=${artifact}@ignite.com, CN=${artifact}, OU=Dev, O=Ignite, L=SPb, ST=SPb, C=RU" -validity 7305 -alias ${artifact} -keypass ${pwd} -keystore ${artifact}.jks -storepass ${pwd} - - echo - echo Create a certificate signing request for ${artifact}. - keytool -certreq -alias ${artifact} -file ${artifact}.csr -keypass ${pwd} -keystore ${artifact}.jks -storepass ${pwd} - - echo - echo "Sign the CSR using CA (default SSL configuration)." - openssl ca -days 7305 -in ${artifact}.csr -out ${artifact}.pem - - echo - echo Convert to PEM format. - openssl x509 -in ${artifact}.pem -out ${artifact}.pem -outform PEM - - echo - echo Concatenate the CA certificate file and ${artifact}.pem certificate file into certificates chain. - cat ${artifact}.pem ${ca_cert} > ${artifact}.chain - - echo - echo Update the keystore, ${artifact}.jks, by importing the CA certificate. - keytool -import -alias ca -file ${ca_cert} -keypass ${pwd} -noprompt -trustcacerts -keystore ${artifact}.jks -storepass ${pwd} - - echo - echo Update the keystore, ${artifact}.jks, by importing the full certificate chain for the ${artifact}. - keytool -import -alias ${artifact} -file ${artifact}.chain -keypass ${pwd} -noprompt -trustcacerts -keystore ${artifact}.jks -storepass ${pwd} - - echo - echo Generate PKCS12 storage for the private key and certificate chain. - keytool -importkeystore \ - -srcstoretype JKS -deststoretype PKCS12 \ - -srckeystore ${artifact}.jks -destkeystore ${artifact}.pfx \ - -srcstorepass ${pwd} -deststorepass ${pwd} \ - -srcalias ${artifact} -destalias ${artifact} \ - -srckeypass ${pwd} -destkeypass ${pwd} \ - -noprompt - - echo - echo Generate PEM storage for the private key and certificate chain. - openssl pkcs12 \ - -in ${artifact}.pfx -out ${artifact}.pem \ - -passin pass:${pwd} -passout pass:${pwd} - - rm -f ${artifact}.chain ${artifact}.csr -} - -pwd="123456" - -createStore "client" ${pwd} -createStore "server" ${pwd} - -echo -echo Update trust store with certificates: CA, client, server. -keytool -import -alias ca -file ${ca_cert} -keypass ${pwd} -noprompt -trustcacerts -keystore trust.jks -storepass ${pwd} -#keytool -importkeystore -srckeystore client.jks -destkeystore trust.jks -srcstorepass ${pwd} -deststorepass ${pwd} -alias client -noprompt -#keytool -importkeystore -srckeystore server.jks -destkeystore trust.jks -srcstorepass ${pwd} -deststorepass ${pwd} -alias server -noprompt -keytool -export -alias client -keystore client.jks -storepass ${pwd} | keytool -importcert -alias client -noprompt -keystore trust.jks -storepass ${pwd} -keytool -export -alias server -keystore server.jks -storepass ${pwd} | keytool -importcert -alias server -noprompt -keystore trust.jks -storepass ${pwd} http://git-wip-us.apache.org/repos/asf/ignite/blob/600542d5/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/KeyStore/server.pem ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/KeyStore/server.pem b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/KeyStore/server.pem deleted file mode 100644 index b8d2174..0000000 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/KeyStore/server.pem +++ /dev/null @@ -1,69 +0,0 @@ -Bag Attributes - friendlyName: server - localKeyID: 54 69 6D 65 20 31 33 33 39 32 33 39 38 36 35 34 32 34 -Key Attributes: <No Attributes> ------BEGIN RSA PRIVATE KEY----- -Proc-Type: 4,ENCRYPTED -DEK-Info: DES-EDE3-CBC,FA0E52C780B7D5E8 - -3B9LjnvxRjASvnPUp3c6ICSk02znhERV1XRQLRR7rhGnMJVI1FJHzRFJsLTmOE/B -irHCzKtOAw3MDlDhRoAncLiZcvaoUwzWCU2SZ0IS7ERLi+wDoV22ftGfXV815x0Y -L2ut3BatgkzFpY6QUGK9ReEenLfZ6AfGhImjAubYvPr1Z3q+fk5ZoNz9Z9ZgpmEX -BfQb1A1XHXvlu/dUXdn46t2DSpYD7RgqTRKCmCJeerWrZak2CwvCCIPC5w0+IHbT -nBTyTquhig3bbsybZHjnNsttLeBPQrhnc0K+ydbNDcHS3OQB7sqPYce5fz2Y2dnF -Adva9r7o9K06e3P0/TSTyHQJyHiFsns157wBOXElRQvGGi8XtDaKHIYIJROeRbKU -2kRYcDOdwN7aRt9k3q7Jo52IyHQ78asL1f1kN4kt1IHl5CVFMPyWPgXeSj+hMzOF -hkV0dWfSX8ZdIZOVzFMZOrqf5dXzAGs3GIbkaWX2lG5DWVnVobch82kDuTYnCIJs -9N7VwwptUCsYqM5WWDo1OUYfvljEhoYyIXNxhn94Fe2lIXYttymsaIW/Dt/rwh9K -ukKGOnehtayNQKaOtiWfnqUxHLJTUZOTGd3ImJQb6A/Ygs79xO1xeWPlYQilNdEN -A/d2x6Auo3P0Axf+FMMNZDfuXzd02FAnYWz2McQT8RXCG0/CIsrYTydVnFRyXTrM -/AjzPgp54r9l3/xBg1GSPwjKb75Vsw4WMG0HUDvBRIGTw3tr3+ng30/JtN93H7Ga -TMqUuOzG1qgRhT0yFUz5pknGesjTnVKzd9TbYD9KtuNHFsTC+7y5Hw== ------END RSA PRIVATE KEY----- -Bag Attributes - friendlyName: 1.2.840.113549.1.9.1=#161373657276657240677269646761696e2e636f6d,CN=server,OU=Dev,O=GridGain,ST=SPb,C=RU - localKeyID: 54 69 6D 65 20 31 33 33 39 32 33 39 38 36 35 34 32 34 -subject=/C=RU/ST=SPb/O=GridGain/OU=Dev/CN=server/emailAddress=ser...@gridgain.com -issuer=/C=RU/ST=SPb/L=SPb/O=GridGain/OU=Dev/CN=ca/emailAddress=c...@gridgain.com ------BEGIN CERTIFICATE----- -MIIC2TCCAkKgAwIBAgIBJTANBgkqhkiG9w0BAQUFADB3MQswCQYDVQQGEwJSVTEM -MAoGA1UECBMDU1BiMQwwCgYDVQQHEwNTUGIxETAPBgNVBAoTCEdyaWRHYWluMQww -CgYDVQQLEwNEZXYxCzAJBgNVBAMTAmNhMR4wHAYJKoZIhvcNAQkBFg9jYUBncmlk -Z2Fpbi5jb20wHhcNMTIwNjA5MTEwNDIyWhcNMzIwNjA5MTEwNDIyWjBxMQswCQYD -VQQGEwJSVTEMMAoGA1UECBMDU1BiMREwDwYDVQQKEwhHcmlkR2FpbjEMMAoGA1UE -CxMDRGV2MQ8wDQYDVQQDEwZzZXJ2ZXIxIjAgBgkqhkiG9w0BCQEWE3NlcnZlckBn -cmlkZ2Fpbi5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANb9uaho52Cs -V5qd70ID38ElGyLH7ac366biFypx9wdkqtie8H8qNjm+JUpHQnDqfxFEh8Pnny6K -ytLd8yvtvBibWXFOCxwPw1xCf63q+vMGGnrz6T9uv3L2JDUNhexuLycei8Uf6K6J -jvstGKOSD4uvA5USzn2Hf1yJrEAL5nfVAgMBAAGjezB5MAkGA1UdEwQCMAAwLAYJ -YIZIAYb4QgENBB8WHU9wZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMB0GA1Ud -DgQWBBSEo9T8PK4ZFCB6lCQ1Vheyop8sMjAfBgNVHSMEGDAWgBS1+Ah4ZG58tImL -KqLVX+xBKbeFUTANBgkqhkiG9w0BAQUFAAOBgQCv9LKixciXDP4p2grYGBoE3WMG -Du1S+seCrg+NGcRihtQEwGCwYZ8O2UHtqjKeBeKe8wLo8X+niUdjUO3pFftsQhg4 -iMViBxlEXtnGGi+UAm4m2F9SDsPmyHZ4BWxjD/n49HhU4ZFure6BySkx5l59oyPp -Yj+nsBrWq7aK4tD7sg== ------END CERTIFICATE----- -Bag Attributes - friendlyName: 1.2.840.113549.1.9.1=#160f636140677269646761696e2e636f6d,CN=ca,OU=Dev,O=GridGain,L=SPb,ST=SPb,C=RU -subject=/C=RU/ST=SPb/L=SPb/O=GridGain/OU=Dev/CN=ca/emailAddress=c...@gridgain.com -issuer=/C=RU/ST=SPb/L=SPb/O=GridGain/OU=Dev/CN=ca/emailAddress=c...@gridgain.com ------BEGIN CERTIFICATE----- -MIIDSTCCArKgAwIBAgIJAKmuj925215OMA0GCSqGSIb3DQEBBQUAMHcxCzAJBgNV -BAYTAlJVMQwwCgYDVQQIEwNTUGIxDDAKBgNVBAcTA1NQYjERMA8GA1UEChMIR3Jp -ZEdhaW4xDDAKBgNVBAsTA0RldjELMAkGA1UEAxMCY2ExHjAcBgkqhkiG9w0BCQEW -D2NhQGdyaWRnYWluLmNvbTAeFw0xMjA2MDkwNjU1MTJaFw0zMjA2MDQwNjU1MTJa -MHcxCzAJBgNVBAYTAlJVMQwwCgYDVQQIEwNTUGIxDDAKBgNVBAcTA1NQYjERMA8G -A1UEChMIR3JpZEdhaW4xDDAKBgNVBAsTA0RldjELMAkGA1UEAxMCY2ExHjAcBgkq -hkiG9w0BCQEWD2NhQGdyaWRnYWluLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAw -gYkCgYEAtd16DCObyM63NKF/cvRcE+8cr1dc3c7mSnTEQ61WfqPJ2QqsQAB6e+5+ -q9Np1SaJyqFTTag6483ibrU+DkGPGgEXndRHtQHQPbStWsf47DBBW2bMi6+bkPox -Cp6BhYO1DQUG5tP9CQ/g32mLQLB7LH0KtS1JcKpAClCjjWZC8b8CAwEAAaOB3DCB -2TAdBgNVHQ4EFgQUtfgIeGRufLSJiyqi1V/sQSm3hVEwgakGA1UdIwSBoTCBnoAU -tfgIeGRufLSJiyqi1V/sQSm3hVGhe6R5MHcxCzAJBgNVBAYTAlJVMQwwCgYDVQQI -EwNTUGIxDDAKBgNVBAcTA1NQYjERMA8GA1UEChMIR3JpZEdhaW4xDDAKBgNVBAsT -A0RldjELMAkGA1UEAxMCY2ExHjAcBgkqhkiG9w0BCQEWD2NhQGdyaWRnYWluLmNv -bYIJAKmuj925215OMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAhrzd -qusVLHO3wtyu0o+EAFyoDv5avCBTFsQLeDDPMyfDcEO6wfxhTanfH8C7gZc0rRnv -2nbkVbfortHIOfU2wch5gClju0cXSTIXSKOAWPIMp3HLxC/l+KpFo3epFz0rsMVB -M1ymOOdRDdAcTxcTTGY7WJXquEM3ZbT5Gh4RLDk= ------END CERTIFICATE----- http://git-wip-us.apache.org/repos/asf/ignite/blob/600542d5/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/KeyStore/server.pfx ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/KeyStore/server.pfx b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/KeyStore/server.pfx deleted file mode 100644 index 798e2f9..0000000 Binary files a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/KeyStore/server.pfx and /dev/null differ http://git-wip-us.apache.org/repos/asf/ignite/blob/600542d5/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/ssl.xml ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/ssl.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/ssl.xml new file mode 100644 index 0000000..5f3bfe6 --- /dev/null +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/ssl.xml @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans.xsd"> + <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration"> + <property name="localHost" value="127.0.0.1"/> + <property name="connectorConfiguration"><null/></property> + + <property name="igniteInstanceName" value="grid1"/> + + <property name="cacheConfiguration"> + <list> + <bean class="org.apache.ignite.configuration.CacheConfiguration"> + <property name="name" value="cache1"/> + <property name="rebalanceMode" value="SYNC"/> + </bean> + </list> + </property> + + <property name="discoverySpi"> + <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi"> + <property name="ipFinder"> + <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder"> + <property name="addresses"> + <list> + <!-- In distributed environment, replace with actual host IP address. --> + <value>127.0.0.1:47500</value> + </list> + </property> + </bean> + </property> + <property name="socketTimeout" value="300" /> + </bean> + </property> + + <!-- Ssl context. --> + <property name="sslContextFactory"> + <bean class="org.apache.ignite.ssl.SslContextFactory"> + <property name="keyStoreFilePath" value="Config/KeyStore/server.jks"/> + <property name="keyStorePassword" value="123456"/> + <property name="trustStoreFilePath" value="Config/KeyStore/trust.jks"/> + <property name="trustStorePassword" value="123456"/> + </bean> + </property> + </bean> +</beans> http://git-wip-us.apache.org/repos/asf/ignite/blob/600542d5/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/start-test-grid1-ssl.xml ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/start-test-grid1-ssl.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/start-test-grid1-ssl.xml deleted file mode 100644 index 5f3bfe6..0000000 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/start-test-grid1-ssl.xml +++ /dev/null @@ -1,65 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<!-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<beans xmlns="http://www.springframework.org/schema/beans" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.springframework.org/schema/beans - http://www.springframework.org/schema/beans/spring-beans.xsd"> - <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration"> - <property name="localHost" value="127.0.0.1"/> - <property name="connectorConfiguration"><null/></property> - - <property name="igniteInstanceName" value="grid1"/> - - <property name="cacheConfiguration"> - <list> - <bean class="org.apache.ignite.configuration.CacheConfiguration"> - <property name="name" value="cache1"/> - <property name="rebalanceMode" value="SYNC"/> - </bean> - </list> - </property> - - <property name="discoverySpi"> - <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi"> - <property name="ipFinder"> - <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder"> - <property name="addresses"> - <list> - <!-- In distributed environment, replace with actual host IP address. --> - <value>127.0.0.1:47500</value> - </list> - </property> - </bean> - </property> - <property name="socketTimeout" value="300" /> - </bean> - </property> - - <!-- Ssl context. --> - <property name="sslContextFactory"> - <bean class="org.apache.ignite.ssl.SslContextFactory"> - <property name="keyStoreFilePath" value="Config/KeyStore/server.jks"/> - <property name="keyStorePassword" value="123456"/> - <property name="trustStoreFilePath" value="Config/KeyStore/trust.jks"/> - <property name="trustStorePassword" value="123456"/> - </bean> - </property> - </bean> -</beans> http://git-wip-us.apache.org/repos/asf/ignite/blob/600542d5/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/start-test-grid1.xml ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/start-test-grid1.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/start-test-grid1.xml deleted file mode 100644 index 6f113e9..0000000 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/start-test-grid1.xml +++ /dev/null @@ -1,55 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<!-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<beans xmlns="http://www.springframework.org/schema/beans" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.springframework.org/schema/beans - http://www.springframework.org/schema/beans/spring-beans.xsd"> - <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration"> - <property name="localHost" value="127.0.0.1"/> - <property name="connectorConfiguration"><null/></property> - - <property name="igniteInstanceName" value="grid1"/> - - <property name="cacheConfiguration"> - <list> - <bean class="org.apache.ignite.configuration.CacheConfiguration"> - <property name="name" value="cache1"/> - <property name="rebalanceMode" value="SYNC"/> - </bean> - </list> - </property> - - <property name="discoverySpi"> - <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi"> - <property name="ipFinder"> - <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder"> - <property name="addresses"> - <list> - <!-- In distributed environment, replace with actual host IP address. --> - <value>127.0.0.1:47500</value> - </list> - </property> - </bean> - </property> - <property name="socketTimeout" value="300" /> - </bean> - </property> - </bean> -</beans> http://git-wip-us.apache.org/repos/asf/ignite/blob/600542d5/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/start-test-grid2.xml ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/start-test-grid2.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/start-test-grid2.xml deleted file mode 100644 index 9b7ae31..0000000 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/start-test-grid2.xml +++ /dev/null @@ -1,46 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<!-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<beans xmlns="http://www.springframework.org/schema/beans" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.springframework.org/schema/beans - http://www.springframework.org/schema/beans/spring-beans.xsd"> - <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration"> - <property name="localHost" value="127.0.0.1"/> - <property name="connectorConfiguration"><null/></property> - - <property name="igniteInstanceName" value="grid2"/> - - <property name="discoverySpi"> - <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi"> - <property name="ipFinder"> - <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder"> - <property name="addresses"> - <list> - <!-- In distributed environment, replace with actual host IP address. --> - <value>127.0.0.1:47500</value> - </list> - </property> - </bean> - </property> - <property name="socketTimeout" value="300" /> - </bean> - </property> - </bean> -</beans> http://git-wip-us.apache.org/repos/asf/ignite/blob/600542d5/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/start-test-grid3.xml ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/start-test-grid3.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/start-test-grid3.xml deleted file mode 100644 index f14f15b..0000000 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/start-test-grid3.xml +++ /dev/null @@ -1,44 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<!-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<beans xmlns="http://www.springframework.org/schema/beans" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.springframework.org/schema/beans - http://www.springframework.org/schema/beans/spring-beans.xsd"> - <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration"> - <property name="localHost" value="127.0.0.1"/> - <property name="connectorConfiguration"><null/></property> - - <property name="discoverySpi"> - <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi"> - <property name="ipFinder"> - <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder"> - <property name="addresses"> - <list> - <!-- In distributed environment, replace with actual host IP address. --> - <value>127.0.0.1:47500</value> - </list> - </property> - </bean> - </property> - <property name="socketTimeout" value="300" /> - </bean> - </property> - </bean> -</beans> http://git-wip-us.apache.org/repos/asf/ignite/blob/600542d5/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs index 412f4bc..c4df141 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs @@ -38,7 +38,7 @@ namespace Apache.Ignite.Core.Tests using Apache.Ignite.Core.Cache.Eviction; using Apache.Ignite.Core.Cache.Expiry; using Apache.Ignite.Core.Cache.Store; - using Apache.Ignite.Core.Cluster.Ssl; + using Apache.Ignite.Core.Ssl; using Apache.Ignite.Core.Common; using Apache.Ignite.Core.Communication.Tcp; using Apache.Ignite.Core.Configuration; http://git-wip-us.apache.org/repos/asf/ignite/blob/600542d5/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Ssl/SslConfigurationTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Ssl/SslConfigurationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Ssl/SslConfigurationTest.cs index 0b1b6db..b35002e 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Ssl/SslConfigurationTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Ssl/SslConfigurationTest.cs @@ -18,15 +18,15 @@ namespace Apache.Ignite.Core.Tests.Ssl { using System.Linq; - using Apache.Ignite.Core.Cluster.Ssl; + using Apache.Ignite.Core.Ssl; using Apache.Ignite.Core.Common; using NUnit.Framework; /// <summary> - /// Ignite start/stop tests. + /// SSL configuration tests. /// </summary> [Category(TestUtils.CategoryIntensive)] - public class SslConfigurationTest + public class SslConfigurationTest : TestBase { /** Test Password. */ private const string Password = "123456"; @@ -43,7 +43,6 @@ namespace Apache.Ignite.Core.Tests.Ssl [TearDown] public void TearDown() { - TestUtils.KillProcesses(); Ignition.StopAll(true); } @@ -130,10 +129,9 @@ namespace Apache.Ignite.Core.Tests.Ssl [Test] public void TestStartWithConfigPath() { - var cfg = new IgniteConfiguration + var cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration()) { - SpringConfigUrl = @"config/start-test-grid1-ssl.xml", - JvmClasspath = TestUtils.CreateTestClasspath() + SpringConfigUrl = @"Config/ssl.xml", }; var grid = Ignition.Start(cfg); @@ -159,18 +157,13 @@ namespace Apache.Ignite.Core.Tests.Ssl [Test] public void TestTwoServers() { - var cfg1 = new IgniteConfiguration + var cfg1 = new IgniteConfiguration(TestUtils.GetTestConfiguration()) { - SpringConfigUrl = @"config/start-test-grid1-ssl.xml", - JvmOptions = TestUtils.TestJavaOptions(), - JvmClasspath = TestUtils.CreateTestClasspath(), + SpringConfigUrl = @"Config/ssl.xml" }; - var cfg2 = new IgniteConfiguration + var cfg2 = new IgniteConfiguration(TestUtils.GetTestConfiguration(name: "grid2")) { - SpringConfigUrl = @"config/start-test-grid2.xml", - JvmOptions = TestUtils.TestJavaOptions(), - JvmClasspath = TestUtils.CreateTestClasspath(), SslContextFactory = GetSslContextFactory() }; @@ -195,8 +188,6 @@ namespace Apache.Ignite.Core.Tests.Ssl Assert.AreEqual(2, grid1.GetCluster().GetNodes().Count); Assert.AreEqual(2, grid2.GetCluster().GetNodes().Count); - - Ignition.StopAll(true); } /// <summary> @@ -205,18 +196,10 @@ namespace Apache.Ignite.Core.Tests.Ssl [Test] public void TestSslConfigurationMismatch() { - var cfg = new IgniteConfiguration - { - SpringConfigUrl = @"config/start-test-grid1.xml", - JvmOptions = TestUtils.TestJavaOptions(), - JvmClasspath = TestUtils.CreateTestClasspath(), - }; + var cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration(name: "grid1")); - var sslCfg = new IgniteConfiguration + var sslCfg = new IgniteConfiguration(TestUtils.GetTestConfiguration(name: "grid2")) { - SpringConfigUrl = @"config/start-test-grid2.xml", - JvmOptions = TestUtils.TestJavaOptions(), - JvmClasspath = TestUtils.CreateTestClasspath(), SslContextFactory = GetSslContextFactory() }; @@ -235,52 +218,40 @@ namespace Apache.Ignite.Core.Tests.Ssl @"Was remote cluster configured with SSL?")); } - /// <summary> /// Tests the client-server mode. /// </summary> [Test] - public void TestClientServer([Values(null, TrustStoreFilePath)] string trustStoreFilePath) + public void TestClientServer() { var factory = GetSslContextFactory(); - factory.TrustStoreFilePath = trustStoreFilePath; - var servCfg = new IgniteConfiguration(TestUtils.GetTestConfiguration()) + var servCfg = new IgniteConfiguration(TestUtils.GetTestConfiguration(name: "grid1")) { - SpringConfigUrl = @"config/start-test-grid1.xml", SslContextFactory = factory }; - var clientCfg = new IgniteConfiguration(TestUtils.GetTestConfiguration()) + var clientCfg = new IgniteConfiguration(TestUtils.GetTestConfiguration(name: "grid2")) { - SpringConfigUrl = @"config/start-test-grid2.xml", - SslContextFactory = factory + SslContextFactory = factory, + ClientMode = true }; - try + using (var serv = Ignition.Start(servCfg)) // start server-mode ignite first { - using (var serv = Ignition.Start(servCfg)) // start server-mode ignite first - { - Assert.IsFalse(serv.GetCluster().GetLocalNode().IsClient); - - Ignition.ClientMode = true; + Assert.IsFalse(serv.GetCluster().GetLocalNode().IsClient); - using (var grid = Ignition.Start(clientCfg)) - { - Assert.IsTrue(grid.GetCluster().GetLocalNode().IsClient); + using (var grid = Ignition.Start(clientCfg)) + { + Assert.IsTrue(grid.GetCluster().GetLocalNode().IsClient); - Assert.AreEqual(2, grid.GetCluster().GetNodes().Count); - Assert.AreEqual(2, serv.GetCluster().GetNodes().Count); + Assert.AreEqual(2, grid.GetCluster().GetNodes().Count); + Assert.AreEqual(2, serv.GetCluster().GetNodes().Count); - Assert.AreEqual(1, grid.GetCluster().ForServers().GetNodes().Count); - Assert.AreEqual(1, serv.GetCluster().ForServers().GetNodes().Count); - } + Assert.AreEqual(1, grid.GetCluster().ForServers().GetNodes().Count); + Assert.AreEqual(1, serv.GetCluster().ForServers().GetNodes().Count); } } - finally - { - Ignition.ClientMode = false; - } } } } http://git-wip-us.apache.org/repos/asf/ignite/blob/600542d5/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.DotNetCore.csproj ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.DotNetCore.csproj b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.DotNetCore.csproj index 795dc18..19fd059 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.DotNetCore.csproj +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.DotNetCore.csproj @@ -1,15 +1,12 @@ -<Project Sdk="Microsoft.NET.Sdk"> - +<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netcoreapp2.0</TargetFramework> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> - <GenerateAssemblyInfo>false</GenerateAssemblyInfo> - <AssemblyName>Apache.Ignite.Core</AssemblyName> - <RootNamespace>Apache.Ignite.Core</RootNamespace> - </PropertyGroup> - + <GenerateAssemblyInfo>false</GenerateAssemblyInfo> + <AssemblyName>Apache.Ignite.Core</AssemblyName> + <RootNamespace>Apache.Ignite.Core</RootNamespace> + </PropertyGroup> <ItemGroup> <PackageReference Include="System.Configuration.ConfigurationManager" Version="4.4.0" /> </ItemGroup> - -</Project> +</Project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/600542d5/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj index 80b15c1..a283d94 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj @@ -70,7 +70,7 @@ <Compile Include="Client\IgniteClientException.cs" /> <Compile Include="Client\IIgniteClient.cs" /> <Compile Include="Common\ExceptionFactory.cs" /> - <Compile Include="Cluster\Ssl\ISslContextFactory.cs" /> + <Compile Include="Ssl\ISslContextFactory.cs" /> <Compile Include="Configuration\Package-Info.cs" /> <Compile Include="Configuration\ClientConnectorConfiguration.cs" /> <Compile Include="Datastream\DataStreamerDefaults.cs" /> @@ -94,8 +94,8 @@ <Compile Include="Client\ClientStatusCode.cs" /> <Compile Include="Events\LocalEventListener.cs" /> <Compile Include="Impl\Cluster\BaselineNode.cs" /> - <Compile Include="Cluster\Ssl\SslContextFactory.cs" /> - <Compile Include="Impl\Cluster\Ssl\SslFactorySerializer.cs" /> + <Compile Include="Ssl\SslContextFactory.cs" /> + <Compile Include="Impl\Ssl\SslFactorySerializer.cs" /> <Compile Include="Impl\DataStorageMetrics.cs" /> <Compile Include="Impl\IIgniteInternal.cs" /> <Compile Include="Impl\Client\Cache\CacheClient.cs" /> http://git-wip-us.apache.org/repos/asf/ignite/blob/600542d5/modules/platforms/dotnet/Apache.Ignite.Core/Cluster/Ssl/ISslContextFactory.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cluster/Ssl/ISslContextFactory.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cluster/Ssl/ISslContextFactory.cs deleted file mode 100644 index 6de1038..0000000 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Cluster/Ssl/ISslContextFactory.cs +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -namespace Apache.Ignite.Core.Cluster.Ssl -{ - /// <summary> - /// Interface for SSL Context Factory. - /// </summary> - public interface ISslContextFactory - { - /// <summary> - /// Path to key store file. - /// </summary> - string KeyStoreFilePath { get; set; } - - /// <summary> - /// Key store password. - /// </summary> - string KeyStorePassword { get; set; } - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/600542d5/modules/platforms/dotnet/Apache.Ignite.Core/Cluster/Ssl/SslContextFactory.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cluster/Ssl/SslContextFactory.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cluster/Ssl/SslContextFactory.cs deleted file mode 100644 index cfde71f..0000000 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Cluster/Ssl/SslContextFactory.cs +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -namespace Apache.Ignite.Core.Cluster.Ssl -{ - using System; - using System.Diagnostics; - using Apache.Ignite.Core.Binary; - - /// <summary> - /// This SSL context factory that provides ssl context configuration with specified key and trust stores. - /// </summary> - [Serializable] - public class SslContextFactory : ISslContextFactory - { - /// <summary> Default value for <see cref="KeyAlgorithm"/>. </summary> - public const string DefaultKeyAlgorithm = "SunX509"; - - /// <summary> Default value for <see cref="KeyStoreType"/> and <see cref="TrustStoreType"/>. </summary> - public const string DefaultStoreType = "JKS"; - - /// <summary> Default value for <see cref="Protocol"/>. </summary> - public const string DefaultSslProtocol = "TLS"; - - /// <summary> - /// Key manager algorithm that will be used to create a key manager. Notice that in most cased default value - /// <see cref="DefaultKeyAlgorithm"/> suites well, however, on Android platform this value need to be set - /// to X509. - /// </summary> - public string KeyAlgorithm { get; set; } - - /// <summary> - /// Key store type used for context creation. <see cref="DefaultStoreType"/> by default. - /// </summary> - public string KeyStoreType { get; set; } - - /// <inheritdoc /> - public string KeyStoreFilePath { get; set; } - - /// <inheritdoc /> - public string KeyStorePassword { get; set; } - - /// <summary> - /// Protocol for secure transport. <see cref="DefaultSslProtocol"/> by default. - /// </summary> - public string Protocol { get; set; } - - /// <summary> - /// Path to trust store file. Could be null if any SSL Certificate should be accepted/succeed. - /// </summary> - public string TrustStoreFilePath { get; set; } - - /// <summary> - /// Trust store password. - /// </summary> - public string TrustStorePassword { get; set; } - - /// <summary> - /// Trust store type used for context creation. <see cref="DefaultStoreType"/> by default. - /// </summary> - public string TrustStoreType { get; set; } - - /// <summary> - /// Creates a new instance of the <see cref="SslContextFactory"/> class. - /// </summary> - /// <param name="keyStoreFilePath">Path to key store file.</param> - /// <param name="keyStorePassword">Key store password.</param> - /// <param name="trustStoreFilePath">Path to trust store file.</param> - /// <param name="trustStorePassword">Trust store password.</param> - public SslContextFactory(string keyStoreFilePath, string keyStorePassword, - string trustStoreFilePath, string trustStorePassword) - : this(keyStoreFilePath, keyStorePassword) - { - TrustStoreFilePath = trustStoreFilePath; - TrustStorePassword = trustStorePassword; - } - - /// <summary> - /// Creates a new instance of the <see cref="SslContextFactory"/> class. - /// Trust store file is not set that results in accepting any SSL Certificate. - /// </summary> - /// <param name="keyStoreFilePath">Path to key store file.</param> - /// <param name="keyStorePassword">Key store password.</param> - public SslContextFactory(string keyStoreFilePath, string keyStorePassword) : this() - { - KeyStoreFilePath = keyStoreFilePath; - KeyStorePassword = keyStorePassword; - } - - /// <summary> - /// Default constructor. - /// </summary> - public SslContextFactory() - { - KeyAlgorithm = DefaultKeyAlgorithm; - TrustStoreType = DefaultStoreType; - KeyStoreType = DefaultStoreType; - Protocol = DefaultSslProtocol; - } - - /// <summary> - /// Initializes a new instance of the <see cref="SslContextFactory"/> class. - /// </summary> - /// <param name="reader">The reader.</param> - internal SslContextFactory(IBinaryRawReader reader) - { - Read(reader); - } - - /// <summary> - /// Reads data into this instance from the specified reader. - /// </summary> - /// <param name="reader">The reader.</param> - private void Read(IBinaryRawReader reader) - { - Debug.Assert(reader != null); - - KeyAlgorithm = reader.ReadString(); - - KeyStoreType = reader.ReadString(); - KeyStoreFilePath = reader.ReadString(); - KeyStorePassword = reader.ReadString(); - - Protocol = reader.ReadString(); - - TrustStoreType = reader.ReadString(); - TrustStoreFilePath = reader.ReadString(); - TrustStorePassword = reader.ReadString(); - } - - /// <summary> - /// Writes this instance to the specified writer. - /// </summary> - /// <param name="writer">The writer.</param> - internal void Write(IBinaryRawWriter writer) - { - Debug.Assert(writer != null); - - writer.WriteString(KeyAlgorithm); - - writer.WriteString(KeyStoreType); - writer.WriteString(KeyStoreFilePath); - writer.WriteString(KeyStorePassword); - - writer.WriteString(Protocol); - - writer.WriteString(TrustStoreType); - writer.WriteString(TrustStoreFilePath); - writer.WriteString(TrustStorePassword); - } - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/600542d5/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs index 5cf5f64..e387634 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs @@ -30,7 +30,6 @@ namespace Apache.Ignite.Core using Apache.Ignite.Core.Cache; using Apache.Ignite.Core.Cache.Configuration; using Apache.Ignite.Core.Cluster; - using Apache.Ignite.Core.Cluster.Ssl; using Apache.Ignite.Core.Common; using Apache.Ignite.Core.Communication; using Apache.Ignite.Core.Communication.Tcp; @@ -43,12 +42,13 @@ namespace Apache.Ignite.Core using Apache.Ignite.Core.Events; using Apache.Ignite.Core.Impl; using Apache.Ignite.Core.Impl.Binary; - using Apache.Ignite.Core.Impl.Cluster.Ssl; using Apache.Ignite.Core.Impl.Common; + using Apache.Ignite.Core.Impl.Ssl; using Apache.Ignite.Core.Lifecycle; using Apache.Ignite.Core.Log; using Apache.Ignite.Core.PersistentStore; using Apache.Ignite.Core.Plugin; + using Apache.Ignite.Core.Ssl; using Apache.Ignite.Core.Transactions; using BinaryReader = Apache.Ignite.Core.Impl.Binary.BinaryReader; using BinaryWriter = Apache.Ignite.Core.Impl.Binary.BinaryWriter; http://git-wip-us.apache.org/repos/asf/ignite/blob/600542d5/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/Ssl/SslFactorySerializer.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/Ssl/SslFactorySerializer.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/Ssl/SslFactorySerializer.cs deleted file mode 100644 index e117479..0000000 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/Ssl/SslFactorySerializer.cs +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -namespace Apache.Ignite.Core.Impl.Cluster.Ssl -{ - using System.Diagnostics; - using Apache.Ignite.Core.Binary; - using Apache.Ignite.Core.Cluster.Ssl; - - /// <summary> - /// Serializer/deserializer for <see cref="ISslContextFactory"/>. - /// </summary> - internal static class SslFactorySerializer - { - /// <summary> - /// Writes the SSL context factory. - /// </summary> - internal static void Write(IBinaryRawWriter writer, ISslContextFactory factory) - { - Debug.Assert(writer != null); - - var contextFactory = factory as SslContextFactory; - - if (contextFactory != null) - { - writer.WriteBoolean(true); - - contextFactory.Write(writer); - } - else - { - writer.WriteBoolean(false); - } - } - - /// <summary> - /// Reads the SSL context factory. - /// </summary> - internal static ISslContextFactory Read(IBinaryRawReader reader) - { - return reader.ReadBoolean() ? new SslContextFactory(reader) : null; - } - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/600542d5/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ssl/SslFactorySerializer.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ssl/SslFactorySerializer.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ssl/SslFactorySerializer.cs new file mode 100644 index 0000000..10ab510 --- /dev/null +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ssl/SslFactorySerializer.cs @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Apache.Ignite.Core.Impl.Ssl +{ + using System; + using System.Diagnostics; + using Apache.Ignite.Core.Binary; + using Apache.Ignite.Core.Ssl; + + /// <summary> + /// Serializer/deserializer for <see cref="ISslContextFactory"/>. + /// </summary> + internal static class SslFactorySerializer + { + /// <summary> + /// Writes the SSL context factory. + /// </summary> + internal static void Write(IBinaryRawWriter writer, ISslContextFactory factory) + { + Debug.Assert(writer != null); + + var contextFactory = factory as SslContextFactory; + + if (contextFactory != null) + { + writer.WriteBoolean(true); + + contextFactory.Write(writer); + } + else if (factory != null) + { + throw new NotSupportedException( + string.Format("Unsupported {0}: {1}. Only predefined implementations are supported: {2}", + typeof(ISslContextFactory).Name, factory.GetType(), typeof(SslContextFactory).Name)); + } + else + { + writer.WriteBoolean(false); + } + } + + /// <summary> + /// Reads the SSL context factory. + /// </summary> + internal static ISslContextFactory Read(IBinaryRawReader reader) + { + return reader.ReadBoolean() ? new SslContextFactory(reader) : null; + } + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/600542d5/modules/platforms/dotnet/Apache.Ignite.Core/Ssl/ISslContextFactory.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Ssl/ISslContextFactory.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Ssl/ISslContextFactory.cs new file mode 100644 index 0000000..3eba38d --- /dev/null +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Ssl/ISslContextFactory.cs @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Apache.Ignite.Core.Ssl +{ + using System.Diagnostics.CodeAnalysis; + + /// <summary> + /// Represents an SSL Context Factory. + /// <para /> + /// Only predefined implementation is supported for now: <see cref="SslContextFactory"/>. + /// </summary> + [SuppressMessage("Microsoft.Design", "CA1040:AvoidEmptyInterfaces")] + public interface ISslContextFactory + { + // No-op. + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/600542d5/modules/platforms/dotnet/Apache.Ignite.Core/Ssl/SslContextFactory.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Ssl/SslContextFactory.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Ssl/SslContextFactory.cs new file mode 100644 index 0000000..bb5c7a0 --- /dev/null +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Ssl/SslContextFactory.cs @@ -0,0 +1,166 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Apache.Ignite.Core.Ssl +{ + using System; + using System.Diagnostics; + using Apache.Ignite.Core.Binary; + + /// <summary> + /// This SSL context factory that provides ssl context configuration with specified key and trust stores. + /// </summary> + [Serializable] + public class SslContextFactory : ISslContextFactory + { + /// <summary> Default value for <see cref="KeyAlgorithm"/>. </summary> + public const string DefaultKeyAlgorithm = "SunX509"; + + /// <summary> Default value for <see cref="KeyStoreType"/> and <see cref="TrustStoreType"/>. </summary> + public const string DefaultStoreType = "JKS"; + + /// <summary> Default value for <see cref="Protocol"/>. </summary> + public const string DefaultSslProtocol = "TLS"; + + /// <summary> + /// Key manager algorithm that will be used to create a key manager. Notice that in most cased default value + /// <see cref="DefaultKeyAlgorithm"/> suites well, however, on Android platform this value need to be set + /// to X509. + /// </summary> + public string KeyAlgorithm { get; set; } + + /// <summary> + /// Key store type used for context creation. <see cref="DefaultStoreType"/> by default. + /// </summary> + public string KeyStoreType { get; set; } + + /// <inheritdoc /> + public string KeyStoreFilePath { get; set; } + + /// <inheritdoc /> + public string KeyStorePassword { get; set; } + + /// <summary> + /// Protocol for secure transport. <see cref="DefaultSslProtocol"/> by default. + /// </summary> + public string Protocol { get; set; } + + /// <summary> + /// Path to trust store file. Could be null if any SSL Certificate should be accepted/succeed. + /// </summary> + public string TrustStoreFilePath { get; set; } + + /// <summary> + /// Trust store password. + /// </summary> + public string TrustStorePassword { get; set; } + + /// <summary> + /// Trust store type used for context creation. <see cref="DefaultStoreType"/> by default. + /// </summary> + public string TrustStoreType { get; set; } + + /// <summary> + /// Creates a new instance of the <see cref="SslContextFactory"/> class. + /// </summary> + /// <param name="keyStoreFilePath">Path to key store file.</param> + /// <param name="keyStorePassword">Key store password.</param> + /// <param name="trustStoreFilePath">Path to trust store file.</param> + /// <param name="trustStorePassword">Trust store password.</param> + public SslContextFactory(string keyStoreFilePath, string keyStorePassword, + string trustStoreFilePath, string trustStorePassword) + : this(keyStoreFilePath, keyStorePassword) + { + TrustStoreFilePath = trustStoreFilePath; + TrustStorePassword = trustStorePassword; + } + + /// <summary> + /// Creates a new instance of the <see cref="SslContextFactory"/> class. + /// Trust store file is not set that results in accepting any SSL Certificate. + /// </summary> + /// <param name="keyStoreFilePath">Path to key store file.</param> + /// <param name="keyStorePassword">Key store password.</param> + public SslContextFactory(string keyStoreFilePath, string keyStorePassword) : this() + { + KeyStoreFilePath = keyStoreFilePath; + KeyStorePassword = keyStorePassword; + } + + /// <summary> + /// Default constructor. + /// </summary> + public SslContextFactory() + { + KeyAlgorithm = DefaultKeyAlgorithm; + TrustStoreType = DefaultStoreType; + KeyStoreType = DefaultStoreType; + Protocol = DefaultSslProtocol; + } + + /// <summary> + /// Initializes a new instance of the <see cref="SslContextFactory"/> class. + /// </summary> + /// <param name="reader">The reader.</param> + internal SslContextFactory(IBinaryRawReader reader) + { + Read(reader); + } + + /// <summary> + /// Reads data into this instance from the specified reader. + /// </summary> + /// <param name="reader">The reader.</param> + private void Read(IBinaryRawReader reader) + { + Debug.Assert(reader != null); + + KeyAlgorithm = reader.ReadString(); + + KeyStoreType = reader.ReadString(); + KeyStoreFilePath = reader.ReadString(); + KeyStorePassword = reader.ReadString(); + + Protocol = reader.ReadString(); + + TrustStoreType = reader.ReadString(); + TrustStoreFilePath = reader.ReadString(); + TrustStorePassword = reader.ReadString(); + } + + /// <summary> + /// Writes this instance to the specified writer. + /// </summary> + /// <param name="writer">The writer.</param> + internal void Write(IBinaryRawWriter writer) + { + Debug.Assert(writer != null); + + writer.WriteString(KeyAlgorithm); + + writer.WriteString(KeyStoreType); + writer.WriteString(KeyStoreFilePath); + writer.WriteString(KeyStorePassword); + + writer.WriteString(Protocol); + + writer.WriteString(TrustStoreType); + writer.WriteString(TrustStoreFilePath); + writer.WriteString(TrustStorePassword); + } + } +}