diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..d6d8997 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,124 @@ +name: .NET + +on: + workflow_dispatch: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + runs-on: windows-latest + env: + LINUX_DISTO: Ubuntu-20.04 + FTP_USER: fullgx + FTP_PASS: fullgx + TRUST_STORE_PASS: fullgx + + steps: + - uses: Vampire/setup-wsl@v1 + with: + distribution: ${{env.LINUX_DISTO}} + additional-packages: + vsftpd + + - name: Setup user + shell: wsl-bash {0} + run: | + sudo useradd -m -p $(perl -e 'print crypt($ARGV[0], "password")' '${{env.FTP_PASS}}') ${{env.FTP_USER}} + echo ${{env.FTP_USER}} >> /etc/vsftpd.userlist + + - name: Setup SSH + shell: wsl-bash {0} + run: | + sudo apt-get -qq -y purge openssh-server + sudo apt-get -qq -y install openssh-server + echo "PasswordAuthentication yes" >> /etc/ssh/sshd_config + sudo service ssh --full-restart + + - uses: Vampire/setup-wsl@v1 + with: + distribution: ${{env.LINUX_DISTO}} + wsl-shell-command: bash -c "sudo -u ${{env.FTP_USER}} bash --noprofile --norc -euo pipefail '{0}'" + + - name: Setup certificates + shell: wsl-bash {0} + run: | + ssh-keygen -b 2048 -t rsa -m pem -f ~/.ssh/id_rsa -q -N "" + ssh-keygen -f ~/.ssh/id_rsa -m pem -e > /tmp/id_rsa.pem + + cat ~/.ssh/id_rsa > /tmp/vsftpd1.pem + cat /tmp/id_rsa.pem >> /tmp/vsftpd1.pem + + openssl req -new -x509 -key ~/.ssh/id_rsa -days 365 -subj "/CN=GeneXus" -out /tmp/ftp.cer + openssl pkcs12 -export -in /tmp/ftp.cer -inkey ~/.ssh/id_rsa -out /tmp/ftp_cert.pfx -password pass:${{env.TRUST_STORE_PASS}} + + ssh-keyscan -H 127.0.0.1 >> /tmp/known_hosts + + echo '::set-output name=BASE_64_ID_RSA::$(cat ~/.ssh/id_rsa | base64)' + echo '::set-output name=BASE_64_PFX_CERT::$(cat /tmp/ftp_cert.pfx | base64)' + echo '::set-output name=BASE_64_KNOWN_HOSTS::$(cat /tmp/known_hosts | base64)' + + - uses: Vampire/setup-wsl@v1 + with: + distribution: ${{env.LINUX_DISTO}} + wsl-shell-command: bash -c "bash --noprofile --norc -euo pipefail '{0}'" + + - name: Configure vsftpd + shell: wsl-bash {0} + run: | + mv /tmp/vsftpd1.pem /etc/ssl/private/vsftpd1.pem + mkdir -p /etc/vsftpd/ + + cat < /etc/vsftpd/vsftpd.conf + listen=NO + listen_ipv6=YES + anonymous_enable=NO + local_enable=YES + write_enable=YES + local_umask=022 + dirmessage_enable=YES + use_localtime=YES + xferlog_enable=YES + connect_from_port_20=YES + chroot_local_user=YES + secure_chroot_dir=/var/run/vsftpd/empty + pam_service_name=ftp + pasv_enable=Yes + pasv_min_port=10000 + pasv_max_port=11000 + user_sub_token=$USER + local_root=/home/$USER/ftp + userlist_enable=YES + userlist_file=/etc/vsftpd.userlist + userlist_deny=NO + rsa_cert_file=/etc/ssl/private/vsftpd1.pem + rsa_private_key_file=/etc/ssl/private/vsftpd1.pem + ssl_enable=YES + allow_anon_ssl=NO + force_local_data_ssl=YES + force_local_logins_ssl=YES + ssl_tlsv1=YES + ssl_sslv2=YES + ssl_sslv3=YES + require_ssl_reuse=NO + debug_ssl=YES + ssl_ciphers=HIGH + seccomp_sandbox=NO + isolate_network=NO + EOF + + sudo /etc/init.d/vsftpd start + + - uses: actions/checkout@v2 + + - name: Setup .NET + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 5.0.x + + - name: Restore dependencies + run: dotnet restore + - name: Build + run: dotnet build --no-restore diff --git a/.gitignore b/.gitignore index 1a21554..a03b360 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ .vs/ packages/ -test/ dotnet/dotnetframework/SecurityAPICommons/bin/ dotnet/dotnetframework/SecurityAPICommons/obj/ dotnet/dotnetframework/GeneXusXmlSignature/obj/ @@ -26,40 +25,19 @@ dotnet/dotnetcore/GeneXusJWTNetCore/obj/ dotnet/dotnetcore/GeneXusJWTNetCore/bin/ dotnet/dotnetcore/GeneXusCryptographyNetCore/obj/ dotnet/dotnetcore/GeneXusCryptographyNetCore/bin/ -dotnet/dotnetcore/GeneXusFtpsNetCore/obj/GeneXusFtpsNetCore.csproj.nuget.cache -dotnet/dotnetcore/GeneXusFtpsNetCore/obj/GeneXusFtpsNetCore.csproj.nuget.dgspec.json -dotnet/dotnetcore/GeneXusFtpsNetCore/obj/GeneXusFtpsNetCore.csproj.nuget.g.props -dotnet/dotnetcore/GeneXusFtpsNetCore/obj/GeneXusFtpsNetCore.csproj.nuget.g.targets -dotnet/dotnetcore/GeneXusFtpsNetCore/obj/project.assets.json -dotnet/dotnetcore/GeneXusFtpsNetCore/obj/Debug/netcoreapp3.1/GeneXusFtpsNetCore.AssemblyInfo.cs -dotnet/dotnetcore/GeneXusFtpsNetCore/obj/Debug/netcoreapp3.1/GeneXusFtpsNetCore.AssemblyInfoInputs.cache -dotnet/dotnetcore/GeneXusFtpsNetCore/obj/Debug/netcoreapp3.1/GeneXusFtpsNetCore.assets.cache -dotnet/dotnetcore/GeneXusFtpsNetCore/obj/Debug/netcoreapp3.1/GeneXusFtpsNetCore.csproj.CopyComplete -dotnet/dotnetcore/GeneXusFtpsNetCore/obj/Debug/netcoreapp3.1/GeneXusFtpsNetCore.csproj.FileListAbsolute.txt -dotnet/dotnetcore/GeneXusFtpsNetCore/obj/Debug/netcoreapp3.1/GeneXusFtpsNetCore.csprojAssemblyReference.cache -dotnet/dotnetcore/GeneXusFtpsNetCore/obj/Debug/netcoreapp3.1/GeneXusFtpsNetCoreImpl.dll -dotnet/dotnetcore/GeneXusFtpsNetCore/obj/Debug/netcoreapp3.1/GeneXusFtpsNetCoreImpl.pdb -dotnet/dotnetcore/GeneXusFtpsNetCore/obj/Release/netcoreapp3.1/GeneXusFtpsNetCore.AssemblyInfo.cs -dotnet/dotnetcore/GeneXusFtpsNetCore/obj/Release/netcoreapp3.1/GeneXusFtpsNetCore.AssemblyInfoInputs.cache -dotnet/dotnetcore/GeneXusFtpsNetCore/obj/Release/netcoreapp3.1/GeneXusFtpsNetCore.assets.cache -dotnet/dotnetcore/GeneXusFtpsNetCore/obj/Release/netcoreapp3.1/GeneXusFtpsNetCore.csproj.CopyComplete -dotnet/dotnetcore/GeneXusFtpsNetCore/obj/Release/netcoreapp3.1/GeneXusFtpsNetCore.csproj.FileListAbsolute.txt -dotnet/dotnetcore/GeneXusFtpsNetCore/obj/Release/netcoreapp3.1/GeneXusFtpsNetCore.csprojAssemblyReference.cache -dotnet/dotnetcore/GeneXusFtpsNetCore/obj/Release/netcoreapp3.1/GeneXusFtpsNetCoreImpl.dll -dotnet/dotnetcore/GeneXusFtpsNetCore/obj/Release/netcoreapp3.1/GeneXusFtpsNetCoreImpl.pdb -dotnet/dotnetcore/GeneXusFtpsNetCore/bin/Debug/netcoreapp3.1/GeneXusFtpsNetCoreImpl.deps.json -dotnet/dotnetcore/GeneXusFtpsNetCore/bin/Debug/netcoreapp3.1/GeneXusFtpsNetCoreImpl.dll -dotnet/dotnetcore/GeneXusFtpsNetCore/bin/Debug/netcoreapp3.1/GeneXusFtpsNetCoreImpl.pdb -dotnet/dotnetcore/GeneXusFtpsNetCore/bin/Debug/netcoreapp3.1/GeneXusSecurityAPICommonsNetCoreImpl.dll -dotnet/dotnetcore/GeneXusFtpsNetCore/bin/Debug/netcoreapp3.1/GeneXusSecurityAPICommonsNetCoreImpl.pdb -dotnet/dotnetcore/GeneXusFtpsNetCore/bin/Release/netcoreapp3.1/GeneXusFtpsNetCoreImpl.deps.json -dotnet/dotnetcore/GeneXusFtpsNetCore/bin/Release/netcoreapp3.1/GeneXusFtpsNetCoreImpl.dll -dotnet/dotnetcore/GeneXusFtpsNetCore/bin/Release/netcoreapp3.1/GeneXusFtpsNetCoreImpl.pdb -dotnet/dotnetcore/GeneXusFtpsNetCore/bin/Release/netcoreapp3.1/GeneXusSecurityAPICommonsNetCoreImpl.dll -dotnet/dotnetcore/GeneXusFtpsNetCore/bin/Release/netcoreapp3.1/GeneXusSecurityAPICommonsNetCoreImpl.pdb +dotnet/dotnetcore/GeneXusFtpsNetCore/obj/ +dotnet/dotnetcore/GeneXusFtpsNetCore/bin/ dotnet/dotnetframework/GeneXusFtps/obj/ dotnet/dotnetframework/GeneXusFtps/bin/ dotnet/dotnetframework/GeneXusFtps/packages.config dotnet/dotnetcore/GeneXusFtpsNetCore/obj/ dotnet/resources/key.snk dotnet/dotnetcore/GeneXusFtpsNetCore/bin/ +/test/dotnetcore/SecurityAPITestNetCore/.runsettings +/test/dotnetframework/SecurityAPITest/.runsettings +/test/dotnetframework/SecurityAPITest/obj/ +/test/dotnetframework/SecurityAPITest/bin/ +/test/dotnetcore/SecurityAPITestNetCore/bin/ +/test/dotnetcore/SecurityAPITestNetCore/obj/ +/test/resources/key.snk +/test/.runsettings diff --git a/SecurityAPIParent.sln b/SecurityAPIParent.sln index 0856a9d..a75bb54 100644 --- a/SecurityAPIParent.sln +++ b/SecurityAPIParent.sln @@ -7,29 +7,29 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dotnet", "dotnet", "{5CB172 EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dotnetframework", "dotnetframework", "{5EA71E19-9448-4F49-B24A-A5BF8964C54D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SecurityAPICommons", "dotnet\dotnetframework\SecurityAPICommons\SecurityAPICommons.csproj", "{BE9A040C-DE9A-490A-B02C-9E1D97B30B21}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SecurityAPICommons", "dotnet\dotnetframework\SecurityAPICommons\SecurityAPICommons.csproj", "{BE9A040C-DE9A-490A-B02C-9E1D97B30B21}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dotnetcore", "dotnetcore", "{2B1F2BC4-723C-46F6-8C23-3FB82AF975E9}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SecurityAPICommonsNetCore", "dotnet\dotnetcore\SecurityAPICommonsNetCore\SecurityAPICommonsNetCore.csproj", "{A3C5EE4E-A9AA-408F-AE26-9E28154D1C39}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GeneXusCryptography", "dotnet\dotnetframework\GeneXusCryptography\GeneXusCryptography.csproj", "{420F7E79-1CC3-4FA6-8399-7C07B2EE94DE}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GeneXusCryptography", "dotnet\dotnetframework\GeneXusCryptography\GeneXusCryptography.csproj", "{420F7E79-1CC3-4FA6-8399-7C07B2EE94DE}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GeneXusCryptographyNetCore", "dotnet\dotnetcore\GeneXusCryptographyNetCore\GeneXusCryptographyNetCore.csproj", "{4E759B82-D093-43E4-BF34-923025AED531}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GeneXusXmlSignature", "dotnet\dotnetframework\GeneXusXmlSignature\GeneXusXmlSignature.csproj", "{291B2556-49D9-4775-823F-FCE5E2416C0A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GeneXusXmlSignature", "dotnet\dotnetframework\GeneXusXmlSignature\GeneXusXmlSignature.csproj", "{291B2556-49D9-4775-823F-FCE5E2416C0A}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GeneXusXmlSignatureNetCore", "dotnet\dotnetcore\GeneXusXmlSignatureNetCore\GeneXusXmlSignatureNetCore.csproj", "{503D8578-4455-4DC0-ADDC-37E4C886427B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GeneXusJWT", "dotnet\dotnetframework\GeneXusJWT\GeneXusJWT.csproj", "{1D9FF129-BE37-4316-BFF3-9BEACC4612CB}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GeneXusJWT", "dotnet\dotnetframework\GeneXusJWT\GeneXusJWT.csproj", "{1D9FF129-BE37-4316-BFF3-9BEACC4612CB}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GeneXusJWTNetCore", "dotnet\dotnetcore\GeneXusJWTNetCore\GeneXusJWTNetCore.csproj", "{09DD9A8C-C6E8-47B2-BF68-D85BF5E6FC36}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GeneXusSftp", "dotnet\dotnetframework\GeneXusSftp\GeneXusSftp.csproj", "{7F864DEC-0EE0-420D-9976-9C7E39398161}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GeneXusSftp", "dotnet\dotnetframework\GeneXusSftp\GeneXusSftp.csproj", "{7F864DEC-0EE0-420D-9976-9C7E39398161}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GeneXusSftpNetCore", "dotnet\dotnetcore\GeneXusSftpNetCore\GeneXusSftpNetCore.csproj", "{1C8B841E-28A7-4D6B-95BE-47D2DDE1FE35}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GeneXusFtps", "dotnet\dotnetframework\GeneXusFtps\GeneXusFtps.csproj", "{76AD359D-960B-418D-8A1C-004E0E2D325C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GeneXusFtps", "dotnet\dotnetframework\GeneXusFtps\GeneXusFtps.csproj", "{76AD359D-960B-418D-8A1C-004E0E2D325C}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GeneXusFtpsNetCore", "dotnet\dotnetcore\GeneXusFtpsNetCore\GeneXusFtpsNetCore.csproj", "{06054CD3-91A7-4A0A-AA5C-A70B64CF4755}" EndProject @@ -39,16 +39,15 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dotnetcore", "dotnetcore", EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dotnetframework", "dotnetframework", "{7F5F1DDC-09BE-4567-8CD4-41387AD91BEE}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SecurityAPITest", "test\dotnetframework\SecurityAPITest\SecurityAPITest.csproj", "{9100025A-68E0-4618-B83C-4D626CB89DBB}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SecurityAPITestNetCore", "test\dotnetcore\SecurityAPITestNetCore\SecurityAPITestNetCore.csproj", "{44B8B2B6-0842-4018-A547-EF33920EFC8E}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SecurityAPITest", "test\dotnetframework\SecurityAPITest\SecurityAPITest.csproj", "{9100025A-68E0-4618-B83C-4D626CB89DBB}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "resources", "resources", "{88EB1BC4-0D68-4906-AA36-E1EA1F6AFD35}" ProjectSection(SolutionItems) = preProject - dotnet\resources\key.snk = dotnet\resources\key.snk dotnet\resources\Neon.SSH.NET.dll = dotnet\resources\Neon.SSH.NET.dll EndProjectSection EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SecurityAPITestNetCore", "test\dotnetcore\SecurityAPITestNetCore\SecurityAPITestNetCore.csproj", "{27D2471A-DA98-4912-A327-AF135550B034}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -107,10 +106,10 @@ Global {9100025A-68E0-4618-B83C-4D626CB89DBB}.Debug|Any CPU.Build.0 = Debug|Any CPU {9100025A-68E0-4618-B83C-4D626CB89DBB}.Release|Any CPU.ActiveCfg = Release|Any CPU {9100025A-68E0-4618-B83C-4D626CB89DBB}.Release|Any CPU.Build.0 = Release|Any CPU - {44B8B2B6-0842-4018-A547-EF33920EFC8E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {44B8B2B6-0842-4018-A547-EF33920EFC8E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {44B8B2B6-0842-4018-A547-EF33920EFC8E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {44B8B2B6-0842-4018-A547-EF33920EFC8E}.Release|Any CPU.Build.0 = Release|Any CPU + {27D2471A-DA98-4912-A327-AF135550B034}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {27D2471A-DA98-4912-A327-AF135550B034}.Debug|Any CPU.Build.0 = Debug|Any CPU + {27D2471A-DA98-4912-A327-AF135550B034}.Release|Any CPU.ActiveCfg = Release|Any CPU + {27D2471A-DA98-4912-A327-AF135550B034}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -133,8 +132,8 @@ Global {89FFECB3-7A69-41F8-88C7-F05193E5CDF4} = {750343D3-EAA6-433E-A099-71BC6851EA71} {7F5F1DDC-09BE-4567-8CD4-41387AD91BEE} = {750343D3-EAA6-433E-A099-71BC6851EA71} {9100025A-68E0-4618-B83C-4D626CB89DBB} = {7F5F1DDC-09BE-4567-8CD4-41387AD91BEE} - {44B8B2B6-0842-4018-A547-EF33920EFC8E} = {89FFECB3-7A69-41F8-88C7-F05193E5CDF4} {88EB1BC4-0D68-4906-AA36-E1EA1F6AFD35} = {5CB1725B-3FA5-49B1-A1F8-41EFCACA3CF1} + {27D2471A-DA98-4912-A327-AF135550B034} = {89FFECB3-7A69-41F8-88C7-F05193E5CDF4} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {AEB1693D-906F-402A-AD66-A1A9AE2ABBE2} diff --git a/dotnet/dotnetcore/GeneXusFtpsNetCore/obj/project.nuget.cache b/dotnet/dotnetcore/GeneXusFtpsNetCore/obj/project.nuget.cache deleted file mode 100644 index b2410ef..0000000 --- a/dotnet/dotnetcore/GeneXusFtpsNetCore/obj/project.nuget.cache +++ /dev/null @@ -1,70 +0,0 @@ -{ - "version": 2, - "dgSpecHash": "zBGgZrulZfk1lp+0T0RHS0cyKL09IXCvEhfouKtnC7w2ry9bSXA5TdXu43kZe+eaWuVCfkjW+Zhr/90czfNxFA==", - "success": true, - "projectFilePath": "C:\\git\\SecurityAPI\\DotNet-SecurityApi-Module\\dotnet\\dotnetcore\\GeneXusFtpsNetCore\\GeneXusFtpsNetCore.csproj", - "expectedPackageFiles": [ - "C:\\Users\\sgrampone\\.nuget\\packages\\fluentftp\\31.3.2\\fluentftp.31.3.2.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\microsoft.netcore.platforms\\1.1.0\\microsoft.netcore.platforms.1.1.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\microsoft.netcore.targets\\1.1.0\\microsoft.netcore.targets.1.1.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\microsoft.win32.primitives\\4.3.0\\microsoft.win32.primitives.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\portable.bouncycastle\\1.8.6.7\\portable.bouncycastle.1.8.6.7.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\runtime.debian.8-x64.runtime.native.system.security.cryptography.openssl\\4.3.0\\runtime.debian.8-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\runtime.fedora.23-x64.runtime.native.system.security.cryptography.openssl\\4.3.0\\runtime.fedora.23-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\runtime.fedora.24-x64.runtime.native.system.security.cryptography.openssl\\4.3.0\\runtime.fedora.24-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\runtime.native.system\\4.3.0\\runtime.native.system.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\runtime.native.system.net.http\\4.3.0\\runtime.native.system.net.http.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\runtime.native.system.net.security\\4.3.0\\runtime.native.system.net.security.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\runtime.native.system.security.cryptography.apple\\4.3.0\\runtime.native.system.security.cryptography.apple.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\runtime.native.system.security.cryptography.openssl\\4.3.0\\runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\runtime.opensuse.13.2-x64.runtime.native.system.security.cryptography.openssl\\4.3.0\\runtime.opensuse.13.2-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\runtime.opensuse.42.1-x64.runtime.native.system.security.cryptography.openssl\\4.3.0\\runtime.opensuse.42.1-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\runtime.osx.10.10-x64.runtime.native.system.security.cryptography.apple\\4.3.0\\runtime.osx.10.10-x64.runtime.native.system.security.cryptography.apple.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\runtime.osx.10.10-x64.runtime.native.system.security.cryptography.openssl\\4.3.0\\runtime.osx.10.10-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\runtime.rhel.7-x64.runtime.native.system.security.cryptography.openssl\\4.3.0\\runtime.rhel.7-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\runtime.ubuntu.14.04-x64.runtime.native.system.security.cryptography.openssl\\4.3.0\\runtime.ubuntu.14.04-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\runtime.ubuntu.16.04-x64.runtime.native.system.security.cryptography.openssl\\4.3.0\\runtime.ubuntu.16.04-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\runtime.ubuntu.16.10-x64.runtime.native.system.security.cryptography.openssl\\4.3.0\\runtime.ubuntu.16.10-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\system.collections\\4.3.0\\system.collections.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\system.collections.concurrent\\4.3.0\\system.collections.concurrent.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\system.console\\4.3.0\\system.console.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\system.diagnostics.debug\\4.3.0\\system.diagnostics.debug.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\system.diagnostics.tracing\\4.3.0\\system.diagnostics.tracing.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\system.globalization\\4.3.0\\system.globalization.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\system.globalization.calendars\\4.3.0\\system.globalization.calendars.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\system.globalization.extensions\\4.3.0\\system.globalization.extensions.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\system.io\\4.3.0\\system.io.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\system.io.filesystem\\4.3.0\\system.io.filesystem.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\system.io.filesystem.primitives\\4.3.0\\system.io.filesystem.primitives.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\system.linq\\4.3.0\\system.linq.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\system.net.nameresolution\\4.3.0\\system.net.nameresolution.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\system.net.primitives\\4.3.0\\system.net.primitives.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\system.net.security\\4.3.0\\system.net.security.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\system.net.sockets\\4.3.0\\system.net.sockets.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\system.reflection\\4.3.0\\system.reflection.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\system.reflection.primitives\\4.3.0\\system.reflection.primitives.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\system.resources.resourcemanager\\4.3.0\\system.resources.resourcemanager.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\system.runtime\\4.3.0\\system.runtime.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\system.runtime.extensions\\4.3.0\\system.runtime.extensions.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\system.runtime.handles\\4.3.0\\system.runtime.handles.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\system.runtime.interopservices\\4.3.0\\system.runtime.interopservices.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\system.runtime.numerics\\4.3.0\\system.runtime.numerics.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\system.security.claims\\4.3.0\\system.security.claims.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\system.security.cryptography.algorithms\\4.3.0\\system.security.cryptography.algorithms.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\system.security.cryptography.cng\\4.7.0\\system.security.cryptography.cng.4.7.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\system.security.cryptography.csp\\4.3.0\\system.security.cryptography.csp.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\system.security.cryptography.encoding\\4.3.0\\system.security.cryptography.encoding.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\system.security.cryptography.openssl\\4.3.0\\system.security.cryptography.openssl.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\system.security.cryptography.primitives\\4.3.0\\system.security.cryptography.primitives.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\system.security.cryptography.x509certificates\\4.3.0\\system.security.cryptography.x509certificates.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\system.security.principal\\4.3.0\\system.security.principal.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\system.security.principal.windows\\4.3.0\\system.security.principal.windows.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\system.text.encoding\\4.3.0\\system.text.encoding.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\system.text.encoding.codepages\\4.3.0\\system.text.encoding.codepages.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\system.threading\\4.3.0\\system.threading.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\system.threading.tasks\\4.3.0\\system.threading.tasks.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\system.threading.thread\\4.3.0\\system.threading.thread.4.3.0.nupkg.sha512", - "C:\\Users\\sgrampone\\.nuget\\packages\\system.threading.threadpool\\4.3.0\\system.threading.threadpool.4.3.0.nupkg.sha512" - ], - "logs": [] -} \ No newline at end of file diff --git a/dotnet/dotnetframework/Directory.Build.props b/dotnet/dotnetframework/Directory.Build.props new file mode 100644 index 0000000..146c3cf --- /dev/null +++ b/dotnet/dotnetframework/Directory.Build.props @@ -0,0 +1,15 @@ + + + 17.4.0 + 17.4.0 + $([System.DateTime]::UtcNow.ToString("yyyy")) + Copyright © 1988-$(CopyrightYear) GeneXus. All Rights Reserved + $(GENEXUS_SECURITY_MODULE_SNK_FILE) + true + GeneXus + true + true + 4 + NU5105;CS0618;CS8032 + + diff --git a/dotnet/dotnetframework/GeneXusCryptography/GeneXusCryptography.csproj b/dotnet/dotnetframework/GeneXusCryptography/GeneXusCryptography.csproj index a69004f..4ce9692 100644 --- a/dotnet/dotnetframework/GeneXusCryptography/GeneXusCryptography.csproj +++ b/dotnet/dotnetframework/GeneXusCryptography/GeneXusCryptography.csproj @@ -1,98 +1,13 @@ - - - - - Debug - AnyCPU - {420F7E79-1CC3-4FA6-8399-7C07B2EE94DE} - Library - Properties + + + net47 GeneXusCryptography GeneXusCryptographyImpl - v4.7 - 512 - true - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - true - - - ..\..\resources\key.snk - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {be9a040c-de9a-490a-b02c-9e1d97b30b21} - SecurityAPICommons - + - - key.snk - - + - - \ No newline at end of file diff --git a/dotnet/dotnetframework/GeneXusCryptography/Properties/AssemblyInfo.cs b/dotnet/dotnetframework/GeneXusCryptography/Properties/AssemblyInfo.cs index 31744e6..44c59b4 100644 --- a/dotnet/dotnetframework/GeneXusCryptography/Properties/AssemblyInfo.cs +++ b/dotnet/dotnetframework/GeneXusCryptography/Properties/AssemblyInfo.cs @@ -6,33 +6,4 @@ // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("GeneXusCryptography")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("GeneXusCryptography")] -[assembly: AssemblyCopyright("Copyright © 2020")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("420f7e79-1cc3-4fa6-8399-7c07b2ee94de")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("17.4.0")] -[assembly: AssemblyFileVersion("17.4.0")] [assembly: AllowPartiallyTrustedCallers] diff --git a/dotnet/dotnetframework/GeneXusFtps/GeneXusFtps.csproj b/dotnet/dotnetframework/GeneXusFtps/GeneXusFtps.csproj index 61e5135..0d0566c 100644 --- a/dotnet/dotnetframework/GeneXusFtps/GeneXusFtps.csproj +++ b/dotnet/dotnetframework/GeneXusFtps/GeneXusFtps.csproj @@ -1,74 +1,13 @@ - - - - - Debug - AnyCPU - {76AD359D-960B-418D-8A1C-004E0E2D325C} - Library - Properties + + + net47 GeneXusFtps GeneXusFtpsImpl - v4.7 - 512 - true - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - true - - - ..\..\resources\key.snk - - - - - - - - - + - - - - - - - - - - - - - {be9a040c-de9a-490a-b02c-9e1d97b30b21} - SecurityAPICommons - - - - - key.snk - - + + - \ No newline at end of file diff --git a/dotnet/dotnetframework/GeneXusFtps/GeneXusFtps/FtpsClient.cs b/dotnet/dotnetframework/GeneXusFtps/GeneXusFtps/FtpsClient.cs index a6d91a7..5ea7608 100644 --- a/dotnet/dotnetframework/GeneXusFtps/GeneXusFtps/FtpsClient.cs +++ b/dotnet/dotnetframework/GeneXusFtps/GeneXusFtps/FtpsClient.cs @@ -235,7 +235,7 @@ public override string GetWorkingDirectory() { pwd = this.client.GetWorkingDirectory(); } - catch (IOException e) + catch (IOException) { this.error.setError("FS006", "Could not obtain working directory, try reconnect"); return ""; diff --git a/dotnet/dotnetframework/GeneXusFtps/Properties/AssemblyInfo.cs b/dotnet/dotnetframework/GeneXusFtps/Properties/AssemblyInfo.cs index 50e2873..44c59b4 100644 --- a/dotnet/dotnetframework/GeneXusFtps/Properties/AssemblyInfo.cs +++ b/dotnet/dotnetframework/GeneXusFtps/Properties/AssemblyInfo.cs @@ -6,33 +6,4 @@ // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("GeneXusFtps")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("GeneXusFtps")] -[assembly: AssemblyCopyright("Copyright © 2020")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("76ad359d-960b-418d-8a1c-004e0e2d325c")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("17.4.0")] -[assembly: AssemblyFileVersion("17.4.0")] [assembly: AllowPartiallyTrustedCallers] diff --git a/dotnet/dotnetframework/GeneXusJWT/Commons/DateUtilObject.cs b/dotnet/dotnetframework/GeneXusJWT/Commons/DateUtilObject.cs index 9e0c69a..c58715f 100644 --- a/dotnet/dotnetframework/GeneXusJWT/Commons/DateUtilObject.cs +++ b/dotnet/dotnetframework/GeneXusJWT/Commons/DateUtilObject.cs @@ -11,8 +11,11 @@ namespace GeneXusJWT.GenexusComons [SecuritySafeCritical] public abstract class DateUtilObject : SecurityAPIObject { + [Obsolete("DateUtil object is deprecated. Use GeneXus DateTime data type instead https://wiki.genexus.com/commwiki/servlet/wiki?7370,DateTime%20data%20type")] public abstract string GetCurrentDate(); + [Obsolete("DateUtil object is deprecated. Use GeneXus DateTime data type instead https://wiki.genexus.com/commwiki/servlet/wiki?7370,DateTime%20data%20type")] public abstract string CurrentPlusSeconds(long seconds); + [Obsolete("DateUtil object is deprecated. Use GeneXus DateTime data type instead https://wiki.genexus.com/commwiki/servlet/wiki?7370,DateTime%20data%20type")] public abstract string CurrentMinusSeconds(long seconds); } } diff --git a/dotnet/dotnetframework/GeneXusJWT/Commons/GUIDObject.cs b/dotnet/dotnetframework/GeneXusJWT/Commons/GUIDObject.cs index 8cc3c5b..7357085 100644 --- a/dotnet/dotnetframework/GeneXusJWT/Commons/GUIDObject.cs +++ b/dotnet/dotnetframework/GeneXusJWT/Commons/GUIDObject.cs @@ -1,5 +1,6 @@  using SecurityAPICommons.Commons; +using System; using System.Security; namespace GeneXusJWT.GenexusComons @@ -8,6 +9,7 @@ namespace GeneXusJWT.GenexusComons public abstract class GUIDObject : SecurityAPIObject { + [Obsolete("GUID object is deprecated. USe Genexus GUID data type instead https://wiki.genexus.com/commwiki/servlet/wiki?31772,GUID+data+type")] public abstract string Generate(); } } diff --git a/dotnet/dotnetframework/GeneXusJWT/GeneXusJWT.csproj b/dotnet/dotnetframework/GeneXusJWT/GeneXusJWT.csproj index 1d229c6..bc74cb7 100644 --- a/dotnet/dotnetframework/GeneXusJWT/GeneXusJWT.csproj +++ b/dotnet/dotnetframework/GeneXusJWT/GeneXusJWT.csproj @@ -1,91 +1,28 @@ - - - - - Debug - AnyCPU - {1D9FF129-BE37-4316-BFF3-9BEACC4612CB} - Library - Properties + + + net47 GeneXusJWT GeneXusJWTImpl - v4.7 - 512 - true - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - true - - - ..\..\resources\key.snk App.$(Configuration).config - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - key.snk - + + + + + + + + + - - {be9a040c-de9a-490a-b02c-9e1d97b30b21} - SecurityAPICommons - + - - \ No newline at end of file diff --git a/dotnet/dotnetframework/GeneXusJWT/JWTClaims/Claims.cs b/dotnet/dotnetframework/GeneXusJWT/JWTClaims/Claims.cs index e8122d8..af59acf 100644 --- a/dotnet/dotnetframework/GeneXusJWT/JWTClaims/Claims.cs +++ b/dotnet/dotnetframework/GeneXusJWT/JWTClaims/Claims.cs @@ -10,7 +10,7 @@ namespace GeneXusJWT.GenexusJWTClaims public class Claims { - private List _claims; + protected List _claims; [SecuritySafeCritical] public Claims() @@ -33,7 +33,7 @@ public List getAllClaims() } [SecuritySafeCritical] - public object getClaimValue(string key, Error error) + public virtual object getClaimValue(string key, Error error) { for (int i = 0; i < _claims.Count; i++) { diff --git a/dotnet/dotnetframework/GeneXusJWT/JWTClaims/PrivateClaims.cs b/dotnet/dotnetframework/GeneXusJWT/JWTClaims/PrivateClaims.cs index ffad850..5421953 100644 --- a/dotnet/dotnetframework/GeneXusJWT/JWTClaims/PrivateClaims.cs +++ b/dotnet/dotnetframework/GeneXusJWT/JWTClaims/PrivateClaims.cs @@ -7,8 +7,6 @@ namespace GeneXusJWT.GenexusJWTClaims [SecuritySafeCritical] public class PrivateClaims : Claims { - private List _claims; - [SecuritySafeCritical] public bool setClaim(string key, string value) { diff --git a/dotnet/dotnetframework/GeneXusJWT/JWTClaims/RegisteredClaims.cs b/dotnet/dotnetframework/GeneXusJWT/JWTClaims/RegisteredClaims.cs index 1180854..dad9005 100644 --- a/dotnet/dotnetframework/GeneXusJWT/JWTClaims/RegisteredClaims.cs +++ b/dotnet/dotnetframework/GeneXusJWT/JWTClaims/RegisteredClaims.cs @@ -10,7 +10,6 @@ namespace GeneXusJWT.GenexusJWTClaims [SecuritySafeCritical] public class RegisteredClaims : Claims { - private List claims; private IDictionary customTimeValidationClaims; public RegisteredClaims() @@ -88,15 +87,15 @@ public bool hasCustomValidationClaims() } - public object getClaimValue(string key, Error error) + public override object getClaimValue(string key, Error error) { if (RegisteredClaimUtils.exists(key)) { - for (int i = 0; i < claims.Count; i++) + for (int i = 0; i < _claims.Count; i++) { - if (SecurityUtils.compareStrings(key, claims[i].getKey())) + if (SecurityUtils.compareStrings(key, _claims[i].getKey())) { - return claims[i].getValue(); + return _claims[i].getValue(); } } error.setError("RC001", "Could not find a claim with" + key + " key value"); diff --git a/dotnet/dotnetframework/GeneXusJWT/Properties/AssemblyInfo.cs b/dotnet/dotnetframework/GeneXusJWT/Properties/AssemblyInfo.cs index 790f0d2..d7e6547 100644 --- a/dotnet/dotnetframework/GeneXusJWT/Properties/AssemblyInfo.cs +++ b/dotnet/dotnetframework/GeneXusJWT/Properties/AssemblyInfo.cs @@ -6,33 +6,4 @@ // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("GeneXusJWT")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("GeneXusJWT")] -[assembly: AssemblyCopyright("Copyright © 2020")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("1d9ff129-be37-4316-bff3-9beacc4612cb")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("17.4.0")] -[assembly: AssemblyFileVersion("17.4.0")] [assembly: AllowPartiallyTrustedCallers] \ No newline at end of file diff --git a/dotnet/dotnetframework/GeneXusSftp/GeneXusSftp.csproj b/dotnet/dotnetframework/GeneXusSftp/GeneXusSftp.csproj index b2283bc..72e67d6 100644 --- a/dotnet/dotnetframework/GeneXusSftp/GeneXusSftp.csproj +++ b/dotnet/dotnetframework/GeneXusSftp/GeneXusSftp.csproj @@ -1,75 +1,15 @@ - - - - - Debug - AnyCPU - {7F864DEC-0EE0-420D-9976-9C7E39398161} - Library - Properties + + + net47 GeneXusSftp GeneXusSftpClientImpl - v4.7 - 512 - true - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - true - - - ..\..\resources\key.snk - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 ..\..\resources\Neon.SSH.NET.dll - - - - - - - - - - - - - - - - - - - - - key.snk - - - - {be9a040c-de9a-490a-b02c-9e1d97b30b21} - SecurityAPICommons - + - \ No newline at end of file diff --git a/dotnet/dotnetframework/GeneXusSftp/Properties/AssemblyInfo.cs b/dotnet/dotnetframework/GeneXusSftp/Properties/AssemblyInfo.cs index 7ee1e08..44c59b4 100644 --- a/dotnet/dotnetframework/GeneXusSftp/Properties/AssemblyInfo.cs +++ b/dotnet/dotnetframework/GeneXusSftp/Properties/AssemblyInfo.cs @@ -6,33 +6,4 @@ // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("GeneXusSftp")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("GeneXusSftp")] -[assembly: AssemblyCopyright("Copyright © 2020")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("7f864dec-0ee0-420d-9976-9c7e39398161")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("17.4.0")] -[assembly: AssemblyFileVersion("17.4.0")] [assembly: AllowPartiallyTrustedCallers] diff --git a/dotnet/dotnetframework/GeneXusXmlSignature/GeneXusXmlSignature.csproj b/dotnet/dotnetframework/GeneXusXmlSignature/GeneXusXmlSignature.csproj index 353fc74..5fa3488 100644 --- a/dotnet/dotnetframework/GeneXusXmlSignature/GeneXusXmlSignature.csproj +++ b/dotnet/dotnetframework/GeneXusXmlSignature/GeneXusXmlSignature.csproj @@ -1,83 +1,15 @@ - - - - - Debug - AnyCPU - {291B2556-49D9-4775-823F-FCE5E2416C0A} - Library - Properties - GeneXusXmlSignature + + + net47 + GeneXusXmlSignature GeneXusXmlSignatureImpl - v4.7 - 512 - true - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - true - - - ..\..\resources\key.snk - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - key.snk - - - - - - {be9a040c-de9a-490a-b02c-9e1d97b30b21} - SecurityAPICommons - + - - \ No newline at end of file diff --git a/dotnet/dotnetframework/GeneXusXmlSignature/Properties/AssemblyInfo.cs b/dotnet/dotnetframework/GeneXusXmlSignature/Properties/AssemblyInfo.cs index 823622e..8c37939 100644 --- a/dotnet/dotnetframework/GeneXusXmlSignature/Properties/AssemblyInfo.cs +++ b/dotnet/dotnetframework/GeneXusXmlSignature/Properties/AssemblyInfo.cs @@ -3,36 +3,4 @@ using System.Runtime.InteropServices; using System.Security; -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("GeneXusXmlSignature")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("GeneXusXmlSignature")] -[assembly: AssemblyCopyright("Copyright © 2020")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("291b2556-49d9-4775-823f-fce5e2416c0a")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("17.4.0")] -[assembly: AssemblyFileVersion("17.4.0")] [assembly: AllowPartiallyTrustedCallers] diff --git a/dotnet/dotnetframework/SecurityAPICommons/Commons/SecurityAPIObject.cs b/dotnet/dotnetframework/SecurityAPICommons/Commons/SecurityAPIObject.cs index 033aa80..093a50b 100644 --- a/dotnet/dotnetframework/SecurityAPICommons/Commons/SecurityAPIObject.cs +++ b/dotnet/dotnetframework/SecurityAPICommons/Commons/SecurityAPIObject.cs @@ -13,8 +13,6 @@ namespace SecurityAPICommons.Commons [SecuritySafeCritical] public class SecurityAPIObject { - [SecuritySafeCritical] - private Error _error; [SecuritySafeCritical] public Error error; diff --git a/dotnet/dotnetframework/SecurityAPICommons/Config/AvailableEncoding.cs b/dotnet/dotnetframework/SecurityAPICommons/Config/AvailableEncoding.cs index 9b5c7f8..0cc41f5 100644 --- a/dotnet/dotnetframework/SecurityAPICommons/Config/AvailableEncoding.cs +++ b/dotnet/dotnetframework/SecurityAPICommons/Config/AvailableEncoding.cs @@ -102,7 +102,23 @@ public static string encapsulateGetString(byte[] input, AvailableEncoding availa { case AvailableEncoding.UTF_8: return Encoding.UTF8.GetString(input); +#if NETCORE + case AvailableEncoding.UTF_16: + Encoding utf16 = Encoding.GetEncoding(1201, new EncoderReplacementFallback(strUniRepChr), new DecoderReplacementFallback(strUniRepChr)); + string utf16_string = utf16.GetString(input); + return utf16_string.Replace(strUniRepChr, String.Empty); + case AvailableEncoding.UTF_16BE: + Encoding utf16_be = Encoding.GetEncoding(1201, new EncoderReplacementFallback(strUniRepChr), new DecoderReplacementFallback(strUniRepChr)); + string utf16_beString = utf16_be.GetString(input); + return utf16_beString.Replace(strUniRepChr, String.Empty); + + case AvailableEncoding.UTF_16LE: + Encoding utf16_le = Encoding.GetEncoding(1200, new EncoderReplacementFallback(strUniRepChr), new DecoderReplacementFallback(strUniRepChr)); + string utf16_leString = utf16_le.GetString(input); + return utf16_leString.Replace(strUniRepChr, String.Empty); + +#else case AvailableEncoding.UTF_16: return Encoding.BigEndianUnicode.GetString(input); @@ -111,7 +127,7 @@ public static string encapsulateGetString(byte[] input, AvailableEncoding availa case AvailableEncoding.UTF_16LE: return Encoding.Unicode.GetString(input); - +#endif case AvailableEncoding.UTF_32: @@ -180,7 +196,20 @@ public static byte[] encapsulateeGetBytes(string input, AvailableEncoding availa { case AvailableEncoding.UTF_8: return Encoding.UTF8.GetBytes(input); +#if NETCORE + case AvailableEncoding.UTF_16: + Encoding utf16 = Encoding.GetEncoding(1201, new EncoderReplacementFallback(strUniRepChr), new DecoderReplacementFallback(strUniRepChr)); + return utf16.GetBytes(input); + case AvailableEncoding.UTF_16BE: + Encoding utf16_be = Encoding.GetEncoding(1201, new EncoderReplacementFallback(strUniRepChr), new DecoderReplacementFallback(strUniRepChr)); + return utf16_be.GetBytes(input); + + case AvailableEncoding.UTF_16LE: + Encoding utf16_le = Encoding.GetEncoding(1200, new EncoderReplacementFallback(strUniRepChr), new DecoderReplacementFallback(strUniRepChr)); + return utf16_le.GetBytes(input); + +#else case AvailableEncoding.UTF_16: return Encoding.BigEndianUnicode.GetBytes(input); @@ -189,7 +218,7 @@ public static byte[] encapsulateeGetBytes(string input, AvailableEncoding availa case AvailableEncoding.UTF_16LE: return Encoding.Unicode.GetBytes(input); - +#endif case AvailableEncoding.UTF_32: Encoding cpUTF32_1 = Encoding.GetEncoding(12001, new EncoderReplacementFallback(strUniRepChr), new DecoderReplacementFallback(strUniRepChr)); diff --git a/dotnet/dotnetframework/SecurityAPICommons/Properties/AssemblyInfo.cs b/dotnet/dotnetframework/SecurityAPICommons/Properties/AssemblyInfo.cs index 273ff4e..4def279 100644 --- a/dotnet/dotnetframework/SecurityAPICommons/Properties/AssemblyInfo.cs +++ b/dotnet/dotnetframework/SecurityAPICommons/Properties/AssemblyInfo.cs @@ -1,38 +1,8 @@ using System.Reflection; -using System.Runtime.InteropServices; using System.Security; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("SecurityAPICommons")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("SecurityAPICommons")] -[assembly: AssemblyCopyright("Copyright © 2020")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("be9a040c-de9a-490a-b02c-9e1d97b30b21")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("17.4.0")] -[assembly: AssemblyFileVersion("17.4.0")] [assembly: AllowPartiallyTrustedCallers] diff --git a/dotnet/dotnetframework/SecurityAPICommons/SecurityAPICommons.csproj b/dotnet/dotnetframework/SecurityAPICommons/SecurityAPICommons.csproj index b9fd0d3..66f667a 100644 --- a/dotnet/dotnetframework/SecurityAPICommons/SecurityAPICommons.csproj +++ b/dotnet/dotnetframework/SecurityAPICommons/SecurityAPICommons.csproj @@ -1,85 +1,13 @@ - - - - - Debug - AnyCPU - {BE9A040C-DE9A-490A-B02C-9E1D97B30B21} - Library - Properties - SecurityAPICommons + + + net47 GeneXusSecurityAPICommonsImpl - v4.7 - 512 - true - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - true - - - ..\..\resources\key.snk - - - - - - ..\..\..\packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net46\System.Security.Cryptography.Algorithms.dll - - - ..\..\..\packages\System.Security.Cryptography.Cng.4.7.0\lib\net46\System.Security.Cryptography.Cng.dll - - - ..\..\..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - key.snk - - + + + - + \ No newline at end of file diff --git a/dotnet/dotnetframework/SecurityAPICommons/Utils/SecurityUtils.cs b/dotnet/dotnetframework/SecurityAPICommons/Utils/SecurityUtils.cs index 0e910b5..da62ffa 100644 --- a/dotnet/dotnetframework/SecurityAPICommons/Utils/SecurityUtils.cs +++ b/dotnet/dotnetframework/SecurityAPICommons/Utils/SecurityUtils.cs @@ -50,6 +50,7 @@ public static bool extensionIs(string path, string ext) [SecuritySafeCritical] public static string getFileExtension(string path) { + string fileName = Path.GetFileName(path); string extension; try @@ -60,6 +61,7 @@ public static string getFileExtension(string path) { extension = ""; } + return extension; } diff --git a/test/dotnetcore/SecurityAPITestNetCore/SecurityAPITestNetCore.csproj b/test/dotnetcore/SecurityAPITestNetCore/SecurityAPITestNetCore.csproj new file mode 100644 index 0000000..a088b69 --- /dev/null +++ b/test/dotnetcore/SecurityAPITestNetCore/SecurityAPITestNetCore.csproj @@ -0,0 +1,743 @@ + + + + net5.0 + false + + + + + + + + + NETCORE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + + + diff --git a/test/dotnetframework/SecurityAPITest/Cryptography/Asymmetric/TestAsymmetricDomainSpaces.cs b/test/dotnetframework/SecurityAPITest/Cryptography/Asymmetric/TestAsymmetricDomainSpaces.cs new file mode 100644 index 0000000..8391770 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/Cryptography/Asymmetric/TestAsymmetricDomainSpaces.cs @@ -0,0 +1,48 @@ +using GeneXusCryptography.Asymmetric; +using NUnit.Framework; +using SecurityAPICommons.Keys; +using SecurityAPICommons.Utils; +using SecurityAPITest.SecurityAPICommons.commons; +using System.IO; + +namespace SecurityAPITest.Cryptography.Asymmetric +{ + [TestFixture] + public class TestAsymmetricDomainSpaces : SecurityAPITestObject + { + private static string path_RSA_sha1_1024; + private static string plainText; + private static PrivateKeyManager key; + private static CertificateX509 cert; + private static string pathKey; + private static string pathCert; + private static AsymmetricCipher asymCipher; + + [SetUp] + public virtual void SetUp() + { + path_RSA_sha1_1024 = Path.Combine(BASE_PATH, "dummycerts", "RSA_sha1_1024"); + plainText = "Lorem ipsum"; + pathKey = Path.Combine(path_RSA_sha1_1024, "sha1d_key.pem"); + pathCert = Path.Combine(path_RSA_sha1_1024, "sha1_cert.crt"); + key = new PrivateKeyManager(); + cert = new CertificateX509(); + asymCipher = new AsymmetricCipher(); + } + + [Test] + public void TestSpaces() + { + + key.Load(pathKey); + cert.Load(pathCert); + string encrypted1 = asymCipher.DoEncrypt_WithPrivateKey("SHA1 ", "PCKS1PADDING ", key, plainText); + //System.out.println("Error. Code: " + asymCipher.getErrorCode() + " Desc: " + asymCipher.getErrorDescription()); + Assert.IsFalse(asymCipher.HasError()); + + string decrypted = asymCipher.DoDecrypt_WithPublicKey(" SHA1", " PCKS1PADDING", cert, encrypted1); + Assert.IsFalse(asymCipher.HasError()); + Assert.IsTrue(SecurityUtils.compareStrings(plainText, decrypted)); + } + } +} diff --git a/test/dotnetframework/SecurityAPITest/Cryptography/Asymmetric/TestECDSASigning.cs b/test/dotnetframework/SecurityAPITest/Cryptography/Asymmetric/TestECDSASigning.cs new file mode 100644 index 0000000..bef600a --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/Cryptography/Asymmetric/TestECDSASigning.cs @@ -0,0 +1,140 @@ +using SecurityAPITest.SecurityAPICommons.commons; +using NUnit.Framework; +using SecurityAPICommons.Config; +using SecurityAPICommons.Keys; +using GeneXusCryptography.Asymmetric; +using System.IO; + +namespace SecurityAPITest.Cryptography.Asymmetric +{ + [TestFixture] + public class TestECDSASigning: SecurityAPITestObject + { + private static string path_ecdsa_sha1; + private static string path_ecdsa_sha256; + + private static string plainText; + + private static string alias; + private static string password; + + private static string[] encodings; + private static EncodingUtil eu; + + [SetUp] + public virtual void SetUp() + { + + path_ecdsa_sha1 = Path.Combine(BASE_PATH, "dummycerts", "ECDSA_sha1"); + path_ecdsa_sha256 = Path.Combine(BASE_PATH, "dummycerts", "ECDSA_sha256"); + + plainText = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam venenatis ex sit amet risus pellentesque, a faucibus quam ultrices. Ut tincidunt quam eu aliquam maximus. Quisque posuere risus at erat blandit eleifend. Curabitur viverra rutrum volutpat. Donec quis quam tellus. Aenean fermentum elementum augue, a semper risus scelerisque sit amet. Nullam vitae sapien vitae dui ullamcorper dapibus quis quis leo. Sed neque felis, pellentesque in risus et, lobortis ultricies nulla. Quisque quis quam risus. Donec vestibulum, lectus vel vestibulum eleifend, velit ante volutpat lacus, ut mattis quam ligula eget est. Sed et pulvinar lectus. In mollis turpis non ipsum vehicula, sit amet rutrum nibh dictum. Duis consectetur convallis ex, eu ultricies enim bibendum vel. Vestibulum vel libero nibh. Morbi nec odio mattis, vestibulum quam blandit, pretium orci.Aenean pellentesque tincidunt nunc a malesuada. Etiam gravida fermentum mi, at dignissim dui aliquam quis. Nullam vel lobortis libero. Phasellus non gravida posuere"; + + alias = "1"; + password = "dummy"; + + encodings = new string[] { "UTF_8", "UTF_16", "UTF_16BE", "UTF_16LE", "UTF_32", "UTF_32BE", "UTF_32LE", "SJIS", + "GB2312" }; + + eu = new EncodingUtil(); + } + + [Test] + public void Test_ecdsa_sha1_PEM() + { + string pathKey = Path.Combine(path_ecdsa_sha1, "sha1_key.pem"); + string pathCert = Path.Combine(path_ecdsa_sha1, "sha1_cert.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + key.Load(pathKey); + CertificateX509 cert = new CertificateX509(); + cert.Load(pathCert); + runTestWithEncoding(key, cert, "SHA1"); + + } + + [Test] + public void Test_ecdsa_sha1_DER() + { + string pathKey = Path.Combine(path_ecdsa_sha1, "sha1_key.pem"); + string pathCert = Path.Combine(path_ecdsa_sha1, "sha1_cert.crt"); + PrivateKeyManager key = new PrivateKeyManager(); + key.Load(pathKey); + CertificateX509 cert = new CertificateX509(); + cert.Load(pathCert); + runTestWithEncoding(key, cert, "SHA1"); + + } + + [Test] + public void Test_ecdsa_sha1_PKCS12() + { + string pathKey = Path.Combine(path_ecdsa_sha1, "sha1_cert.p12"); + string pathCert = Path.Combine(path_ecdsa_sha1, "sha1_cert.p12"); + PrivateKeyManager key = new PrivateKeyManager(); + key.LoadPKCS12(pathKey, alias, password); + CertificateX509 cert = new CertificateX509(); + cert.LoadPKCS12(pathCert, alias, password); + runTestWithEncoding(key, cert, "SHA1"); + } + + [Test] + public void Test_ecdsa_sha256_PEM() + { + string pathKey = Path.Combine(path_ecdsa_sha256, "sha256_key.pem"); + string pathCert = Path.Combine(path_ecdsa_sha256, "sha256_cert.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + key.Load(pathKey); + CertificateX509 cert = new CertificateX509(); + cert.Load(pathCert); + runTestWithEncoding(key, cert, "SHA256"); + + } + + [Test] + public void Test_ecdsa_sha256_DER() + { + string pathKey = Path.Combine(path_ecdsa_sha256, "sha256_key.pem"); + string pathCert = Path.Combine(path_ecdsa_sha256, "sha256_cert.crt"); + PrivateKeyManager key = new PrivateKeyManager(); + key.Load(pathKey); + CertificateX509 cert = new CertificateX509(); + cert.Load(pathCert); + runTestWithEncoding(key, cert, "SHA256"); + + } + + [Test] + public void Test_ecdsa_sha256_PKCS12() + { + string pathKey = Path.Combine(path_ecdsa_sha256, "sha256_cert.p12"); + string pathCert = Path.Combine(path_ecdsa_sha256, "sha256_cert.p12"); + PrivateKeyManager key = new PrivateKeyManager(); + key.LoadPKCS12(pathKey, alias, password); + CertificateX509 cert = new CertificateX509(); + cert.LoadPKCS12(pathCert, alias, password); + runTestWithEncoding(key, cert, "SHA256"); + + } + + + private void bulkTest(PrivateKeyManager key, CertificateX509 cert, string hashAlgorithm) + { + AsymmetricSigner asymSig = new AsymmetricSigner(); + string signature = asymSig.DoSign(key, hashAlgorithm, plainText); + bool result = asymSig.DoVerify(cert, plainText, signature); + Assert.IsTrue(result); + True(result, asymSig); + } + + private void runTestWithEncoding(PrivateKeyManager key, CertificateX509 cert, string hash) + { + //{ "UTF_8", "UTF_16", "UTF_16BE", "UTF_16LE", "UTF_32", "UTF_32BE", "UTF_32LE", "SJIS", + //"GB2312" }; + for (int i = 0; i < encodings.Length; i++) + { + eu.setEncoding(encodings[i]); + bulkTest(key, cert, hash); + } + } + } +} diff --git a/test/dotnetframework/SecurityAPITest/Cryptography/Asymmetric/TestRSAEncryption.cs b/test/dotnetframework/SecurityAPITest/Cryptography/Asymmetric/TestRSAEncryption.cs new file mode 100644 index 0000000..5c32471 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/Cryptography/Asymmetric/TestRSAEncryption.cs @@ -0,0 +1,330 @@ +using SecurityAPITest.SecurityAPICommons.commons; +using NUnit.Framework; +using SecurityAPICommons.Config; +using SecurityAPICommons.Keys; +using GeneXusCryptography.Asymmetric; +using SecurityAPICommons.Utils; +using System.IO; + +namespace SecurityAPITest.Cryptography.Asymmetric +{ + [TestFixture] + public class TestRSAEncryption: SecurityAPITestObject + { + private static string path_RSA_sha1_1024; + private static string path_RSA_sha256_1024; + private static string path_RSA_sha256_2048; + private static string path_RSA_sha512_2048; + + private static string[] arrayPaddings; + + private static string plainText; + + private static string plainText16; + private static string plainText32; + + private static string alias; + private static string password; + + private static string[] encodings; + private static EncodingUtil eu; + + [SetUp] + public virtual void SetUp() + { + + path_RSA_sha1_1024 = Path.Combine(BASE_PATH, "dummycerts", "RSA_sha1_1024"); + path_RSA_sha256_1024 = Path.Combine(BASE_PATH, "dummycerts", "RSA_sha256_1024"); + path_RSA_sha256_2048 = Path.Combine(BASE_PATH, "dummycerts", "RSA_sha256_2048"); + path_RSA_sha512_2048 = Path.Combine(BASE_PATH, "dummycerts", "RSA_sha512_2048"); + + arrayPaddings = new string[] { "OAEPPADDING", "PCKS1PADDING", "ISO97961PADDING" }; + + plainText = ""; + plainText16 = "Lorem ipsum dolor sit amet"; + plainText32 = "Lorem ipsum"; + + alias = "1"; + password = "dummy"; + + encodings = new string[] { "UTF_8", "UTF_16", "UTF_16BE", "UTF_16LE", "UTF_32", "UTF_32BE", "UTF_32LE", "SJIS", + "GB2312" }; + + eu = new EncodingUtil(); + + } + + [Test] + public void Test_sha1_1024_DER() + { + string pathKey = Path.Combine(path_RSA_sha1_1024, "sha1d_key.pem"); + string pathCert = Path.Combine(path_RSA_sha1_1024, "sha1_cert.crt"); + PrivateKeyManager key = new PrivateKeyManager(); + key.Load(pathKey); + CertificateX509 cert = new CertificateX509(); + cert.Load(pathCert); + runTestWithEncoding(key, cert, "SHA1"); + + } + + [Test] + public void Test_sha1_1024_PEM() + { + string pathKey = Path.Combine(path_RSA_sha1_1024, "sha1d_key.pem"); + string pathCert = Path.Combine(path_RSA_sha1_1024, "sha1_cert.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + key.Load(pathKey); + CertificateX509 cert = new CertificateX509(); + cert.Load(pathCert); + runTestWithEncoding(key, cert, "SHA1"); + + } + + + + [Test] + public void Test_sha1_1024_PKCS12() + { + string pathKey = Path.Combine(path_RSA_sha1_1024, "sha1_cert.p12"); + string pathCert = Path.Combine(path_RSA_sha1_1024, "sha1_cert.p12"); + PrivateKeyManager key = new PrivateKeyManager(); + key.LoadPKCS12(pathKey, alias, password); + CertificateX509 cert = new CertificateX509(); + cert.LoadPKCS12(pathCert, alias, password); + runTestWithEncoding(key, cert, "SHA1"); + + } + + [Test] + public void Test_sha256_1024_DER() + { + string pathKey = Path.Combine(path_RSA_sha256_1024, "sha256d_key.pem"); + string pathCert = Path.Combine(path_RSA_sha256_1024, "sha256_cert.crt"); + PrivateKeyManager key = new PrivateKeyManager(); + key.Load(pathKey); + CertificateX509 cert = new CertificateX509(); + cert.Load(pathCert); + runTestWithEncoding(key, cert, "SHA256"); + + } + + [Test] + public void Test_sha256_1024_PEM() + { + string pathKey = Path.Combine(path_RSA_sha256_1024, "sha256d_key.pem"); + string pathCert = Path.Combine(path_RSA_sha256_1024, "sha256_cert.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + key.Load(pathKey); + CertificateX509 cert = new CertificateX509(); + cert.Load(pathCert); + runTestWithEncoding(key, cert, "SHA256"); + + } + + + + [Test] + public void Test_sha256_1024_PKCS12() + { + string pathKey = Path.Combine(path_RSA_sha256_1024, "sha256_cert.p12"); + string pathCert = Path.Combine(path_RSA_sha256_1024, "sha256_cert.p12"); + PrivateKeyManager key = new PrivateKeyManager(); + key.LoadPKCS12(pathKey, alias, password); + CertificateX509 cert = new CertificateX509(); + cert.LoadPKCS12(pathCert, alias, password); + runTestWithEncoding(key, cert, "SHA256"); + + } + + [Test] + public void Test_sha256_2048_DER() + { + string pathKey = Path.Combine(path_RSA_sha256_2048, "sha256d_key.pem"); + string pathCert = Path.Combine(path_RSA_sha256_2048, "sha256_cert.crt"); + PrivateKeyManager key = new PrivateKeyManager(); + key.Load(pathKey); + CertificateX509 cert = new CertificateX509(); + cert.Load(pathCert); + runTestWithEncoding(key, cert, "SHA256"); + + } + + [Test] + public void Test_sha256_2048_PEM() + { + string pathKey = Path.Combine(path_RSA_sha256_2048, "sha256d_key.pem"); + string pathCert = Path.Combine(path_RSA_sha256_2048, "sha256_cert.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + key.Load(pathKey); + CertificateX509 cert = new CertificateX509(); + cert.Load(pathCert); + runTestWithEncoding(key, cert, "SHA256"); + + } + + + + [Test] + public void Test_sha256_2048_PKCS12() + { + string pathKey = Path.Combine(path_RSA_sha256_2048, "sha256_cert.p12"); + string pathCert = Path.Combine(path_RSA_sha256_2048, "sha256_cert.p12"); + PrivateKeyManager key = new PrivateKeyManager(); + key.LoadPKCS12(pathKey, alias, password); + CertificateX509 cert = new CertificateX509(); + cert.LoadPKCS12(pathCert, alias, password); + runTestWithEncoding(key, cert, "SHA256"); + + } + + [Test] + public void Test_sha512_2048_DER() + { + string pathKey = Path.Combine(path_RSA_sha512_2048, "sha512d_key.pem"); + string pathCert = Path.Combine(path_RSA_sha512_2048, "sha512_cert.crt"); + PrivateKeyManager key = new PrivateKeyManager(); + key.Load(pathKey); + CertificateX509 cert = new CertificateX509(); + cert.Load(pathCert); + runTestWithEncoding(key, cert, "SHA512"); + + } + + [Test] + public void Test_sha512_2048_PEM() + { + string pathKey = Path.Combine(path_RSA_sha512_2048, "sha512d_key.pem"); + string pathCert = Path.Combine(path_RSA_sha512_2048, "sha512_cert.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + key.Load(pathKey); + CertificateX509 cert = new CertificateX509(); + cert.Load(pathCert); + runTestWithEncoding(key, cert, "SHA512"); + + } + + + + [Test] + public void Test_sha512_2048_PKCS12() + { + string pathKey = Path.Combine(path_RSA_sha512_2048, "sha512_cert.p12"); + string pathCert = Path.Combine(path_RSA_sha512_2048, "sha512_cert.p12"); + PrivateKeyManager key = new PrivateKeyManager(); + key.LoadPKCS12(pathKey, alias, password); + CertificateX509 cert = new CertificateX509(); + cert.LoadPKCS12(pathCert, alias, password); + runTestWithEncoding(key, cert, "SHA512"); + + } + + [Test] + public void Test_base64() + { + string base64stringCert = "MIIC/DCCAmWgAwIBAgIJAPmCVmfcc0IXMA0GCSqGSIb3DQEBCwUAMIGWMQswCQYDVQQGEwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQMA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMMCXNncmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMB4XDTIwMDcwODE4NDkxNVoXDTI1MDcwNzE4NDkxNVowgZYxCzAJBgNVBAYTAlVZMRMwEQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYDVQQKDAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dyYW1wb25lMSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMZ8m4ftIhfrdugi5kEszRZr5IRuqGDLTex+CfVnhnBYXyQgJXeCI0eyRYUAbNzw/9MPdFN//pV26AXeH/ajORVu1JVoOACZdNOIPFnwXXh8oBxNxLAYlqoK2rAL+/tns8rKqqS4p8HSat9tj07TUXnsYJmmbXJM/eB94Ex66D1ZAgMBAAGjUDBOMB0GA1UdDgQWBBTfXY8eOfDONCZpFE0V34mJJeCYtTAfBgNVHSMEGDAWgBTfXY8eOfDONCZpFE0V34mJJeCYtTAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBCwUAA4GBAAPv7AFlCSpJ32c/VYowlbk6UBhOKmVWBQlrAtvVQYtCKO/y9CEB8ikG19c8lHM9axnsbZR+G7g04Rfuiea3T7VPkSmUXPpz5fl6Zyk4LZg5Oji7MMMXGmr+7cpYWRhifCVwoxSgZEXt3d962IZ1Wei0LMO+4w4gnzPxqr8wVHnT"; + string base64stringKey = "MIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBAMZ8m4ftIhfrdugi5kEszRZr5IRuqGDLTex+CfVnhnBYXyQgJXeCI0eyRYUAbNzw/9MPdFN//pV26AXeH/ajORVu1JVoOACZdNOIPFnwXXh8oBxNxLAYlqoK2rAL+/tns8rKqqS4p8HSat9tj07TUXnsYJmmbXJM/eB94Ex66D1ZAgMBAAECgYA1xrTs0taV3HnO0wXHSrgWBw1WxBRihTKLjGpuTqoh7g943izIgD3GwwoKyt6zzafCK0G9DcSQAjNCw7etPvPL3FxwhDl+AHSv9JcChk/auICtMWwjurG4npto+s3byj/N00Idpz1xuOgKd8k9sdoPBGKa8l+LL+adSXzoivLG8QJBAPDvbOLSs9petB2iM6w5/DiC8EoxqDaBc7I1JFCvPOfB7i1GFFxkQ7hlgxpvaPX3NHXjAZpgdOW68P/SjU0izKsCQQDS5bjrNo3xn/MbYKojzwprR/Bo8Kvbi4/2M9NE3GwHegVmx5I+df+J0aObrbBNPLs/rhrFtt12OtgxJaac+FYLAkEA8DUUbvO4wj7m/iBnug65irHo1V+6oFThv0tCIHsFkt4DEvoqdI62AZKbafCnSYqjr+CaCYqfIScG/Vay77OBLwJBAI8EYAmKPmn7+SW4wMh1z+/+ogbYJwNEOoVQkdXh0JSlZ+JSNleLN5ajhtq8x5EpPSYrEFbB8p8JurBhgwJx2g8CQQDrp9scoK8eKBJ2p/63xqLGYSN6OZQo/4Lkq3983rmHoDCAp3Bz1zUyxQB3UVyrOj4U44C7RtDNiMSZuCwvjYAI"; + PrivateKeyManager key = new PrivateKeyManager(); + key.FromBase64(base64stringKey); + CertificateX509 cert = new CertificateX509(); + cert.FromBase64(base64stringCert); + runTestWithEncoding(key, cert, "SHA256"); + + } + + + + private void bulkTest(PrivateKeyManager privateKey, CertificateX509 cert, string hashAlgorithm) + { + string enc = Global.GLOBAL_ENCODING; + if (SecurityUtils.compareStrings(enc, "UTF_32") || SecurityUtils.compareStrings(enc, "UTF_32BE") + || SecurityUtils.compareStrings(enc, "UTF_32LE")) + { + plainText = eu.getString(eu.getBytes(plainText32)); + } + else + { + + plainText = eu.getString(eu.getBytes(plainText16)); + } + + for (int p = 0; p < arrayPaddings.Length; p++) + { + + AsymmetricCipher asymCipher = new AsymmetricCipher(); + // AsymmetricCipher asymCipherD = new AsymmetricCipher(); + string encrypted1 = asymCipher.DoEncrypt_WithPrivateKey(hashAlgorithm, arrayPaddings[p], privateKey, + plainText); + string decrypted1 = asymCipher.DoDecrypt_WithPublicKey(hashAlgorithm, arrayPaddings[p], cert, encrypted1); + + Assert.AreEqual(decrypted1, plainText); + True(SecurityUtils.compareStrings(decrypted1, plainText), asymCipher); + string encrypted2 = asymCipher.DoEncrypt_WithPublicKey(hashAlgorithm, arrayPaddings[p], cert, plainText); + string decrypted2 = asymCipher.DoDecrypt_WithPrivateKey(hashAlgorithm, arrayPaddings[p], privateKey, + encrypted2); + Assert.IsTrue(SecurityUtils.compareStrings(decrypted2, plainText)); + True(SecurityUtils.compareStrings(decrypted2, plainText), asymCipher); + } + } + + private void runTestWithEncoding(PrivateKeyManager key, CertificateX509 cert, string hash) + { + for (int i = 0; i < encodings.Length; i++) + { + eu.setEncoding(encodings[i]); + bulkTest(key, cert, hash); + } + } + + [Test] + public void Test_sha1_1024_PEM_Encrypted() + { + string pathKey = Path.Combine(path_RSA_sha1_1024, "sha1_key.pem"); + string pathCert = Path.Combine(path_RSA_sha1_1024, "sha1_cert.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + key.LoadEncrypted(pathKey, password); + CertificateX509 cert = new CertificateX509(); + cert.Load(pathCert); + runTestWithEncoding(key, cert, "SHA1"); + + } + + [Test] + public void Test_sha256_1024_PEM_Encrypted() + { + string pathKey = Path.Combine(path_RSA_sha256_1024, "sha256_key.pem"); + string pathCert = Path.Combine(path_RSA_sha256_1024, "sha256_cert.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + key.LoadEncrypted(pathKey, password); + CertificateX509 cert = new CertificateX509(); + cert.Load(pathCert); + runTestWithEncoding(key, cert, "SHA256"); + + } + + [Test] + public void Test_sha256_2048_PEM_Encrypted() + { + string pathKey = Path.Combine(path_RSA_sha256_2048, "sha256_key.pem"); + string pathCert = Path.Combine(path_RSA_sha256_2048, "sha256_cert.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + key.LoadEncrypted(pathKey, password); + CertificateX509 cert = new CertificateX509(); + cert.Load(pathCert); + runTestWithEncoding(key, cert, "SHA256"); + + } + + [Test] + public void Test_sha512_2048_PEM_Encrypted() + { + string pathKey = Path.Combine(path_RSA_sha512_2048, "sha512_key.pem"); + string pathCert = Path.Combine(path_RSA_sha512_2048, "sha512_cert.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + key.LoadEncrypted(pathKey, password); + CertificateX509 cert = new CertificateX509(); + cert.Load(pathCert); + runTestWithEncoding(key, cert, "SHA512"); + + } + } +} diff --git a/test/dotnetframework/SecurityAPITest/Cryptography/Asymmetric/TestRSASigning.cs b/test/dotnetframework/SecurityAPITest/Cryptography/Asymmetric/TestRSASigning.cs new file mode 100644 index 0000000..1b5b516 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/Cryptography/Asymmetric/TestRSASigning.cs @@ -0,0 +1,295 @@ +using SecurityAPITest.SecurityAPICommons.commons; +using System; +using NUnit.Framework; +using SecurityAPICommons.Config; +using GeneXusCryptography.Asymmetric; +using SecurityAPICommons.Keys; +using System.IO; + +namespace SecurityAPITest.Cryptography.Asymmetric +{ + [TestFixture] + public class TestRSASigning: SecurityAPITestObject + { + + private static string path_RSA_sha1_1024; + private static string path_RSA_sha256_1024; + private static string path_RSA_sha256_2048; + private static string path_RSA_sha512_2048; + private static string[] encodings; + private static EncodingUtil eu; + + //private static String[] arrayPaddings; + + private static string plainText; + + public static string alias; + public static string password; + + [SetUp] + public virtual void SetUp() + { + + path_RSA_sha1_1024 = Path.Combine(BASE_PATH, "dummycerts", "RSA_sha1_1024"); + path_RSA_sha256_1024 = Path.Combine(BASE_PATH, "dummycerts", "RSA_sha256_1024"); + path_RSA_sha256_2048 = Path.Combine(BASE_PATH, "dummycerts", "RSA_sha256_2048"); + path_RSA_sha512_2048 = Path.Combine(BASE_PATH, "dummycerts", "RSA_sha512_2048"); + + //arrayPaddings = new String[] { "OAEPPADDING", "PCKS1PADDING", "ISO97961PADDING" }; + + plainText = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam venenatis ex sit amet risus pellentesque, a faucibus quam ultrices. Ut tincidunt quam eu aliquam maximus. Quisque posuere risus at erat blandit eleifend. Curabitur viverra rutrum volutpat. Donec quis quam tellus. Aenean fermentum elementum augue, a semper risus scelerisque sit amet. Nullam vitae sapien vitae dui ullamcorper dapibus quis quis leo. Sed neque felis, pellentesque in risus et, lobortis ultricies nulla. Quisque quis quam risus. Donec vestibulum, lectus vel vestibulum eleifend, velit ante volutpat lacus, ut mattis quam ligula eget est. Sed et pulvinar lectus. In mollis turpis non ipsum vehicula, sit amet rutrum nibh dictum. Duis consectetur convallis ex, eu ultricies enim bibendum vel. Vestibulum vel libero nibh. Morbi nec odio mattis, vestibulum quam blandit, pretium orci.Aenean pellentesque tincidunt nunc a malesuada. Etiam gravida fermentum mi, at dignissim dui aliquam quis. Nullam vel lobortis libero. Phasellus non gravida posuere"; + + alias = "1"; + password = "dummy"; + + encodings = new string[] { "UTF_8", "UTF_16", "UTF_16BE", "UTF_16LE", "UTF_32", "UTF_32BE", "UTF_32LE", "SJIS", "GB2312" }; + + eu = new EncodingUtil(); + } + + [Test] + public void Test_sha1_1024_DER() + { + + string pathKey = Path.Combine(path_RSA_sha1_1024, "sha1d_key.pem"); + string pathCert = Path.Combine(path_RSA_sha1_1024, "sha1_cert.crt"); + PrivateKeyManager key = new PrivateKeyManager(); + key.Load(pathKey); + CertificateX509 cert = new CertificateX509(); + cert.Load(pathCert); + runTestWithEncoding(key, cert, "SHA1"); + } + + [Test] + public void Test_sha1_1024_PEM() + { + string pathKey = Path.Combine(path_RSA_sha1_1024, "sha1d_key.pem"); + string pathCert = Path.Combine(path_RSA_sha1_1024, "sha1_cert.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + key.Load(pathKey); + CertificateX509 cert = new CertificateX509(); + cert.Load(pathCert); + runTestWithEncoding(key, cert, "SHA1"); + + } + + + + [Test] + public void Test_sha1_1024_PKCS12() + { + string pathKey = Path.Combine(path_RSA_sha1_1024, "sha1_cert.p12"); + string pathCert = Path.Combine(path_RSA_sha1_1024, "sha1_cert.p12"); + PrivateKeyManager key = new PrivateKeyManager(); + key.LoadPKCS12(pathKey, alias, password); + CertificateX509 cert = new CertificateX509(); + cert.LoadPKCS12(pathCert, alias, password); + runTestWithEncoding(key, cert, "SHA1"); + + } + + [Test] + public void Test_sha256_1024_DER() + { + string pathKey = Path.Combine(path_RSA_sha256_1024, "sha256d_key.pem"); + string pathCert = Path.Combine(path_RSA_sha256_1024, "sha256_cert.crt"); + PrivateKeyManager key = new PrivateKeyManager(); + key.Load(pathKey); + CertificateX509 cert = new CertificateX509(); + cert.Load(pathCert); + runTestWithEncoding(key, cert, "SHA256"); + + } + + [Test] + public void Test_sha256_1024_PEM() + { + string pathKey = Path.Combine(path_RSA_sha256_1024, "sha256d_key.pem"); + string pathCert = Path.Combine(path_RSA_sha256_1024, "sha256_cert.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + key.Load(pathKey); + CertificateX509 cert = new CertificateX509(); + cert.Load(pathCert); + runTestWithEncoding(key, cert, "SHA256"); + + } + + + + [Test] + public void Test_sha256_1024_PKCS12() + { + string pathKey = Path.Combine(path_RSA_sha256_1024, "sha256_cert.p12"); + string pathCert = Path.Combine(path_RSA_sha256_1024, "sha256_cert.p12"); + PrivateKeyManager key = new PrivateKeyManager(); + key.LoadPKCS12(pathKey, alias, password); + CertificateX509 cert = new CertificateX509(); + cert.LoadPKCS12(pathCert, alias, password); + runTestWithEncoding(key, cert, "SHA256"); + + } + + [Test] + public void Test_sha256_2048_DER() + { + string pathKey = Path.Combine(path_RSA_sha256_2048, "sha256d_key.pem"); + string pathCert = Path.Combine(path_RSA_sha256_2048, "sha256_cert.crt"); + PrivateKeyManager key = new PrivateKeyManager(); + key.Load(pathKey); + CertificateX509 cert = new CertificateX509(); + cert.Load(pathCert); + runTestWithEncoding(key, cert, "SHA256"); + + } + + [Test] + public void Test_sha256_2048_PEM() + { + string pathKey = Path.Combine(path_RSA_sha256_2048, "sha256d_key.pem"); + string pathCert = Path.Combine(path_RSA_sha256_2048, "sha256_cert.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + key.Load(pathKey); + CertificateX509 cert = new CertificateX509(); + cert.Load(pathCert); + runTestWithEncoding(key, cert, "SHA256"); + + } + + + + [Test] + public void Test_sha256_2048_PKCS12() + { + string pathKey = Path.Combine(path_RSA_sha256_2048, "sha256_cert.p12"); + string pathCert = Path.Combine(path_RSA_sha256_2048, "sha256_cert.p12"); + PrivateKeyManager key = new PrivateKeyManager(); + key.LoadPKCS12(pathKey, alias, password); + CertificateX509 cert = new CertificateX509(); + cert.LoadPKCS12(pathCert, alias, password); + runTestWithEncoding(key, cert, "SHA256"); + + } + + [Test] + public void Test_sha512_2048_DER() + { + string pathKey = Path.Combine(path_RSA_sha512_2048, "sha512d_key.pem"); + string pathCert = Path.Combine(path_RSA_sha512_2048, "sha512_cert.crt"); + PrivateKeyManager key = new PrivateKeyManager(); + key.Load(pathKey); + CertificateX509 cert = new CertificateX509(); + cert.Load(pathCert); + runTestWithEncoding(key, cert, "SHA512"); + + } + + [Test] + public void Test_sha512_2048_PEM() + { + string pathKey = Path.Combine(path_RSA_sha512_2048, "sha512d_key.pem"); + string pathCert = Path.Combine(path_RSA_sha512_2048, "sha512_cert.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + key.Load(pathKey); + CertificateX509 cert = new CertificateX509(); + cert.Load(pathCert); + runTestWithEncoding(key, cert, "SHA512"); + + } + + + + [Test] + public void Test_sha512_2048_PKCS12() + { + string pathKey = Path.Combine(path_RSA_sha512_2048, "sha512_cert.p12"); + string pathCert = Path.Combine(path_RSA_sha512_2048, "sha512_cert.p12"); + PrivateKeyManager key = new PrivateKeyManager(); + key.LoadPKCS12(pathKey, alias, password); + CertificateX509 cert = new CertificateX509(); + cert.LoadPKCS12(pathCert, alias, password); + runTestWithEncoding(key, cert, "SHA512"); + } + + [Test] + public void Test_base64() + { + string base64stringCert = "MIIC/DCCAmWgAwIBAgIJAPmCVmfcc0IXMA0GCSqGSIb3DQEBCwUAMIGWMQswCQYDVQQGEwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQMA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMMCXNncmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMB4XDTIwMDcwODE4NDkxNVoXDTI1MDcwNzE4NDkxNVowgZYxCzAJBgNVBAYTAlVZMRMwEQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYDVQQKDAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dyYW1wb25lMSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMZ8m4ftIhfrdugi5kEszRZr5IRuqGDLTex+CfVnhnBYXyQgJXeCI0eyRYUAbNzw/9MPdFN//pV26AXeH/ajORVu1JVoOACZdNOIPFnwXXh8oBxNxLAYlqoK2rAL+/tns8rKqqS4p8HSat9tj07TUXnsYJmmbXJM/eB94Ex66D1ZAgMBAAGjUDBOMB0GA1UdDgQWBBTfXY8eOfDONCZpFE0V34mJJeCYtTAfBgNVHSMEGDAWgBTfXY8eOfDONCZpFE0V34mJJeCYtTAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBCwUAA4GBAAPv7AFlCSpJ32c/VYowlbk6UBhOKmVWBQlrAtvVQYtCKO/y9CEB8ikG19c8lHM9axnsbZR+G7g04Rfuiea3T7VPkSmUXPpz5fl6Zyk4LZg5Oji7MMMXGmr+7cpYWRhifCVwoxSgZEXt3d962IZ1Wei0LMO+4w4gnzPxqr8wVHnT"; + string base64stringKey = "MIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBAMZ8m4ftIhfrdugi5kEszRZr5IRuqGDLTex+CfVnhnBYXyQgJXeCI0eyRYUAbNzw/9MPdFN//pV26AXeH/ajORVu1JVoOACZdNOIPFnwXXh8oBxNxLAYlqoK2rAL+/tns8rKqqS4p8HSat9tj07TUXnsYJmmbXJM/eB94Ex66D1ZAgMBAAECgYA1xrTs0taV3HnO0wXHSrgWBw1WxBRihTKLjGpuTqoh7g943izIgD3GwwoKyt6zzafCK0G9DcSQAjNCw7etPvPL3FxwhDl+AHSv9JcChk/auICtMWwjurG4npto+s3byj/N00Idpz1xuOgKd8k9sdoPBGKa8l+LL+adSXzoivLG8QJBAPDvbOLSs9petB2iM6w5/DiC8EoxqDaBc7I1JFCvPOfB7i1GFFxkQ7hlgxpvaPX3NHXjAZpgdOW68P/SjU0izKsCQQDS5bjrNo3xn/MbYKojzwprR/Bo8Kvbi4/2M9NE3GwHegVmx5I+df+J0aObrbBNPLs/rhrFtt12OtgxJaac+FYLAkEA8DUUbvO4wj7m/iBnug65irHo1V+6oFThv0tCIHsFkt4DEvoqdI62AZKbafCnSYqjr+CaCYqfIScG/Vay77OBLwJBAI8EYAmKPmn7+SW4wMh1z+/+ogbYJwNEOoVQkdXh0JSlZ+JSNleLN5ajhtq8x5EpPSYrEFbB8p8JurBhgwJx2g8CQQDrp9scoK8eKBJ2p/63xqLGYSN6OZQo/4Lkq3983rmHoDCAp3Bz1zUyxQB3UVyrOj4U44C7RtDNiMSZuCwvjYAI"; + PrivateKeyManager key = new PrivateKeyManager(); + key.FromBase64(base64stringKey); + CertificateX509 cert = new CertificateX509(); + cert.FromBase64(base64stringCert); + runTestWithEncoding(key, cert, "SHA256"); + } + + private void bulkTest(PrivateKeyManager key, CertificateX509 cert, string hashAlgorithm) + { + AsymmetricSigner asymSig = new AsymmetricSigner(); + string signature = asymSig.DoSign(key, hashAlgorithm, plainText); + bool result = asymSig.DoVerify(cert, plainText, signature); + Assert.IsTrue(result); + True(result, asymSig); + } + + private void runTestWithEncoding(PrivateKeyManager key, CertificateX509 cert, string hash) + { + for (int i = 0; i < encodings.Length; i++) + { + eu.setEncoding(encodings[i]); + bulkTest(key, cert, hash); + } + } + + [Test] + public void Test_sha256_2048_PEM_Encrypted() + { + string pathKey = Path.Combine(path_RSA_sha256_2048, "sha256_key.pem"); + string pathCert = Path.Combine(path_RSA_sha256_2048, "sha256_cert.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + key.LoadEncrypted(pathKey, password); + CertificateX509 cert = new CertificateX509(); + cert.Load(pathCert); + runTestWithEncoding(key, cert, "SHA256"); + + } + + [Test] + public void Test_sha512_2048_PEM_Encrypted() + { + string pathKey = Path.Combine(path_RSA_sha512_2048, "sha512_key.pem"); + string pathCert = Path.Combine(path_RSA_sha512_2048, "sha512_cert.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + key.LoadEncrypted(pathKey, password); + CertificateX509 cert = new CertificateX509(); + cert.Load(pathCert); + runTestWithEncoding(key, cert, "SHA512"); + + } + + [Test] + public void Test_sha256_1024_PEM_Encrypted() + { + string pathKey = Path.Combine(path_RSA_sha256_1024, "sha256_key.pem"); + string pathCert = Path.Combine(path_RSA_sha256_1024, "sha256_cert.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + key.LoadEncrypted(pathKey, password); + CertificateX509 cert = new CertificateX509(); + cert.Load(pathCert); + runTestWithEncoding(key, cert, "SHA256"); + + } + + [Test] + public void Test_sha1_1024_PEM_Encrypted() + { + string pathKey = Path.Combine(path_RSA_sha1_1024, "sha1_key.pem"); + string pathCert = Path.Combine(path_RSA_sha1_1024, "sha1_cert.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + key.LoadEncrypted(pathKey, password); + CertificateX509 cert = new CertificateX509(); + cert.Load(pathCert); + runTestWithEncoding(key, cert, "SHA1"); + + } + } +} diff --git a/test/dotnetframework/SecurityAPITest/Cryptography/Checksum/TestChecksum.cs b/test/dotnetframework/SecurityAPITest/Cryptography/Checksum/TestChecksum.cs new file mode 100644 index 0000000..6e97837 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/Cryptography/Checksum/TestChecksum.cs @@ -0,0 +1,136 @@ +using GeneXusCryptography.Checksum; +using NUnit.Framework; +using SecurityAPICommons.Config; +using SecurityAPICommons.Utils; +using SecurityAPITest.SecurityAPICommons.commons; +using System.IO; + +namespace SecurityAPITest.Cryptography.Checksum +{ + [TestFixture] + public class TestChecksum : SecurityAPITestObject + { + private static string input; + private static string b64Input; + private static string hexaInput; + private static string localFileInput; + private static string[] algorithms; + private static string[] results; + private static string[] results0x; + private static string[] resultsLocalFile; + private static string[] resultsLocalFile0x; + private static string[] inputTypes; + private static string[] inputs; + + [SetUp] + protected virtual void SetUp() + { + new EncodingUtil().setEncoding("UTF8"); + input = "123456789"; + b64Input = "MTIzNDU2Nzg5"; + hexaInput = "313233343536373839"; + localFileInput = Path.Combine(BASE_PATH, "Temp", "bookSample.xml"); + + inputs = new string[] { input, input, b64Input, hexaInput }; + inputTypes = new string[] { "ASCII", "TXT", "BASE64", "HEX" }; + algorithms = new string[] { "CRC8", "CRC8_CDMA2000", "CRC8_DARC", "CRC8_DVB_S2", "CRC8_EBU", "CRC8_I_CODE", + "CRC8_ITU", "CRC8_MAXIM", "CRC8_ROHC", "CRC8_WCDMA", "CRC16_AUG_CCITT", "CRC16_CCITT_FALSE", + "CRC16_ARC", "CRC16_BUYPASS", "CRC16_CDMA2000", "CRC16_DDS_110", "CRC16_DECT_R", "CRC16_DECT_X", + "CRC16_DNP", "CRC16_EN_13757", "CRC16_GENIBUS", "CRC16_MAXIM", "CRC16_MCRF4XX", "CRC16_RIELLO", + "CRC16_T10_DIF", "CRC16_TELEDISK", "CRC16_TMS_37157", "CRC16_USB", "CRC_A", "CRC16_KERMIT", + "CRC16_MODBUS", "CRC16_X_25", "CRC16_XMODEM", "CRC32", "CRC32_BZIP2", "CRC32C", "CRC32D", + "CRC32_MPEG_2", "CRC32_POSIX", "CRC32Q", "CRC32_JAMCRC", "CRC32_XFER", "MD5", "SHA1", "SHA256", + "SHA512" }; + results = new string[] { "F4", "DA", "15", "BC", "97", "7E", "A1", "A1", "D0", "25", "E5CC", "29B1", "BB3D", + "FEE8", "4C06", "9ECF", "007E", "007F", "EA82", "C2B7", "D64E", "44C2", "6F91", "63D0", "D0DB", "0FB3", + "26B1", "B4C8", "BF05", "2189", "4B37", "906E", "31C3", "CBF43926", "FC891918", "E3069283", "87315576", + "0376E6E7", "765E7680", "3010BF7F", "340BC6D9", "BD0BE338", "25F9E794323B453885F5181F1B624D0B", + "F7C3BC1D808E04732ADF679965CCC34CA7AE3441", + "15E2B0D3C33891EBB0F1EF609EC419420C20E320CE94C65FBC8C3312448EB225", + "D9E6762DD1C8EAF6D61B3C6192FC408D4D6D5F1176D0C29169BC24E71C3F274AD27FCD5811B313D681F7E55EC02D73D499C95455B6B5BB503ACF574FBA8FFE85" }; + results0x = new string[] { "0xF4", "0xDA", "0x15", "0xBC", "0x97", "0x7E", "0xA1", "0xA1", "0xD0", "0x25", "0xE5CC", "0x29B1", "0xBB3D", + "0xFEE8", "0x4C06", "0x9ECF", "0x007E", "0x007F", "0xEA82", "0xC2B7", "0xD64E", "0x44C2", "0x6F91", "0x63D0", "0xD0DB", "0x0FB3", + "0x26B1", "0xB4C8", "0xBF05", "0x2189", "0x4B37", "0x906E", "0x31C3", "0xCBF43926", "0xFC891918", "0xE3069283", "0x87315576", + "0x0376E6E7", "0x765E7680", "0x3010BF7F", "0x340BC6D9", "0xBD0BE338", "0x25F9E794323B453885F5181F1B624D0B", + "0xF7C3BC1D808E04732ADF679965CCC34CA7AE3441", + "0x15E2B0D3C33891EBB0F1EF609EC419420C20E320CE94C65FBC8C3312448EB225", + "0xD9E6762DD1C8EAF6D61B3C6192FC408D4D6D5F1176D0C29169BC24E71C3F274AD27FCD5811B313D681F7E55EC02D73D499C95455B6B5BB503ACF574FBA8FFE85" }; + resultsLocalFile = new string[] { "AD", "C2", "C0", "29", "AC", "C6", "F8", "58", "E9", "BA", "E7BF", "EB02", + "7982", "8DC7", "8023", "347E", "78ED", "78EC", "1223", "F11E", "14FD", "867D", "8690", "8656", "89CC", + "D6A3", "FF40", "1452", "47D3", "12A7", "EBAD", "796F", "072B", "3172BC69", "18D27AE6", "8C403DED", + "3B83323F", "E72D8519", "981F81DA", "323A5936", "CE8D4396", "ABBC544E", + "19D987515BC23D6D8A29AD2A063A58ED", "1DCC48655437412E56A0B66E214DE0A91B0F888F", + "5248D4A7D1A6588AB8BABDE9487D43579CA957DED6ED553AF04D506702100C9F", + "5C7B1671D81B37FB4A1B8DF4E23091D10181F2D3559BD3B5515C23F8F042CF8A60E26EAC5A70D8E2AC7B8585CAAB7F42480213D5771FC5430E550F2D429349FA" }; + resultsLocalFile0x = new string[] { "0xAD", "0xC2", "0xC0", "0x29", "0xAC", "0xC6", "0xF8", "0x58", "0xE9", + "0xBA", "0xE7BF", "0xEB02", "0x7982", "0x8DC7", "0x8023", "0x347E", "0x78ED", "0x78EC", "0x1223", + "0xF11E", "0x14FD", "0x867D", "0x8690", "0x8656", "0x89CC", "0xD6A3", "0xFF40", "0x1452", "0x47D3", + "0x12A7", "0xEBAD", "0x796F", "0x072B", "0x3172BC69", "0x18D27AE6", "0x8C403DED", "0x3B83323F", + "0xE72D8519", "0x981F81DA", "0x323A5936", "0xCE8D4396", "0xABBC544E", + "0x19D987515BC23D6D8A29AD2A063A58ED", "0x1DCC48655437412E56A0B66E214DE0A91B0F888F", + "0x5248D4A7D1A6588AB8BABDE9487D43579CA957DED6ED553AF04D506702100C9F", + "0x5C7B1671D81B37FB4A1B8DF4E23091D10181F2D3559BD3B5515C23F8F042CF8A60E26EAC5A70D8E2AC7B8585CAAB7F42480213D5771FC5430E550F2D429349FA" }; + } + + [Test] + public void TestBulkChecksum() + { + ChecksumCreator check = new ChecksumCreator(); + for (int j = 0; j < inputs.Length; j++) + { + for (int i = 0; i < algorithms.Length; i++) + { + string checksum = check.GenerateChecksum(inputs[j], inputTypes[j], algorithms[i]); + Assert.IsTrue(SecurityUtils.compareStrings(checksum, results[i])); + bool verify = check.VerifyChecksum(inputs[j], inputTypes[j], algorithms[i], checksum); + True(verify, check); + } + } + + } + + [Test] + public void TestBulkChecksum0x() + { + ChecksumCreator check = new ChecksumCreator(); + for (int j = 0; j < inputs.Length; j++) + { + for (int i = 0; i < algorithms.Length; i++) + { + string checksum = check.GenerateChecksum(inputs[j], inputTypes[j], algorithms[i]); + Assert.IsTrue(SecurityUtils.compareStrings(checksum, results[i])); + bool verify = check.VerifyChecksum(inputs[j], inputTypes[j], algorithms[i], results0x[i].ToLower()); + True(verify, check); + } + } + + } + + [Test] + public void TestBulkChecksum_LocalFile() + { + ChecksumCreator check = new ChecksumCreator(); + for (int k = 0; k < algorithms.Length; k++) + { + string checksum = check.GenerateChecksum(localFileInput, "LOCAL_FILE", algorithms[k]); + Assert.IsTrue(SecurityUtils.compareStrings(checksum, resultsLocalFile[k])); + bool verify = check.VerifyChecksum(localFileInput, "LOCAL_FILE", algorithms[k], checksum); + True(verify, check); + } + } + + [Test] + public void TestBulkChecksum0x_LocalFile() + { + ChecksumCreator check = new ChecksumCreator(); + for (int k = 0; k < algorithms.Length; k++) + { + string checksum = check.GenerateChecksum(localFileInput, "LOCAL_FILE", algorithms[k]); + Assert.IsTrue(SecurityUtils.compareStrings(checksum, resultsLocalFile[k])); + bool verify = check.VerifyChecksum(localFileInput, "LOCAL_FILE", algorithms[k], + resultsLocalFile0x[k].ToLower()); + True(verify, check); + } + } + } +} diff --git a/test/dotnetframework/SecurityAPITest/Cryptography/Hash/TestHashDomainSpaces.cs b/test/dotnetframework/SecurityAPITest/Cryptography/Hash/TestHashDomainSpaces.cs new file mode 100644 index 0000000..802e2f8 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/Cryptography/Hash/TestHashDomainSpaces.cs @@ -0,0 +1,31 @@ +using GeneXusCryptography.Hash; +using NUnit.Framework; +using SecurityAPICommons.Utils; +using SecurityAPITest.SecurityAPICommons.commons; + +namespace SecurityAPITest.Cryptography.Hash +{ + [TestFixture] + public class TestHashDomainSpaces : SecurityAPITestObject + { + protected static string plainText; + protected static string SHA1Digest = "38F00F8738E241DAEA6F37F6F55AE8414D7B0219"; + protected static Hashing hash; + + [SetUp] + public virtual void SetUp() + { + SHA1Digest = "38F00F8738E241DAEA6F37F6F55AE8414D7B0219"; + hash = new Hashing(); + plainText = "Lorem ipsum dolor sit amet"; + } + + [Test] + public void TestSpaces() + { + string digest = hash.DoHash(" SHA1", plainText); + Assert.IsFalse(hash.HasError()); + Assert.IsTrue(SecurityUtils.compareStrings(digest, SHA1Digest)); + } + } +} diff --git a/test/dotnetframework/SecurityAPITest/Cryptography/Hash/TestHashing.cs b/test/dotnetframework/SecurityAPITest/Cryptography/Hash/TestHashing.cs new file mode 100644 index 0000000..b78e03b --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/Cryptography/Hash/TestHashing.cs @@ -0,0 +1,88 @@ +using System; +using GeneXusCryptography.Hash; +using NUnit.Framework; +using SecurityAPICommons.Config; +using SecurityAPICommons.Utils; +using SecurityAPITest.SecurityAPICommons.commons; + +namespace SecurityAPITest.Cryptography.Hash +{ + [TestFixture] + public class TestHashing: SecurityAPITestObject + { + protected static string plainText; + protected string[] arrayHashes; + protected string[] arrayResHashes; + + [SetUp] + protected virtual void SetUp() + { + new EncodingUtil().setEncoding("UTF8"); + string MD5 = "FEA80F2DB003D4EBC4536023814AA885"; + string SHA1 = "38F00F8738E241DAEA6F37F6F55AE8414D7B0219"; + string SHA224 = "B3F933DCF0CD5C02169F6FFB9E9DD156E6A378F64DD992D5768BA020"; + string SHA256 = "16ABA5393AD72C0041F5600AD3C2C52EC437A2F0C7FC08FADFC3C0FE9641D7A3"; + string SHA384 = "95A0541E1E04F0C65701902FD92329070BDC7001477B0B9B280C79BC1ADDC9D8C305E97A8BDECDC3E6024069AE97A2CD"; + string SHA512 = "B1F4AAA6B51C19FFBE4B1B6FA107BE09C8ACAFD7C768106A3FAF475B1E27A940D3C075FDA671EADF46C68F93D7EABCF604BCBF7055DA0DC4EAE6743607A2FC3F"; + string BLAKE2B_224 = "CFD4B035CD7F135A65E196FD5220FD232D499017F153D7A12AAC48EE"; + string BLAKE2B_256 = "43D3205918BBB6A0175A949BD5AA77F6AC87184F8459ED9EA66387773B4121A5"; + string BLAKE2B_384 = "44BC61A7DD4447862D2DB262338A6ABF2B3FFCC3E05CBE4C0ED279157FCCDB36BE66B67F7733ABA902CE6AF65B733B31"; + string BLAKE2B_512 = "965F6293650C11D0AFB91385AFA89F937A468E1F693C5402D369431347E4DC22800A9DCF425B27BFA884E05C80F9D2F23797CA6DB3CD357383D3C6DCA8BA68CA"; + string BLAKE2S_128 = "20CBE99525EC7A3B20BC2A5F9A6B0A01"; + string BLAKE2S_160 = "08E46034CD071C09DAAFF949AA47652E32BC4029"; + string BLAKE2S_224 = "7DF368CC11D65AF123CBDEE9ABDDEC3B09AB879AAD1BD3EBE6E512F0"; + string BLAKE2S_256 = "52FEE5030C5B61C42DB2DC09435BC6E6F357AAFA450C23F0C4DB8F2D44C7C3A6"; + string GOST3411_2012_256 = "2FB0AA06A692B00A1905BE6AF797F24C976B6746DE31D5A67A096E685EFB4489"; + string GOST3411_2012_512 = "C5DC8AF567D3183040C6CDC1F19F38FC6345B0513D02EBF9D2054690D85DD38271E38F3C0069A9C0891764E9F94E627D1245C6D718C4194AA3E594E209639453"; + string GOST3411 = "47B222D3029D84F229DB1798942A1192F5BA27D3647F12DD0F735DD0C420C160"; + string KECCAK_224 = "8AF0DB4E1481E9E8704312634537664FA634932E92236DED8B2AA348"; + string KECCAK_256 = "B53B7CA515051D49E851C07BD0FBDDDB8010A9366F5B1F5FB737BA21A4356301"; + string KECCAK_288 = "5F73ABD3095975571EBC94BAC6D9840CC888D81A9FD2BF524D1F9F37E422E736C7EE47CC"; + string KECCAK_384 = "C31C889B72BAEBEC30903190864B0035A5058C3A79A45A5E488DC4FFA7E81D881F6B85DD3493C222925B79E90B8AEDED"; + string KECCAK_512 = "21FDB61F9F82B8D20930B43D51DC7FE0E931D2E18E957F3B5316D147FE3E2E5EC567457D0894A6BF867595A1A1AA1303FB19D57D2DA5921119C8EC801FC1F68D"; + string MD2 = "854BF540A75F548906201F479526C1BA"; + string MD4 = "69740FE64C87D1DF772D8B8BAC7FCC26"; + string RIPEMD128 = "52EE689604C15591ED9EF6A0BDF6FD28"; + string RIPEMD160 = "7D0982BE59EBE828D02AA0D031AA6651644D60DA"; + string RIPEMD256 = "49A275CDAC39B746C0E0DCFBCE97144940863F83DF4EA8A0833874496BC84102"; + string RIPEMD320 = "969607288B7E788A239B91803AC0187530F16242AA314CFD06CBE780E2377CFA200A2288DB019BFD"; + string SHA3_224 = "F75F9AFF421AB1A2BF95B997144F184ACF97F2BCD4FFB854B8C7377D"; + string SHA3_256 = "AFBE560C8EA52AF055471E6AEDB33B104F2A2373CE642B251A9F5F25E669BF66"; + string SHA3_384 = "4E1389E97F01ACB13A88AF18FCA572CEFE56926612315F797C6D2CB0F5EEA3BF4FD2623D3E3A388B14225F2DEE806F2A"; + string SHA3_512 = "8571AE21DB0FE5F7EEE18B029557038B61C024773A625082FA528DBCD19737A828663CB4D51726865B959AB6961D609DD1FEEBC251A575BED0DD8661BE2B83C1"; + string SHAKE_128 = "22E24D7A4D4CD0FFC803529449287D60"; + string SHAKE_256 = "F4112786511DF1AD767E69121859269D4BE0C910A0E88848D8DD887D49741B5E"; + string SM3 = "2F097B534D5FC00AF295A8ECA9CC7B75DFCD1C1F9E272B406626DC98908244D7"; + string TIGER = "3217841153FBA3E5CFFC5F57E815FCE833A813ED10F78F3C"; + string WHIRLPOOL = "EA126D6304A311602F7F194E492559FBEA4D4DC7F3E6415DE369D184E19F6597171DD1303527D8EE440A049F5239385D23E58750913FC4F94A4C5E4CDE9031D1"; + + plainText = "Lorem ipsum dolor sit amet"; + + arrayHashes = new string[] { "MD5", "SHA1", "SHA224", "SHA256", "SHA384", "SHA512", "BLAKE2B_224", + "BLAKE2B_256", "BLAKE2B_384", "BLAKE2B_512", "BLAKE2S_128", "BLAKE2S_160", "BLAKE2S_224", "BLAKE2S_256", + "GOST3411_2012_256", "GOST3411_2012_512", "GOST3411", "KECCAK_224", "KECCAK_256", "KECCAK_288", + "KECCAK_384", "KECCAK_512", "MD2", "MD4", "RIPEMD128", "RIPEMD160", "RIPEMD256", "RIPEMD320", + "SHA3-224", "SHA3-256", "SHA3-384", "SHA3-512", "SHAKE_128", "SHAKE_256", "SM3", "TIGER", "WHIRLPOOL" }; + arrayResHashes = new string[] { MD5, SHA1, SHA224, SHA256, SHA384, SHA512, BLAKE2B_224, BLAKE2B_256, + BLAKE2B_384, BLAKE2B_512, BLAKE2S_128, BLAKE2S_160, BLAKE2S_224, BLAKE2S_256, GOST3411_2012_256, + GOST3411_2012_512, GOST3411, KECCAK_224, KECCAK_256, KECCAK_288, KECCAK_384, KECCAK_512, MD2, MD4, + RIPEMD128, RIPEMD160, RIPEMD256, RIPEMD320, SHA3_224, SHA3_256, SHA3_384, SHA3_512, SHAKE_128, + SHAKE_256, SM3, TIGER, WHIRLPOOL }; + } + + [Test] + public void TestBulkHashes() + { + Hashing hash = new Hashing(); + for (int a = 0; a < arrayHashes.Length; a++) + { + string result = hash.DoHash(arrayHashes[a], plainText); + Assert.IsTrue(SecurityUtils.compareStrings(arrayResHashes[a], result)); + True(SecurityUtils.compareStrings(arrayResHashes[a], result), hash); + } + } + + + + } +} diff --git a/test/dotnetframework/SecurityAPITest/Cryptography/Mac/TestCmac.cs b/test/dotnetframework/SecurityAPITest/Cryptography/Mac/TestCmac.cs new file mode 100644 index 0000000..7b27fca --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/Cryptography/Mac/TestCmac.cs @@ -0,0 +1,650 @@ +using System; +using GeneXusCryptography.Mac; +using NUnit.Framework; +using SecurityAPICommons.Config; +using SecurityAPICommons.Keys; +using SecurityAPITest.SecurityAPICommons.commons; + +namespace SecurityAPITest.Cryptography.Mac +{ + [TestFixture] + public class TestCmac: SecurityAPITestObject + { + private static string plainText; + private static string plainTextCTS; + + protected static string key1024; + protected static string key512; + protected static string key448; + protected static string key256; + protected static string key192; + protected static string key160; + protected static string key128; + protected static string key64; + + protected static string IV128; + protected static string IV64; + + private static SymmetricKeyGenerator keyGen; + + private static string[] encodings; + private static EncodingUtil eu; + + [SetUp] + public virtual void SetUp() + { + plainText = "Neque porro quisquam est qui dolorem ipsum quia dolor sit amet"; + plainTextCTS = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam venenatis ex sit amet risus pellentesque, a faucibus quam ultrices. Ut tincidunt quam eu aliquam maximus. Quisque posuere risus at erat blandit eleifend. Curabitur viverra rutrum volutpat. Donec quis quam tellus. Aenean fermentum elementum augue, a semper risus scelerisque sit amet. Nullam vitae sapien vitae dui ullamcorper dapibus quis quis leo. Sed neque felis, pellentesque in risus et, lobortis ultricies nulla. Quisque quis quam risus. Donec vestibulum, lectus vel vestibulum eleifend, velit ante volutpat lacus, ut mattis quam ligula eget est. Sed et pulvinar lectus. In mollis turpis non ipsum vehicula, sit amet rutrum nibh dictum. Duis consectetur convallis ex, eu ultricies enim bibendum vel. Vestibulum vel libero nibh. Morbi nec odio mattis, vestibulum quam blandit, pretium orci.Aenean pellentesque tincidunt nunc a malesuada. Etiam gravida fermentum mi, at dignissim dui aliquam quis. Nullam vel lobortis libero. Phasellus non gravida posuere"; + + keyGen = new SymmetricKeyGenerator(); + + /**** CREATE KEYS ****/ + key1024 = keyGen.doGenerateKey("GENERICRANDOM", 1024); + key512 = keyGen.doGenerateKey("GENERICRANDOM", 512); + key448 = keyGen.doGenerateKey("GENERICRANDOM", 448); + key256 = keyGen.doGenerateKey("GENERICRANDOM", 256); + key160 = keyGen.doGenerateKey("GENERICRANDOM", 160); + key192 = keyGen.doGenerateKey("GENERICRANDOM", 192); + key128 = keyGen.doGenerateKey("GENERICRANDOM", 128); + key64 = keyGen.doGenerateKey("GENERICRANDOM", 64); + + /**** CREATE IVs ****/ + IV128 = keyGen.doGenerateIV("GENERICRANDOM", 128); + IV64 = keyGen.doGenerateIV("GENERICRANDOM", 64); + + + encodings = new string[] { "UTF_8", "UTF_16", "UTF_16BE", "UTF_16LE", "UTF_32", "UTF_32BE", "UTF_32LE", "SJIS", "GB2312" }; + eu = new EncodingUtil(); + + } + + [Test] + public void TestAES() + { + // key legths 128,192 & 256 + // blocksize 128 + + testBulkAlgorithm("AES", key128, IV128, 128, false); + testBulkAlgorithm("AES", key128, IV128, 0, false); + testBulkAlgorithm("AES", key128, IV128, 64, false); + + testBulkAlgorithm("AES", key128, "", 128, false); + testBulkAlgorithm("AES", key128, "", 0, false); + testBulkAlgorithm("AES", key128, "", 64, false); + + testBulkAlgorithm("AES", key192, IV128, 128, false); + testBulkAlgorithm("AES", key192, IV128, 0, false); + testBulkAlgorithm("AES", key192, IV128, 64, false); + + testBulkAlgorithm("AES", key192, "", 128, false); + testBulkAlgorithm("AES", key192, "", 0, false); + testBulkAlgorithm("AES", key192, "", 64, false); + + testBulkAlgorithm("AES", key256, IV128, 128, false); + testBulkAlgorithm("AES", key256, IV128, 0, false); + testBulkAlgorithm("AES", key256, IV128, 64, false); + + testBulkAlgorithm("AES", key256, "", 128, false); + testBulkAlgorithm("AES", key256, "", 0, false); + testBulkAlgorithm("AES", key256, "", 64, false); + + + + } + + [Test] + public void TestBLOWFISH() + { + // key lengths 0...448 + // blocksize 64 + // no gcm + // no se puede usar CCM (blosize!=128) + // no se pude usar GCM (blocksize <128) + // EAX siempre explota, no se puede usar con AEAD + + testBulkAlgorithm("BLOWFISH", key128, IV64, 64, false); + testBulkAlgorithm("BLOWFISH", key128, IV64, 0, false); + + testBulkAlgorithm("BLOWFISH", key128, "", 64, false); + testBulkAlgorithm("BLOWFISH", key128, "", 0, false); + + testBulkAlgorithm("BLOWFISH", key192, IV64, 64, false); + testBulkAlgorithm("BLOWFISH", key192, IV64, 0, false); + + testBulkAlgorithm("BLOWFISH", key192, "", 64, false); + testBulkAlgorithm("BLOWFISH", key192, "", 0, false); + + testBulkAlgorithm("BLOWFISH", key256, IV64, 64, false); + testBulkAlgorithm("BLOWFISH", key256, IV64, 0, false); + + testBulkAlgorithm("BLOWFISH", key256, "", 64, false); + testBulkAlgorithm("BLOWFISH", key256, "", 0, false); + + } + + [Test] + public void TestCAMELLIA() + { + // key lengths 128.192.256 + // blocksize 128 + + testBulkAlgorithm("CAMELLIA", key128, IV128, 128, false); + testBulkAlgorithm("CAMELLIA", key128, IV128, 64, false); + testBulkAlgorithm("CAMELLIA", key128, IV128, 0, false); + + testBulkAlgorithm("CAMELLIA", key128, "", 128, false); + testBulkAlgorithm("CAMELLIA", key128, "", 64, false); + testBulkAlgorithm("CAMELLIA", key128, "", 0, false); + + testBulkAlgorithm("CAMELLIA", key192, IV128, 128, false); + testBulkAlgorithm("CAMELLIA", key192, IV128, 64, false); + testBulkAlgorithm("CAMELLIA", key192, IV128, 0, false); + + testBulkAlgorithm("CAMELLIA", key192, "", 128, false); + testBulkAlgorithm("CAMELLIA", key192, "", 64, false); + testBulkAlgorithm("CAMELLIA", key192, "", 0, false); + + testBulkAlgorithm("CAMELLIA", key256, IV128, 128, false); + testBulkAlgorithm("CAMELLIA", key256, IV128, 64, false); + testBulkAlgorithm("CAMELLIA", key256, IV128, 0, false); + + testBulkAlgorithm("CAMELLIA", key256, "", 128, false); + testBulkAlgorithm("CAMELLIA", key256, "", 64, false); + testBulkAlgorithm("CAMELLIA", key256, "", 0, false); + + + } + + [Test] + public void TestCAST5() + { + // key length 0...128 + // blocksize 64 + // no se puede usar CCM (blosize!=128) + // no se pude usar GCM (blocksize <128) + // EAX siempre explota, no se puede usar con AEAD + + testBulkAlgorithm("CAST5", key64, IV64, 64, false); + testBulkAlgorithm("CAST5", key64, IV64, 0, false); + + testBulkAlgorithm("CAST5", key64, "", 64, false); + testBulkAlgorithm("CAST5", key64, "", 0, false); + + testBulkAlgorithm("CAST5", key128, IV64, 64, false); + testBulkAlgorithm("CAST5", key128, IV64, 0, false); + + testBulkAlgorithm("CAST5", key128, "", 64, false); + testBulkAlgorithm("CAST5", key128, "", 0, false); + + + } + + [Test] + public void TestCAST6() + { + // key length 0...256 + // blocksize 128 + testBulkAlgorithm("CAST6", key64, IV128, 128, false); + testBulkAlgorithm("CAST6", key64, IV128, 0, false); + testBulkAlgorithm("CAST6", key64, IV128, 64, false); + + testBulkAlgorithm("CAST6", key64, "", 128, false); + testBulkAlgorithm("CAST6", key64, "", 0, false); + testBulkAlgorithm("CAST6", key64, "", 64, false); + + testBulkAlgorithm("CAST6", key128, IV128, 128, false); + testBulkAlgorithm("CAST6", key128, IV128, 0, false); + testBulkAlgorithm("CAST6", key128, IV128, 64, false); + + testBulkAlgorithm("CAST6", key128, "", 128, false); + testBulkAlgorithm("CAST6", key128, "", 0, false); + testBulkAlgorithm("CAST6", key128, "", 64, false); + + testBulkAlgorithm("CAST6", key192, IV128, 128, false); + testBulkAlgorithm("CAST6", key192, IV128, 0, false); + testBulkAlgorithm("CAST6", key192, IV128, 64, false); + + testBulkAlgorithm("CAST6", key192, "", 128, false); + testBulkAlgorithm("CAST6", key192, "", 0, false); + testBulkAlgorithm("CAST6", key192, "", 64, false); + + testBulkAlgorithm("CAST6", key256, IV128, 128, false); + testBulkAlgorithm("CAST6", key256, IV128, 0, false); + testBulkAlgorithm("CAST6", key256, IV128, 64, false); + + testBulkAlgorithm("CAST6", key256, "", 128, false); + testBulkAlgorithm("CAST6", key256, "", 0, false); + testBulkAlgorithm("CAST6", key256, "", 64, false); + + + } + + [Test] + public void TestDES() + { + // key length 64 + // blocksize 64 + // no se puede usar CCM (blosize!=128) + // no se pude usar GCM (blocksize <128) + // EAX no se puede usar (keylength != 128, 192 o 256 + + testBulkAlgorithm("DES", key64, IV64, 64, false); + testBulkAlgorithm("DES", key64, IV64, 0, false); + + testBulkAlgorithm("DES", key64, "", 64, false); + testBulkAlgorithm("DES", key64, "", 0, false); + + } + + [Test] + public void TestTRIPLEDES() + { + // key length 128.192 + // blocksize 64 + // no se puede usar CCM (blosize!=128) + // no se pude usar GCM (blocksize <128) + // EAX siempre explota, no se puede usar con AEAD + + testBulkAlgorithm("TRIPLEDES", key128, IV64, 64, false); + testBulkAlgorithm("TRIPLEDES", key128, IV64, 0, false); + + testBulkAlgorithm("TRIPLEDES", key128, "", 64, false); + testBulkAlgorithm("TRIPLEDES", key128, "", 0, false); + + testBulkAlgorithm("TRIPLEDES", key192, IV64, 64, false); + testBulkAlgorithm("TRIPLEDES", key192, IV64, 0, false); + + testBulkAlgorithm("TRIPLEDES", key192, "", 64, false); + testBulkAlgorithm("TRIPLEDES", key192, "", 0, false); + + } + + [Test] + public void TestDSTU7624() + { + // key length 128, 256, 512 + // blocksize 128.256.512 + // input should be as lenght as the block + testBulkAlgorithm("DSTU7624_128", key128, IV128, 128, true); + testBulkAlgorithm("DSTU7624_128", key128, IV128, 64, true); + testBulkAlgorithm("DSTU7624_128", key128, IV128, 0, true); + + testBulkAlgorithm("DSTU7624_128", key128, "", 128, true); + testBulkAlgorithm("DSTU7624_128", key128, "", 64, true); + testBulkAlgorithm("DSTU7624_128", key128, "", 0, true); + + + } + + [Test] + public void TestGOST28147() + { + // key length 256 + // blocksize 64 + // no se puede usar CCM (blosize!=128) + // no se pude usar GCM (blocksize <128) + // EAX siempre explota, no se puede usar con AEAD + + testBulkAlgorithm("GOST28147", key256, IV64, 64, false); + testBulkAlgorithm("GOST28147", key256, IV64, 0, false); + + testBulkAlgorithm("GOST28147", key256, "", 64, false); + testBulkAlgorithm("GOST28147", key256, "", 0, false); + + } + + [Test] + public void TestNOEKEON() + { + // key length 128 + // blocksize 128 + testBulkAlgorithm("NOEKEON", key128, IV128, 128, false); + testBulkAlgorithm("NOEKEON", key128, IV128, 64, false); + testBulkAlgorithm("NOEKEON", key128, IV128, 0, false); + + + testBulkAlgorithm("NOEKEON", key128, "", 128, false); + testBulkAlgorithm("NOEKEON", key128, "", 64, false); + testBulkAlgorithm("NOEKEON", key128, "", 0, false); + } + + [Test] + public void TestRC2() + { + // key length 0...1024 + // blocksize 64 + // no se puede usar CCM (blosize!=128) + // no se pude usar GCM (blocksize <128) + // EAX siempre explota, no se puede usar con AEAD + + testBulkAlgorithm("RC2", key64, IV64, 64, false); + testBulkAlgorithm("RC2", key64, IV64, 0, false); + + testBulkAlgorithm("RC2", key64, "", 64, false); + testBulkAlgorithm("RC2", key64, "", 0, false); + + testBulkAlgorithm("RC2", key128, IV64, 64, false); + testBulkAlgorithm("RC2", key128, IV64, 0, false); + + testBulkAlgorithm("RC2", key128, "", 64, false); + testBulkAlgorithm("RC2", key128, "", 0, false); + + testBulkAlgorithm("RC2", key192, IV64, 64, false); + testBulkAlgorithm("RC2", key192, IV64, 0, false); + + testBulkAlgorithm("RC2", key192, "", 64, false); + testBulkAlgorithm("RC2", key192, "", 0, false); + + testBulkAlgorithm("RC2", key256, IV64, 64, false); + testBulkAlgorithm("RC2", key256, IV64, 0, false); + + testBulkAlgorithm("RC2", key256, "", 64, false); + testBulkAlgorithm("RC2", key256, "", 0, false); + + testBulkAlgorithm("RC2", key448, IV64, 64, false); + testBulkAlgorithm("RC2", key448, IV64, 0, false); + + testBulkAlgorithm("RC2", key448, "", 64, false); + testBulkAlgorithm("RC2", key448, "", 0, false); + + testBulkAlgorithm("RC2", key512, IV64, 64, false); + testBulkAlgorithm("RC2", key512, IV64, 0, false); + + testBulkAlgorithm("RC2", key512, "", 64, false); + testBulkAlgorithm("RC2", key512, "", 0, false); + + testBulkAlgorithm("RC2", key1024, IV64, 64, false); + testBulkAlgorithm("RC2", key1024, IV64, 0, false); + + testBulkAlgorithm("RC2", key1024, "", 64, false); + testBulkAlgorithm("RC2", key1024, "", 0, false); + + + } + + [Test] + public void TestRC532() + { + // key length 0...128 + // blocksize 64 + // no se puede usar CCM (blosize!=128) + // no se pude usar GCM (blocksize <128) + // EAX siempre explota, no se puede usar con AEAD + + testBulkAlgorithm("RC532", key64, IV64, 64, false); + testBulkAlgorithm("RC532", key64, IV64, 0, false); + + testBulkAlgorithm("RC532", key64, "", 64, false); + testBulkAlgorithm("RC532", key64, "", 0, false); + + testBulkAlgorithm("RC532", key128, IV64, 64, false); + testBulkAlgorithm("RC532", key128, IV64, 0, false); + + testBulkAlgorithm("RC532", key128, "", 64, false); + testBulkAlgorithm("RC532", key128, "", 0, false); + } + + [Test] + public void TestRC6() + { + // key length 0...256 + // blocksize 128 + testBulkAlgorithm("RC6", key64, IV128, 128, false); + testBulkAlgorithm("RC6", key64, IV128, 64, false); + testBulkAlgorithm("RC6", key64, IV128, 0, false); + + testBulkAlgorithm("RC6", key64, "", 128, false); + testBulkAlgorithm("RC6", key64, "", 64, false); + testBulkAlgorithm("RC6", key64, "", 0, false); + + testBulkAlgorithm("RC6", key128, IV128, 128, false); + testBulkAlgorithm("RC6", key128, IV128, 64, false); + testBulkAlgorithm("RC6", key128, IV128, 0, false); + + testBulkAlgorithm("RC6", key128, "", 128, false); + testBulkAlgorithm("RC6", key128, "", 64, false); + testBulkAlgorithm("RC6", key128, "", 0, false); + + testBulkAlgorithm("RC6", key192, IV128, 128, false); + testBulkAlgorithm("RC6", key192, IV128, 64, false); + testBulkAlgorithm("RC6", key192, IV128, 0, false); + + testBulkAlgorithm("RC6", key192, "", 128, false); + testBulkAlgorithm("RC6", key192, "", 64, false); + testBulkAlgorithm("RC6", key192, "", 0, false); + + testBulkAlgorithm("RC6", key256, IV128, 128, false); + testBulkAlgorithm("RC6", key256, IV128, 64, false); + testBulkAlgorithm("RC6", key256, IV128, 0, false); + + testBulkAlgorithm("RC6", key256, "", 128, false); + testBulkAlgorithm("RC6", key256, "", 64, false); + testBulkAlgorithm("RC6", key256, "", 0, false); + + } + + [Test] + public void TestRIJNDAEL() + { + // key length 128.160.224.256 + // blocksize 128, 160, 192, 224, 256 + + testBulkAlgorithm("RIJNDAEL_128", key128, IV128, 128, false); + testBulkAlgorithm("RIJNDAEL_128", key128, IV128, 64, false); + testBulkAlgorithm("RIJNDAEL_128", key128, IV128, 0, false); + + testBulkAlgorithm("RIJNDAEL_128", key128, "", 128, false); + testBulkAlgorithm("RIJNDAEL_128", key128, "", 64, false); + testBulkAlgorithm("RIJNDAEL_128", key128, "", 0, false); + + testBulkAlgorithm("RIJNDAEL_128", key160, IV128, 128, false); + testBulkAlgorithm("RIJNDAEL_128", key160, IV128, 64, false); + testBulkAlgorithm("RIJNDAEL_128", key160, IV128, 0, false); + + testBulkAlgorithm("RIJNDAEL_128", key160, "", 128, false); + testBulkAlgorithm("RIJNDAEL_128", key160, "", 64, false); + testBulkAlgorithm("RIJNDAEL_128", key160, "", 0, false); + + testBulkAlgorithm("RIJNDAEL_128", key192, IV128, 128, false); + testBulkAlgorithm("RIJNDAEL_128", key192, IV128, 64, false); + testBulkAlgorithm("RIJNDAEL_128", key192, IV128, 0, false); + + testBulkAlgorithm("RIJNDAEL_128", key192, "", 128, false); + testBulkAlgorithm("RIJNDAEL_128", key192, "", 64, false); + testBulkAlgorithm("RIJNDAEL_128", key192, "", 0, false); + + testBulkAlgorithm("RIJNDAEL_128", key256, IV128, 128, false); + testBulkAlgorithm("RIJNDAEL_128", key256, IV128, 64, false); + testBulkAlgorithm("RIJNDAEL_128", key256, IV128, 0, false); + + testBulkAlgorithm("RIJNDAEL_128", key256, "", 128, false); + testBulkAlgorithm("RIJNDAEL_128", key256, "", 64, false); + testBulkAlgorithm("RIJNDAEL_128", key256, "", 0, false); + + + } + + [Test] + public void TestSEED() + { + // key length 128 + // blocksize 128 + + + testBulkAlgorithm("SEED", key128, IV128, 128, false); + testBulkAlgorithm("SEED", key128, IV128, 0, false); + testBulkAlgorithm("SEED", key128, IV128, 64, false); + + testBulkAlgorithm("SEED", key128, "", 0, false); + testBulkAlgorithm("SEED", key128, "", 128, false); + testBulkAlgorithm("SEED", key128, "", 64, false); + + } + + [Test] + public void TestSERPENT() + { + // key length 128.192.256 + // blocksize 128 + + testBulkAlgorithm("SERPENT", key128, IV128, 128, false); + testBulkAlgorithm("SERPENT", key128, IV128, 0, false); + testBulkAlgorithm("SERPENT", key128, IV128, 64, false); + + testBulkAlgorithm("SERPENT", key128, "", 128, false); + testBulkAlgorithm("SERPENT", key128, "", 0, false); + testBulkAlgorithm("SERPENT", key128, "", 64, false); + + testBulkAlgorithm("SERPENT", key192, IV128, 128, false); + testBulkAlgorithm("SERPENT", key192, IV128, 0, false); + testBulkAlgorithm("SERPENT", key192, IV128, 64, false); + + testBulkAlgorithm("SERPENT", key192, "", 128, false); + testBulkAlgorithm("SERPENT", key192, "", 0, false); + testBulkAlgorithm("SERPENT", key192, "", 64, false); + + testBulkAlgorithm("SERPENT", key256, IV128, 128, false); + testBulkAlgorithm("SERPENT", key256, IV128, 0, false); + testBulkAlgorithm("SERPENT", key256, IV128, 64, false); + + testBulkAlgorithm("SERPENT", key256, "", 128, false); + testBulkAlgorithm("SERPENT", key256, "", 0, false); + testBulkAlgorithm("SERPENT", key256, "", 64, false); + + } + + [Test] + public void TestSKIPJACK() + { + // key length 128 + // blocksize 64 + // no se puede usar CCM (blosize!=128) + // no se pude usar GCM (blocksize <128) + // EAX siempre explota, no se puede usar con AEAD + + testBulkAlgorithm("SKIPJACK", key128, IV64, 64, false); + testBulkAlgorithm("SKIPJACK", key128, IV64, 0, false); + + testBulkAlgorithm("SKIPJACK", key128, "", 64, false); + testBulkAlgorithm("SKIPJACK", key128, "", 0, false); + + } + + [Test] + public void TestSM4() + { + // key length 128 + // blocksize 128 + testBulkAlgorithm("SM4", key128, IV128, 128, false); + testBulkAlgorithm("SM4", key128, IV128, 0, false); + testBulkAlgorithm("SM4", key128, IV128, 64, false); + + testBulkAlgorithm("SM4", key128, "", 128, false); + testBulkAlgorithm("SM4", key128, "", 0, false); + testBulkAlgorithm("SM4", key128, "", 64, false); + + } + + [Test] + public void TestTEA() + { + // key length 128 + // blocksize 64 + // no se puede usar CCM (blosize!=128) + // no se pude usar GCM (blocksize <128) + // EAX siempre explota, no se puede usar con AEAD + + testBulkAlgorithm("TEA", key128, IV64, 64, false); + testBulkAlgorithm("TEA", key128, IV64, 0, false); + + testBulkAlgorithm("TEA", key128, "", 64, false); + testBulkAlgorithm("TEA", key128, "", 0, false); + + } + + [Test] + public void TestTWOFISH() + { + // key length 128.192.256 + // blocksize 128 + testBulkAlgorithm("TWOFISH", key128, IV128, 128, false); + testBulkAlgorithm("TWOFISH", key128, IV128, 0, false); + testBulkAlgorithm("TWOFISH", key128, IV128, 64, false); + + testBulkAlgorithm("TWOFISH", key128, "", 128, false); + testBulkAlgorithm("TWOFISH", key128, "", 0, false); + testBulkAlgorithm("TWOFISH", key128, "", 64, false); + + + testBulkAlgorithm("TWOFISH", key192, IV128, 128, false); + testBulkAlgorithm("TWOFISH", key192, IV128, 0, false); + testBulkAlgorithm("TWOFISH", key192, IV128, 64, false); + + testBulkAlgorithm("TWOFISH", key192, "", 128, false); + testBulkAlgorithm("TWOFISH", key192, "", 0, false); + testBulkAlgorithm("TWOFISH", key192, "", 64, false); + + testBulkAlgorithm("TWOFISH", key256, IV128, 128, false); + testBulkAlgorithm("TWOFISH", key256, IV128, 0, false); + testBulkAlgorithm("TWOFISH", key256, IV128, 64, false); + + testBulkAlgorithm("TWOFISH", key256, "", 128, false); + testBulkAlgorithm("TWOFISH", key256, "", 0, false); + testBulkAlgorithm("TWOFISH", key256, "", 64, false); + + + } + + [Test] + public void TestXTEA() + { + // key length 128 + // blocksize 64 + // no se puede usar CCM (blosize!=128) + // no se pude usar GCM (blocksize <128) + // EAX siempre explota, no se puede usar con AEAD + + testBulkAlgorithm("XTEA", key128, IV64, 64, false); + testBulkAlgorithm("XTEA", key128, IV64, 0, false); + + testBulkAlgorithm("XTEA", key128, "", 64, false); + testBulkAlgorithm("XTEA", key128, "", 0, false); + + + } + + + private void testBulkAlgorithm(string algorithm, string key, string IV, int macSize, bool cts) + { + for (int i = 0; i < encodings.Length; i++) + { + eu.setEncoding(encodings[i]); + if (cts) + { + testBulkAlgorithmCTS(algorithm, key, IV, macSize, plainTextCTS); + } + else + { + testBulkAlgorithmCTS(algorithm, key, IV, macSize, plainText); + } + } + } + + private void testBulkAlgorithmCTS(string algorithm, string key, string IV, int macSize, string input) + { + + Cmac mac = new Cmac(); + string res = mac.calculate(input, key, algorithm, macSize); + bool verified = mac.verify(input, key, res, algorithm, macSize); + //System.out.println("res: "+res); + /*if(mac.hasError()) + { + System.out.println("Eror. Code: "+mac.getErrorCode()+" Desc: "+mac.getErrorDescription()); + }else { + System.out.println("no error"); + }*/ + Assert.IsTrue(verified); + True(true, mac); + } + } +} diff --git a/test/dotnetframework/SecurityAPITest/Cryptography/Mac/TestHmac.cs b/test/dotnetframework/SecurityAPITest/Cryptography/Mac/TestHmac.cs new file mode 100644 index 0000000..a78b7fb --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/Cryptography/Mac/TestHmac.cs @@ -0,0 +1,114 @@ +using SecurityAPITest.SecurityAPICommons.commons; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using NUnit.Framework; +using SecurityAPICommons.Config; +using SecurityAPICommons.Keys; +using GeneXusCryptography.Mac; +using SecurityAPICommons.Utils; + +namespace SecurityAPITest.Cryptography.Mac +{ + [TestFixture] + public class TestHmac: SecurityAPITestObject + { + + protected static string plainText; + protected string[] arrayHashes; + protected static string password; + protected static string passUTF8; + protected string[] arrayResHashes; + + private static string[] encodings; + private static EncodingUtil eu; + + [SetUp] + public virtual void SetUp() + { + SymmetricKeyGenerator keyGen = new SymmetricKeyGenerator(); + password = keyGen.doGenerateKey("GENERICRANDOM", 128); + passUTF8 = "64887e525dce27351f5cb5ce85615e52"; + plainText = "Lorem ipsum dolor sit amet"; + arrayHashes = new string[] { "MD5", "SHA1", "SHA224", "SHA256", "SHA384", "SHA512", "BLAKE2B_224", + "BLAKE2B_256", "BLAKE2B_384", "BLAKE2B_512", "BLAKE2S_128", "BLAKE2S_160", "BLAKE2S_224", "BLAKE2S_256", + "GOST3411_2012_256", "GOST3411_2012_512", "GOST3411", "KECCAK_224", "KECCAK_256", "KECCAK_288", + "KECCAK_384", "KECCAK_512", "MD2", "MD4", "RIPEMD128", "RIPEMD160", "RIPEMD256", "RIPEMD320", + "SHA3-224", "SHA3-256", "SHA3-384", "SHA3-512", "SHAKE_128", "SHAKE_256", "SM3", "TIGER", "WHIRLPOOL" }; + + encodings = new string[] { "UTF_8", "UTF_16", "UTF_16BE", "UTF_16LE", "UTF_32", "UTF_32BE", "UTF_32LE", "SJIS", + "GB2312" }; + + eu = new EncodingUtil(); + + string MD5 = "41A5B12FFE84175A2982A8D500B1EBAF"; + string SHA1 = "50D4AE631960E8D040FBEC617EF442B7AB251221"; + string SHA224 = "F441D15E93F2BAA1B5379A5F16B878307A21D5BEDCB61A987F01CE61"; + string SHA256 = "6B0E8EB91ED3EAE87A0AD4E1293F8FC50C2C297E4FAEC07AA43AB47E49CB7B1F"; + string SHA384 = "04C3B9B5A874D95749D6134073FB27C2B4E02D701BC5A2B5D3A0CCC345EA66B8D3C57036977DE686CBFBFFEEC2398218"; + string SHA512 = "E9A2125DBA53A4227DE74855526BA4816C6B45B5D001318C3D069D2DF94359A93099F6CDBC14710D8D3B5B956037192B44EEF8C32DE32E3AF59D24BDFC3E5DAF"; + string BLAKE2B_224 = "26CF9B1A316F1FD854DF19163C7B8C142618254DA200A20635E1D698"; + string BLAKE2B_256 = "9F78D7ACAFDA844CADD4F57817E1A368776A7D783B61BC95D174097BAC9E12BC"; + string BLAKE2B_384 = "2E2205934FB1057E3A347958180170FCE5F4DFA5ACC7623EA79BD6BC9CDAC2E57A192A77E2B9B0FE87D24BAB5BDDEEF2"; + string BLAKE2B_512 = "453EBB12652903F1C0DB44A86CF4D8DE8BD10BBDDCAE20C62ABFA16B3F7F289E10D69AAE6BEACEEEDD4CB4C42B1181C2964B95B7AE18A342605E969536A21B47"; + string BLAKE2S_128 = "9FF71F18EB2D3A9E21D5F7CD17BCF5C9"; + string BLAKE2S_160 = "CE919197A9207946EEC7DEDD2DA8F0CFCE3D10B8"; + string BLAKE2S_224 = "4CFE71196DAEAB298B31362BB2B908C667C2395DB45E717328093F21"; + string BLAKE2S_256 = "B4272BFA822369C40A3FA584739755E47F2EEE3D1A109CA010773B79883E5581"; + string GOST3411_2012_256 = "4BB2AC559E3A163BDFEC294339DE624AA90CFA5E91812477FCF43EC8692EA8E9"; + string GOST3411_2012_512 = "B96ABD6DCAB30DF76777B214AD243EC5C9349D5017A2D2F196499757AE31EAC121C72ADC457081BBF6B0763E9AE32472B7D85F1E1342B3104E5F2934F2DC83A0"; + string GOST3411 = "CA0BCB7E5C49CDFA68F2D0B53F52670626C3EDEABEA8335CBC7ED1FDFC8200D8"; + string KECCAK_224 = "1FE172D71F537B6F83B23E24E744C5E880E25F0051DCEC3B1F678327"; + string KECCAK_256 = "BFDFB4872184A37996A6A8544A3ABB84C1968D46F89E0839B3BDF7C8E87C2E4F"; + string KECCAK_288 = "6C49617278C34213B98CB90510ADD1346DEF8D0FB90B0F693553E0FFB41CB5D425C5A2EF"; + string KECCAK_384 = "B37946F7370758D7656B8D48DD9704B1AECBB4A2C58CBA0DD4B1FC730EACC9D42CCE666FD216A5238C127D4552CEA6D7"; + string KECCAK_512 = "0CCBD557A60DA24082FF20EA8A1987516BBDA2ACAD23DAA27C47F20082BA940A8D7B298C08395180A56DA5E68E90BBCC4A56B1C51431BF9AAB1A10B72BC988D4"; + string MD2 = "4F13A1C9AE27F3EF6D824DF30A1E2290"; + string MD4 = "8FB02C3DFC1E5F570BBDDDAF844D74F2"; + string RIPEMD128 = "AE3231A70E15B56FB15FE6947BACF32B"; + string RIPEMD160 = "BB7AC728783394986A6085DE3CA4CABA1B16B35B"; + string RIPEMD256 = "C0AA36C7D7A5F4C9ADA1A33976DEB7D8E61A55D5B6378F023A011A92AEFB8FC7"; + string RIPEMD320 = "34DABB9D5E807F77309A59289B7F339CB824C963DF66EBCEF56E3499630D86B2E31E0AC98C50EED4"; + string SHA3_224 = "621437AB69507712BC89DDB9128E1DF19894357AAB3637557CAD39B9"; + string SHA3_256 = "3B19CB71223B73C8B8BE4E9CAE8FDF9FDCFB53B0CE8788749F5EBDD186C90620"; + string SHA3_384 = "C3682F9296438F8A6F83599FB9F37F40C8EAC20A63B3F3E889C34982CD5B22FEEF5B1B23816B5047303C4BB953F68B57"; + string SHA3_512 = "0B9BD9EB8D6A6F7A2E64FAD66798250B5007CEC289BB6354973D02BD1BA94F4FF6C4561E75781D784FD0620515D67BD084956542CE80D7B6E49FE06E8CB755B5"; + string SHAKE_128 = "F08CC5D7EA62097A1B180F2902CD287B"; + string SHAKE_256 = "D760B7E606CD64BBEDACA6B36F3F2D9EE0D9EBD84B5CC195999AB549CDE60914"; + string SM3 = "8F447ED2CF879D5001CAE681041DE38326C55B948846168997D3C304AEA32D6D"; + string TIGER = "FEF8448095FC19DFCE2E6B6CAE8BA594D3DC358E910473B2"; + string WHIRLPOOL = "594BDF03B876331E3642685A497DDEC69894403422ABCB6ADE0E77999DA030027EA613027E0E18A3D42190110DEBE75357412EB7567EEF9C7CB170BCCFC3E7EC"; + + arrayResHashes = new string[] { MD5, SHA1, SHA224, SHA256, SHA384, SHA512, BLAKE2B_224, BLAKE2B_256, + BLAKE2B_384, BLAKE2B_512, BLAKE2S_128, BLAKE2S_160, BLAKE2S_224, BLAKE2S_256, GOST3411_2012_256, + GOST3411_2012_512, GOST3411, KECCAK_224, KECCAK_256, KECCAK_288, KECCAK_384, KECCAK_512, MD2, MD4, + RIPEMD128, RIPEMD160, RIPEMD256, RIPEMD320, SHA3_224, SHA3_256, SHA3_384, SHA3_512, SHAKE_128, + SHAKE_256, SM3, TIGER, WHIRLPOOL }; + + } + + [Test] + public void TestBulkMacs() + { + for (int i = 0; i < encodings.Length; i++) + { + eu.setEncoding(encodings[i]); + Hmac mac = new Hmac(); + for (int a = 0; a < arrayHashes.Length; a++) + { + if (SecurityUtils.compareStrings(encodings[i], "UTF_8")) + { + string res = mac.calculate(plainText, passUTF8, arrayHashes[a]); + Assert.IsTrue(SecurityUtils.compareStrings(res, arrayResHashes[a])); + True(true, mac); + } + string result = mac.calculate(plainText, password, arrayHashes[a]); + Assert.IsTrue(mac.verify(plainText, password, result, arrayHashes[a])); + True(true, mac); + } + } + } + } +} diff --git a/test/dotnetframework/SecurityAPITest/Cryptography/PasswordDerivation/TestPasswordDerivation.cs b/test/dotnetframework/SecurityAPITest/Cryptography/PasswordDerivation/TestPasswordDerivation.cs new file mode 100644 index 0000000..a87fa90 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/Cryptography/PasswordDerivation/TestPasswordDerivation.cs @@ -0,0 +1,127 @@ +using SecurityAPITest.SecurityAPICommons.commons; +using System; +using NUnit.Framework; +using SecurityAPICommons.Config; +using SecurityAPICommons.Commons; +using SecurityAPICommons.Encoders; +using GeneXusCryptography.PasswordDerivation; + +namespace SecurityAPITest.Cryptography.PasswordDerivationTest +{ + [TestFixture] + public class TestPasswordDerivation: SecurityAPITestObject + { + protected static string password; + protected static Error error; + protected static HexaEncoder hexa; + protected static PasswordDerivation pd; + + /* SCRYPT */ + + protected static string saltScrypt; + protected static int N; + protected static int r; + protected static int p; + protected static int keyLenght; + protected static string expectedScrypt; + + /* BCRYPT */ + protected static int cost; + protected static string saltBcrypt; + protected static string expectedBcrypt; + + /* ARGON2 */ + protected static int iterations; + protected static int parallelism; + protected static int memory; + protected static int hashLength; + protected static string saltArgon2; + protected static string[] argon2Version; + protected static string[] argon2HashType; + protected static string[] argon2Results; + + [SetUp] + public virtual void SetUp() + { + new EncodingUtil().setEncoding("UTF8"); + password = "password"; + error = new Error(); + hexa = new HexaEncoder(); + pd = new PasswordDerivation(); + + /* SCRYPT */ + N = 16384; + r = 8; + p = 1; + keyLenght = 256; + saltScrypt = "123456"; + expectedScrypt = "Yc4uLDXRam2HNQxFdEJWkNYADNWgelNIidOmFE8G3G9G9j6/l/fXP43ErypBMZGs+6PLVPBPRop2pHWWIhUg4hXDoM8+fsp10wBoV3p06yxxdZu7LV19gcgwgL2tnMTN/H8Y7YYM9KpFwdFqMXbIX4DPN2hrL6DAXxNIYJO7Pcm1l9qPrOwpsZZjE032nYlXch6t8/4HRxWFOFRl8t5UjtILEyFdg1w3kLlYzP46XJV1IqGEMyFjeQbtz/c7MteZmID0aSxLtoZJPF3TA41vs09hLlhG/AoMiVQ+EXsp3vZZzg7t4RNrWfuLd2H+oFEqeEUNUisUoB8IWmyAZgn2QQ=="; + /* BCRYPT */ + cost = 6; + saltBcrypt = "0c6a8a8235bb90219d004aa4056ec884"; + expectedBcrypt = "XoHha7SLqyY2AKgIIetMdjYBM5bizqPc"; + /* ARGON2 */ + iterations = 1; + parallelism = 2; + memory = 4; + hashLength = 32; + saltArgon2 = "14ae8da01afea8700c2358dcef7c5358d9021282bd88663a4562f59fb74d22ee"; + argon2Version = new string[] { "ARGON2_VERSION_10", "ARGON2_VERSION_13" }; + argon2HashType = new string[] { "ARGON2_d", "ARGON2_i", "ARGON2_id" }; + argon2Results = new string[] { "f9hF4rzwC9AvfFMK8ZHvKoQeipc7OUQ/dBV4nBer57U=", "QuNCd8sy8STFTBeylfaUVWAN8w3PDl0L94rr9TqaK/g=", "El6fozCF2xSzdcrfR0QO8U1Zmh4OuRZPwufAvqXcLiY=", "xvlSYizqgM93gmi7cTDvkXda41QDj6fTaCC2cpltt3E=", "jDKqkLzOaxFQ2vHwB3/UQiSI2wO+2cDk6Y1VQwSXzz4=", "A8icyy1A7VlunnJKBZXJl/BkNmVQ5FlMznCNKS1YJCM=" }; + + } + + [Test] + public void TestScrypt() + { + string derivated = pd.DoGenerateSCrypt(password, saltScrypt, N, r, p, keyLenght); + Assert.AreEqual(expectedScrypt, derivated); + Equals(expectedScrypt, derivated, pd); + } + + [Test] + public void TestDefaultScrypt() + { + string derivated = pd.DoGenerateDefaultSCrypt(password, saltScrypt); + Assert.AreEqual(expectedScrypt, derivated); + Equals(expectedScrypt, derivated, pd); + } + + [Test] + public void TestBcrypt() + { + string derivated = pd.DoGenerateBcrypt(password, saltBcrypt, cost); + Assert.AreEqual(expectedBcrypt, derivated); + Equals(expectedBcrypt, derivated, pd); + } + + [Test] + public void TestDefaultBcrypt() + { + string derivated = pd.DoGenerateDefaultBcrypt(password, saltBcrypt); + Assert.AreEqual(expectedBcrypt, derivated); + Equals(expectedBcrypt, derivated, pd); + } + + + [Test] + public void TestArgon2() + { + /*int i = 0; + foreach (string version in argon2Version) + { + foreach (string hashType in argon2HashType) + { + string derivated = pd.doGenerateArgon2(version, hashType, iterations, memory, parallelism, password, saltArgon2, hashLength); + Assert.AreEqual(argon2Results[i], derivated); + Equals(argon2Results[i], derivated, pd); + i++; + } + }*/ + //*****ALGORITHM NOT IMPLEMENTED IN C#*****// + Assert.IsTrue(true); + + } + } +} diff --git a/test/dotnetframework/SecurityAPITest/Cryptography/Symmetric/TestBlockEncryption.cs b/test/dotnetframework/SecurityAPITest/Cryptography/Symmetric/TestBlockEncryption.cs new file mode 100644 index 0000000..a374023 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/Cryptography/Symmetric/TestBlockEncryption.cs @@ -0,0 +1,660 @@ +using SecurityAPITest.SecurityAPICommons.commons; +using NUnit.Framework; +using SecurityAPICommons.Keys; +using SecurityAPICommons.Config; +using GeneXusCryptography.Symmetric; +using SecurityAPICommons.Utils; + +namespace SecurityAPITest.Cryptography.Symmetric +{ + [TestFixture] + public class TestBlockEncryption: SecurityAPITestObject + { + private static string plainText; + private static string plainTextCTS; + private static string[] arrayPaddings; + private static string[] arrayModes; + private static string[] arrayModes64; + private static string[] arrayNoncesCCM; + private static string[] arrayNonces; + private static int[] arrayTagsGCM; + private static int[] arrayMacsEAX; + private static int[] arrayTagsCCM; + + protected static string key1024; + protected static string key512; + protected static string key448; + protected static string key256; + protected static string key192; + protected static string key160; + protected static string key128; + protected static string key64; + + protected static string IV1024; + protected static string IV512; + protected static string IV256; + protected static string IV224; + protected static string IV192; + protected static string IV160; + protected static string IV128; + protected static string IV64; + + private static SymmetricKeyGenerator keyGen; + + private static string[] encodings; + private static EncodingUtil eu; + + [SetUp] + protected virtual void SetUp() + { + + // new EncodingUtil().setEncoding("UTF8"); + plainText = "Neque porro quisquam est qui dolorem ipsum quia dolor sit amet"; + plainTextCTS = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam venenatis ex sit amet risus pellentesque, a faucibus quam ultrices. Ut tincidunt quam eu aliquam maximus. Quisque posuere risus at erat blandit eleifend. Curabitur viverra rutrum volutpat. Donec quis quam tellus. Aenean fermentum elementum augue, a semper risus scelerisque sit amet. Nullam vitae sapien vitae dui ullamcorper dapibus quis quis leo. Sed neque felis, pellentesque in risus et, lobortis ultricies nulla. Quisque quis quam risus. Donec vestibulum, lectus vel vestibulum eleifend, velit ante volutpat lacus, ut mattis quam ligula eget est. Sed et pulvinar lectus. In mollis turpis non ipsum vehicula, sit amet rutrum nibh dictum. Duis consectetur convallis ex, eu ultricies enim bibendum vel. Vestibulum vel libero nibh. Morbi nec odio mattis, vestibulum quam blandit, pretium orci.Aenean pellentesque tincidunt nunc a malesuada. Etiam gravida fermentum mi, at dignissim dui aliquam quis. Nullam vel lobortis libero. Phasellus non gravida posuere"; + + keyGen = new SymmetricKeyGenerator(); + + /**** CREATE KEYS ****/ + key1024 = keyGen.doGenerateKey("GENERICRANDOM", 1024); + key512 = keyGen.doGenerateKey("GENERICRANDOM", 512); + key448 = keyGen.doGenerateKey("GENERICRANDOM", 448); + key256 = keyGen.doGenerateKey("GENERICRANDOM", 256); + key160 = keyGen.doGenerateKey("GENERICRANDOM", 160); + key192 = keyGen.doGenerateKey("GENERICRANDOM", 192); + key128 = keyGen.doGenerateKey("GENERICRANDOM", 128); + key64 = keyGen.doGenerateKey("GENERICRANDOM", 64); + + /**** CREATE IVs ****/ + IV1024 = keyGen.doGenerateIV("GENERICRANDOM", 1024); + IV512 = keyGen.doGenerateIV("GENERICRANDOM", 512); + IV256 = keyGen.doGenerateIV("GENERICRANDOM", 256); + IV224 = keyGen.doGenerateIV("GENERICRANDOM", 224); + IV192 = keyGen.doGenerateIV("GENERICRANDOM", 192); + IV160 = keyGen.doGenerateIV("GENERICRANDOM", 160); + IV128 = keyGen.doGenerateIV("GENERICRANDOM", 128); + IV64 = keyGen.doGenerateIV("GENERICRANDOM", 64); + + /**** CREATE nonces ****/ + string nonce104 = keyGen.doGenerateIV("GENERICRANDOM", 104); + string nonce64 = keyGen.doGenerateIV("GENERICRANDOM", 64); + string nonce56 = keyGen.doGenerateIV("GENERICRANDOM", 56); + arrayNoncesCCM = new string[] { nonce56, nonce64, nonce104 }; + + /**** CREATE PADDINGS ****/ + arrayPaddings = new string[] { "PKCS7PADDING", "ISO10126D2PADDING", "X923PADDING", "ISO7816D4PADDING", + "ZEROBYTEPADDING" }; + + /**** CREATEMODES ****/ + arrayModes = new string[] { "ECB", "CBC", "CFB", "CTR", "CTS", "OFB", "OPENPGPCFB" }; + arrayModes64 = new string[] { "ECB", "CBC", "CFB", "CTR", "CTS", "OFB", "OPENPGPCFB", "GCTR" }; + arrayTagsGCM = new int[] { 128, 120, 112, 104, 96 }; + arrayTagsCCM = new int[] { 64, 128 }; + arrayMacsEAX = new int[] { 8, 16, 64, 128 }; + arrayNonces = new string[] { IV64, IV128, IV192, IV256 }; + + encodings = new string[] { "UTF_8", "UTF_16", "UTF_16BE", "UTF_16LE", "UTF_32", "UTF_32BE", "UTF_32LE", "SJIS", + "GB2312" }; + + eu = new EncodingUtil(); + } + + [Test] + public void TestAES() + { + // key legths 128,192 & 256 + // blocksize 128 + + testBulkAlgorithm("AES", arrayModes, arrayPaddings, key128, IV128, false); + testBulkAlgorithm("AES", arrayModes, arrayPaddings, key192, IV128, false); + testBulkAlgorithm("AES", arrayModes, arrayPaddings, key256, IV128, false); + // testCCM(string algorithm, string key, int macSize, boolean cts) { + // testGCM(string algorithm, string key, string nonce, boolean cts) { + // testEAX(string algorithm, string key, string nonce, boolean cts) { + testCCM("AES", key128, false); + testCCM("AES", key192, false); + testCCM("AES", key256, false); + + testGCM("AES", key128, false); + testGCM("AES", key192, false); + testGCM("AES", key256, false); + + testEAX("AES", key128, false); + testEAX("AES", key192, false); + testEAX("AES", key256, false); + + } + + [Test] + public void TestBLOWFISH() + { + // key lengths 0...448 + // blocksize 64 + // no gcm + // no se puede usar CCM (blosize!=128) + // no se pude usar GCM (blocksize <128) + // EAX siempre explota, no se puede usar con AEAD + + testBulkAlgorithm("BLOWFISH", arrayModes64, arrayPaddings, key128, IV64, false); + testBulkAlgorithm("BLOWFISH", arrayModes64, arrayPaddings, key192, IV64, false); + testBulkAlgorithm("BLOWFISH", arrayModes64, arrayPaddings, key256, IV64, false); + testBulkAlgorithm("BLOWFISH", arrayModes64, arrayPaddings, key448, IV64, false); + + } + + [Test] + public void TestCAMELLIA() + { + // key lengths 128.192.256 + // blocksize 128 + + testBulkAlgorithm("CAMELLIA", arrayModes, arrayPaddings, key128, IV128, false); + testBulkAlgorithm("CAMELLIA", arrayModes, arrayPaddings, key192, IV128, false); + testBulkAlgorithm("CAMELLIA", arrayModes, arrayPaddings, key256, IV128, false); + + // testCCM(string algorithm, string key, int macSize, boolean cts) { + // testGCM(string algorithm, string key, string nonce, boolean cts) { + // testEAX(string algorithm, string key, string nonce, boolean cts) { + + testCCM("CAMELLIA", key128, false); + testCCM("CAMELLIA", key192, false); + testCCM("CAMELLIA", key256, false); + + testGCM("CAMELLIA", key128, false); + testGCM("CAMELLIA", key192, false); + testGCM("CAMELLIA", key256, false); + + testEAX("CAMELLIA", key128, false); + testEAX("CAMELLIA", key192, false); + testEAX("CAMELLIA", key256, false); + + } + + [Test] + public void TestCAST5() + { + // key length 0...128 + // blocksize 64 + // no se puede usar CCM (blosize!=128) + // no se pude usar GCM (blocksize <128) + // EAX siempre explota, no se puede usar con AEAD + + testBulkAlgorithm("CAST5", arrayModes64, arrayPaddings, key64, IV64, false); + testBulkAlgorithm("CAST5", arrayModes64, arrayPaddings, key128, IV64, false); + + } + + [Test] + public void TestCAST6() + { + // key length 0...256 + // blocksize 128 + testBulkAlgorithm("CAST6", arrayModes, arrayPaddings, key64, IV128, false); + testBulkAlgorithm("CAST6", arrayModes, arrayPaddings, key128, IV128, false); + testBulkAlgorithm("CAST6", arrayModes, arrayPaddings, key192, IV128, false); + testBulkAlgorithm("CAST6", arrayModes, arrayPaddings, key256, IV128, false); + + // testCCM(string algorithm, string key, int macSize, boolean cts) { + // testGCM(string algorithm, string key, string nonce, boolean cts) { + // testEAX(string algorithm, string key, string nonce, boolean cts) { + + testCCM("CAST6", key64, false); + testCCM("CAST6", key128, false); + testCCM("CAST6", key192, false); + testCCM("CAST6", key256, false); + + testGCM("CAST6", key64, false); + testGCM("CAST6", key128, false); + testGCM("CAST6", key192, false); + testGCM("CAST6", key256, false); + + testEAX("CAST6", key128, false); + testEAX("CAST6", key192, false); + testEAX("CAST6", key256, false); + + } + + [Test] + public void TestDES() + { + // key length 64 + // blocksize 64 + // no se puede usar CCM (blosize!=128) + // no se pude usar GCM (blocksize <128) + // EAX no se puede usar (keylength != 128, 192 o 256 + + testBulkAlgorithm("DES", arrayModes64, arrayPaddings, key64, IV64, false); + + } + + [Test] + public void TestTRIPLEDES() + { + // key length 128.192 + // blocksize 64 + // no se puede usar CCM (blosize!=128) + // no se pude usar GCM (blocksize <128) + // EAX siempre explota, no se puede usar con AEAD + + testBulkAlgorithm("TRIPLEDES", arrayModes64, arrayPaddings, key128, IV64, false); + testBulkAlgorithm("TRIPLEDES", arrayModes64, arrayPaddings, key192, IV64, false); + + } + + [Test] + public void TestDSTU7624() + { + // key length 128, 256, 512 + // blocksize 128.256.512 + // input should be as lenght as the block + testBulkAlgorithm("DSTU7624_128", arrayModes, arrayPaddings, key128, IV128, true); + testBulkAlgorithm("DSTU7624_256", arrayModes, arrayPaddings, key256, IV256, true); + testBulkAlgorithm("DSTU7624_512", arrayModes, arrayPaddings, key512, IV512, true); + + // testCCM(string algorithm, string key, int macSize, boolean cts) { + // testGCM(string algorithm, string key, string nonce, boolean cts) { + // testEAX(string algorithm, string key, string nonce, boolean cts) { + + testCCM("DSTU7624_128", key128, true); + + testGCM("DSTU7624_128", key128, true); + + testEAX("DSTU7624_128", key128, true); + + } + + [Test] + public void TestGOST28147() + { + // key length 256 + // blocksize 64 + // no se puede usar CCM (blosize!=128) + // no se pude usar GCM (blocksize <128) + // EAX siempre explota, no se puede usar con AEAD + + testBulkAlgorithm("GOST28147", arrayModes64, arrayPaddings, key256, IV64, false); + + } + + [Test] + public void TestNOEKEON() + { + // key length 128 + // blocksize 128 + testBulkAlgorithm("NOEKEON", arrayModes, arrayPaddings, key128, IV128, false); + + testCCM("NOEKEON", key128, false); + testGCM("NOEKEON", key128, false); + testEAX("NOEKEON", key128, false); + + } + + [Test] + public void TestRC2() + { + // key length 0...1024 + // blocksize 64 + // no se puede usar CCM (blosize!=128) + // no se pude usar GCM (blocksize <128) + // EAX siempre explota, no se puede usar con AEAD + + testBulkAlgorithm("RC2", arrayModes64, arrayPaddings, key64, IV64, false); + testBulkAlgorithm("RC2", arrayModes64, arrayPaddings, key128, IV64, false); + testBulkAlgorithm("RC2", arrayModes64, arrayPaddings, key192, IV64, false); + testBulkAlgorithm("RC2", arrayModes64, arrayPaddings, key256, IV64, false); + testBulkAlgorithm("RC2", arrayModes64, arrayPaddings, key512, IV64, false); + testBulkAlgorithm("RC2", arrayModes64, arrayPaddings, key1024, IV64, false); + + } + + [Test] + public void TestRC532() + { + // key length 0...128 + // blocksize 64 + // no se puede usar CCM (blosize!=128) + // no se pude usar GCM (blocksize <128) + // EAX siempre explota, no se puede usar con AEAD + + testBulkAlgorithm("RC532", arrayModes64, arrayPaddings, key64, IV64, false); + testBulkAlgorithm("RC532", arrayModes64, arrayPaddings, key128, IV64, false); + } + + [Test] + public void TestRC6() + { + // key length 0...256 + // blocksize 128 + testBulkAlgorithm("RC6", arrayModes, arrayPaddings, key64, IV128, false); + testBulkAlgorithm("RC6", arrayModes, arrayPaddings, key128, IV128, false); + testBulkAlgorithm("RC6", arrayModes, arrayPaddings, key192, IV128, false); + testBulkAlgorithm("RC6", arrayModes, arrayPaddings, key256, IV128, false); + + testCCM("RC6", key64, false); + testCCM("RC6", key128, false); + testCCM("RC6", key192, false); + testCCM("RC6", key256, false); + + testGCM("RC6", key64, false); + testGCM("RC6", key128, false); + testGCM("RC6", key192, false); + testGCM("RC6", key256, false); + + testEAX("RC6", key128, false); + testEAX("RC6", key192, false); + testEAX("RC6", key256, false); + } + + [Test] + public void TestRIJNDAEL() + { + // key length 128.160.224.256 + // blocksize 128, 160, 192, 224, 256 + + testBulkAlgorithm("RIJNDAEL_128", arrayModes, arrayPaddings, key128, IV128, false); + testBulkAlgorithm("RIJNDAEL_128", arrayModes, arrayPaddings, key160, IV128, false); + testBulkAlgorithm("RIJNDAEL_128", arrayModes, arrayPaddings, key192, IV128, false); + testBulkAlgorithm("RIJNDAEL_128", arrayModes, arrayPaddings, key256, IV128, false); + + testBulkAlgorithm("RIJNDAEL_160", arrayModes, arrayPaddings, key128, IV160, false); + testBulkAlgorithm("RIJNDAEL_160", arrayModes, arrayPaddings, key160, IV160, false); + testBulkAlgorithm("RIJNDAEL_160", arrayModes, arrayPaddings, key192, IV160, false); + testBulkAlgorithm("RIJNDAEL_160", arrayModes, arrayPaddings, key256, IV160, false); + + testBulkAlgorithm("RIJNDAEL_192", arrayModes, arrayPaddings, key128, IV192, false); + testBulkAlgorithm("RIJNDAEL_192", arrayModes, arrayPaddings, key160, IV192, false); + testBulkAlgorithm("RIJNDAEL_192", arrayModes, arrayPaddings, key192, IV192, false); + testBulkAlgorithm("RIJNDAEL_192", arrayModes, arrayPaddings, key256, IV192, false); + + testBulkAlgorithm("RIJNDAEL_224", arrayModes, arrayPaddings, key128, IV224, false); + testBulkAlgorithm("RIJNDAEL_224", arrayModes, arrayPaddings, key160, IV224, false); + testBulkAlgorithm("RIJNDAEL_224", arrayModes, arrayPaddings, key192, IV224, false); + testBulkAlgorithm("RIJNDAEL_224", arrayModes, arrayPaddings, key256, IV224, false); + + testBulkAlgorithm("RIJNDAEL_256", arrayModes, arrayPaddings, key128, IV256, false); + testBulkAlgorithm("RIJNDAEL_256", arrayModes, arrayPaddings, key160, IV256, false); + testBulkAlgorithm("RIJNDAEL_256", arrayModes, arrayPaddings, key192, IV256, false); + testBulkAlgorithm("RIJNDAEL_256", arrayModes, arrayPaddings, key256, IV256, false); + + testCCM("RIJNDAEL_128", key128, false); + testCCM("RIJNDAEL_128", key160, false); + testCCM("RIJNDAEL_128", key192, false); + testCCM("RIJNDAEL_128", key256, false); + + testGCM("RIJNDAEL_128", key128, false); + testGCM("RIJNDAEL_128", key160, false); + testGCM("RIJNDAEL_128", key192, false); + testGCM("RIJNDAEL_128", key256, false); + + testEAX("RIJNDAEL_128", key128, false); + testEAX("RIJNDAEL_128", key192, false); + testEAX("RIJNDAEL_128", key256, false); + + } + + [Test] + public void TestSEED() + { + // key length 128 + // blocksize 128 + + testBulkAlgorithm("SEED", arrayModes, arrayPaddings, key128, IV128, false); + + testCCM("SEED", key128, false); + testGCM("SEED", key128, false); + testEAX("SEED", key128, false); + } + + [Test] + public void TestSERPENT() + { + // key length 128.192.256 + // blocksize 128 + testBulkAlgorithm("SERPENT", arrayModes, arrayPaddings, key128, IV128, false); + testBulkAlgorithm("SERPENT", arrayModes, arrayPaddings, key192, IV128, false); + testBulkAlgorithm("SERPENT", arrayModes, arrayPaddings, key256, IV128, false); + + testCCM("SERPENT", key128, false); + testCCM("SERPENT", key192, false); + testCCM("SERPENT", key256, false); + + testGCM("SERPENT", key128, false); + testGCM("SERPENT", key192, false); + testGCM("SERPENT", key256, false); + + testEAX("SERPENT", key128, false); + testEAX("SERPENT", key192, false); + testEAX("SERPENT", key256, false); + + } + + [Test] + public void TestSKIPJACK() + { + // key length 128 + // blocksize 64 + // no se puede usar CCM (blosize!=128) + // no se pude usar GCM (blocksize <128) + // EAX siempre explota, no se puede usar con AEAD + + testBulkAlgorithm("SKIPJACK", arrayModes64, arrayPaddings, key128, IV64, false); + + } + + [Test] + public void TestSM4() + { + // key length 128 + // blocksize 128 + testBulkAlgorithm("SM4", arrayModes, arrayPaddings, key128, IV128, false); + + testCCM("SM4", key128, false); + testGCM("SM4", key128, false); + testEAX("SM4", key128, false); + } + + [Test] + public void TestTEA() + { + // key length 128 + // blocksize 64 + // no se puede usar CCM (blosize!=128) + // no se pude usar GCM (blocksize <128) + // EAX siempre explota, no se puede usar con AEAD + + testBulkAlgorithm("TEA", arrayModes64, arrayPaddings, key128, IV64, false); + + } + + [Test] + public void TestTHREEFISH() + { + // key length 256.512.1024 + // blocksize 256.512.1024 + // key must be same size as the block + // the input must be the same length or longer than the block + // no se puede usar CCM (blosize!=128) + // GCM siempre explota + + testBulkAlgorithm("THREEFISH_256", arrayModes, arrayPaddings, key256, IV256, true); + testBulkAlgorithm("THREEFISH_512", arrayModes, arrayPaddings, key512, IV512, true); + testBulkAlgorithm("THREEFISH_1024", arrayModes, arrayPaddings, key1024, IV1024, true); + } + + [Test] + public void TestTWOFISH() + { + // key length 128.192.256 + // blocksize 128 + testBulkAlgorithm("TWOFISH", arrayModes, arrayPaddings, key128, IV128, false); + testBulkAlgorithm("TWOFISH", arrayModes, arrayPaddings, key192, IV128, false); + testBulkAlgorithm("TWOFISH", arrayModes, arrayPaddings, key256, IV128, false); + + testCCM("TWOFISH", key128, false); + testCCM("TWOFISH", key192, false); + testCCM("TWOFISH", key256, false); + + testGCM("TWOFISH", key128, false); + testGCM("TWOFISH", key192, false); + testGCM("TWOFISH", key256, false); + + testEAX("TWOFISH", key128, false); + testEAX("TWOFISH", key192, false); + testEAX("TWOFISH", key256, false); + + } + + [Test] + public void TestXTEA() + { + // key length 128 + // blocksize 64 + // no se puede usar CCM (blosize!=128) + // no se pude usar GCM (blocksize <128) + // EAX siempre explota, no se puede usar con AEAD + + testBulkAlgorithm("XTEA", arrayModes64, arrayPaddings, key128, IV64, false); + + } + + + + private void testBulkAlgorithm(string algorithm, string[] modes, string[] paddings, string key, string IV, + bool cts) + { + for (int i = 0; i < encodings.Length; i++) + { + eu.setEncoding(encodings[i]); + if (cts) + { + testBulkAlgorithmCTS(algorithm, modes, paddings, key, IV, plainTextCTS); + } + else + { + testBulkAlgorithmCTS(algorithm, modes, paddings, key, IV, plainText); + } + } + } + + private void testBulkAlgorithmCTS(string algorithm, string[] modes, string[] paddings, string key, string IV, + string text) + { + for (int m = 0; m < arrayModes.Length; m++) + { + for (int p = 0; p < arrayPaddings.Length; p++) + { + SymmetricBlockCipher symBlockCipher = new SymmetricBlockCipher(); + string encrypted = symBlockCipher.DoEncrypt(algorithm, arrayModes[m], arrayPaddings[p], key, IV, text); + string decrypted = symBlockCipher.DoDecrypt(algorithm, arrayModes[m], arrayPaddings[p], key, IV, + encrypted); + + /*eu.setEncoding("UTF_16"); + string encrypted = symBlockCipher.DoEncrypt(algorithm, arrayModes[2], arrayPaddings[0], key, IV, text); + string decrypted = symBlockCipher.DoDecrypt(algorithm, arrayModes[2], arrayPaddings[0], key, IV, + encrypted); + string encoding = eu.getEncoding();*/ + string resText = eu.getString(eu.getBytes(text)); + Assert.IsTrue(SecurityUtils.compareStrings(resText, decrypted)); + + True(true, symBlockCipher); + } + + } + } + + private void testCCM(string algorithm, string key, bool cts) + { + if (cts) + { + testCCM_CTS(algorithm, key, plainTextCTS); + } + else + { + testCCM_CTS(algorithm, key, plainText); + } + } + + private void testCCM_CTS(string algorithm, string key, string text) + { + for (int n = 0; n < arrayNoncesCCM.Length; n++) + { + for (int t = 0; t < arrayTagsCCM.Length; t++) + { + for (int p = 0; p < arrayPaddings.Length; p++) + { + SymmetricBlockCipher symBlockCipher = new SymmetricBlockCipher(); + string encrypted = symBlockCipher.DoAEADEncrypt(algorithm, "AEAD_CCM", key, arrayTagsCCM[t], + arrayNoncesCCM[n], text); + string decrypted = symBlockCipher.DoAEADDecrypt(algorithm, "AEAD_CCM", key, arrayTagsCCM[t], + arrayNoncesCCM[n], encrypted); + Assert.IsTrue(SecurityUtils.compareStrings(text, decrypted)); + True(SecurityUtils.compareStrings(text, decrypted), symBlockCipher); + } + } + } + } + + private void testEAX(string algorithm, string key, bool cts) + { + if (cts) + { + testEAX_CTS(algorithm, key, plainTextCTS); + } + else + { + testEAX_CTS(algorithm, key, plainText); + } + } + + private void testEAX_CTS(string algorithm, string key, string text) + { + for (int m = 0; m < arrayMacsEAX.Length; m++) + { + for (int n = 0; n < arrayNonces.Length; n++) + { + for (int p = 0; p < arrayPaddings.Length; p++) + { + SymmetricBlockCipher symBlockCipher = new SymmetricBlockCipher(); + string encrypted = symBlockCipher.DoAEADEncrypt(algorithm, "AEAD_EAX", key, arrayMacsEAX[m], + arrayNonces[n], text); + string decrypted = symBlockCipher.DoAEADDecrypt(algorithm, "AEAD_EAX", key, arrayMacsEAX[m], + arrayNonces[n], encrypted); + Assert.IsTrue(SecurityUtils.compareStrings(text, decrypted)); + True(SecurityUtils.compareStrings(text, decrypted), symBlockCipher); + } + } + } + } + + private void testGCM(string algorithm, string key, bool cts) + { + if (cts) + { + testGCM_CTS(algorithm, key, plainTextCTS); + } + else + { + testGCM_CTS(algorithm, key, plainText); + } + } + + private void testGCM_CTS(string algorithm, string key, string text) + { + for (int m = 0; m < arrayTagsGCM.Length; m++) + { + for (int n = 0; n < arrayNonces.Length; n++) + { + for (int p = 0; p < arrayPaddings.Length; p++) + { + SymmetricBlockCipher symBlockCipher = new SymmetricBlockCipher(); + string encrypted = symBlockCipher.DoAEADEncrypt(algorithm, "AEAD_GCM", key, arrayTagsGCM[m], + arrayNonces[n], text); + string decrypted = symBlockCipher.DoAEADDecrypt(algorithm, "AEAD_GCM", key, arrayTagsGCM[m], + arrayNonces[n], encrypted); + Assert.IsTrue(SecurityUtils.compareStrings(text, decrypted)); + True(SecurityUtils.compareStrings(text, decrypted), symBlockCipher); + } + } + } + } + } +} diff --git a/test/dotnetframework/SecurityAPITest/Cryptography/Symmetric/TestStreamEncryption.cs b/test/dotnetframework/SecurityAPITest/Cryptography/Symmetric/TestStreamEncryption.cs new file mode 100644 index 0000000..29c007d --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/Cryptography/Symmetric/TestStreamEncryption.cs @@ -0,0 +1,156 @@ +using SecurityAPITest.SecurityAPICommons.commons; +using NUnit.Framework; +using SecurityAPICommons.Config; +using SecurityAPICommons.Keys; +using GeneXusCryptography.Symmetric; +using SecurityAPICommons.Utils; + +namespace SecurityAPITest.Cryptography.Symmetric +{ + [TestFixture] + public class TestStreamEncryption: SecurityAPITestObject + { + protected static string key8; + protected static string key32; + protected static string key128; + protected static string key256; + protected static string key1024; + protected static string key6144; + protected static string key8192; + + protected static string IV64; + protected static string IV128; + protected static string IV192; + protected static string IV256; + protected static string IV512; + protected static string IV1024; + protected static string IV6144; + + private static string plainText; + + private static string[] encodings; + private static EncodingUtil eu; + + [SetUp] + public virtual void SetUp() + { + + plainText = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam venenatis ex sit amet risus pellentesque, a faucibus quam ultrices. Ut tincidunt quam eu aliquam maximus. Quisque posuere risus at erat blandit eleifend. Curabitur viverra rutrum volutpat. Donec quis quam tellus. Aenean fermentum elementum augue, a semper risus scelerisque sit amet. Nullam vitae sapien vitae dui ullamcorper dapibus quis quis leo. Sed neque felis, pellentesque in risus et, lobortis ultricies nulla. Quisque quis quam risus. Donec vestibulum, lectus vel vestibulum eleifend, velit ante volutpat lacus, ut mattis quam ligula eget est. Sed et pulvinar lectus. In mollis turpis non ipsum vehicula, sit amet rutrum nibh dictum. Duis consectetur convallis ex, eu ultricies enim bibendum vel. Vestibulum vel libero nibh. Morbi nec odio mattis, vestibulum quam blandit, pretium orci.Aenean pellentesque tincidunt nunc a malesuada. Etiam gravida fermentum mi, at dignissim dui aliquam quis. Nullam vel lobortis libero. Phasellus non gravida posuere"; + SymmetricKeyGenerator keyGen = new SymmetricKeyGenerator(); + + /**** GENERATE KEYS ****/ + key8 = keyGen.doGenerateKey("GENERICRANDOM", 8); + key32 = keyGen.doGenerateKey("GENERICRANDOM", 32); + key128 = keyGen.doGenerateKey("GENERICRANDOM", 128); + key256 = keyGen.doGenerateKey("GENERICRANDOM", 256); + key1024 = keyGen.doGenerateKey("GENERICRANDOM", 1024); + key8192 = keyGen.doGenerateKey("GENERICRANDOM", 8192); + key6144 = keyGen.doGenerateKey("GENERICRANDOM", 6144); + + /**** GENERATE IVs ****/ + IV64 = keyGen.doGenerateIV("GENERICRANDOM", 64); + IV128 = keyGen.doGenerateIV("GENERICRANDOM", 128); + IV192 = keyGen.doGenerateIV("GENERICRANDOM", 192); + IV256 = keyGen.doGenerateIV("GENERICRANDOM", 256); + IV512 = keyGen.doGenerateIV("GENERICRANDOM", 512); + IV1024 = keyGen.doGenerateIV("GENERICRANDOM", 1024); + IV6144 = keyGen.doGenerateIV("GENERICRANDOM", 6144); + + encodings = new string[] { "UTF_8", "UTF_16", "UTF_16BE", "UTF_16LE", "UTF_32", "UTF_32BE", "UTF_32LE", "SJIS", + "GB2312" }; + + eu = new EncodingUtil(); + + } + + [Test] + public void TestRC4() + { + // RC4 key 1024, no nonce + testBulkAlgorithms("RC4", key1024, ""); + } + + [Test] + public void TestHC128() + { + // HC128 key 128 bits, no nonce + testBulkAlgorithms("HC128", key128, IV128); + } + + [Test] + public void TestHC256() + { + // HC256 key 256 bits, IV 128 o 256 bits + testBulkAlgorithms("HC256", key256, IV128); + testBulkAlgorithms("HC256", key256, IV256); + + } + + [Test] + public void TestSALSA20() + { + // SALSA20 key 256 o 128 bits, 64 bit nonce + testBulkAlgorithms("SALSA20", key128, IV64); + testBulkAlgorithms("SALSA20", key256, IV64); + + } + + [Test] + public void TestCHACHA20() + { + // CHACHA key 128 o 256, IV 64 bits + testBulkAlgorithms("CHACHA20", key128, IV64); + testBulkAlgorithms("CHACHA20", key256, IV64); + } + + [Test] + public void TestXSALSA20() + { + // SALSA20 key 256 bits, 192 bit nonce + testBulkAlgorithms("XSALSA20", key256, IV192); + } + + [Test] + public void TestISAAC() + { + // ISAAC 32, 8192 key, no nonce + testBulkAlgorithms("ISAAC", key32, ""); + testBulkAlgorithms("ISAAC", key8192, ""); + } + + [Test] + public void TestVMPC() + { + // key 8 o 6144, nonce 1...6144 bits + testBulkAlgorithms("VMPC", key8, IV64); + testBulkAlgorithms("VMPC", key8, IV128); + testBulkAlgorithms("VMPC", key8, IV192); + testBulkAlgorithms("VMPC", key8, IV256); + testBulkAlgorithms("VMPC", key8, IV512); + testBulkAlgorithms("VMPC", key8, IV1024); + testBulkAlgorithms("VMPC", key8, IV6144); + + testBulkAlgorithms("VMPC", key6144, IV64); + testBulkAlgorithms("VMPC", key6144, IV128); + testBulkAlgorithms("VMPC", key6144, IV192); + testBulkAlgorithms("VMPC", key6144, IV256); + testBulkAlgorithms("VMPC", key6144, IV512); + testBulkAlgorithms("VMPC", key6144, IV1024); + testBulkAlgorithms("VMPC", key6144, IV6144); + + } + + private void testBulkAlgorithms(string algorithm, string key, string IV) + { + for (int i = 0; i < encodings.Length; i++) + { + eu.setEncoding(encodings[i]); + SymmetricStreamCipher symCipher = new SymmetricStreamCipher(); + string encrypted = symCipher.DoEncrypt(algorithm, key, IV, plainText); + string decrypted = symCipher.DoDecrypt(algorithm, key, IV, encrypted); + Assert.IsTrue(SecurityUtils.compareStrings(plainText, decrypted)); + True(SecurityUtils.compareStrings(plainText, decrypted), symCipher); + } + } + } +} diff --git a/test/dotnetframework/SecurityAPITest/Cryptography/Symmetric/TestSymmetricDomainSpaces.cs b/test/dotnetframework/SecurityAPITest/Cryptography/Symmetric/TestSymmetricDomainSpaces.cs new file mode 100644 index 0000000..2ed31d1 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/Cryptography/Symmetric/TestSymmetricDomainSpaces.cs @@ -0,0 +1,58 @@ +using GeneXusCryptography.Symmetric; +using NUnit.Framework; +using SecurityAPICommons.Keys; +using SecurityAPICommons.Utils; +using SecurityAPITest.SecurityAPICommons.commons; + +namespace SecurityAPITest.Cryptography.Symmetric +{ + [TestFixture] + public class TestSymmetricDomainSpaces : SecurityAPITestObject + { + private static string plainText; + private static SymmetricKeyGenerator keyGen; + private static string key128; + private static string IV128; + private static SymmetricBlockCipher symBlockCipher; + + private static string plainTextStream; + private static string key1024; + private static SymmetricStreamCipher symStreamCipher; + + [SetUp] + public virtual void SetUp() + { + plainText = "Neque porro quisquam est qui dolorem ipsum quia dolor sit amet"; + keyGen = new SymmetricKeyGenerator(); + + key128 = keyGen.doGenerateKey(" GENERICRANDOM", 128); + IV128 = keyGen.doGenerateIV("GENERICRANDOM ", 128); + symBlockCipher = new SymmetricBlockCipher(); + + plainTextStream = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam venenatis ex sit amet risus pellentesque, a faucibus quam ultrices. Ut tincidunt quam eu aliquam maximus. Quisque posuere risus at erat blandit eleifend. Curabitur viverra rutrum volutpat. Donec quis quam tellus. Aenean fermentum elementum augue, a semper risus scelerisque sit amet. Nullam vitae sapien vitae dui ullamcorper dapibus quis quis leo. Sed neque felis, pellentesque in risus et, lobortis ultricies nulla. Quisque quis quam risus. Donec vestibulum, lectus vel vestibulum eleifend, velit ante volutpat lacus, ut mattis quam ligula eget est. Sed et pulvinar lectus. In mollis turpis non ipsum vehicula, sit amet rutrum nibh dictum. Duis consectetur convallis ex, eu ultricies enim bibendum vel. Vestibulum vel libero nibh. Morbi nec odio mattis, vestibulum quam blandit, pretium orci.Aenean pellentesque tincidunt nunc a malesuada. Etiam gravida fermentum mi, at dignissim dui aliquam quis. Nullam vel lobortis libero. Phasellus non gravida posuere"; + key1024 = keyGen.doGenerateKey("GENERICRANDOM ", 1024); + symStreamCipher = new SymmetricStreamCipher(); + + } + + [Test] + public void TestBlockDomains() + { + string encrypted = symBlockCipher.DoEncrypt("AES ", "CBC ", "ZEROBYTEPADDING ", key128, IV128, plainText); + Assert.IsFalse(symBlockCipher.HasError()); + string decrypted = symBlockCipher.DoDecrypt(" AES", " CBC", " ZEROBYTEPADDING", key128, IV128, encrypted); + Assert.IsFalse(symBlockCipher.HasError()); + Assert.IsTrue(SecurityUtils.compareStrings(decrypted, plainText)); + } + + [Test] + public void TestStreamDomains() + { + string encrypted = symStreamCipher.DoEncrypt("RC4 ", key1024, "", plainTextStream); + Assert.IsFalse(symStreamCipher.HasError()); + string decrypted = symStreamCipher.DoDecrypt(" RC4", key1024, "", encrypted); + Assert.IsFalse(symStreamCipher.HasError()); + Assert.IsTrue(SecurityUtils.compareStrings(decrypted, plainTextStream)); + } + } +} diff --git a/test/dotnetframework/SecurityAPITest/Ftps/TestFtps.cs b/test/dotnetframework/SecurityAPITest/Ftps/TestFtps.cs new file mode 100644 index 0000000..c452e24 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/Ftps/TestFtps.cs @@ -0,0 +1,139 @@ +using GeneXusFtps.GeneXusFtps; +using NUnit.Framework; +using SecurityAPICommons.Utils; +using SecurityAPITest.SecurityAPICommons.commons; +using System.IO; + +namespace SecurityAPITest.Ftps +{ + [TestFixture] + [RunIfRunSettingsConfigured] + public class TestFtps: SecurityAPITestObject + { + protected static string host; + protected static string user; + protected static string password; + protected static string localPath; + protected static string remoteDir; + protected static string remoteFilePath; + protected static string localDir; + protected static string pwd; + protected static int port; + protected static string connectionMode; + protected static bool forceEncryption; + protected static string encoding; + protected static string encryptionMode; + protected static string protocol; + protected static string trustStorePath; + protected static string trustStorePassword; + protected static ExtensionsWhiteList whiteList; + protected static string imagePath; + + [SetUp] + public virtual void SetUp() + { + host = TestContextParameter("gx_ftp_host"); + user = TestContextParameter("gx_ftps_user"); + password = TestContextParameter("gx_ftps_password"); + localPath = Path.Combine(BASE_PATH, "Temp", "ftps", "ftpstest.txt"); + remoteDir = "/files"; + remoteFilePath = "/files/ftpstest.txt"; + localDir = Path.Combine(BASE_PATH, "Temp", "ftps", "back"); + port = 21; + connectionMode = "PASSIVE"; + forceEncryption = true; + encoding = "BINARY"; + encryptionMode = "EXPLICIT"; + protocol = "TLS1_2"; + string certificateConentBase64 = TestContextParameter("gx_ftp_certificate_content_base64"); + trustStorePath = Path.Combine(BASE_PATH, "Temp", "ftps", "ftps_cert.pfx"); + File.WriteAllBytes(trustStorePath, System.Convert.FromBase64String(certificateConentBase64)); + trustStorePassword = TestContextParameter("gx_ftps_trust_store_password"); + whiteList = new ExtensionsWhiteList(); + whiteList.SetExtension(".txt"); + whiteList.SetExtension(".pdf"); + imagePath = Path.Combine(BASE_PATH, "Temp", "icon.png"); + } + + private FtpsClient TestConnection(FtpsOptions options) + { + FtpsClient client = new FtpsClient(); + bool connected = client.Connect(options); + True(connected, client); + return client; + } + + private void TestPut(FtpsClient client) + { + bool put = client.Put(localPath, remoteDir); + True(put, client); + } + + private void TestGet(FtpsClient client) + { + bool get = client.Get(remoteFilePath, localDir); + True(get, client); + } + + [Test] + public void TestWithoutCert() + { + FtpsOptions options = new FtpsOptions(); + options.Host = host; + options.User = user; + options.Password = password; + options.Port = port; + options.ForceEncryption = forceEncryption; + options.ConnectionMode = connectionMode; + options.EncryptionMode = encryptionMode; + options.Protocol = protocol; + options.WhiteList = whiteList; + FtpsClient client = TestConnection(options); + TestPut(client); + TestGet(client); + client.Disconnect(); + } + + [Test] + public void TestWithCert() + { + FtpsOptions options = new FtpsOptions(); + options.Host = host; + options.User = user; + options.Password = password; + options.Port = port; + options.ForceEncryption = forceEncryption; + options.ConnectionMode = connectionMode; + options.EncryptionMode = encryptionMode; + options.Protocol = protocol; + options.WhiteList = whiteList; + options.TrustStorePath = trustStorePath; + options.TrustStorePassword = trustStorePassword; + FtpsClient client = TestConnection(options); + TestPut(client); + TestGet(client); + client.Disconnect(); + } + + [Test] + public void TestWhiteList() + { + FtpsOptions options = new FtpsOptions(); + options.Host = host; + options.User = user; + options.Password = password; + options.Port = port; + options.ForceEncryption = forceEncryption; + options.ConnectionMode = connectionMode; + options.EncryptionMode = encryptionMode; + options.Protocol = protocol; + options.WhiteList = whiteList; + FtpsClient client = TestConnection(options); + bool put = client.Put(imagePath, remoteDir); + Assert.IsFalse(put); + Assert.IsTrue(client.HasError()); + client.Disconnect(); + + } + } +} diff --git a/test/dotnetframework/SecurityAPITest/Ftps/TestFtpsDomainSpaces.cs b/test/dotnetframework/SecurityAPITest/Ftps/TestFtpsDomainSpaces.cs new file mode 100644 index 0000000..a4ac3c1 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/Ftps/TestFtpsDomainSpaces.cs @@ -0,0 +1,83 @@ +using GeneXusFtps.GeneXusFtps; +using NUnit.Framework; +using SecurityAPITest.SecurityAPICommons.commons; +using System.IO; + +namespace SecurityAPITest.Ftps +{ + [TestFixture] + [RunIfRunSettingsConfigured] + public class TestFtpsDomainSpaces : SecurityAPITestObject + { + protected static string host; + protected static string user; + protected static string password; + protected static string localPath; + protected static string remoteDir; + protected static string remoteFilePath; + protected static string localDir; + protected static string pwd; + protected static int port; + protected static string connectionMode; + protected static bool forceEncryption; + protected static string encoding; + protected static string encryptionMode; + protected static string protocol; + + [SetUp] + public virtual void SetUp() + { + host = TestContextParameter("gx_ftp_host"); + user = TestContextParameter("gx_ftps_user"); + password = TestContextParameter("gx_ftps_password"); + localPath = Path.Combine(BASE_PATH, "Temp", "ftps", "ftpstest.txt"); + remoteDir = "/files"; + remoteFilePath = "/files/ftpstest.txt"; + localDir = Path.Combine(BASE_PATH, "Temp", "ftps", "back"); + port = 21; + connectionMode = "PASSIVE "; + forceEncryption = true; + encoding = " BINARY"; + encryptionMode = " EXPLICIT"; + protocol = "TLS1_2 "; + } + + private FtpsClient TestConnection(FtpsOptions options) + { + FtpsClient client = new FtpsClient(); + bool connected = client.Connect(options); + True(connected, client); + return client; + } + + private void TestPut(FtpsClient client) + { + bool put = client.Put(localPath, remoteDir); + True(put, client); + } + + private void TestGet(FtpsClient client) + { + bool get = client.Get(remoteFilePath, localDir); + True(get, client); + } + + [Test] + public void TestSFtpsSpaces() + { + FtpsOptions options = new FtpsOptions(); + options.Host = host; + options.User = user; + options.Password = password; + options.Port = port; + options.ForceEncryption = forceEncryption; + options.ConnectionMode = connectionMode; + options.EncryptionMode = encryptionMode; + options.Protocol = protocol; + FtpsClient client = TestConnection(options); + TestPut(client); + TestGet(client); + client.Disconnect(); + } + } +} diff --git a/test/dotnetframework/SecurityAPITest/Jwt/Asymmetric/TestAsymmetricJwt.cs b/test/dotnetframework/SecurityAPITest/Jwt/Asymmetric/TestAsymmetricJwt.cs new file mode 100644 index 0000000..173e78d --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/Jwt/Asymmetric/TestAsymmetricJwt.cs @@ -0,0 +1,279 @@ +using SecurityAPITest.SecurityAPICommons.commons; +using NUnit.Framework; +using GeneXusJWT.GenexusComons; +using GeneXusJWT.GenexusJWT; +using SecurityAPICommons.Keys; +using GeneXusJWT.GenexusJWTUtils; +using GeneXusJWT.GenexusJWTClaims; +using System; +using System.IO; + +namespace SecurityAPITest.Jwt.Asymmetric +{ + [TestFixture] + public class TestAsymmetricJwt: SecurityAPITestObject + { + protected static JWTOptions options; + protected static PrivateClaims claims; + protected static GUID guid; + protected static DateUtil du; + protected static SymmetricKeyGenerator keyGenerator; + protected static JWTCreator jwt; + + protected static string path_RSA_sha256_1024; + protected static string path_RSA_sha256_2048; + protected static string path_RSA_sha512_2048; + protected static string path_EC; + + protected static string alias; + protected static string password; + + [SetUp] + public virtual void SetUp() + { + + du = new DateUtil(); + guid = new GUID(); + keyGenerator = new SymmetricKeyGenerator(); + jwt = new JWTCreator(); + options = new JWTOptions(); + claims = new PrivateClaims(); + + options.AddRegisteredClaim("iss", "GXSA"); + options.AddRegisteredClaim("sub", "subject1"); + options.AddRegisteredClaim("aud", "audience1"); + + options.AddRegisteredClaim("jti", guid.Generate()); + + options.AddCustomTimeValidationClaim("exp", du.CurrentPlusSeconds(100), "20"); + options.AddCustomTimeValidationClaim("iat", du.GetCurrentDate(), "20"); + options.AddCustomTimeValidationClaim("nbf", du.GetCurrentDate(), "20"); + + claims.setClaim("hola1", "hola1"); + claims.setClaim("hola2", "hola2"); + + path_RSA_sha256_1024 = Path.Combine(BASE_PATH, "dummycerts", "RSA_sha256_1024"); + path_RSA_sha256_2048 = Path.Combine(BASE_PATH, "dummycerts", "RSA_sha256_2048"); + path_RSA_sha512_2048 = Path.Combine(BASE_PATH, "dummycerts", "RSA_sha512_2048"); + path_EC = Path.Combine(BASE_PATH, "dummycerts", "JWT_ECDSA", "prime_test"); + + alias = "1"; + password = "dummy"; + + } + + [Test] + public void Test_sha256_1024_DER() + { + string pathKey = Path.Combine(path_RSA_sha256_1024, "sha256d_key.pem"); + string pathCert = Path.Combine(path_RSA_sha256_1024, "sha256_cert.crt"); + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "RS256"; + bulkTest(key, cert, alg); + } + + [Test] + public void Test_sha256_1024_PEM() + { + string pathKey = Path.Combine(path_RSA_sha256_1024, "sha256d_key.pem"); + string pathCert = Path.Combine(path_RSA_sha256_1024, "sha256_cert.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "RS256"; + bulkTest(key, cert, alg); + } + + + + [Test] + public void Test_sha256_1024_PKCS12() + { + string pathKey = Path.Combine(path_RSA_sha256_1024, "sha256_cert.p12"); + string pathCert = Path.Combine(path_RSA_sha256_1024, "sha256_cert.p12"); + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.LoadPKCS12(pathKey, alias, password); + cert.LoadPKCS12(pathCert, alias, password); + string alg = "RS256"; + bulkTest(key, cert, alg); + } + + [Test] + public void Test_sha256_2048_DER() + { + string pathKey = Path.Combine(path_RSA_sha256_2048, "sha256d_key.pem"); + string pathCert = Path.Combine(path_RSA_sha256_2048, "sha256_cert.crt"); + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "RS256"; + bulkTest(key, cert, alg); + } + + [Test] + public void Test_sha256_2048_PEM() + { + string pathKey = Path.Combine(path_RSA_sha256_2048, "sha256d_key.pem"); + string pathCert = Path.Combine(path_RSA_sha256_2048, "sha256_cert.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "RS256"; + bulkTest(key, cert, alg); + } + + + + [Test] + public void Test_sha256_2048_PKCS12() + { + string pathKey = Path.Combine(path_RSA_sha256_2048, "sha256_cert.p12"); + string pathCert = Path.Combine(path_RSA_sha256_2048, "sha256_cert.p12"); + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.LoadPKCS12(pathKey, alias, password); + cert.LoadPKCS12(pathCert, alias, password); + string alg = "RS256"; + bulkTest(key, cert, alg); + } + + [Test] + public void Test_sha512_2048_DER() + { + string pathKey = Path.Combine(path_RSA_sha512_2048, "sha512d_key.pem"); + string pathCert = Path.Combine(path_RSA_sha512_2048, "sha512_cert.crt"); + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "RS512"; + bulkTest(key, cert, alg); + } + + [Test] + public void Test_sha512_2048_PEM() + { + string pathKey = Path.Combine(path_RSA_sha512_2048, "sha512d_key.pem"); + string pathCert = Path.Combine(path_RSA_sha512_2048, "sha512_cert.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "RS512"; + bulkTest(key, cert, alg); + } + + + + [Test] + public void Test_sha512_2048_PKCS12() + { + string pathKey = Path.Combine(path_RSA_sha512_2048, "sha512_cert.p12"); + string pathCert = Path.Combine(path_RSA_sha512_2048, "sha512_cert.p12"); + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.LoadPKCS12(pathKey, alias, password); + cert.LoadPKCS12(pathCert, alias, password); + string alg = "RS512"; + bulkTest(key, cert, alg); + } + + /*[Test] + public void Test_sha256_EC() + { + string pathKey = Path.Combine(path_EC, "key.pem"); + string pathCert = Path.Combine(path_EC, "cert_sha256.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "ES256"; + bulkTest(key, cert, alg); + } + + [Test] + public void Test_sha384_EC() + { + string pathKey = Path.Combine(path_EC, "key.pem"); + string pathCert = Path.Combine(path_EC, "cert_sha384.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "ES384"; + bulkTest(key, cert, alg); + } + + [Test] + public void Test_sha512_EC() + { + string pathKey = Path.Combine(path_EC, "key.pem"); + string pathCert = Path.Combine(path_EC, "cert_sha512.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "ES512"; + bulkTest(key, cert, alg); + }*/ + + + + private void bulkTest(PrivateKeyManager key, CertificateX509 cert, string alg) + { + options.SetPrivateKey(key); + options.SetCertificate(cert); + string token = jwt.DoCreate(alg, claims, options); + Assert.IsFalse(jwt.HasError()); + //bool verification = jwt.DoVerify(token, alg, claims, options); + //True(verification, jwt); + } + + [Test] + public void Test_sha512_2048_PEM_Encrypted() + { + string pathKey = Path.Combine(path_RSA_sha512_2048, "sha512_key.pem"); + string pathCert = Path.Combine(path_RSA_sha512_2048, "sha512_cert.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.LoadEncrypted(pathKey, password); + cert.Load(pathCert); + string alg = "RS512"; + bulkTest(key, cert, alg); + } + + [Test] + public void Test_sha256_1024_PEM_Encrypted() + { + string pathKey = Path.Combine(path_RSA_sha256_1024, "sha256_key.pem"); + string pathCert = Path.Combine(path_RSA_sha256_1024, "sha256_cert.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.LoadEncrypted(pathKey, password); + cert.Load(pathCert); + string alg = "RS256"; + bulkTest(key, cert, alg); + } + + [Test] + public void Test_sha256_2048_PEM_Encrypted() + { + string pathKey = Path.Combine(path_RSA_sha256_2048, "sha256_key.pem"); + string pathCert = Path.Combine(path_RSA_sha256_2048, "sha256_cert.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.LoadEncrypted(pathKey, password); + cert.Load(pathCert); + string alg = "RS256"; + bulkTest(key, cert, alg); + } + + } +} diff --git a/test/dotnetframework/SecurityAPITest/Jwt/Asymmetric/TestCreateWithoutCert.cs b/test/dotnetframework/SecurityAPITest/Jwt/Asymmetric/TestCreateWithoutCert.cs new file mode 100644 index 0000000..799db18 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/Jwt/Asymmetric/TestCreateWithoutCert.cs @@ -0,0 +1,61 @@ +using GeneXusJWT.GenexusComons; +using GeneXusJWT.GenexusJWT; +using GeneXusJWT.GenexusJWTClaims; +using NUnit.Framework; +using SecurityAPICommons.Keys; +using SecurityAPICommons.Utils; +using SecurityAPITest.SecurityAPICommons.commons; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SecurityAPITest.Jwt.Asymmetric +{ + [TestFixture] + public class TestCreateWithoutCert: SecurityAPITestObject + { + protected static JWTOptions options; + protected static PrivateClaims claims; + protected static SymmetricKeyGenerator keyGenerator; + protected static JWTCreator jwt; + + protected static string path_RSA_sha256_1024; + + [SetUp] + public virtual void SetUp() + { + + + keyGenerator = new SymmetricKeyGenerator(); + jwt = new JWTCreator(); + options = new JWTOptions(); + claims = new PrivateClaims(); + + options.AddRegisteredClaim("iss", "GXSA"); + options.AddRegisteredClaim("sub", "subject1"); + options.AddRegisteredClaim("aud", "audience1"); + + claims.setClaim("hola1", "hola1"); + claims.setClaim("hola2", "hola2"); + + path_RSA_sha256_1024 = Path.Combine(BASE_PATH, "dummycerts", "RSA_sha256_1024"); + + } + + [Test] + public void Test_sha256_1024_PEM() + { + String pathKey = Path.Combine(path_RSA_sha256_1024, "sha256d_key.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + key.Load(pathKey); + options.SetPrivateKey(key); + String alg = "RS256"; + String token = jwt.DoCreate(alg, claims, options); + Assert.IsFalse(SecurityUtils.compareStrings("", token)); + Assert.IsFalse(jwt.HasError()); + } + } +} diff --git a/test/dotnetframework/SecurityAPITest/Jwt/Asymmetric/TestECDSACurvesPrimeJwt.cs b/test/dotnetframework/SecurityAPITest/Jwt/Asymmetric/TestECDSACurvesPrimeJwt.cs new file mode 100644 index 0000000..5a125be --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/Jwt/Asymmetric/TestECDSACurvesPrimeJwt.cs @@ -0,0 +1,197 @@ +using GeneXusJWT.GenexusComons; +using GeneXusJWT.GenexusJWT; +using GeneXusJWT.GenexusJWTClaims; +using GeneXusJWT.GenexusJWTUtils; +using NUnit.Framework; +using SecurityAPICommons.Keys; +using SecurityAPITest.SecurityAPICommons.commons; +using System.IO; + +namespace SecurityAPITest.Jwt.Asymmetric +{ + [TestFixture] + public class TestECDSACurvesPrimeJwt: SecurityAPITestObject + { + protected static JWTOptions options; + protected static PrivateClaims claims; + protected static GUID guid; + protected static JWTCreator jwt; + protected static string ECDSA_path; + + [SetUp] + public virtual void SetUp() + { + guid = new GUID(); + jwt = new JWTCreator(); + options = new JWTOptions(); + claims = new PrivateClaims(); + + options.AddRegisteredClaim("iss", "GXSA"); + options.AddRegisteredClaim("sub", "subject1"); + options.AddRegisteredClaim("aud", "audience1"); + + options.AddRegisteredClaim("jti", guid.Generate()); + + claims.setClaim("hola1", "hola1"); + claims.setClaim("hola2", "hola2"); + + ECDSA_path = Path.Combine(BASE_PATH, "dummycerts", "JWT_ECDSA"); + } + + private void bulkTest_shouldWork(PrivateKeyManager key, CertificateX509 cert, string alg, string curve) + { + options.SetPrivateKey(key); + options.SetCertificate(cert); + string token = jwt.DoCreate(alg, claims, options); + Assert.IsFalse(jwt.HasError()); + bool verification = jwt.DoVerify(token, alg, claims, options); + True(verification, jwt); + } + + private void bulkTest_shouldntWork(PrivateKeyManager key, CertificateX509 cert, string alg, string curve) + { + options.SetPrivateKey(key); + options.SetCertificate(cert); + string token = jwt.DoCreate(alg, claims, options); + Assert.IsTrue(jwt.HasError()); + } + + public void test_shouldWork() + { + + prime192v1(); + prime192v2(); + prime192v3(); + prime239v1(); + prime239v2(); + prime239v3(); + prime256v1(); + } + + + [Test] + public void prime192v1() + { + string pathKey = Path.Combine(ECDSA_path, "prime192v1", "key.pem"); + string pathCert = Path.Combine(ECDSA_path, "prime192v1", "cert.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "ES256"; + string curve = "prime192v1"; +#if NETCORE + bulkTest_shouldntWork(key, cert, alg, curve); +#else + bulkTest_shouldWork(key, cert, alg, curve); +#endif + + + } + + [Test] + public void prime192v2() + { + string pathKey = Path.Combine(ECDSA_path, "prime192v2", "key.pem"); + string pathCert = Path.Combine(ECDSA_path, "prime192v2", "cert.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "ES256"; + string curve = "prime192v2"; +#if NETCORE + bulkTest_shouldntWork(key, cert, alg, curve); +#else + bulkTest_shouldWork(key, cert, alg, curve); +#endif + } + + [Test] + public void prime192v3() + { + string pathKey = Path.Combine(ECDSA_path, "prime192v3", "key.pem"); + string pathCert = Path.Combine(ECDSA_path, "prime192v3", "cert.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "ES256"; + string curve = "prime192v3"; +#if NETCORE + bulkTest_shouldntWork(key, cert, alg, curve); +#else + bulkTest_shouldWork(key, cert, alg, curve); +#endif + } + + [Test] + public void prime239v1() + { + string pathKey = Path.Combine(ECDSA_path, "prime239v1", "key.pem"); + string pathCert = Path.Combine(ECDSA_path, "prime239v1", "cert.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "ES256"; + string curve = "prime239v1"; +#if NETCORE + bulkTest_shouldntWork(key, cert, alg, curve); +#else + bulkTest_shouldWork(key, cert, alg, curve); +#endif + } + + [Test] + public void prime239v2() + { + string pathKey = Path.Combine(ECDSA_path, "prime239v2", "key.pem"); + string pathCert = Path.Combine(ECDSA_path, "prime239v2", "cert.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "ES256"; + string curve = "prime239v2"; +#if NETCORE + bulkTest_shouldntWork(key, cert, alg, curve); +#else + bulkTest_shouldWork(key, cert, alg, curve); +#endif + } + + [Test] + public void prime239v3() + { + string pathKey = Path.Combine(ECDSA_path, "prime239v3", "key.pem"); + string pathCert = Path.Combine(ECDSA_path, "prime239v3", "cert.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "ES256"; + string curve = "prime239v3"; +#if NETCORE + bulkTest_shouldntWork(key, cert, alg, curve); +#else + bulkTest_shouldWork(key, cert, alg, curve); +#endif + } + + [Test] + public void prime256v1() + { + string pathKey = Path.Combine(ECDSA_path, "prime256v1", "key.pem"); + string pathCert = Path.Combine(ECDSA_path, "prime256v1", "cert.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "ES256"; + string curve = "prime256v1"; + bulkTest_shouldWork(key, cert, alg, curve); + } + + } +} diff --git a/test/dotnetframework/SecurityAPITest/Jwt/Asymmetric/TestECDSACurvesSecpJwt.cs b/test/dotnetframework/SecurityAPITest/Jwt/Asymmetric/TestECDSACurvesSecpJwt.cs new file mode 100644 index 0000000..205841a --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/Jwt/Asymmetric/TestECDSACurvesSecpJwt.cs @@ -0,0 +1,278 @@ +using GeneXusJWT.GenexusComons; +using GeneXusJWT.GenexusJWT; +using GeneXusJWT.GenexusJWTClaims; +using GeneXusJWT.GenexusJWTUtils; +using NUnit.Framework; +using SecurityAPICommons.Commons; +using SecurityAPICommons.Keys; +using SecurityAPITest.SecurityAPICommons.commons; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SecurityAPITest.Jwt.Asymmetric +{ + [TestFixture] + public class TestECDSACurvesSecpJwt: SecurityAPITestObject + { + protected static JWTOptions options; + protected static PrivateClaims claims; + protected static GUID guid; + protected static JWTCreator jwt; + protected static string ECDSA_path; + + [SetUp] + public virtual void SetUp() + { + guid = new GUID(); + jwt = new JWTCreator(); + options = new JWTOptions(); + claims = new PrivateClaims(); + + options.AddRegisteredClaim("iss", "GXSA"); + options.AddRegisteredClaim("sub", "subject1"); + options.AddRegisteredClaim("aud", "audience1"); + + options.AddRegisteredClaim("jti", guid.Generate()); + + claims.setClaim("hola1", "hola1"); + claims.setClaim("hola2", "hola2"); + + ECDSA_path = Path.Combine(BASE_PATH, "dummycerts", "JWT_ECDSA"); + } + + private void bulkTest_shouldWork(PrivateKeyManager key, CertificateX509 cert, string alg, string curve) + { + options.SetPrivateKey(key); + options.SetCertificate(cert); + string token = jwt.DoCreate(alg, claims, options); + Assert.IsFalse(jwt.HasError()); + bool verification = jwt.DoVerify(token, alg, claims, options); + True(verification, jwt); + } + + private void bulkTest_shouldntWork(PrivateKeyManager key, CertificateX509 cert, string alg, string curve) + { + options.SetPrivateKey(key); + options.SetCertificate(cert); + string token = jwt.DoCreate(alg, claims, options); + Assert.IsTrue(jwt.HasError()); + } + + public void test_shouldWork() + { + + secp192k1(); + secp256k1(); + secp384r1(); + secp521r1(); + + } + + public void test_shouldntWork() + { + secp112r1(); + secp112r2(); + secp128r1(); + secp128r2(); + secp160k1(); + secp160r1(); + /***ESTOS DOS FUNCIONAN A VECES SI Y A VECES NO***/ + //secp224k1(); + //secp224r1(); + secp160r2(); + + } + + [Test] + public void secp112r1() + { + string pathKey = Path.Combine(ECDSA_path, "secp112r1", "key.pem"); + string pathCert = Path.Combine(ECDSA_path, "secp112r1", "cert.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "ES256"; + string curve = "secp112r1"; + bulkTest_shouldntWork(key, cert, alg, curve); + } + + [Test] + public void secp112r2() + { + string pathKey = Path.Combine(ECDSA_path, "secp112r2", "key.pem"); + string pathCert = Path.Combine(ECDSA_path, "secp112r2", "cert.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "ES256"; + string curve = "secp112r2"; + bulkTest_shouldntWork(key, cert, alg, curve); + } + + [Test] + public void secp128r1() + { + string pathKey = Path.Combine(ECDSA_path, "secp128r1", "key.pem"); + string pathCert = Path.Combine(ECDSA_path, "secp128r1", "cert.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "ES256"; + string curve = "secp128r1"; + bulkTest_shouldntWork(key, cert, alg, curve); + } + + [Test] + public void secp128r2() + { + string pathKey = Path.Combine(ECDSA_path, "secp128r2", "key.pem"); + string pathCert = Path.Combine(ECDSA_path, "secp128r2", "cert.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "ES256"; + string curve = "secp128r2"; + bulkTest_shouldntWork(key, cert, alg, curve); + } + + [Test] + public void secp160k1() + { + string pathKey = Path.Combine(ECDSA_path, "secp160k1", "key.pem"); + string pathCert = Path.Combine(ECDSA_path, "secp160k1", "cert.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "ES256"; + string curve = "secp160k1"; + bulkTest_shouldntWork(key, cert, alg, curve); + } + + [Test] + public void secp160r1() + { + string pathKey = Path.Combine(ECDSA_path, "secp160r1", "key.pem"); + string pathCert = Path.Combine(ECDSA_path, "secp160r1", "cert.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "ES256"; + string curve = "secp160r1"; + bulkTest_shouldntWork(key, cert, alg, curve); + } + + [Test] + public void secp160r2() + { + string pathKey = Path.Combine(ECDSA_path, "secp160r2", "key.pem"); + string pathCert = Path.Combine(ECDSA_path, "secp160r2", "cert.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "ES256"; + string curve = "secp160r2"; + bulkTest_shouldntWork(key, cert, alg, curve); + } + + [Test] + public void secp192k1() + { + string pathKey = Path.Combine(ECDSA_path, "secp192k1", "key.pem"); + string pathCert = Path.Combine(ECDSA_path, "secp192k1", "cert.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "ES256"; + string curve = "secp192k1"; +#if NETCORE + bulkTest_shouldntWork(key, cert, alg, curve); +#else + bulkTest_shouldWork(key, cert, alg, curve); +#endif + } + + /*private void secp224k1() { + string pathKey = Path.Combine(ECDSA_path, "secp224k1", "key.pem"); + string pathCert = Path.Combine(ECDSA_path, "secp224k1", "cert.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "ES256"; + string curve = "secp224k1"; + bulkTest_shouldntWork(key, cert, alg, curve); + + }*/ + + /*private void secp224r1() { + string pathKey = Path.Combine(ECDSA_path, "secp224r1", "key.pem"); + string pathCert = Path.Combine(ECDSA_path, "secp224r1", "cert.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "ES256"; + string curve = "secp224r1"; + bulkTest_shouldntWork(key, cert, alg, curve); + }*/ + + [Test] + public void secp256k1() + { + string pathKey = Path.Combine(ECDSA_path, "secp256k1", "key.pem"); + string pathCert = Path.Combine(ECDSA_path, "secp256k1", "cert.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "ES256"; + string curve = "secp256k1"; +#if NETCORE + bulkTest_shouldntWork(key, cert, alg, curve); +#else + bulkTest_shouldWork(key, cert, alg, curve); +#endif + + } + + [Test] + public void secp384r1() + { + string pathKey = Path.Combine(ECDSA_path, "secp384r1", "key.pem"); + string pathCert = Path.Combine(ECDSA_path, "secp384r1", "cert.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "ES256"; + string curve = "secp384r1"; + bulkTest_shouldWork(key, cert, alg, curve); + } + + [Test] + public void secp521r1() + { + string pathKey = Path.Combine(ECDSA_path, "secp521r1", "key.pem"); + string pathCert = Path.Combine(ECDSA_path, "secp521r1", "cert.pem"); + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "ES256"; + string curve = "secp521r1"; + bulkTest_shouldWork(key, cert, alg, curve); + } + } +} diff --git a/test/dotnetframework/SecurityAPITest/Jwt/Asymmetric/TestECDSACurvesSectJwt.cs b/test/dotnetframework/SecurityAPITest/Jwt/Asymmetric/TestECDSACurvesSectJwt.cs new file mode 100644 index 0000000..a5ae49b --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/Jwt/Asymmetric/TestECDSACurvesSectJwt.cs @@ -0,0 +1,347 @@ +using GeneXusJWT.GenexusComons; +using GeneXusJWT.GenexusJWT; +using GeneXusJWT.GenexusJWTClaims; +using GeneXusJWT.GenexusJWTUtils; +using NUnit.Framework; +using SecurityAPICommons.Keys; +using SecurityAPITest.SecurityAPICommons.commons; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SecurityAPITest.Jwt.Asymmetric +{ + [TestFixture] + public class TestECDSACurvesSectJwt: SecurityAPITestObject + { + protected static JWTOptions options; + protected static PrivateClaims claims; + protected static GUID guid; + protected static JWTCreator jwt; + protected static string ECDSA_path; + + [SetUp] + public virtual void SetUp() + { + guid = new GUID(); + jwt = new JWTCreator(); + options = new JWTOptions(); + claims = new PrivateClaims(); + + options.AddRegisteredClaim("iss", "GXSA"); + options.AddRegisteredClaim("sub", "subject1"); + options.AddRegisteredClaim("aud", "audience1"); + + options.AddRegisteredClaim("jti", guid.Generate()); + + claims.setClaim("hola1", "hola1"); + claims.setClaim("hola2", "hola2"); + + ECDSA_path = Path.Combine(BASE_PATH, "dummycerts", "JWT_ECDSA"); + } + + + private void bulkTest_shouldWork(PrivateKeyManager key, CertificateX509 cert, string alg, string curve) + { + options.SetPrivateKey(key); + options.SetCertificate(cert); + string token = jwt.DoCreate(alg, claims, options); + Assert.IsFalse(jwt.HasError()); + bool verification = jwt.DoVerify(token, alg, claims, options); + True(verification, jwt); + } + + private void bulkTest_shouldntWork(PrivateKeyManager key, CertificateX509 cert, string alg, string curve) + { + options.SetPrivateKey(key); + options.SetCertificate(cert); + string token = jwt.DoCreate(alg, claims, options); + Assert.IsTrue(jwt.HasError()); + } + + /*public void test_shouldWork() + { + + + + + }*/ + + public void test_shouldntWork() + { + sect113r1(); + sect113r2(); + sect131r1(); + sect131r2(); + sect163k1(); + sect163r1(); + sect163r2(); + sect193r1(); + sect193r2(); + sect233k1(); + /***ANDA CUANDO QUIERE***/ + // sect233r1(); + sect283k1(); + sect283r1(); + sect409k1(); + sect409r1(); + sect571k1(); + sect571r1(); + sect239k1(); +} + + + [Test] + public void sect113r1() + { + string pathKey = ECDSA_path + "sect113r1" + "\\key.pem"; + string pathCert = ECDSA_path + "sect113r1" + "\\cert.pem"; + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "ES256"; + string curve = "sect113r1"; + bulkTest_shouldntWork(key, cert, alg, curve); + } + + [Test] + public void sect113r2() + { + string pathKey = ECDSA_path + "sect113r2" + "\\key.pem"; + string pathCert = ECDSA_path + "sect113r2" + "\\cert.pem"; + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "ES256"; + string curve = "sect113r2"; + bulkTest_shouldntWork(key, cert, alg, curve); + } + + [Test] + public void sect131r1() + { + string pathKey = ECDSA_path + "sect131r1" + "\\key.pem"; + string pathCert = ECDSA_path + "sect131r1" + "\\cert.pem"; + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "ES256"; + string curve = "sect131r1"; + bulkTest_shouldntWork(key, cert, alg, curve); + } + + [Test] + public void sect131r2() + { + string pathKey = ECDSA_path + "sect131r2" + "\\key.pem"; + string pathCert = ECDSA_path + "sect131r2" + "\\cert.pem"; + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "ES256"; + string curve = "sect131r2"; + bulkTest_shouldntWork(key, cert, alg, curve); + } + + [Test] + public void sect163k1() + { + string pathKey = ECDSA_path + "sect163k1" + "\\key.pem"; + string pathCert = ECDSA_path + "sect163k1" + "\\cert.pem"; + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "ES256"; + string curve = "sect163k1"; + bulkTest_shouldntWork(key, cert, alg, curve); + } + + [Test] + public void sect163r1() + { + string pathKey = ECDSA_path + "sect163r1" + "\\key.pem"; + string pathCert = ECDSA_path + "sect163r1" + "\\cert.pem"; + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "ES256"; + string curve = "sect163r1"; + bulkTest_shouldntWork(key, cert, alg, curve); + } + + [Test] + public void sect163r2() + { + string pathKey = ECDSA_path + "sect163r2" + "\\key.pem"; + string pathCert = ECDSA_path + "sect163r2" + "\\cert.pem"; + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "ES256"; + string curve = "sect163r2"; + bulkTest_shouldntWork(key, cert, alg, curve); + } + + [Test] + public void sect193r1() + { + string pathKey = ECDSA_path + "sect193r1" + "\\key.pem"; + string pathCert = ECDSA_path + "sect193r1" + "\\cert.pem"; + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "ES256"; + string curve = "sect193r1"; + bulkTest_shouldntWork(key, cert, alg, curve); + } + + [Test] + public void sect193r2() + { + string pathKey = ECDSA_path + "sect193r2" + "\\key.pem"; + string pathCert = ECDSA_path + "sect193r2" + "\\cert.pem"; + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "ES256"; + string curve = "sect193r2"; + bulkTest_shouldntWork(key, cert, alg, curve); + } + + [Test] + public void sect233k1() + { + string pathKey = ECDSA_path + "sect233k1" + "\\key.pem"; + string pathCert = ECDSA_path + "sect233k1" + "\\cert.pem"; + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "ES256"; + string curve = "sect233k1"; + bulkTest_shouldntWork(key, cert, alg, curve); + } + + /*private void sect233r1() { + string pathKey = ECDSA_path + "sect233r1" + "\\key.pem"; + string pathCert = ECDSA_path + "sect233r1" + "\\cert.pem"; + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "ES256"; + string curve = "sect233r1"; + bulkTest_shouldWork(key, cert, alg, curve); + }*/ + + [Test] + public void sect239k1() + { + string pathKey = ECDSA_path + "sect239k1" + "\\key.pem"; + string pathCert = ECDSA_path + "sect239k1" + "\\cert.pem"; + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "ES256"; + string curve = "sect239k1"; + bulkTest_shouldntWork(key, cert, alg, curve); + } + + [Test] + public void sect283k1() + { + string pathKey = ECDSA_path + "sect283k1" + "\\key.pem"; + string pathCert = ECDSA_path + "sect283k1" + "\\cert.pem"; + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "ES256"; + string curve = "sect283k1"; + bulkTest_shouldntWork(key, cert, alg, curve); + } + + [Test] + public void sect283r1() + { + string pathKey = ECDSA_path + "sect283r1" + "\\key.pem"; + string pathCert = ECDSA_path + "sect283r1" + "\\cert.pem"; + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "ES256"; + string curve = "sect283r1"; + bulkTest_shouldntWork(key, cert, alg, curve); + } + + [Test] + public void sect409k1() + { + string pathKey = ECDSA_path + "sect409k1" + "\\key.pem"; + string pathCert = ECDSA_path + "sect409k1" + "\\cert.pem"; + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "ES256"; + string curve = "sect409k1"; + bulkTest_shouldntWork(key, cert, alg, curve); + } + + [Test] + public void sect409r1() + { + string pathKey = ECDSA_path + "sect409r1" + "\\key.pem"; + string pathCert = ECDSA_path + "sect409r1" + "\\cert.pem"; + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "ES256"; + string curve = "sect409r1"; + bulkTest_shouldntWork(key, cert, alg, curve); + } + + [Test] + public void sect571k1() + { + string pathKey = ECDSA_path + "sect571k1" + "\\key.pem"; + string pathCert = ECDSA_path + "sect571k1" + "\\cert.pem"; + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "ES256"; + string curve = "sect571k1"; + bulkTest_shouldntWork(key, cert, alg, curve); + } + + [Test] + public void sect571r1() + { + string pathKey = ECDSA_path + "sect571r1" + "\\key.pem"; + string pathCert = ECDSA_path + "sect571r1" + "\\cert.pem"; + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + string alg = "ES256"; + string curve = "sect571r1"; + bulkTest_shouldntWork(key, cert, alg, curve); + } + } +} diff --git a/test/dotnetframework/SecurityAPITest/Jwt/Features/TestJwtDiverseDataTypes.cs b/test/dotnetframework/SecurityAPITest/Jwt/Features/TestJwtDiverseDataTypes.cs new file mode 100644 index 0000000..421013e --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/Jwt/Features/TestJwtDiverseDataTypes.cs @@ -0,0 +1,70 @@ +using GeneXusJWT.GenexusComons; +using GeneXusJWT.GenexusJWT; +using GeneXusJWT.GenexusJWTClaims; +using NUnit.Framework; +using SecurityAPICommons.Keys; +using SecurityAPITest.SecurityAPICommons.commons; + +namespace SecurityAPITest.Jwt.Features +{ + [TestFixture] + public class TestJwtDiverseDataTypes : SecurityAPITestObject + { + protected static JWTCreator jwt; + protected static JWTOptions options; + protected static SymmetricKeyGenerator keyGen; + protected PrivateClaims claimslevel1; + protected PrivateClaims claimslevel2; + protected PrivateClaims claimslevel3; + protected static string token; + protected static string currentDate; + protected static string hexaKey; + + [SetUp] + public virtual void SetUp() + { + jwt = new JWTCreator(); + options = new JWTOptions(); + + keyGen = new SymmetricKeyGenerator(); + claimslevel1 = new PrivateClaims(); + claimslevel2 = new PrivateClaims(); + claimslevel3 = new PrivateClaims(); + + + hexaKey = keyGen.doGenerateKey("GENERICRANDOM", 256); + + options.AddRegisteredClaim("aud", "jitsi"); + options.AddRegisteredClaim("iss", "my_client"); + options.AddRegisteredClaim("sub", "meet.jit.si"); + + + claimslevel1.setClaim("room", "*"); + claimslevel1.setNumericClaim("uno", 1); + claimslevel1.setBooleanClaim("boolean", true); + //1607626804 + claimslevel1.setDateClaim("date", 1607626804); + + claimslevel1.setClaim("context", claimslevel2); + + claimslevel2.setClaim("user", claimslevel3); + claimslevel3.setClaim("avatar", "https:/gravatar.com/avatar/abc123"); + claimslevel3.setClaim("name", "John Doe"); + claimslevel3.setClaim("email", "jdoe@example.com"); + claimslevel3.setClaim("id", "abcd:a1b2c3-d4e5f6-0abc1-23de-abcdef01fedcba"); + claimslevel2.setClaim("group", "a123-123-456-789"); + + options.SetSecret(hexaKey); + token = jwt.DoCreate("HS256", claimslevel1, options); + } + + [Test] + public void TestPositive() + { + string payload = jwt.GetPayload(token); + bool verification = jwt.DoVerify(token, "HS256", claimslevel1, options); + + True(verification, jwt); + } + } +} diff --git a/test/dotnetframework/SecurityAPITest/Jwt/Features/TestJwtHeaderParameters.cs b/test/dotnetframework/SecurityAPITest/Jwt/Features/TestJwtHeaderParameters.cs new file mode 100644 index 0000000..e260e56 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/Jwt/Features/TestJwtHeaderParameters.cs @@ -0,0 +1,98 @@ +using SecurityAPITest.SecurityAPICommons.commons; +using System; +using NUnit.Framework; +using GeneXusJWT.GenexusJWT; +using GeneXusJWT.GenexusComons; +using SecurityAPICommons.Keys; +using GeneXusJWT.GenexusJWTClaims; +using GeneXusJWT.GenexusJWTUtils; + +namespace SecurityAPITest.Jwt.Features +{ + [TestFixture] + public class TestJwtHeaderParameters: SecurityAPITestObject + { + protected static JWTCreator jwt; + protected static JWTOptions options; + protected static SymmetricKeyGenerator keyGen; + protected static DateUtil du; + protected PrivateClaims claims; + protected static string token; + protected static string currentDate; + protected static string hexaKey; + + [SetUp] + public virtual void SetUp() + { + jwt = new JWTCreator(); + options = new JWTOptions(); + du = new DateUtil(); + keyGen = new SymmetricKeyGenerator(); + claims = new PrivateClaims(); + + + + hexaKey = keyGen.doGenerateKey("GENERICRANDOM", 256); + + options.AddRegisteredClaim("aud", "jitsi"); + options.AddRegisteredClaim("iss", "my_client"); + options.AddRegisteredClaim("sub", "meet.jit.si"); + + + claims.setClaim("hola", "hola"); + + options.AddHeaderParameter("cty", "twilio-fpa;v=1"); + options.SetSecret(hexaKey); + + token = jwt.DoCreate("HS256", claims, options); + } + + [Test] + public void TestPositive() + { + bool verification = jwt.DoVerify(token, "HS256", claims, options); + True(verification, jwt); + } + + [Test] + public void TestNegative1() + { + options.AddHeaderParameter("pepe", "whatever"); + bool verification = jwt.DoVerify(token, "HS256", claims, options); + Assert.IsFalse(verification); + Assert.IsFalse(jwt.HasError()); + } + + [Test] + public void TestNegative2() + { + JWTOptions op = new JWTOptions(); + op.AddRegisteredClaim("aud", "jitsi"); + op.AddRegisteredClaim("iss", "my_client"); + op.AddRegisteredClaim("sub", "meet.jit.si"); + op.SetSecret(hexaKey); + op.AddHeaderParameter("pepe", "whatever"); + + bool verification = jwt.DoVerify(token, "HS256", claims, op); + Assert.IsFalse(verification); + Assert.IsFalse(jwt.HasError()); + + } + + [Test] + public void TestNegative3() + { + JWTOptions op = new JWTOptions(); + op.AddRegisteredClaim("aud", "jitsi"); + op.AddRegisteredClaim("iss", "my_client"); + op.AddRegisteredClaim("sub", "meet.jit.si"); + op.SetSecret(hexaKey); + //op.AddHeaderParameter("pepe", "whatever"); + + bool verification = jwt.DoVerify(token, "HS256", claims, op); + // Assert.IsFalse(verification); + Assert.IsFalse(jwt.HasError()); + + } + } +} diff --git a/test/dotnetframework/SecurityAPITest/Jwt/Features/TestJwtNestedClaims.cs b/test/dotnetframework/SecurityAPITest/Jwt/Features/TestJwtNestedClaims.cs new file mode 100644 index 0000000..ed406cc --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/Jwt/Features/TestJwtNestedClaims.cs @@ -0,0 +1,97 @@ +using SecurityAPITest.SecurityAPICommons.commons; +using NUnit.Framework; +using GeneXusJWT.GenexusJWT; +using GeneXusJWT.GenexusComons; +using SecurityAPICommons.Keys; +using GeneXusJWT.GenexusJWTUtils; +using GeneXusJWT.GenexusJWTClaims; + +namespace SecurityAPITest.Jwt.Features +{ + [TestFixture] + public class TestJwtNestedClaims: SecurityAPITestObject + { + protected static JWTCreator jwt; + protected static JWTOptions options; + protected static SymmetricKeyGenerator keyGen; + protected PrivateClaims claimslevel1; + protected PrivateClaims claimslevel2; + protected PrivateClaims claimslevel3; + protected static string token; + protected static string currentDate; + protected static string hexaKey; + + [SetUp] + public virtual void SetUp() + { + jwt = new JWTCreator(); + options = new JWTOptions(); + + keyGen = new SymmetricKeyGenerator(); + claimslevel1 = new PrivateClaims(); + claimslevel2 = new PrivateClaims(); + claimslevel3 = new PrivateClaims(); + + + hexaKey = keyGen.doGenerateKey("GENERICRANDOM", 256); + + options.AddRegisteredClaim("aud", "jitsi"); + options.AddRegisteredClaim("iss", "my_client"); + options.AddRegisteredClaim("sub", "meet.jit.si"); + + + claimslevel1.setClaim("room", "*"); + + claimslevel1.setClaim("context", claimslevel2); + + claimslevel2.setClaim("user", claimslevel3); + claimslevel3.setClaim("avatar", "https:/gravatar.com/avatar/abc123"); + claimslevel3.setClaim("name", "John Doe"); + claimslevel3.setClaim("email", "jdoe@example.com"); + claimslevel3.setClaim("id", "abcd:a1b2c3-d4e5f6-0abc1-23de-abcdef01fedcba"); + claimslevel2.setClaim("group", "a123-123-456-789"); + + options.SetSecret(hexaKey); + token = jwt.DoCreate("HS256", claimslevel1, options); + } + + [Test] + public void TestPositive() + { + bool verification = jwt.DoVerify(token, "HS256", claimslevel1, options); + True(verification, jwt); + } + + [Test] + public void TestNegative1() + { + claimslevel2.setClaim("pepe", "whatever"); + bool verification = jwt.DoVerify(token, "HS256", claimslevel1, options); + Assert.IsFalse(verification); + Assert.IsFalse(jwt.HasError()); + } + + [Test] + public void TestNegative2() + { + PrivateClaims claimslevel11 = new PrivateClaims(); + PrivateClaims claimslevel21 = new PrivateClaims(); + PrivateClaims claimslevel31 = new PrivateClaims(); + claimslevel11.setClaim("room", "*"); + + claimslevel11.setClaim("context", claimslevel21); + + claimslevel21.setClaim("user", claimslevel31); + claimslevel31.setClaim("avatar", "https:/gravatar.com/avatar/abc123"); + claimslevel31.setClaim("name", "John Doe"); + claimslevel31.setClaim("email", "jdoe@example.com"); + claimslevel31.setClaim("id", "abcd:a1b2c3-d4e5f6-0abc1-23de-abcdef01fedcba"); + + bool verification = jwt.DoVerify(token, "HS256", claimslevel11, options); + Assert.IsFalse(verification); + Assert.IsFalse(jwt.HasError()); + } + } + + +} diff --git a/test/dotnetframework/SecurityAPITest/Jwt/Features/TestJwtRevocationList.cs b/test/dotnetframework/SecurityAPITest/Jwt/Features/TestJwtRevocationList.cs new file mode 100644 index 0000000..55be346 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/Jwt/Features/TestJwtRevocationList.cs @@ -0,0 +1,67 @@ +using SecurityAPITest.SecurityAPICommons.commons; +using System; +using NUnit.Framework; +using GeneXusJWT.GenexusJWT; +using GeneXusJWT.GenexusComons; +using GeneXusJWT.GenexusJWTClaims; +using SecurityAPICommons.Keys; +using GeneXusJWT.GenexusJWTUtils; + +namespace SecurityAPITest.Jwt.Features +{ + [TestFixture] + public class TestJwtRevocationList: SecurityAPITestObject + { + protected static String ID; + protected static JWTCreator jwt; + protected static JWTOptions options; + protected static PrivateClaims claims; + protected static SymmetricKeyGenerator keyGen; + protected static String token; + protected static RevocationList rList; + + [SetUp] + public virtual void SetUp() + { + jwt = new JWTCreator(); + options = new JWTOptions(); + keyGen = new SymmetricKeyGenerator(); + claims = new PrivateClaims(); + rList = new RevocationList(); + + + + options.AddRegisteredClaim("iss", "GXSA"); + options.AddRegisteredClaim("sub", "subject1"); + options.AddRegisteredClaim("aud", "audience1"); + ID = "0696bb20-6223-4a1c-9ebf-e15c74387b9c, 0696bb20-6223-4a1c-9ebf-e15c74387b9c";//&guid.Generate() + options.AddRegisteredClaim("jti", ID); + claims.setClaim("hola1", "hola1"); + claims.setClaim("hola2", "hola2"); + + String hexaKey = keyGen.doGenerateKey("GENERICRANDOM", 256); + options.SetSecret(hexaKey); + options.AddRevocationList(rList); + + token = jwt.DoCreate("HS256", claims, options); + } + + [Test] + public void TestPositive() + { + bool verification = jwt.DoVerify(token, "HS256", claims, options); + Assert.IsTrue(verification); + True(verification, jwt); + } + + [Test] + public void TestNegative() + { + rList.addIDToRevocationList(ID); + bool verification = jwt.DoVerify(token, "HS256", claims, options); + Assert.IsFalse(verification); + Assert.IsFalse(jwt.HasError()); + + } + } +} diff --git a/test/dotnetframework/SecurityAPITest/Jwt/Features/TestJwtVerifyJustSignature.cs b/test/dotnetframework/SecurityAPITest/Jwt/Features/TestJwtVerifyJustSignature.cs new file mode 100644 index 0000000..4f28440 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/Jwt/Features/TestJwtVerifyJustSignature.cs @@ -0,0 +1,96 @@ +using GeneXusJWT.GenexusComons; +using GeneXusJWT.GenexusJWT; +using GeneXusJWT.GenexusJWTClaims; +using GeneXusJWT.GenexusJWTUtils; +using NUnit.Framework; +using SecurityAPICommons.Keys; +using SecurityAPITest.SecurityAPICommons.commons; + +namespace SecurityAPITest.Jwt.Features +{ + [TestFixture] + public class TestJwtVerifyJustSignature: SecurityAPITestObject + { + protected static JWTCreator jwt; + protected static JWTOptions options; + protected static SymmetricKeyGenerator keyGen; + protected static DateUtil du; + protected PrivateClaims claims; + protected static string token; + protected static string currentDate; + protected static string hexaKey; + + [SetUp] + public virtual void SetUp() + { + jwt = new JWTCreator(); + options = new JWTOptions(); + du = new DateUtil(); + keyGen = new SymmetricKeyGenerator(); + claims = new PrivateClaims(); + + currentDate = du.GetCurrentDate(); + hexaKey = keyGen.doGenerateKey("GENERICRANDOM", 256); + + options.AddRegisteredClaim("aud", "jitsi"); + options.AddRegisteredClaim("iss", "my_client"); + options.AddRegisteredClaim("sub", "meet.jit.si"); + string expiration = du.CurrentPlusSeconds(200); + options.AddCustomTimeValidationClaim("exp", expiration, "20"); + + claims.setClaim("hola", "hola"); + + options.AddHeaderParameter("cty", "twilio-fpa;v=1"); + options.SetSecret(hexaKey); + + token = jwt.DoCreate("HS256", claims, options); + + } + + [Test] + public void testPositive_JustSign() + { + JWTOptions options1 = new JWTOptions(); + options1.SetSecret(hexaKey); + bool verification = jwt.DoVerifyJustSignature(token, "HS256", options1); + True(verification, jwt); + } + + [Test] + public void testComplete_JustSign() + { + bool verification = jwt.DoVerifyJustSignature(token, "HS256", options); + True(verification, jwt); + } + + [Test] + public void TestNegative_JustSign() + { + JWTOptions options1 = new JWTOptions(); + string hexaKey1 = keyGen.doGenerateKey("GENERICRANDOM", 256); + options1.SetSecret(hexaKey1); + bool verification = jwt.DoVerifyJustSignature(token, "HS256", options1); + Assert.IsFalse(verification); + Assert.IsTrue(jwt.HasError()); + } + + [Test] + public void TestPositive_Sign() + { + options.SetSecret(hexaKey); + bool verification = jwt.DoVerifySignature(token, "HS256", options); + True(verification, jwt); + } + + [Test] + public void TestNegative_Sign() + { + string hexaKey1 = keyGen.doGenerateKey("GENERICRANDOM", 256); + options.SetSecret(hexaKey1); + bool verification = jwt.DoVerifySignature(token, "HS256", options); + Assert.IsFalse(verification); + Assert.IsTrue(jwt.HasError()); + } + + } +} diff --git a/test/dotnetframework/SecurityAPITest/Jwt/Other/TestIssue81664.cs b/test/dotnetframework/SecurityAPITest/Jwt/Other/TestIssue81664.cs new file mode 100644 index 0000000..49481ef --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/Jwt/Other/TestIssue81664.cs @@ -0,0 +1,68 @@ +using SecurityAPITest.SecurityAPICommons.commons; +using NUnit.Framework; +using SecurityAPICommons.Keys; +using GeneXusJWT.GenexusComons; +using GeneXusJWT.GenexusJWTClaims; +using GeneXusJWT.GenexusJWTUtils; +using GeneXusJWT.GenexusJWT; +using SecurityAPICommons.Utils; + +namespace SecurityAPITest.Jwt.Other +{ + [TestFixture] + public class TestIssue81664: SecurityAPITestObject + { + private static CertificateX509 cert; + private static PrivateKeyManager key; + private static JWTOptions options; + private static PrivateClaims claims; + private static string token; + private static string expected; + private static DateUtil du; + private static JWTCreator jwt; + + [SetUp] + public virtual void SetUp() + { + cert = new CertificateX509(); + key = new PrivateKeyManager(); + options = new JWTOptions(); + claims = new PrivateClaims(); + du = new DateUtil(); + jwt = new JWTCreator(); + + + cert.Load(BASE_PATH + "dummycerts\\RSA_sha256_1024\\sha256_cert.crt"); + options.SetCertificate(cert); + + + key.Load(BASE_PATH + "dummycerts\\RSA_sha256_1024\\sha256d_key.pem"); + options.SetPrivateKey(key); + // + // carga de privateClaim (es parte del Payload) + claims.setClaim("GeneXus", "Viglia"); + + + // Carga de Registered Claims + options.AddRegisteredClaim("iss", "Martin"); + options.AddRegisteredClaim("sub", "Martin1"); + options.AddRegisteredClaim("aud", "martivigliadoocebbooyo.docebosaas.com"); + options.AddCustomTimeValidationClaim("iat", du.GetCurrentDate(), "20"); + options.AddCustomTimeValidationClaim("exp", du.CurrentPlusSeconds(3600), "20"); + options.AddPublicClaim("client_id", "Martin"); + + token = jwt.DoCreate("RS256", claims, options); + expected = "{\"alg\":\"RS256\",\"typ\":\"JWT\"}"; + } + + [Test] + public void Test_algorithm() + { + string header = jwt.GetHeader(token); + Assert.IsTrue(SecurityUtils.compareStrings(header, expected)); + } + + + + } +} diff --git a/test/dotnetframework/SecurityAPITest/Jwt/Other/TestIssue83649.cs b/test/dotnetframework/SecurityAPITest/Jwt/Other/TestIssue83649.cs new file mode 100644 index 0000000..96ca423 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/Jwt/Other/TestIssue83649.cs @@ -0,0 +1,56 @@ +using SecurityAPITest.SecurityAPICommons.commons; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using NUnit.Framework; +using GeneXusJWT.GenexusJWT; +using GeneXusJWT.GenexusComons; +using GeneXusJWT.GenexusJWTClaims; +using SecurityAPICommons.Keys; +using SecurityAPICommons.Utils; + +namespace SecurityAPITest.Jwt.Other +{ + [TestFixture] + public class TestIssue83649: SecurityAPITestObject + { + protected static JWTCreator jwt; + protected static JWTOptions options; + protected static PrivateClaims claims; + protected static SymmetricKeyGenerator keyGen; + protected static string payload; + protected static string expected; + + + [SetUp] + public virtual void SetUp() + { + jwt = new JWTCreator(); + options = new JWTOptions(); + keyGen = new SymmetricKeyGenerator(); + claims = new PrivateClaims(); + + options.AddCustomTimeValidationClaim("exp", "2020/07/20 17:56:51", "20"); + options.AddCustomTimeValidationClaim("iat", "2020/07/20 17:56:51", "20"); + options.AddCustomTimeValidationClaim("nbf", "2020/07/20 17:56:51", "20"); + claims.setClaim("hola1", "hola1"); + string hexaKey = keyGen.doGenerateKey("GENERICRANDOM", 256); + options.SetSecret(hexaKey); + string token = jwt.DoCreate("HS256", claims, options); + payload = jwt.GetPayload(token); + + + expected = "{\"hola1\":\"hola1\",\"exp\":1595267811,\"iat\":1595267811,\"nbf\":1595267811}"; + } + + [Test] + public void Test_timeClaims() + { + Assert.IsTrue(SecurityUtils.compareStrings(expected, payload)); + } + + + } +} diff --git a/test/dotnetframework/SecurityAPITest/Jwt/Other/TestIssue84142.cs b/test/dotnetframework/SecurityAPITest/Jwt/Other/TestIssue84142.cs new file mode 100644 index 0000000..4a0149b --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/Jwt/Other/TestIssue84142.cs @@ -0,0 +1,55 @@ +using SecurityAPITest.SecurityAPICommons.commons; +using NUnit.Framework; +using GeneXusJWT.GenexusComons; +using SecurityAPICommons.Keys; +using GeneXusJWT.GenexusJWT; +using GeneXusJWT.GenexusJWTClaims; + +namespace SecurityAPITest.Jwt.Other +{ + [TestFixture] + public class TestIssue84142: SecurityAPITestObject + { + protected static JWTOptions options; + protected static PrivateClaims claims; + protected static SymmetricKeyGenerator keyGenerator; + protected static JWTCreator jwt; + + + [SetUp] + public virtual void SetUp() + { + + + keyGenerator = new SymmetricKeyGenerator(); + jwt = new JWTCreator(); + options = new JWTOptions(); + claims = new PrivateClaims(); + + string hexaKey = keyGenerator.doGenerateKey("GENERICRANDOM", 256); + options.SetSecret(hexaKey); + + claims.setClaim("hola1", "hola1"); + + + } + + [Test] + public void Test_expValidationPositive() + { + options.AddCustomTimeValidationClaim("exp", "2030/07/07 10:15:20", "20"); + string token = jwt.DoCreate("HS256", claims, options); + bool validation = jwt.DoVerify(token, "HS256", claims, options); + Assert.IsTrue(validation); + } + + [Test] + public void Test_expValidationNegative() + { + options.AddCustomTimeValidationClaim("exp", "2019/07/07 10:15:20", "20"); + string token = jwt.DoCreate("HS256", claims, options); + bool validation = jwt.DoVerify(token, "HS256", claims, options); + Assert.IsFalse(validation); + } + } +} diff --git a/test/dotnetframework/SecurityAPITest/Jwt/Other/TestIssue84859.cs b/test/dotnetframework/SecurityAPITest/Jwt/Other/TestIssue84859.cs new file mode 100644 index 0000000..670b68d --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/Jwt/Other/TestIssue84859.cs @@ -0,0 +1,50 @@ +using GeneXusJWT.GenexusJWT; +using NUnit.Framework; +using SecurityAPICommons.Utils; +using SecurityAPITest.SecurityAPICommons.commons; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SecurityAPITest.Jwt.Other +{ + [TestFixture] + public class TestIssue84859 : SecurityAPITestObject + { + protected static string token; + protected static JWTCreator jwt; + + [SetUp] + public virtual void SetUp() + { + token = "dummy"; + jwt = new JWTCreator(); + } + + [Test] + public void TestMalformedPayload() + { + string res = jwt.GetPayload(token); + Assert.IsTrue(SecurityUtils.compareStrings(res, "")); + Assert.IsTrue(jwt.HasError()); + } + + [Test] + public void TestMalformedHeader() + { + string res = jwt.GetHeader(token); + Assert.IsTrue(SecurityUtils.compareStrings(res, "")); + Assert.IsTrue(jwt.HasError()); + } + + [Test] + public void TestMalformedID() + { + string res = jwt.GetTokenID(token); + Assert.IsTrue(SecurityUtils.compareStrings(res, "")); + Assert.IsTrue(jwt.HasError()); + } + } +} diff --git a/test/dotnetframework/SecurityAPITest/Jwt/Other/TestIssue86867.cs b/test/dotnetframework/SecurityAPITest/Jwt/Other/TestIssue86867.cs new file mode 100644 index 0000000..8b9ab6e --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/Jwt/Other/TestIssue86867.cs @@ -0,0 +1,65 @@ +using GeneXusJWT.GenexusComons; +using GeneXusJWT.GenexusJWT; +using GeneXusJWT.GenexusJWTClaims; +using NUnit.Framework; +using SecurityAPICommons.Keys; +using SecurityAPITest.SecurityAPICommons.commons; +using System; +using System.IO; + +namespace SecurityAPITest.Jwt.Other +{ + + + [TestFixture] + public class TestIssue86867 : SecurityAPITestObject + { + protected static JWTCreator jwt; + protected static JWTOptions options1; + protected static JWTOptions options2; + protected static PrivateClaims claims; + protected static string token; + protected static string path_RSA_sha256_1024; + + [SetUp] + public virtual void SetUp() + { + options1 = new JWTOptions(); + options2 = new JWTOptions(); + jwt = new JWTCreator(); + claims = new PrivateClaims(); + claims.setClaim("hola1", "hola1"); + path_RSA_sha256_1024 = Path.Combine(BASE_PATH, "dummycerts", "RSA_sha256_1024"); + + String pathKey = Path.Combine(path_RSA_sha256_1024, "sha256d_key.pem"); + String pathCert = Path.Combine(path_RSA_sha256_1024, "sha256_cert.crt"); + PrivateKeyManager key = new PrivateKeyManager(); + CertificateX509 cert = new CertificateX509(); + key.Load(pathKey); + cert.Load(pathCert); + + options1.SetCertificate(cert); + options1.SetPrivateKey(key); + options1.AddRegisteredClaim("iss", "GXSA"); + options1.AddRegisteredClaim("sub", "subject1"); + options1.AddRegisteredClaim("aud", "audience1"); + + options2.AddRegisteredClaim("iss", "GXSA"); + options2.AddRegisteredClaim("sub", "subject1"); + options2.AddRegisteredClaim("aud", "audience1"); + options2.SetCertificate(cert); + + token = jwt.DoCreate("RS256", claims, options1); + } + + [Test] + public void TestVerificationWithoutPrivateKey() + { + bool validation = jwt.DoVerify(token, "RS256", claims, options2); + //System.out.println("Error. Code: " + jwt.getErrorCode() + " Desc: " + jwt.getErrorDescription()); + Assert.IsTrue(validation); + } + } +} + + diff --git a/test/dotnetframework/SecurityAPITest/Jwt/Other/TestJwtDomainSpaces.cs b/test/dotnetframework/SecurityAPITest/Jwt/Other/TestJwtDomainSpaces.cs new file mode 100644 index 0000000..d2b71b2 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/Jwt/Other/TestJwtDomainSpaces.cs @@ -0,0 +1,58 @@ +using GeneXusJWT.GenexusComons; +using GeneXusJWT.GenexusJWT; +using GeneXusJWT.GenexusJWTClaims; +using GeneXusJWT.GenexusJWTUtils; +using NUnit.Framework; +using SecurityAPICommons.Keys; +using SecurityAPITest.SecurityAPICommons.commons; + +namespace SecurityAPITest.Jwt.Other +{ + [TestFixture] + public class TestJwtDomainSpaces : SecurityAPITestObject + { + protected static JWTCreator jwt; + protected static JWTOptions options; + protected static SymmetricKeyGenerator keyGen; + protected static DateUtil du; + protected PrivateClaims claims; + protected static string currentDate; + protected static string hexaKey; + + [SetUp] + public virtual void SetUp() + { + jwt = new JWTCreator(); + options = new JWTOptions(); + du = new DateUtil(); + keyGen = new SymmetricKeyGenerator(); + claims = new PrivateClaims(); + + currentDate = du.GetCurrentDate(); + hexaKey = keyGen.doGenerateKey("GENERICRANDOM", 256); + + options.AddRegisteredClaim("aud ", "jitsi"); + options.AddRegisteredClaim(" iss", "my_client"); + options.AddRegisteredClaim(" sub ", "meet.jit.si"); + string expiration = du.CurrentPlusSeconds(200); + options.AddCustomTimeValidationClaim("exp", expiration, "20"); + + claims.setClaim("hola", "hola"); + + options.AddHeaderParameter("cty", "twilio-fpa;v=1"); + options.SetSecret(hexaKey); + + } + + [Test] + public void TestDomains() + { + + options.SetSecret(hexaKey); + string token = jwt.DoCreate("HS256 ", claims, options); + Assert.IsFalse(jwt.HasError()); + bool verification = jwt.DoVerifyJustSignature(token, " HS256", options); + True(verification, jwt); + } + } +} diff --git a/test/dotnetframework/SecurityAPITest/Jwt/Other/TestJwtOtherFunctions.cs b/test/dotnetframework/SecurityAPITest/Jwt/Other/TestJwtOtherFunctions.cs new file mode 100644 index 0000000..b74bbc7 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/Jwt/Other/TestJwtOtherFunctions.cs @@ -0,0 +1,92 @@ +using SecurityAPITest.SecurityAPICommons.commons; +using NUnit.Framework; +using GeneXusJWT.GenexusJWT; +using GeneXusJWT.GenexusJWTClaims; +using SecurityAPICommons.Keys; +using GeneXusJWT.GenexusComons; +using SecurityAPICommons.Utils; + +namespace SecurityAPITest.Jwt.Other +{ + [TestFixture] + public class TestJwtOtherFunctions: SecurityAPITestObject + { + protected static string ID; + protected static JWTCreator jwt; + protected static JWTOptions options; + protected static PrivateClaims claims; + protected static SymmetricKeyGenerator keyGen; + protected static string token; + + [SetUp] + public virtual void SetUp() + { + options = new JWTOptions(); + jwt = new JWTCreator(); + claims = new PrivateClaims(); + keyGen = new SymmetricKeyGenerator(); + + options.AddRegisteredClaim("iss", "GXSA"); + options.AddRegisteredClaim("sub", "subject1"); + options.AddRegisteredClaim("aud", "audience1"); + ID = "0696bb20-6223-4a1c-9ebf-e15c74387b9c, 0696bb20-6223-4a1c-9ebf-e15c74387b9c";// &guid.Generate() + options.AddRegisteredClaim("jti", ID); + claims.setClaim("hola1", "hola1"); + claims.setClaim("hola2", "hola2"); + } + + [Test] + public void GenerateToken() + { + string hexaKey = keyGen.doGenerateKey("GENERICRANDOM", 256); + options.SetSecret(hexaKey); + token = jwt.DoCreate("HS256", claims, options); + Assert.IsFalse(jwt.HasError()); + bool verification = jwt.DoVerify(token, "HS256", claims, options); + True(verification, jwt); + } + + [Test] + public void TestGetID() + { + string tID = jwt.GetTokenID(token); + Assert.IsTrue(SecurityUtils.compareStrings(ID, tID)); + } + + [Test] + public void TestGetPayload() + { + string payload = "{\"sub\":\"subject1\",\"aud\":\"audience1\",\"hola1\":\"hola1\",\"iss\":\"GXSA\",\"hola2\":\"hola2\",\"jti\":\"" + + ID + "\"}"; + string payload1 = "{\"hola1\":\"hola1\",\"hola2\":\"hola2\",\"iss\":\"GXSA\",\"sub\":\"subject1\",\"aud\":\"audience1\",\"jti\":\"" + + ID + "\"}"; + string payload2 = "{\"sub\":\"subject1\",\"aud\":\"audience1\",\"hola1\":\"hola1\",\"iss\":\"GXSA\",\"hola2\":\"hola2\",\"jti\":\"" + + ID + "\"}"; + + string tPayload = jwt.GetPayload(token); + Assert.IsTrue(SecurityUtils.compareStrings(payload, tPayload) || SecurityUtils.compareStrings(payload1, tPayload) + || SecurityUtils.compareStrings(payload2, tPayload)); + } + + [Test] + public void TestGetHeader() + { + string header = "{\"typ\":\"JWT\",\"alg\":\"HS256\"}"; + string header1 = "{\"alg\":\"HS256\",\"typ\":\"JWT\"}"; + string tHeader = jwt.GetHeader(token); + Assert.IsTrue(SecurityUtils.compareStrings(header, tHeader) || SecurityUtils.compareStrings(header1, tHeader)); + } + + [Test] + public void TestbadAlgorithm() + { + string hexaKey = keyGen.doGenerateKey("GENERICRANDOM", 256); + options.SetSecret(hexaKey); + string token1 = jwt.DoCreate("HS256", claims, options); + bool verification = jwt.DoVerify(token1, "RS256", claims, options); + Assert.IsFalse(verification); + Assert.IsTrue(jwt.HasError()); + } + + } +} diff --git a/test/dotnetframework/SecurityAPITest/Jwt/Symmetric/TestSymmetricJwt.cs b/test/dotnetframework/SecurityAPITest/Jwt/Symmetric/TestSymmetricJwt.cs new file mode 100644 index 0000000..8208710 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/Jwt/Symmetric/TestSymmetricJwt.cs @@ -0,0 +1,69 @@ +using SecurityAPITest.SecurityAPICommons.commons; +using NUnit.Framework; +using GeneXusJWT.GenexusComons; +using GeneXusJWT.GenexusJWTUtils; +using SecurityAPICommons.Keys; +using GeneXusJWT.GenexusJWTClaims; +using GeneXusJWT.GenexusJWT; + +namespace SecurityAPITest.Jwt.Symmetric +{ + [TestFixture] + public class TestSymmetricJwt: SecurityAPITestObject + { + protected static JWTOptions options; + protected static PrivateClaims claims; + protected static GUID guid; + protected static DateUtil du; + protected static SymmetricKeyGenerator keyGenerator; + protected static JWTCreator jwt; + + [SetUp] + public virtual void SetUp() + { + + du = new DateUtil(); + guid = new GUID(); + keyGenerator = new SymmetricKeyGenerator(); + jwt = new JWTCreator(); + options = new JWTOptions(); + claims = new PrivateClaims(); + + options.AddRegisteredClaim("iss", "GXSA"); + options.AddRegisteredClaim("sub", "subject1"); + options.AddRegisteredClaim("aud", "audience1"); + + options.AddRegisteredClaim("jti", guid.Generate()); + + + options.AddCustomTimeValidationClaim("iat", du.GetCurrentDate(), "20"); + options.AddCustomTimeValidationClaim("nbf", du.GetCurrentDate(), "20"); + + claims.setClaim("hola1", "hola1"); + claims.setClaim("hola2", "hola2"); + + } + + [Test] + public void Test_HS256() + { + string hexaKey = keyGenerator.doGenerateKey("GENERICRANDOM", 256); + options.SetSecret(hexaKey); + string token = jwt.DoCreate("HS256", claims, options); + Assert.IsFalse(jwt.HasError()); + bool verification = jwt.DoVerify(token, "HS256", claims, options); + True(verification, jwt); + } + + [Test] + public void Test_HS512() + { + string hexaKey = keyGenerator.doGenerateKey("GENERICRANDOM", 512); + options.SetSecret(hexaKey); + string token = jwt.DoCreate("HS512", claims, options); + Assert.IsFalse(jwt.HasError()); + bool verification = jwt.DoVerify(token, "HS512", claims, options); + True(verification, jwt); + } + } +} diff --git a/test/dotnetframework/SecurityAPITest/Properties/AssemblyInfo.cs b/test/dotnetframework/SecurityAPITest/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..1d2092c --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/Properties/AssemblyInfo.cs @@ -0,0 +1,10 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Security; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +//[assembly: AssemblyTitle("GeneXusCryptography")] +//[assembly: AllowPartiallyTrustedCallers] diff --git a/test/dotnetframework/SecurityAPITest/SecurityAPICommons/commons/SecurityAPITestObject.cs b/test/dotnetframework/SecurityAPITest/SecurityAPICommons/commons/SecurityAPITestObject.cs new file mode 100644 index 0000000..13a9395 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/SecurityAPICommons/commons/SecurityAPITestObject.cs @@ -0,0 +1,55 @@ +using NUnit.Framework; +using NUnit.Framework.Interfaces; +using SecurityAPICommons.Commons; +using SecurityAPICommons.Utils; +using System; +using System.IO; +using System.Reflection; + +namespace SecurityAPITest.SecurityAPICommons.commons +{ + public class RunIfRunSettingsConfigured : Attribute, ITestAction + { + public ActionTargets Targets { get; private set; } + + public void AfterTest(ITest test) { } + + public void BeforeTest(ITest test) + { + if (TestContext.Parameters.Count==0) + Assert.Ignore("Omitting {0}. RunSettings not configured for this solution.", test.Name); + } + } + public class SecurityAPITestObject + { + public string TestContextParameter(string key) { + return TestContext.Parameters[key]; + } + + static string GetStartupDirectory() + { + string dir = Assembly.GetCallingAssembly().GetName().CodeBase; + Uri uri = new Uri(dir); + return Path.GetDirectoryName(uri.LocalPath); + } + + protected static string BASE_PATH = GetStartupDirectory() + "\\"; + public void True(bool result, SecurityAPIObject obj) + { + Assert.IsTrue(result); + Assert.IsFalse(obj.HasError()); + } + + public void False(bool result, SecurityAPIObject obj) + { + + Assert.IsFalse(result); + Assert.IsTrue(obj.HasError()); + } + + public void Equals(string expected, string obtained, SecurityAPIObject obj) + { + Assert.IsTrue(SecurityUtils.compareStrings(expected, obtained) && !obj.HasError()); + } + } +} diff --git a/test/dotnetframework/SecurityAPITest/SecurityAPICommons/encoders/TestBase64.cs b/test/dotnetframework/SecurityAPITest/SecurityAPICommons/encoders/TestBase64.cs new file mode 100644 index 0000000..b437403 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/SecurityAPICommons/encoders/TestBase64.cs @@ -0,0 +1,52 @@ +using SecurityAPICommons.Encoders; +using SecurityAPITest.SecurityAPICommons.commons; +using NUnit.Framework; + +namespace SecurityAPITest.SecurityAPICommons.encoders +{ + [TestFixture] + public class TestBase64: SecurityAPITestObject + { + protected static string expected_plainText; + protected static string expected_encoded; + protected static string expected_hexaText; + protected static Base64Encoder base64; + + [SetUp] + public virtual void SetUp() + { + expected_plainText = "hello world"; + expected_encoded = "aGVsbG8gd29ybGQ="; + expected_hexaText = "68656C6C6F20776F726C64"; + base64 = new Base64Encoder(); + } + + [Test] + public void TestToBase64() + { + string encoded = base64.toBase64(expected_plainText); + Equals(expected_encoded, encoded, base64); + } + + [Test] + public void TestToPlainText() + { + string plainText = base64.toPlainText(expected_encoded); + Equals(expected_plainText, plainText, base64); + } + + [Test] + public void TestTostringHexa() + { + string hexaText = base64.toStringHexa(expected_encoded); + Equals(expected_hexaText, hexaText, base64); + } + + [Test] + public void TestFromstringHexaToBase64() + { + string encoded = base64.fromStringHexaToBase64(expected_hexaText); + Equals(expected_encoded, encoded, base64); + } + } +} diff --git a/test/dotnetframework/SecurityAPITest/SecurityAPICommons/encoders/TestHexa.cs b/test/dotnetframework/SecurityAPITest/SecurityAPICommons/encoders/TestHexa.cs new file mode 100644 index 0000000..f880fd3 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/SecurityAPICommons/encoders/TestHexa.cs @@ -0,0 +1,36 @@ +using SecurityAPITest.SecurityAPICommons.commons; +using NUnit.Framework; +using SecurityAPICommons.Encoders; + +namespace SecurityAPITest.SecurityAPICommons.encoders +{ + [TestFixture] + public class TestHexa: SecurityAPITestObject + { + protected static string expected_plainText; + protected static string expected_hexaText; + protected static HexaEncoder hexa; + + [SetUp] + public virtual void SetUp() + { + expected_plainText = "hello world"; + expected_hexaText = "68656C6C6F20776F726C64"; + hexa = new HexaEncoder(); + } + + [Test] + public void TestFromHexa() + { + string plainText = hexa.fromHexa(expected_hexaText); + Equals(expected_plainText, plainText, hexa); + } + + [Test] + public void TestToHexa() + { + string hexaText = hexa.toHexa(expected_plainText); + Equals(expected_hexaText, hexaText, hexa); + } + } +} diff --git a/test/dotnetframework/SecurityAPITest/SecurityAPICommons/keys/TestBase64PrivateKey.cs b/test/dotnetframework/SecurityAPITest/SecurityAPICommons/keys/TestBase64PrivateKey.cs new file mode 100644 index 0000000..853d9a1 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/SecurityAPICommons/keys/TestBase64PrivateKey.cs @@ -0,0 +1,39 @@ +using NUnit.Framework; +using SecurityAPICommons.Keys; +using SecurityAPICommons.Utils; +using SecurityAPITest.SecurityAPICommons.commons; + +namespace SecurityAPITest.SecurityAPICommons.keys +{ + [TestFixture] + public class TestBase64PrivateKey : SecurityAPITestObject + { + protected static string path; + protected static string base64string; + + [SetUp] + public virtual void SetUp() + { + path = BASE_PATH + "dummycerts\\RSA_sha256_1024\\sha256d_key.pem"; + base64string = "MIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBAMZ8m4ftIhfrdugi5kEszRZr5IRuqGDLTex+CfVnhnBYXyQgJXeCI0eyRYUAbNzw/9MPdFN//pV26AXeH/ajORVu1JVoOACZdNOIPFnwXXh8oBxNxLAYlqoK2rAL+/tns8rKqqS4p8HSat9tj07TUXnsYJmmbXJM/eB94Ex66D1ZAgMBAAECgYA1xrTs0taV3HnO0wXHSrgWBw1WxBRihTKLjGpuTqoh7g943izIgD3GwwoKyt6zzafCK0G9DcSQAjNCw7etPvPL3FxwhDl+AHSv9JcChk/auICtMWwjurG4npto+s3byj/N00Idpz1xuOgKd8k9sdoPBGKa8l+LL+adSXzoivLG8QJBAPDvbOLSs9petB2iM6w5/DiC8EoxqDaBc7I1JFCvPOfB7i1GFFxkQ7hlgxpvaPX3NHXjAZpgdOW68P/SjU0izKsCQQDS5bjrNo3xn/MbYKojzwprR/Bo8Kvbi4/2M9NE3GwHegVmx5I+df+J0aObrbBNPLs/rhrFtt12OtgxJaac+FYLAkEA8DUUbvO4wj7m/iBnug65irHo1V+6oFThv0tCIHsFkt4DEvoqdI62AZKbafCnSYqjr+CaCYqfIScG/Vay77OBLwJBAI8EYAmKPmn7+SW4wMh1z+/+ogbYJwNEOoVQkdXh0JSlZ+JSNleLN5ajhtq8x5EpPSYrEFbB8p8JurBhgwJx2g8CQQDrp9scoK8eKBJ2p/63xqLGYSN6OZQo/4Lkq3983rmHoDCAp3Bz1zUyxQB3UVyrOj4U44C7RtDNiMSZuCwvjYAI"; + } + + [Test] + public void TestImport() + { + PrivateKeyManager pkm = new PrivateKeyManager(); + bool loaded = pkm.FromBase64(base64string); + True(loaded, pkm); + } + + [Test] + public void TestExport() + { + PrivateKeyManager pkm = new PrivateKeyManager(); + pkm.Load(path); + string base64res = pkm.ToBase64(); + Assert.IsTrue(SecurityUtils.compareStrings(base64res, base64string)); + Assert.IsFalse(pkm.HasError()); + } + } +} diff --git a/test/dotnetframework/SecurityAPITest/SecurityAPICommons/keys/TestBase64PublicKey.cs b/test/dotnetframework/SecurityAPITest/SecurityAPICommons/keys/TestBase64PublicKey.cs new file mode 100644 index 0000000..7a96955 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/SecurityAPICommons/keys/TestBase64PublicKey.cs @@ -0,0 +1,46 @@ +using NUnit.Framework; +using SecurityAPICommons.Keys; +using SecurityAPICommons.Utils; +using SecurityAPITest.SecurityAPICommons.commons; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SecurityAPITest.SecurityAPICommons.keys +{ + [TestFixture] + public class TestBase64PublicKey: SecurityAPITestObject + { + + protected static string path; + protected static string base64string; + + [SetUp] + public virtual void SetUp() + { + path = BASE_PATH + "dummycerts\\RSA_sha256_1024\\sha256_cert.pem"; + base64string = "MIIC/DCCAmWgAwIBAgIJAPmCVmfcc0IXMA0GCSqGSIb3DQEBCwUAMIGWMQswCQYDVQQGEwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQMA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMMCXNncmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMB4XDTIwMDcwODE4NDkxNVoXDTI1MDcwNzE4NDkxNVowgZYxCzAJBgNVBAYTAlVZMRMwEQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYDVQQKDAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dyYW1wb25lMSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMZ8m4ftIhfrdugi5kEszRZr5IRuqGDLTex+CfVnhnBYXyQgJXeCI0eyRYUAbNzw/9MPdFN//pV26AXeH/ajORVu1JVoOACZdNOIPFnwXXh8oBxNxLAYlqoK2rAL+/tns8rKqqS4p8HSat9tj07TUXnsYJmmbXJM/eB94Ex66D1ZAgMBAAGjUDBOMB0GA1UdDgQWBBTfXY8eOfDONCZpFE0V34mJJeCYtTAfBgNVHSMEGDAWgBTfXY8eOfDONCZpFE0V34mJJeCYtTAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBCwUAA4GBAAPv7AFlCSpJ32c/VYowlbk6UBhOKmVWBQlrAtvVQYtCKO/y9CEB8ikG19c8lHM9axnsbZR+G7g04Rfuiea3T7VPkSmUXPpz5fl6Zyk4LZg5Oji7MMMXGmr+7cpYWRhifCVwoxSgZEXt3d962IZ1Wei0LMO+4w4gnzPxqr8wVHnT"; + } + + [Test] + public void TestImport() + { + CertificateX509 cert = new CertificateX509(); + bool loaded = cert.FromBase64(base64string); + True(loaded, cert); + } + + + [Test] + public void TestExport() + { + CertificateX509 cert = new CertificateX509(); + cert.Load(path); + string base64res = cert.ToBase64(); + Assert.IsTrue(SecurityUtils.compareStrings(base64res, base64string)); + Assert.IsFalse(cert.HasError()); + } + } +} diff --git a/test/dotnetframework/SecurityAPITest/SecurityAPITest.csproj b/test/dotnetframework/SecurityAPITest/SecurityAPITest.csproj new file mode 100644 index 0000000..afd969f --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/SecurityAPITest.csproj @@ -0,0 +1,411 @@ + + + + net471 + false + SecurityAPITest + SecurityAPITest + + + + + + + + + + + + + + + + + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + + + + + \ No newline at end of file diff --git a/test/dotnetframework/SecurityAPITest/Sftp/TestSftp.cs b/test/dotnetframework/SecurityAPITest/Sftp/TestSftp.cs new file mode 100644 index 0000000..c0604bf --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/Sftp/TestSftp.cs @@ -0,0 +1,126 @@ +using SecurityAPITest.SecurityAPICommons.commons; +using NUnit.Framework; +using Sftp.GeneXusSftp; +using System.IO; +using System; + +namespace SecurityAPITest.Sftp +{ + [TestFixture] + [RunIfRunSettingsConfigured] + public class TestSftp: SecurityAPITestObject + { + protected static string host; + protected static string user; + protected static string known_hosts; + protected static string password; + protected static string keyPath; + protected static string keyPassword; + protected static string localPath; + protected static string remoteDir; + protected static string remoteFilePath; + protected static string localDir; + protected static string pwd; + + [SetUp] + public virtual void SetUp() + { + host = TestContextParameter("gx_ftp_host"); + user = TestContextParameter("gx_sftp_user"); + string known_hosts_content_base64 = TestContextParameter("gx_ftp_known_hosts_content_base64"); + known_hosts = Path.Combine(BASE_PATH, "Temp", "sftptest", "key", "known_hosts"); + File.WriteAllBytes(known_hosts, Convert.FromBase64String(known_hosts_content_base64)); + password = TestContextParameter("gx_sftp_password"); + keyPath = Path.Combine(BASE_PATH, "Temp", "sftptest", "key", "id_rsa"); + string id_rsaConentBase64 = TestContextParameter("gx_ftp_id_rsa_content_base64"); + File.WriteAllBytes(keyPath, Convert.FromBase64String(id_rsaConentBase64)); + keyPassword = TestContextParameter("gx_sftp_key_password"); + localPath = Path.Combine(BASE_PATH, "Temp", "sftptest", "sftptest1.txt"); + remoteDir = "sftp"; + remoteFilePath = "sftp/sftptest1.txt"; + localDir = Path.Combine(BASE_PATH, "Temp", "sftptest", "back"); + } + + private SftpClient TestConnection(SftpOptions options) + { + SftpClient client = new SftpClient(); + bool connected = client.Connect(options); + True(connected, client); + return client; + } + + private void TestPut(SftpClient client) + { + bool put = client.Put(localPath, remoteDir); + True(put, client); + } + + private void TestGet(SftpClient client) + { + bool get = client.Get(remoteFilePath, localDir); + True(get, client); + } + + [Test] + public void TestWithUserPassword() + { + SftpOptions options = new SftpOptions(); + options.Host = host; + options.User = user; + options.Password = password; + options.AllowHostKeyChecking = false; + SftpClient client = TestConnection(options); + TestPut(client); + TestGet(client); + client.Disconnect(); + } + + [Test] + public void TestWithKey() + { + SftpOptions options = new SftpOptions(); + options.Host = host; + options.User = user; + options.Password = password; + options.AllowHostKeyChecking = false; + options.KeyPassword = keyPassword; + SftpClient client = TestConnection(options); + TestPut(client); + TestGet(client); + client.Disconnect(); + } + + [Test] + public void TestWithKeyAndKnown_Hosts() + { + SftpOptions options = new SftpOptions(); + options.Host = host; + options.User = user; + options.Password = password; + options.AllowHostKeyChecking = true; + options.KeyPassword = keyPassword; + options.KnownHostsPath = known_hosts; + SftpClient client = TestConnection(options); + TestPut(client); + TestGet(client); + client.Disconnect(); + } + + [Test] + public void TestRoot() + { + SftpOptions o = new SftpOptions(); + o.Host = host; + o.User = user; + o.Password = password; + o.AllowHostKeyChecking = false; + SftpClient c = new SftpClient(); + c.Connect(o); + bool put = c.Put(localPath, "/"); + True(put, c); + bool get = c.Get("sftptest1.txt", localPath); + True(get, c); + c.Disconnect(); + } + } +} diff --git a/test/dotnetframework/SecurityAPITest/Temp/bookSample.xml b/test/dotnetframework/SecurityAPITest/Temp/bookSample.xml new file mode 100644 index 0000000..673a13d --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/Temp/bookSample.xml @@ -0,0 +1,31 @@ + + + + Everyday Italian + Giada De Laurentiis + 2005 + 30.00 + + + Harry Potter + J K. Rowling + 2005 + 29.99 + + + XQuery Kick Start + James McGovern + Per Bothner + Kurt Cagle + James Linn + Vaidyanathan Nagarajan + 2003 + 49.99 + + + Learning XML + Erik T. Ray + 2003 + 39.95 + + \ No newline at end of file diff --git a/test/dotnetframework/SecurityAPITest/Temp/ftps/back/dummy.txt b/test/dotnetframework/SecurityAPITest/Temp/ftps/back/dummy.txt new file mode 100644 index 0000000..e69de29 diff --git a/test/dotnetframework/SecurityAPITest/Temp/ftps/ftpstest.txt b/test/dotnetframework/SecurityAPITest/Temp/ftps/ftpstest.txt new file mode 100644 index 0000000..e69de29 diff --git a/test/dotnetframework/SecurityAPITest/Temp/outputTestFilesC/dummy.txt b/test/dotnetframework/SecurityAPITest/Temp/outputTestFilesC/dummy.txt new file mode 100644 index 0000000..e69de29 diff --git a/test/dotnetframework/SecurityAPITest/Temp/outputTestFilesJ/dummy.txt b/test/dotnetframework/SecurityAPITest/Temp/outputTestFilesJ/dummy.txt new file mode 100644 index 0000000..e69de29 diff --git a/test/dotnetframework/SecurityAPITest/Temp/sftptest/back/dummy.txt b/test/dotnetframework/SecurityAPITest/Temp/sftptest/back/dummy.txt new file mode 100644 index 0000000..2995a4d --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/Temp/sftptest/back/dummy.txt @@ -0,0 +1 @@ +dummy \ No newline at end of file diff --git a/test/dotnetframework/SecurityAPITest/Temp/sftptest/key/dummy.txt b/test/dotnetframework/SecurityAPITest/Temp/sftptest/key/dummy.txt new file mode 100644 index 0000000..e69de29 diff --git a/test/dotnetframework/SecurityAPITest/Temp/sftptest/sftptest1.txt b/test/dotnetframework/SecurityAPITest/Temp/sftptest/sftptest1.txt new file mode 100644 index 0000000..00ea0eb --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/Temp/sftptest/sftptest1.txt @@ -0,0 +1,2 @@ +SFTP Java tutorial +https://www.baeldung.com/java-file-sftp diff --git a/test/dotnetframework/SecurityAPITest/Temp/tosign.xml b/test/dotnetframework/SecurityAPITest/Temp/tosign.xml new file mode 100644 index 0000000..e23e35e --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/Temp/tosign.xml @@ -0,0 +1,6 @@ + + + + Ola mundo + + \ No newline at end of file diff --git a/test/dotnetframework/SecurityAPITest/Temp/xmlID.xml b/test/dotnetframework/SecurityAPITest/Temp/xmlID.xml new file mode 100644 index 0000000..6f1dae7 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/Temp/xmlID.xml @@ -0,0 +1,15 @@ + + + + Tove + Jani + Reminder + Don't forget me this weekend! + + + Jani + Tove + Re: Reminder + I will not + + \ No newline at end of file diff --git a/test/dotnetframework/SecurityAPITest/Temp/xmlIDSchema.xsd b/test/dotnetframework/SecurityAPITest/Temp/xmlIDSchema.xsd new file mode 100644 index 0000000..ea3aa3a --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/Temp/xmlIDSchema.xsd @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/dotnetframework/SecurityAPITest/XmlSignature/DSig/TestBase64Certificate.cs b/test/dotnetframework/SecurityAPITest/XmlSignature/DSig/TestBase64Certificate.cs new file mode 100644 index 0000000..8f3f935 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/XmlSignature/DSig/TestBase64Certificate.cs @@ -0,0 +1,70 @@ +using SecurityAPITest.SecurityAPICommons.commons; +using NUnit.Framework; +using GeneXusXmlSignature.GeneXusCommons; +using SecurityAPICommons.Keys; +using GeneXusXmlSignature.GeneXusDSig; +using SecurityAPICommons.Utils; +using System.IO; + +namespace SecurityAPITest.XmlSignature.DSig +{ + [TestFixture] + public class TestBase64Certificate: SecurityAPITestObject + { + private string base64 = "MIIC/DCCAmWgAwIBAgIJAIh1DtAn5T0IMA0GCSqGSIb3DQEBBQUAMIGWMQswCQYDVQQGEwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQMA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMMCXNncmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMB4XDTIwMDcwODE4NDM1N1oXDTI1MDcwNzE4NDM1N1owgZYxCzAJBgNVBAYTAlVZMRMwEQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYDVQQKDAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dyYW1wb25lMSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAKvo5gGDQ2w0veZSDxd+nJc7w7z/Is+4iGhOEuK9A/U713RfBdXYx2prp+7BAkUrGYm+Z6SkXZ6r78Tl5D/L2pNeA6nn5geCoWH1KSFOlAvEnjXcGvkdo8bIE/Day3PWFdeIGD8Mt0badAoIM+0m6s5jfSu9N8o4I4UX9O4PoEwhAgMBAAGjUDBOMB0GA1UdDgQWBBSLvqEYCzyExQe0fuRFBXpHjVbb6TAfBgNVHSMEGDAWgBSLvqEYCzyExQe0fuRFBXpHjVbb6TAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAArYRju3NQeCspTxvpixMLLPWaYzxRmtUkEz1yr7VhlIH63RTIqbRcbP+40DRxx83LkIOJRdOcCVeLX3ZutknJglfrqFkUF5grWrhrHpd+IRSeN3lePMYa3GeeljTyrPINCwnv0YFLQOwRf8UlZcKAquJO2ouQZkVd9t1tRWTvNo"; + + private string path_RSA_sha1_1024; + private string xmlUnsignedPath; + private string pathSigned; + private DSigOptions options; + private string pathKey; + private string xmlSignedPathRoot; + + [SetUp] + public virtual void SetUp() + { + path_RSA_sha1_1024 = Path.Combine(BASE_PATH, "dummycerts", "RSA_sha1_1024"); + + options = new DSigOptions(); + + xmlUnsignedPath = Path.Combine(BASE_PATH, "Temp", "toSign.xml"); + pathSigned = "base64.xml"; + pathKey = Path.Combine(path_RSA_sha1_1024, "sha1d_key.pem"); + xmlSignedPathRoot = Path.Combine(BASE_PATH, "Temp", "outputTestFilesJ"); + + } + + [Test] + public void TestSignBase64() + { + CertificateX509 newCert = new CertificateX509(); + bool loaded = newCert.FromBase64(base64); + Assert.IsTrue(loaded); + True(loaded, newCert); + PrivateKeyManager key = new PrivateKeyManager(); + bool privateLoaded = key.Load(pathKey); + Assert.IsTrue(privateLoaded); + True(privateLoaded, key); + XmlDSigSigner signer = new XmlDSigSigner(); + bool result = signer.DoSignFile(xmlUnsignedPath, key, newCert, xmlSignedPathRoot + pathSigned, options); + Assert.IsTrue(result); + True(result, signer); + bool verify = signer.DoVerifyFile(xmlSignedPathRoot + pathSigned, options); + Assert.IsTrue(verify); + True(verify, signer); + } + + [Test] + public void TestToBase64() + { + CertificateX509 newCert = new CertificateX509(); + bool loaded = newCert.FromBase64(base64); + Assert.IsTrue(loaded); + True(loaded, newCert); + string newBase64 = newCert.ToBase64(); + bool result = SecurityUtils.compareStrings(newBase64, base64); + Assert.IsTrue(result); + True(result, newCert); + } + } +} diff --git a/test/dotnetframework/SecurityAPITest/XmlSignature/DSig/TestFindID.cs b/test/dotnetframework/SecurityAPITest/XmlSignature/DSig/TestFindID.cs new file mode 100644 index 0000000..69e3e24 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/XmlSignature/DSig/TestFindID.cs @@ -0,0 +1,47 @@ +using GeneXusXmlSignature.GeneXusCommons; +using GeneXusXmlSignature.GeneXusDSig; +using NUnit.Framework; +using SecurityAPICommons.Keys; +using SecurityAPICommons.Utils; +using SecurityAPITest.SecurityAPICommons.commons; + +namespace SecurityAPITest.XmlSignature.DSig +{ + [TestFixture] + public class TestFindID : SecurityAPITestObject + { + private CertificateX509 cert; + private PrivateKeyManager key; + private XmlDSigSigner signer; + private DSigOptions options; + private string xmlInput; + private string xPath; + + [SetUp] + public virtual void SetUp() + { + cert = new CertificateX509(); + cert.Load(BASE_PATH + "dummycerts\\RSA_sha256_1024\\sha256_cert.crt"); + key = new PrivateKeyManager(); + key.Load(BASE_PATH + "dummycerts\\RSA_sha256_1024\\sha256d_key.pem"); + + signer = new XmlDSigSigner(); + options = new DSigOptions(); + + options.IdentifierAttribute = "Id"; + + xmlInput = "191131102046000145352101143101700029885500500001660115740578482021-01-26T11:12:34-03:0021021011.00Ciencia da Operacao"; + xPath = "#ID2102103521011431017000298855005000016601157405784801"; + } + + [Test] + public void TestFindID1() + { + //System.Diagnostics.Debugger.Launch(); + string signed = signer.DoSignElement(xmlInput, xPath, key, cert, options); + Assert.IsFalse(SecurityUtils.compareStrings(signed, "")); + Assert.IsFalse(signer.HasError()); + } + + } +} diff --git a/test/dotnetframework/SecurityAPITest/XmlSignature/DSig/TestRSASigning.cs b/test/dotnetframework/SecurityAPITest/XmlSignature/DSig/TestRSASigning.cs new file mode 100644 index 0000000..5cb6f19 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/XmlSignature/DSig/TestRSASigning.cs @@ -0,0 +1,468 @@ +using SecurityAPITest.SecurityAPICommons.commons; +using NUnit.Framework; +using GeneXusXmlSignature.GeneXusCommons; +using SecurityAPICommons.Commons; +using SecurityAPICommons.Keys; +using GeneXusXmlSignature.GeneXusUtils; +using GeneXusXmlSignature.GeneXusDSig; +using SecurityAPICommons.Config; +using System.IO; + +namespace SecurityAPITest.XmlSignature.DSig +{ + [TestFixture] + public class TestRSASigning: SecurityAPITestObject + + { + private static string path_RSA_sha1_1024; + private static string path_RSA_sha256_1024; + private static string path_RSA_sha256_2048; + private static string path_RSA_sha512_2048; + + private static string xmlUnsigned; + private static string xmlUnsignedPath; + private static string xmlSignedPathRoot; + + private static string alias; + private static string password; + + private static string dSigType; + + private static string[] arrayCanonicalization; + private static string[] arrayKeyInfoType; + + private static DSigOptions options; + private static DSigOptions optionsXPath; + private static DSigOptions optionsID; + + private static Error error; + +#if !NETCORE + private static string xmlUnsignedXPathFile; + private static string xPath; + private static string xmlUnsignedXPath; +#endif + + private static string xmlUnsignedIDPathFile; + private static string identifierAttribute; + private static string id; + private static string xmlUnsignedID; + private static string xmlIDSchemaPath; + + private static EncodingUtil eu; + + [SetUp] + public virtual void SetUp() + { + eu = new EncodingUtil(); + eu.setEncoding("UTF_8"); + path_RSA_sha1_1024 = Path.Combine(BASE_PATH, "dummycerts", "RSA_sha1_1024"); + path_RSA_sha256_1024 = Path.Combine(BASE_PATH, "dummycerts", "RSA_sha256_1024"); + path_RSA_sha256_2048 = Path.Combine(BASE_PATH, "dummycerts", "RSA_sha256_2048"); + path_RSA_sha512_2048 = Path.Combine(BASE_PATH, "dummycerts", "RSA_sha512_2048"); + + alias = "1"; + password = "dummy"; + + xmlUnsigned = "" + "" + + " " + " Ola mundo" + " " + ""; + + xmlUnsignedPath = Path.Combine(BASE_PATH, "Temp", "toSign.xml"); + xmlSignedPathRoot = Path.Combine(BASE_PATH, "Temp", "outputTestFilesC"); + + dSigType = "ENVELOPED"; + arrayCanonicalization = new string[] { "C14n_WITH_COMMENTS", "C14n_OMIT_COMMENTS", "exc_C14n_OMIT_COMMENTS", + "exc_C14N_WITH_COMMENTS" }; + arrayKeyInfoType = new string[] { "KeyValue", "X509Certificate", "NONE" }; + + options = new DSigOptions(); + + optionsXPath = new DSigOptions(); + + error = new Error(); +#if !NETCORE + xmlUnsignedXPathFile = Path.Combine(BASE_PATH, "Temp", "bookSample.xml"); + xPath = "/bookstore/book[1]"; +#endif + + xmlUnsignedIDPathFile = Path.Combine(BASE_PATH, "Temp", "xmlID.xml"); + identifierAttribute = "id"; + id = "#tag1"; + xmlIDSchemaPath = Path.Combine(BASE_PATH, "Temp", "xmlIDSchema.xsd"); + + optionsID = new DSigOptions(); + optionsID.IdentifierAttribute = identifierAttribute; + + xmlUnsignedID = "\r\n" + "\r\n" + " \r\n" + + " Tove\r\n" + " Jani\r\n" + " Reminder\r\n" + + " Don't forget me this weekend!\r\n" + " \r\n" + " \r\n" + + " Jani\r\n" + " Tove\r\n" + " Re: Reminder\r\n" + + " I will not\r\n" + " \r\n" + ""; +#if !NETCORE + xmlUnsignedXPath = "\r\n" + "\r\n" + + "\r\n" + " Everyday Italian\r\n" + + " Giada De Laurentiis\r\n" + " 2005\r\n" + + " 30.00\r\n" + "\r\n" + "\r\n" + + " Harry Potter\r\n" + " J K. Rowling\r\n" + + " 2005\r\n" + " 29.99\r\n" + "\r\n" + + "\r\n" + " XQuery Kick Start\r\n" + + " James McGovern\r\n" + " Per Bothner\r\n" + + " Kurt Cagle\r\n" + " James Linn\r\n" + + " Vaidyanathan Nagarajan\r\n" + " 2003\r\n" + + " 49.99\r\n" + "\r\n" + "\r\n" + + " Learning XML\r\n" + " Erik T. Ray\r\n" + + " 2003\r\n" + " 39.95\r\n" + "\r\n" + ""; +#endif + } + + [Test] + public void Test_sha1_1024_DER() + { + string pathKey = Path.Combine(path_RSA_sha1_1024, "sha1d_key.pem"); + string pathCert = Path.Combine(path_RSA_sha1_1024, "sha1_cert.crt"); + string pathSigned = "Test_sha1_1024_DER"; + bulkTest(pathCert, pathKey, pathSigned, false, false); + + } + + [Test] + public void Test_sha1_1024_PEM() + { + string pathKey = Path.Combine(path_RSA_sha1_1024, "sha1d_key.pem"); + string pathCert = Path.Combine(path_RSA_sha1_1024, "sha1_cert.pem"); + string pathSigned = "Test_sha1_1024_PEM"; + bulkTest(pathCert, pathKey, pathSigned, false, false); + } + + + + [Test] + public void Test_sha1_1024_PKCS12() + { + string pathKey = Path.Combine(path_RSA_sha1_1024, "sha1_cert.p12"); + string pathCert = Path.Combine(path_RSA_sha1_1024, "sha1_cert.p12"); + string pathSigned = "Test_sha1_1024_PKCS12"; + bulkTest(pathCert, pathKey, pathSigned, true, false); + } + + [Test] + public void Test_sha256_1024_DER() + { + string pathKey = Path.Combine(path_RSA_sha256_1024, "sha256d_key.pem"); + string pathCert = Path.Combine(path_RSA_sha256_1024, "sha256_cert.crt"); + string pathSigned = "Test_sha256_1024_DER"; + bulkTest(pathCert, pathKey, pathSigned, false, false); + } + + [Test] + public void Test_sha256_1024_PEM() + { + string pathKey = Path.Combine(path_RSA_sha256_1024, "sha256d_key.pem"); + string pathCert = Path.Combine(path_RSA_sha256_1024, "sha256_cert.pem"); + string pathSigned = "Test_sha256_1024_PEM"; + bulkTest(pathCert, pathKey, pathSigned, false, false); + } + + + + [Test] + public void Test_sha256_1024_PKCS12() + { + string pathKey = Path.Combine(path_RSA_sha256_1024, "sha256_cert.p12"); + string pathCert = Path.Combine(path_RSA_sha256_1024, "sha256_cert.p12"); + string pathSigned = "Test_sha256_1024_PKCS12"; + bulkTest(pathCert, pathKey, pathSigned, true, false); + } + + [Test] + public void Test_sha256_2048_DER() + { + string pathKey = Path.Combine(path_RSA_sha256_2048, "sha256d_key.pem"); + string pathCert = Path.Combine(path_RSA_sha256_2048, "sha256_cert.crt"); + string pathSigned = "Test_sha256_2048_DER"; + bulkTest(pathCert, pathKey, pathSigned, false, false); + } + + [Test] + public void Test_sha256_2048_PEM() + { + string pathKey = Path.Combine(path_RSA_sha256_2048, "sha256d_key.pem"); + string pathCert = Path.Combine(path_RSA_sha256_2048, "sha256_cert.pem"); + string pathSigned = "Test_sha256_2048_PEM"; + bulkTest(pathCert, pathKey, pathSigned, false, false); + } + + + + [Test] + public void Test_sha256_2048_PKCS12() + { + string pathKey = Path.Combine(path_RSA_sha256_2048, "sha256_cert.p12"); + string pathCert = Path.Combine(path_RSA_sha256_2048, "sha256_cert.p12"); + string pathSigned = "Test_sha256_2048_PKCS12"; + bulkTest(pathCert, pathKey, pathSigned, true, false); + } + + [Test] + public void Test_sha512_2048_DER() + { + string pathKey = Path.Combine(path_RSA_sha512_2048, "sha512d_key.pem"); + string pathCert = Path.Combine(path_RSA_sha512_2048, "sha512_cert.crt"); + string pathSigned = "Test_sha512_2048_DER"; + bulkTest(pathCert, pathKey, pathSigned, false, false); + } + + [Test] + public void Test_sha512_2048_PEM() + { + string pathKey = Path.Combine(path_RSA_sha512_2048, "sha512d_key.pem"); + string pathCert = Path.Combine(path_RSA_sha512_2048, "sha512_cert.pem"); + string pathSigned = "Test_sha512_2048_PEM"; + bulkTest(pathCert, pathKey, pathSigned, false, false); + } + + + + [Test] + public void Test_sha512_2048_PKCS12() + { + string pathKey = Path.Combine(path_RSA_sha512_2048, "sha512_cert.p12"); + string pathCert = Path.Combine(path_RSA_sha512_2048, "sha512_cert.p12"); + string pathSigned = "Test_sha512_2048_PKCS12"; + bulkTest(pathCert, pathKey, pathSigned, true, false); + } + + + + + private void bulkTest(string pathCert, string pathKey, string pathSigned, bool ispkcs12, bool encrypted) + { + for (int k = 0; k < arrayKeyInfoType.Length; k++) + { + options.KeyInfoType = arrayKeyInfoType[k]; + optionsXPath.KeyInfoType = arrayKeyInfoType[k]; + optionsID.KeyInfoType = arrayKeyInfoType[k]; + CertificateX509 cert = new CertificateX509(); + if (ispkcs12) + { + cert.LoadPKCS12(pathCert, alias, password); + } + else { + cert.Load(pathCert); + } + PrivateKeyManager key = new PrivateKeyManager(); + + if (ispkcs12) + { + key.LoadPKCS12(pathKey, alias, password); + } + else + { + key.Load(pathKey); + } + /*if (ispkcs12) + { + key.LoadPKCS12(pathKey, alias, password); + } + else if(encrypted) + { + key.LoadEncrypted(pathKey, password); + }else + { + key.Load(pathKey); + }*/ + + bulkTestWithKeyInfo(cert, key, pathSigned); + bulkTestWithKeyInfoXPath(cert, key, pathSigned); + bulkTestWithKeyInfoID(cert, key, pathSigned); + } + + } + + private void bulkTestWithKeyInfoXPath(CertificateX509 certificate, PrivateKeyManager key, string pathSigned) + { +#if NETCORE + //******Net Core no tiene habilitado usar la transform xpath******// + Assert.IsTrue(true); +#else + XmlDSigSigner signer = new XmlDSigSigner(); + + string pathSignedXPath = pathSigned + "_xPAth"; + for (int c = 0; c < arrayCanonicalization.Length; c++) + { + + /**** TEST FILES ****/ + optionsXPath.DSigSignatureType = dSigType; + optionsXPath.Canonicalization = arrayCanonicalization[c]; + bool signedFile = signer.DoSignFileElement(xmlUnsignedXPathFile, xPath, key, certificate, + Path.Combine(xmlSignedPathRoot ,pathSignedXPath + ".xml"), optionsXPath); + Assert.IsTrue(signedFile); + True(signedFile, signer); + + bool verifyFile = false; + KeyInfoType keyInfo = KeyInfoTypeUtils.getKeyInfoType(optionsXPath.KeyInfoType, error); + if (keyInfo != KeyInfoType.NONE) + { + verifyFile = signer.DoVerifyFile(Path.Combine(xmlSignedPathRoot,pathSignedXPath + ".xml"), optionsXPath); + } + else + { + verifyFile = signer.DoVerifyFileWithCert(Path.Combine(xmlSignedPathRoot,pathSignedXPath + ".xml"), certificate, + optionsXPath); + } + //True(verifyFile, signer); + + /**** TEST STRINGS ****/ + + string signedString = signer.DoSignElement(xmlUnsignedXPath, xPath, key, certificate, optionsXPath); + bool resultSignString = false; + if (keyInfo != KeyInfoType.NONE) + { + resultSignString = signer.DoVerify(signedString, optionsXPath); + } + else + { + resultSignString = signer.DoVerifyWithCert(signedString, certificate, optionsXPath); + + } + //True(resultSignString, signer); + + } +#endif + } + + private void bulkTestWithKeyInfo(CertificateX509 certificate, PrivateKeyManager key, string pathSigned) + { + XmlDSigSigner signer = new XmlDSigSigner(); + + for (int c = 0; c < arrayCanonicalization.Length; c++) + { + + /**** TEST FILES ****/ + options.DSigSignatureType = dSigType; + options.Canonicalization = arrayCanonicalization[c]; + bool signedFile = signer.DoSignFile(xmlUnsignedPath, key, certificate, + Path.Combine(xmlSignedPathRoot,pathSigned + ".xml"), options); + Assert.IsTrue(signedFile); + True(signedFile, signer); + + bool verifyFile = false; + KeyInfoType keyInfo = KeyInfoTypeUtils.getKeyInfoType(options.KeyInfoType, error); + if (keyInfo != KeyInfoType.NONE) + { + verifyFile = signer.DoVerifyFile(Path.Combine(xmlSignedPathRoot,pathSigned + ".xml"), options); + } + else + { + verifyFile = signer.DoVerifyFileWithCert(Path.Combine(xmlSignedPathRoot,pathSigned + ".xml"), certificate, options); + } + True(verifyFile, signer); + + /**** TEST STRINGS ****/ + + string signedString = signer.DoSign(xmlUnsigned, key, certificate, options); + bool resultSignString = false; + if (keyInfo != KeyInfoType.NONE) + { + resultSignString = signer.DoVerify(signedString, options); + } + else + { + resultSignString = signer.DoVerifyWithCert(signedString, certificate, options); + + } + True(resultSignString, signer); + + } + } + + private void bulkTestWithKeyInfoID(CertificateX509 certificate, PrivateKeyManager key, string pathSigned) + { + XmlDSigSigner signer = new XmlDSigSigner(); + string pathSignedID = pathSigned + "_id"; + for (int c = 0; c < arrayCanonicalization.Length; c++) + { + + /**** TEST FILES ****/ + optionsID.DSigSignatureType = dSigType; + optionsID.Canonicalization = arrayCanonicalization[c]; + + optionsID.XmlSchemaPath = xmlIDSchemaPath; + bool signedFile = signer.DoSignFileElement(xmlUnsignedIDPathFile, id, key, certificate, + Path.Combine(xmlSignedPathRoot, pathSignedID + ".xml"), optionsID); + Assert.IsTrue(signedFile); + True(signedFile, signer); + + bool verifyFile = false; + optionsID.XmlSchemaPath = ""; + KeyInfoType keyInfo = KeyInfoTypeUtils.getKeyInfoType(optionsID.KeyInfoType, error); + if (keyInfo != KeyInfoType.NONE) + { + + verifyFile = signer.DoVerifyFile(Path.Combine(xmlSignedPathRoot, pathSignedID + ".xml"), optionsID); + } + else + { + verifyFile = signer.DoVerifyFileWithCert(Path.Combine(xmlSignedPathRoot,pathSignedID + ".xml"), certificate, + optionsID); + } + True(verifyFile, signer); + + /**** TEST STRINGS ****/ + optionsID.XmlSchemaPath = xmlIDSchemaPath; + string signedString = signer.DoSignElement(xmlUnsignedID, id, key, certificate, optionsID); + bool resultSignString = false; + + optionsID.XmlSchemaPath = ""; + if (keyInfo != KeyInfoType.NONE) + { + resultSignString = signer.DoVerify(signedString, optionsID); + } + else + { + resultSignString = signer.DoVerifyWithCert(signedString, certificate, optionsID); + + } + Assert.IsTrue(resultSignString); + True(resultSignString, signer); + + } + } + + /*[Test] + public void Test_sha256_1024_PEM_Encrypted() + { + string pathKey = Path.Combine(path_RSA_sha256_1024, "sha256_key.pem"); + string pathCert = Path.Combine(path_RSA_sha256_1024, "sha256_cert.pem"); + string pathSigned = "Test_sha256_1024_PEM"; + bulkTest(pathCert, pathKey, pathSigned, false, true); + } + + [Test] + public void Test_sha1_1024_PEM_Encrypted() + { + string pathKey = Path.Combine(path_RSA_sha1_1024, "sha1_key.pem"); + string pathCert = Path.Combine(path_RSA_sha1_1024, "sha1_cert.pem"); + string pathSigned = "Test_sha1_1024_PEM"; + bulkTest(pathCert, pathKey, pathSigned, false, true); + } + + [Test] + public void Test_sha256_2048_PEM_Encrypted() + { + string pathKey = Path.Combine(path_RSA_sha256_2048, "sha256_key.pem"); + string pathCert = Path.Combine(path_RSA_sha256_2048, "sha256_cert.pem"); + string pathSigned = "Test_sha256_2048_PEM"; + bulkTest(pathCert, pathKey, pathSigned, false, true); + } + + [Test] + public void Test_sha512_2048_PEM_Encrypted() + { + string pathKey = Path.Combine(path_RSA_sha512_2048, "sha512_key.pem"); + string pathCert = Path.Combine(path_RSA_sha512_2048, "sha512_cert.pem"); + string pathSigned = "Test_sha512_2048_PEM"; + bulkTest(pathCert, pathKey, pathSigned, false, true); + }*/ + } +} diff --git a/test/dotnetframework/SecurityAPITest/XmlSignature/DSig/TestXmlSignatureDomainSpaces.cs b/test/dotnetframework/SecurityAPITest/XmlSignature/DSig/TestXmlSignatureDomainSpaces.cs new file mode 100644 index 0000000..a39d846 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/XmlSignature/DSig/TestXmlSignatureDomainSpaces.cs @@ -0,0 +1,58 @@ +using GeneXusXmlSignature.GeneXusCommons; +using GeneXusXmlSignature.GeneXusDSig; +using NUnit.Framework; +using SecurityAPICommons.Keys; +using SecurityAPITest.SecurityAPICommons.commons; +using System.IO; + +namespace SecurityAPITest.XmlSignature.DSig +{ + [TestFixture] + public class TestXmlSignatureDomainSpaces : SecurityAPITestObject + { + private static string path_RSA_sha1_1024; + //private static string xmlUnsigned; + //private static string dSigType; + private static DSigOptions options; + private static string pathKey; + private static string pathCert; + private static XmlDSigSigner signer; + private static PrivateKeyManager key; + private static CertificateX509 cert; + + [SetUp] + public virtual void SetUp() + { + signer = new XmlDSigSigner(); + path_RSA_sha1_1024 = Path.Combine(BASE_PATH, "dummycerts", "RSA_sha1_1024"); + //xmlUnsigned = "" + "" + // + " " + " Ola mundo" + " " + ""; + //dSigType = "ENVELOPED "; + options = new DSigOptions(); + + pathKey = Path.Combine(path_RSA_sha1_1024, "sha1d_key.pem"); + pathCert = Path.Combine(path_RSA_sha1_1024, "sha1_cert.crt"); + + key = new PrivateKeyManager(); + cert = new CertificateX509(); + } + + /*[Test] + public void TestDomains() + { + key.Load(pathKey); + Assert.IsFalse(key.HasError()); + cert.Load(pathCert); + Assert.IsFalse(cert.HasError()); + options.DSigSignatureType = dSigType; + options.Canonicalization = "C14n_OMIT_COMMENTS "; + options.KeyInfoType = " X509Certificate"; + string signed = signer.DoSign(xmlUnsigned, key, cert, options); + //System.out.println("Error. Code: " + signer.getErrorCode() + " Desc: " + signer.getErrorDescription()); + Assert.IsFalse(signer.HasError()); + bool verified = signer.DoVerify(signed, options); + True(verified, signer); + }*/ + + } +} diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/ECDSA_sha1/sha1_cert.crt b/test/dotnetframework/SecurityAPITest/dummycerts/ECDSA_sha1/sha1_cert.crt new file mode 100644 index 0000000..05139c2 Binary files /dev/null and b/test/dotnetframework/SecurityAPITest/dummycerts/ECDSA_sha1/sha1_cert.crt differ diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/ECDSA_sha1/sha1_cert.p12 b/test/dotnetframework/SecurityAPITest/dummycerts/ECDSA_sha1/sha1_cert.p12 new file mode 100644 index 0000000..a5a4d05 Binary files /dev/null and b/test/dotnetframework/SecurityAPITest/dummycerts/ECDSA_sha1/sha1_cert.p12 differ diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/ECDSA_sha1/sha1_cert.pem b/test/dotnetframework/SecurityAPITest/dummycerts/ECDSA_sha1/sha1_cert.pem new file mode 100644 index 0000000..f55914e --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/ECDSA_sha1/sha1_cert.pem @@ -0,0 +1,17 @@ +-----BEGIN CERTIFICATE----- +MIICrzCCAjegAwIBAgIJAN6IVQEPkPo6MAkGByqGSM49BAEwgZYxCzAJBgNVBAYT +AlVZMRMwEQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAw +DgYDVQQKDAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dy +YW1wb25lMSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wHhcN +MjAwNzA4MjA0MjU4WhcNMjUwNzA3MjA0MjU4WjCBljELMAkGA1UEBhMCVVkxEzAR +BgNVBAgMCk1vbnRldmlkZW8xEzARBgNVBAcMCk1vbnRldmlkZW8xEDAOBgNVBAoM +B0dlbmVYdXMxETAPBgNVBAsMCFNlY3VyaXR5MRIwEAYDVQQDDAlzZ3JhbXBvbmUx +JDAiBgkqhkiG9w0BCQEWFXNncmFtcG9uZUBnZW5leHVzLmNvbTB2MBAGByqGSM49 +AgEGBSuBBAAiA2IABDpU5/oasLTs+rPcIYTOcR95jvAio1vopcO6GuE+0TJj06if ++mY8SYE5RjwxXGaGcYZko/ulY7wx5ckhoN+6HDA0KLk43PNnsAr3dSn1k2f/w32R +4+VmeUXMDXXSxmbY26NQME4wHQYDVR0OBBYEFFD38EPaOcDTw52DyW2Zu2N/nUPE +MB8GA1UdIwQYMBaAFFD38EPaOcDTw52DyW2Zu2N/nUPEMAwGA1UdEwQFMAMBAf8w +CQYHKoZIzj0EAQNnADBkAjB2lIF+AZSfMWuJs5U0jF1uHL9w0AR4fI5l3IRdm7By +TiXmacMPBJEOVbL31HZTzCECMGploCmddgoymeawuTbYTS0rqZefe/MBtmyBsoVL +tjk3w4fKM2HVwz8WvqXwrg9caw== +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/ECDSA_sha1/sha1_key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/ECDSA_sha1/sha1_key.pem new file mode 100644 index 0000000..0bfa020 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/ECDSA_sha1/sha1_key.pem @@ -0,0 +1,6 @@ +-----BEGIN EC PRIVATE KEY----- +MIGkAgEBBDDASNRqsB6xPRUMxp0HCrSiIL4kGuwR1EHi2rDciohQD5aEzipd6NpV +fR4ndLNmpF+gBwYFK4EEACKhZANiAAQ6VOf6GrC07Pqz3CGEznEfeY7wIqNb6KXD +uhrhPtEyY9Oon/pmPEmBOUY8MVxmhnGGZKP7pWO8MeXJIaDfuhwwNCi5ONzzZ7AK +93Up9ZNn/8N9kePlZnlFzA110sZm2Ns= +-----END EC PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/ECDSA_sha256/sha256_cert.crt b/test/dotnetframework/SecurityAPITest/dummycerts/ECDSA_sha256/sha256_cert.crt new file mode 100644 index 0000000..493d81d Binary files /dev/null and b/test/dotnetframework/SecurityAPITest/dummycerts/ECDSA_sha256/sha256_cert.crt differ diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/ECDSA_sha256/sha256_cert.p12 b/test/dotnetframework/SecurityAPITest/dummycerts/ECDSA_sha256/sha256_cert.p12 new file mode 100644 index 0000000..374d1c1 Binary files /dev/null and b/test/dotnetframework/SecurityAPITest/dummycerts/ECDSA_sha256/sha256_cert.p12 differ diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/ECDSA_sha256/sha256_cert.pem b/test/dotnetframework/SecurityAPITest/dummycerts/ECDSA_sha256/sha256_cert.pem new file mode 100644 index 0000000..e0f11d1 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/ECDSA_sha256/sha256_cert.pem @@ -0,0 +1,17 @@ +-----BEGIN CERTIFICATE----- +MIICsjCCAjigAwIBAgIJAOpC5nNoxOzcMAoGCCqGSM49BAMCMIGWMQswCQYDVQQG +EwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQ +MA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMMCXNn +cmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMB4X +DTIwMDcwODIwNDY0MloXDTI1MDcwNzIwNDY0MlowgZYxCzAJBgNVBAYTAlVZMRMw +EQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYDVQQK +DAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dyYW1wb25l +MSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wdjAQBgcqhkjO +PQIBBgUrgQQAIgNiAATtTvl6nBuTUzfWthCvgoqK+abITZKnpq/R7iDguJzUXzfB +X1DsYCUURlGzPE0nvndg+y8nBTYBcEsaCwmHL7KajB+7DtcprPzo4D/xn/EK5SkV +P3tIzQXOiu8YYvU7/3ujUDBOMB0GA1UdDgQWBBSFl4Qp+v6xBTgwL8Ctajz3Weqv +2zAfBgNVHSMEGDAWgBSFl4Qp+v6xBTgwL8Ctajz3Weqv2zAMBgNVHRMEBTADAQH/ +MAoGCCqGSM49BAMCA2gAMGUCMQCkrNN8ZLMgOi74tQKWrhlNyrJhF1cJsL/mCoeU +8xZ5vd1qSOa73QWwM2pejlrIjcACMHFbTl2RCwbLbCR76DHZTjPugDx8KUXa68V7 +ADZutzqxm6f35IW2LLh+jn52Eid3mA== +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/ECDSA_sha256/sha256_key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/ECDSA_sha256/sha256_key.pem new file mode 100644 index 0000000..0edb562 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/ECDSA_sha256/sha256_key.pem @@ -0,0 +1,6 @@ +-----BEGIN EC PRIVATE KEY----- +MIGkAgEBBDAA0D8361/f9fjOjpsIDtiOMrmwXfHuCMQjwcIJ6H0nHIJgSzH8z6W6 +I1UPDpS4pKOgBwYFK4EEACKhZANiAATtTvl6nBuTUzfWthCvgoqK+abITZKnpq/R +7iDguJzUXzfBX1DsYCUURlGzPE0nvndg+y8nBTYBcEsaCwmHL7KajB+7DtcprPzo +4D/xn/EK5SkVP3tIzQXOiu8YYvU7/3s= +-----END EC PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime192v1/cert.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime192v1/cert.pem new file mode 100644 index 0000000..a013cb1 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime192v1/cert.pem @@ -0,0 +1,15 @@ +-----BEGIN CERTIFICATE----- +MIICVTCCAgugAwIBAgIJANwmdZrFcHQzMAoGCCqGSM49BAMCMIGWMQswCQYDVQQG +EwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQ +MA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdWlydHkxEjAQBgNVBAMMCXNn +cmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMB4X +DTIwMTAyMjE0NTQzN1oXDTIwMTEyMTE0NTQzN1owgZYxCzAJBgNVBAYTAlVZMRMw +EQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYDVQQK +DAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1aXJ0eTESMBAGA1UEAwwJc2dyYW1wb25l +MSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wSTATBgcqhkjO +PQIBBggqhkjOPQMBAQMyAARrK0QGr4PZmDmmHLAEqoX2iqy/IRHVr8Pl/1b9TgY+ +FJWHZC/XLrfFfAHnnFfxP72jUDBOMB0GA1UdDgQWBBQLfDLRzNVJPUVJ1UganVwP +etd8EjAfBgNVHSMEGDAWgBQLfDLRzNVJPUVJ1UganVwPetd8EjAMBgNVHRMEBTAD +AQH/MAoGCCqGSM49BAMCAzgAMDUCGQDtFyZY6eLUFPWW+/stXUrSmO29tJXG+lwC +GC+fDUj2zFf8+EqOHHvZ/OxP8iYa1VBAMA== +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime192v1/key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime192v1/key.pem new file mode 100644 index 0000000..20a7872 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime192v1/key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MF8CAQEEGDmMXscXsK6l9tQBPGRa0oWPTaWeKCwJGKAKBggqhkjOPQMBAaE0AzIA +BGsrRAavg9mYOaYcsASqhfaKrL8hEdWvw+X/Vv1OBj4UlYdkL9cut8V8AeecV/E/ +vQ== +-----END EC PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime192v2/cert.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime192v2/cert.pem new file mode 100644 index 0000000..c03f85a --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime192v2/cert.pem @@ -0,0 +1,15 @@ +-----BEGIN CERTIFICATE----- +MIICVjCCAgugAwIBAgIJAMhlDOUT16BgMAoGCCqGSM49BAMCMIGWMQswCQYDVQQG +EwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQ +MA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMMCXNn +cmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMB4X +DTIwMTAyMjE0NTUzMFoXDTIwMTEyMTE0NTUzMFowgZYxCzAJBgNVBAYTAlVZMRMw +EQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYDVQQK +DAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dyYW1wb25l +MSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wSTATBgcqhkjO +PQIBBggqhkjOPQMBAgMyAAT9T3YqDlL4C6o/Yj7afB5DqSFcPCqjtxyaeWDt46zz +cfqvqNVdTwOsl0QspCETORKjUDBOMB0GA1UdDgQWBBRG9hY022lpEY8HGBs2RVqn +s+jHbjAfBgNVHSMEGDAWgBRG9hY022lpEY8HGBs2RVqns+jHbjAMBgNVHRMEBTAD +AQH/MAoGCCqGSM49BAMCAzkAMDYCGQDANe7K+TgQ7obj4k0ZqZikK3NomHoHIh4C +GQDpkjPz9bj5JqMwadzLxVtHuCbp3C4N9yg= +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime192v2/key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime192v2/key.pem new file mode 100644 index 0000000..3096500 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime192v2/key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MF8CAQEEGAvioKaRVADCgAl6EhSbusiWgqQ0ShCVt6AKBggqhkjOPQMBAqE0AzIA +BP1PdioOUvgLqj9iPtp8HkOpIVw8KqO3HJp5YO3jrPNx+q+o1V1PA6yXRCykIRM5 +Eg== +-----END EC PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime192v3/cert.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime192v3/cert.pem new file mode 100644 index 0000000..2c3cdfd --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime192v3/cert.pem @@ -0,0 +1,15 @@ +-----BEGIN CERTIFICATE----- +MIICVDCCAgugAwIBAgIJAPxWi60KZG4EMAoGCCqGSM49BAMCMIGWMQswCQYDVQQG +EwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQ +MA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMMCXNn +cmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMB4X +DTIwMTAyMjE0NTYyNFoXDTIwMTEyMTE0NTYyNFowgZYxCzAJBgNVBAYTAlVZMRMw +EQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYDVQQK +DAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dyYW1wb25l +MSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wSTATBgcqhkjO +PQIBBggqhkjOPQMBAwMyAASz+GH5C+my9HF+ftcicQkKZf5S54velkoDz9ueLS6T ++B4phyBS4FGFPcF3rJV46G6jUDBOMB0GA1UdDgQWBBS7mLzgLZZ81YH2EGATdtLh +TTWGWjAfBgNVHSMEGDAWgBS7mLzgLZZ81YH2EGATdtLhTTWGWjAMBgNVHRMEBTAD +AQH/MAoGCCqGSM49BAMCAzcAMDQCGD/zKCKnIQsFWlFp1t2O//uMjYq/19KymwIY +b3FG2pOag3eFHOfZbiABMavvfJAbhZv6 +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime192v3/key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime192v3/key.pem new file mode 100644 index 0000000..446339f --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime192v3/key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MF8CAQEEGBm1NiFjPoDKptSeV4uQjb3Ok/60bQtaMaAKBggqhkjOPQMBA6E0AzIA +BLP4YfkL6bL0cX5+1yJxCQpl/lLni96WSgPP254tLpP4HimHIFLgUYU9wXeslXjo +bg== +-----END EC PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime239v1/cert.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime239v1/cert.pem new file mode 100644 index 0000000..16d0fe9 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime239v1/cert.pem @@ -0,0 +1,16 @@ +-----BEGIN CERTIFICATE----- +MIICbjCCAhmgAwIBAgIJAJLEycMWDn07MAoGCCqGSM49BAMCMIGXMQswCQYDVQQG +EwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQ +MA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMMCXNn +cmFtcG9uZTElMCMGCSqGSIb3DQEJARYWc2VncmFtcG9uZUBnZW5leHVzLmNvbTAe +Fw0yMDEwMjIxNTA0MjRaFw0yMDExMjExNTA0MjRaMIGXMQswCQYDVQQGEwJVWTET +MBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQMA4GA1UE +CgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMMCXNncmFtcG9u +ZTElMCMGCSqGSIb3DQEJARYWc2VncmFtcG9uZUBnZW5leHVzLmNvbTBVMBMGByqG +SM49AgEGCCqGSM49AwEEAz4ABAAuriV4OGOVR7Fw/kjpt7/wBZQbEe/I/Gplv3Pf +iCXR+A8a3sCdnQJ7DKP3gk/lUvS8Qxn9OqSFWJ4XdaNQME4wHQYDVR0OBBYEFI/H +4rIvt8Yui/tl9WQripGsdDHiMB8GA1UdIwQYMBaAFI/H4rIvt8Yui/tl9WQripGs +dDHiMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDQwAwQAIeLgB15CFDYxbfSrKU +e0WnvzKXJmBHNxWv7TtG4N6XAh5hlSYwRq2HmG1vujPe79CwqiCFECwuW8YPfcsR +3p4= +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime239v1/key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime239v1/key.pem new file mode 100644 index 0000000..def0f0c --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime239v1/key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHECAQEEHh8UQet0lNaTLqfmFcrgNV0f7CftIVS3yqgakLI73KAKBggqhkjOPQMB +BKFAAz4ABAAuriV4OGOVR7Fw/kjpt7/wBZQbEe/I/Gplv3PfiCXR+A8a3sCdnQJ7 +DKP3gk/lUvS8Qxn9OqSFWJ4XdQ== +-----END EC PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime239v2/cert.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime239v2/cert.pem new file mode 100644 index 0000000..d1ca998 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime239v2/cert.pem @@ -0,0 +1,15 @@ +-----BEGIN CERTIFICATE----- +MIICbDCCAhegAwIBAgIJAOFYkFaKKHmGMAoGCCqGSM49BAMCMIGWMQswCQYDVQQG +EwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQ +MA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMMCXNn +cmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMB4X +DTIwMTAyMjE1MDUxMVoXDTIwMTEyMTE1MDUxMVowgZYxCzAJBgNVBAYTAlVZMRMw +EQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYDVQQK +DAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dyYW1wb25l +MSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wVTATBgcqhkjO +PQIBBggqhkjOPQMBBQM+AARnAT6M17sq6UGEZEJq7io4pnmSlY/3zjlbmi5WIVIh +KXgNSVODeY4t2xDtfkQnl1SlS5XgOcHYL9GxyNSjUDBOMB0GA1UdDgQWBBTThUSZ +CkjtjxrAm1UcUAXqGTiWADAfBgNVHSMEGDAWgBTThUSZCkjtjxrAm1UcUAXqGTiW +ADAMBgNVHRMEBTADAQH/MAoGCCqGSM49BAMCA0MAMEACHlnHrkvH8Vhn+kv4sHn8 +grDZCzdQpmlTrMGIHlUS9AIeP9xBCkWzP/YYny5a7Kk1lPgXlJwdoPViIojBsFg9 +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime239v2/key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime239v2/key.pem new file mode 100644 index 0000000..2a36f71 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime239v2/key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHECAQEEHnRLl4h63L54nskPrvLfRz/iSbDlXDelySY9cJ0dJqAKBggqhkjOPQMB +BaFAAz4ABGcBPozXuyrpQYRkQmruKjimeZKVj/fOOVuaLlYhUiEpeA1JU4N5ji3b +EO1+RCeXVKVLleA5wdgv0bHI1A== +-----END EC PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime239v3/cert.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime239v3/cert.pem new file mode 100644 index 0000000..391808e --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime239v3/cert.pem @@ -0,0 +1,15 @@ +-----BEGIN CERTIFICATE----- +MIICbDCCAhegAwIBAgIJAJdIsvE83x8ZMAoGCCqGSM49BAMCMIGWMQswCQYDVQQG +EwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQ +MA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMMCXNn +cmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMB4X +DTIwMTAyMjE1MDYxN1oXDTIwMTEyMTE1MDYxN1owgZYxCzAJBgNVBAYTAlVZMRMw +EQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYDVQQK +DAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dyYW1wb25l +MSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wVTATBgcqhkjO +PQIBBggqhkjOPQMBBgM+AARHNP5z2rIFoL4iUNgY869nSGWMV95/yEC3GWjnnHdI +1QHE/hrcuOK+YbV8B5ny2NzwboTQz/4mRbuoRACjUDBOMB0GA1UdDgQWBBSh5O4q +ZabPX4YeO65MhL1EZTy9jzAfBgNVHSMEGDAWgBSh5O4qZabPX4YeO65MhL1EZTy9 +jzAMBgNVHRMEBTADAQH/MAoGCCqGSM49BAMCA0MAMEACHioqcjx3gAgdk8nK38Sx +0gV22fmo7j0LP1tnDsH16gIeb9IcOB4w1I+uNxEz+m6pMIUT3wsrX7soKI3RQgtR +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime239v3/key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime239v3/key.pem new file mode 100644 index 0000000..eaa70be --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime239v3/key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHECAQEEHmcN3Lgf4vm1Lg451iIDVMjalAm/7YPiqWUnD8SXRqAKBggqhkjOPQMB +BqFAAz4ABEc0/nPasgWgviJQ2Bjzr2dIZYxX3n/IQLcZaOecd0jVAcT+Gty44r5h +tXwHmfLY3PBuhNDP/iZFu6hEAA== +-----END EC PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime256v1/cert.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime256v1/cert.pem new file mode 100644 index 0000000..d198d70 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime256v1/cert.pem @@ -0,0 +1,16 @@ +-----BEGIN CERTIFICATE----- +MIICdTCCAhugAwIBAgIJAIkfZlZb1VAbMAoGCCqGSM49BAMCMIGWMQswCQYDVQQG +EwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQ +MA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMMCXNn +cmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMB4X +DTIwMTAyMjE1MDcxMFoXDTIwMTEyMTE1MDcxMFowgZYxCzAJBgNVBAYTAlVZMRMw +EQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYDVQQK +DAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dyYW1wb25l +MSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wWTATBgcqhkjO +PQIBBggqhkjOPQMBBwNCAASrhEd/8BRVyHSyEcfPgROvbEHyBABKIEkTEglSR2HR +JPoUXlXk2PpssepPa/xM/BYoz4Tv8eF13Ob/LvhG1pwoo1AwTjAdBgNVHQ4EFgQU +T2yhjYW/nbEk0+LSUbUmKX8Qm00wHwYDVR0jBBgwFoAUT2yhjYW/nbEk0+LSUbUm +KX8Qm00wDAYDVR0TBAUwAwEB/zAKBggqhkjOPQQDAgNIADBFAiEAnPAAhAxVVf8v +4hdnM8l6z1zHgoq9kEP9esMeuZ85B1ACIEotYXlm+ECh3dhzjHb0ef38c9ao//1w +5ECQKTWeWeqS +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime256v1/key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime256v1/key.pem new file mode 100644 index 0000000..03bf8b5 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime256v1/key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIDGQzJBv1o5loyF0p7kYFFegueeBuepCnnfUGnLg3wpeoAoGCCqGSM49 +AwEHoUQDQgAEq4RHf/AUVch0shHHz4ETr2xB8gQASiBJExIJUkdh0ST6FF5V5Nj6 +bLHqT2v8TPwWKM+E7/Hhddzm/y74RtacKA== +-----END EC PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime_test/cert.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime_test/cert.pem new file mode 100644 index 0000000..d198d70 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime_test/cert.pem @@ -0,0 +1,16 @@ +-----BEGIN CERTIFICATE----- +MIICdTCCAhugAwIBAgIJAIkfZlZb1VAbMAoGCCqGSM49BAMCMIGWMQswCQYDVQQG +EwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQ +MA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMMCXNn +cmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMB4X +DTIwMTAyMjE1MDcxMFoXDTIwMTEyMTE1MDcxMFowgZYxCzAJBgNVBAYTAlVZMRMw +EQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYDVQQK +DAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dyYW1wb25l +MSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wWTATBgcqhkjO +PQIBBggqhkjOPQMBBwNCAASrhEd/8BRVyHSyEcfPgROvbEHyBABKIEkTEglSR2HR +JPoUXlXk2PpssepPa/xM/BYoz4Tv8eF13Ob/LvhG1pwoo1AwTjAdBgNVHQ4EFgQU +T2yhjYW/nbEk0+LSUbUmKX8Qm00wHwYDVR0jBBgwFoAUT2yhjYW/nbEk0+LSUbUm +KX8Qm00wDAYDVR0TBAUwAwEB/zAKBggqhkjOPQQDAgNIADBFAiEAnPAAhAxVVf8v +4hdnM8l6z1zHgoq9kEP9esMeuZ85B1ACIEotYXlm+ECh3dhzjHb0ef38c9ao//1w +5ECQKTWeWeqS +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime_test/cert_sha256.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime_test/cert_sha256.pem new file mode 100644 index 0000000..a6eddd4 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime_test/cert_sha256.pem @@ -0,0 +1,16 @@ +-----BEGIN CERTIFICATE----- +MIICdDCCAhugAwIBAgIJAJFFEyaq0CtjMAoGCCqGSM49BAMCMIGWMQswCQYDVQQG +EwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQ +MA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMMCXNn +cmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMB4X +DTIwMTAyNTE1NDExMloXDTIwMTEyNDE1NDExMlowgZYxCzAJBgNVBAYTAlVZMRMw +EQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYDVQQK +DAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dyYW1wb25l +MSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wWTATBgcqhkjO +PQIBBggqhkjOPQMBBwNCAASrhEd/8BRVyHSyEcfPgROvbEHyBABKIEkTEglSR2HR +JPoUXlXk2PpssepPa/xM/BYoz4Tv8eF13Ob/LvhG1pwoo1AwTjAdBgNVHQ4EFgQU +T2yhjYW/nbEk0+LSUbUmKX8Qm00wHwYDVR0jBBgwFoAUT2yhjYW/nbEk0+LSUbUm +KX8Qm00wDAYDVR0TBAUwAwEB/zAKBggqhkjOPQQDAgNHADBEAiBAf9B5Uc/iLNpv +dHy12J6t1Z0QZ9+tSyb9hLuUIh7vWgIgUUC3P0/8ATrWOicl7cuyY/dw/FZuuRMo +aExLyrL5B4s= +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime_test/cert_sha384.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime_test/cert_sha384.pem new file mode 100644 index 0000000..957683e --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime_test/cert_sha384.pem @@ -0,0 +1,16 @@ +-----BEGIN CERTIFICATE----- +MIICdDCCAhugAwIBAgIJAKIBNSFRktFKMAoGCCqGSM49BAMDMIGWMQswCQYDVQQG +EwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQ +MA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMMCXNn +cmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMB4X +DTIwMTAyNTE1NDEzN1oXDTIwMTEyNDE1NDEzN1owgZYxCzAJBgNVBAYTAlVZMRMw +EQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYDVQQK +DAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dyYW1wb25l +MSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wWTATBgcqhkjO +PQIBBggqhkjOPQMBBwNCAASrhEd/8BRVyHSyEcfPgROvbEHyBABKIEkTEglSR2HR +JPoUXlXk2PpssepPa/xM/BYoz4Tv8eF13Ob/LvhG1pwoo1AwTjAdBgNVHQ4EFgQU +T2yhjYW/nbEk0+LSUbUmKX8Qm00wHwYDVR0jBBgwFoAUT2yhjYW/nbEk0+LSUbUm +KX8Qm00wDAYDVR0TBAUwAwEB/zAKBggqhkjOPQQDAwNHADBEAiBb0l00mw+CdHcv +RkfHzrzJpkFPfqkF5GXUuH9DW2JzxAIgOnWBrh2i627vF0I5W1kyzNr467KfIBoB +7aaK4tnINMM= +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime_test/cert_sha512.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime_test/cert_sha512.pem new file mode 100644 index 0000000..008f0be --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime_test/cert_sha512.pem @@ -0,0 +1,16 @@ +-----BEGIN CERTIFICATE----- +MIICdDCCAhugAwIBAgIJANupPIXMt1lnMAoGCCqGSM49BAMEMIGWMQswCQYDVQQG +EwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQ +MA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMMCXNn +cmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMB4X +DTIwMTAyNTE1NDIwNFoXDTIwMTEyNDE1NDIwNFowgZYxCzAJBgNVBAYTAlVZMRMw +EQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYDVQQK +DAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dyYW1wb25l +MSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wWTATBgcqhkjO +PQIBBggqhkjOPQMBBwNCAASrhEd/8BRVyHSyEcfPgROvbEHyBABKIEkTEglSR2HR +JPoUXlXk2PpssepPa/xM/BYoz4Tv8eF13Ob/LvhG1pwoo1AwTjAdBgNVHQ4EFgQU +T2yhjYW/nbEk0+LSUbUmKX8Qm00wHwYDVR0jBBgwFoAUT2yhjYW/nbEk0+LSUbUm +KX8Qm00wDAYDVR0TBAUwAwEB/zAKBggqhkjOPQQDBANHADBEAiBWvELNS7izFw4A +XDpNJq/+tQ6WbefKx5P4W2/Ra7+MZAIgPHtOzNWlHQhoOrd7Wq9CZb8wPHy/QP1Y +HMXzAMhFKgQ= +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime_test/key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime_test/key.pem new file mode 100644 index 0000000..03bf8b5 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/prime_test/key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIDGQzJBv1o5loyF0p7kYFFegueeBuepCnnfUGnLg3wpeoAoGCCqGSM49 +AwEHoUQDQgAEq4RHf/AUVch0shHHz4ETr2xB8gQASiBJExIJUkdh0ST6FF5V5Nj6 +bLHqT2v8TPwWKM+E7/Hhddzm/y74RtacKA== +-----END EC PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp112r1/cert.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp112r1/cert.pem new file mode 100644 index 0000000..b96ab7e --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp112r1/cert.pem @@ -0,0 +1,14 @@ +-----BEGIN CERTIFICATE----- +MIICKjCCAfSgAwIBAgIJANoDW6czwhCjMAoGCCqGSM49BAMCMIGWMQswCQYDVQQG +EwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQ +MA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMMCXNn +cmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMB4X +DTIwMTAyMjE0MzkzN1oXDTIwMTEyMTE0MzkzN1owgZYxCzAJBgNVBAYTAlVZMRMw +EQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYDVQQK +DAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dyYW1wb25l +MSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wMjAQBgcqhkjO +PQIBBgUrgQQABgMeAAQ/jXT36fsiDdh/5OBMhhsvbvwvcYnlNT0HvgwYo1AwTjAd +BgNVHQ4EFgQUxY6LhoTkK1rM6qH8fEZEbr/kgwkwHwYDVR0jBBgwFoAUxY6LhoTk +K1rM6qH8fEZEbr/kgwkwDAYDVR0TBAUwAwEB/zAKBggqhkjOPQQDAgMkADAhAg8A +j1+cJc4E9cykFcdksEgCDibOb7uxYlRLlRRjlQYF +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp112r1/key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp112r1/key.pem new file mode 100644 index 0000000..5b3fc14 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp112r1/key.pem @@ -0,0 +1,4 @@ +-----BEGIN EC PRIVATE KEY----- +MD4CAQEEDnfC7Feqbvn+7pTg6ItUoAcGBSuBBAAGoSADHgAEP4109+n7Ig3Yf+Tg +TIYbL278L3GJ5TU9B74MGA== +-----END EC PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp112r2/cert.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp112r2/cert.pem new file mode 100644 index 0000000..da3571e --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp112r2/cert.pem @@ -0,0 +1,14 @@ +-----BEGIN CERTIFICATE----- +MIICKTCCAfSgAwIBAgIJAN02Y1/xUOcTMAoGCCqGSM49BAMCMIGWMQswCQYDVQQG +EwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQ +MA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIc2VjdXJpdHkxEjAQBgNVBAMMCXNn +cmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMB4X +DTIwMTAyMjE0NDExNloXDTIwMTEyMTE0NDExNlowgZYxCzAJBgNVBAYTAlVZMRMw +EQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYDVQQK +DAdHZW5lWHVzMREwDwYDVQQLDAhzZWN1cml0eTESMBAGA1UEAwwJc2dyYW1wb25l +MSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wMjAQBgcqhkjO +PQIBBgUrgQQABwMeAATXH2nLiDcPNHom7JnSLs4+4w/TjBqJNzs38B92o1AwTjAd +BgNVHQ4EFgQU/eijGeA5tQtm6Alw/Q5lsLO4EXowHwYDVR0jBBgwFoAU/eijGeA5 +tQtm6Alw/Q5lsLO4EXowDAYDVR0TBAUwAwEB/zAKBggqhkjOPQQDAgMjADAgAg4Z +iYyBMkuTQRNvrjwyfQIOIcIQIYBVmYw+Q7W/S4E= +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp112r2/key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp112r2/key.pem new file mode 100644 index 0000000..810c4e4 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp112r2/key.pem @@ -0,0 +1,4 @@ +-----BEGIN EC PRIVATE KEY----- +MD4CAQEEDjDrkz+2aA4NAe7JC7rVoAcGBSuBBAAHoSADHgAE1x9py4g3DzR6JuyZ +0i7OPuMP04waiTc7N/Afdg== +-----END EC PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp128r1/cert.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp128r1/cert.pem new file mode 100644 index 0000000..cd615c0 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp128r1/cert.pem @@ -0,0 +1,14 @@ +-----BEGIN CERTIFICATE----- +MIICMjCCAfigAwIBAgIJAI2wNupDNRFZMAoGCCqGSM49BAMCMIGWMQswCQYDVQQG +EwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQ +MA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMMCXNn +cmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMB4X +DTIwMTAyMjE0NDIyNFoXDTIwMTEyMTE0NDIyNFowgZYxCzAJBgNVBAYTAlVZMRMw +EQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYDVQQK +DAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dyYW1wb25l +MSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wNjAQBgcqhkjO +PQIBBgUrgQQAHAMiAAR/v87xXJvdssAfKfc9n8MLfiWeXaiNu+uFBKpo9AsCZaNQ +ME4wHQYDVR0OBBYEFPePs/AV6GkKZUN8GtYIxXEO1sQeMB8GA1UdIwQYMBaAFPeP +s/AV6GkKZUN8GtYIxXEO1sQeMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDKAAw +JQIRAK89UVs/42K9r5WAgTXsL2QCEBs+Xd7hNm7c1sBuRS+a3ZQ= +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp128r1/key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp128r1/key.pem new file mode 100644 index 0000000..92e7d9f --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp128r1/key.pem @@ -0,0 +1,4 @@ +-----BEGIN EC PRIVATE KEY----- +MEQCAQEEEG9x4bBg7KZizdpHFjcfeVegBwYFK4EEAByhJAMiAAR/v87xXJvdssAf +Kfc9n8MLfiWeXaiNu+uFBKpo9AsCZQ== +-----END EC PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp128r2/cert.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp128r2/cert.pem new file mode 100644 index 0000000..47caff0 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp128r2/cert.pem @@ -0,0 +1,14 @@ +-----BEGIN CERTIFICATE----- +MIICMTCCAfigAwIBAgIJAIU74rujRO+7MAoGCCqGSM49BAMCMIGWMQswCQYDVQQG +EwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQ +MA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIc2VjdXJpdHkxEjAQBgNVBAMMCXNn +cmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMB4X +DTIwMTAyMjE0NDQwM1oXDTIwMTEyMTE0NDQwM1owgZYxCzAJBgNVBAYTAlVZMRMw +EQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYDVQQK +DAdHZW5lWHVzMREwDwYDVQQLDAhzZWN1cml0eTESMBAGA1UEAwwJc2dyYW1wb25l +MSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wNjAQBgcqhkjO +PQIBBgUrgQQAHQMiAATz7jT6U4WJan1IlIIdsYl+itgerLWbH3r3xbTwYWSQNqNQ +ME4wHQYDVR0OBBYEFKfUsmwsM2HVh7sJnUAjzaLjxyvYMB8GA1UdIwQYMBaAFKfU +smwsM2HVh7sJnUAjzaLjxyvYMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDJwAw +JAIQLkfxRgVr4RtYFhKpP1coDQIQPgTCwMEbiW7O3siC4W8qlw== +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp128r2/key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp128r2/key.pem new file mode 100644 index 0000000..6ea70a8 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp128r2/key.pem @@ -0,0 +1,4 @@ +-----BEGIN EC PRIVATE KEY----- +MEQCAQEEECsHYxweJUATsIOd/m94GgqgBwYFK4EEAB2hJAMiAATz7jT6U4WJan1I +lIIdsYl+itgerLWbH3r3xbTwYWSQNg== +-----END EC PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp160k1/cert.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp160k1/cert.pem new file mode 100644 index 0000000..2c58464 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp160k1/cert.pem @@ -0,0 +1,15 @@ +-----BEGIN CERTIFICATE----- +MIICQTCCAgCgAwIBAgIJAJvQr/6Kn9AEMAoGCCqGSM49BAMCMIGWMQswCQYDVQQG +EwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQ +MA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMMCXNn +cmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMB4X +DTIwMTAyMjE0NDUwOFoXDTIwMTEyMTE0NDUwOFowgZYxCzAJBgNVBAYTAlVZMRMw +EQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYDVQQK +DAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dyYW1wb25l +MSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wPjAQBgcqhkjO +PQIBBgUrgQQACQMqAAQLEJm85r9f32zEdedxEK6ji8N5E6tOgiSHpGhQ9BsKeOtJ +BzSYH/Rko1AwTjAdBgNVHQ4EFgQU+8wQoti+XNwIJTiyYzNVfg7eEbkwHwYDVR0j +BBgwFoAU+8wQoti+XNwIJTiyYzNVfg7eEbkwDAYDVR0TBAUwAwEB/zAKBggqhkjO +PQQDAgMvADAsAhRH2d9QVUSWbfg4WLrbBXXEsG52VwIUWkK0u60A9xtyHmDnqiMi +t9ru3Ng= +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp160k1/key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp160k1/key.pem new file mode 100644 index 0000000..a0ec571 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp160k1/key.pem @@ -0,0 +1,4 @@ +-----BEGIN EC PRIVATE KEY----- +MFACAQEEFHLvqf4Fxc7ONdu89tS75oTglJEAoAcGBSuBBAAJoSwDKgAECxCZvOa/ +X99sxHXncRCuo4vDeROrToIkh6RoUPQbCnjrSQc0mB/0ZA== +-----END EC PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp160r1/cert.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp160r1/cert.pem new file mode 100644 index 0000000..c0a68da --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp160r1/cert.pem @@ -0,0 +1,15 @@ +-----BEGIN CERTIFICATE----- +MIICQjCCAgCgAwIBAgIJAJH8eIiMmt3iMAoGCCqGSM49BAMCMIGWMQswCQYDVQQG +EwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQ +MA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMMCXNn +cmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMB4X +DTIwMTAyMjE0NDU1NVoXDTIwMTEyMTE0NDU1NVowgZYxCzAJBgNVBAYTAlVZMRMw +EQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYDVQQK +DAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dyYW1wb25l +MSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wPjAQBgcqhkjO +PQIBBgUrgQQACAMqAAQLyCGikpfFhiSU+oUv2UfLILPXnWXYmV5gQRIH1E49tJQ9 +GWPgU0TUo1AwTjAdBgNVHQ4EFgQUfP5XUebPcxDkenyF4vEjREMICmYwHwYDVR0j +BBgwFoAUfP5XUebPcxDkenyF4vEjREMICmYwDAYDVR0TBAUwAwEB/zAKBggqhkjO +PQQDAgMwADAtAhRVZXNgG/OopCO2gRHWq3Aw+mJ1wgIVAN4E243JYvle5gZkVjQ6 +0rhvrswQ +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp160r1/key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp160r1/key.pem new file mode 100644 index 0000000..1dee63d --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp160r1/key.pem @@ -0,0 +1,4 @@ +-----BEGIN EC PRIVATE KEY----- +MFACAQEEFGOJdxxxONgAj8rU9oTDJM+1xpEwoAcGBSuBBAAIoSwDKgAEC8ghopKX +xYYklPqFL9lHyyCz151l2JleYEESB9ROPbSUPRlj4FNE1A== +-----END EC PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp160r2/cert.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp160r2/cert.pem new file mode 100644 index 0000000..437df1a --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp160r2/cert.pem @@ -0,0 +1,15 @@ +-----BEGIN CERTIFICATE----- +MIICQzCCAgCgAwIBAgIJAPaJd1XqjJ4uMAoGCCqGSM49BAMCMIGWMQswCQYDVQQG +EwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQ +MA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMMCXNn +cmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMB4X +DTIwMTAyMjE0NDY1MloXDTIwMTEyMTE0NDY1MlowgZYxCzAJBgNVBAYTAlVZMRMw +EQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYDVQQK +DAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dyYW1wb25l +MSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wPjAQBgcqhkjO +PQIBBgUrgQQAHgMqAAQpQVfllcmAmd0EqO6sXPZqwHfbS4sJ3VDa22nP68QSYk3d +lJ+ucSmlo1AwTjAdBgNVHQ4EFgQUyYCINnSzVVVf7nwnpKSh491bePQwHwYDVR0j +BBgwFoAUyYCINnSzVVVf7nwnpKSh491bePQwDAYDVR0TBAUwAwEB/zAKBggqhkjO +PQQDAgMxADAuAhUA8GBT9KxSoo/g3nL8MPpHn3lKx6UCFQDXplm5HAz0zJBkn0g/ +gmW4JSSR6Q== +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp160r2/key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp160r2/key.pem new file mode 100644 index 0000000..6a365a5 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp160r2/key.pem @@ -0,0 +1,4 @@ +-----BEGIN EC PRIVATE KEY----- +MFACAQEEFOqovvoy9zGigVBu93rIAxYAKMihoAcGBSuBBAAeoSwDKgAEKUFX5ZXJ +gJndBKjurFz2asB320uLCd1Q2ttpz+vEEmJN3ZSfrnEppQ== +-----END EC PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp192k1/cert.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp192k1/cert.pem new file mode 100644 index 0000000..57f3ba7 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp192k1/cert.pem @@ -0,0 +1,15 @@ +-----BEGIN CERTIFICATE----- +MIICUjCCAgigAwIBAgIJANxj/oGgJ707MAoGCCqGSM49BAMCMIGWMQswCQYDVQQG +EwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQ +MA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMMCXNn +cmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMB4X +DTIwMTAyMjE0NDc1NFoXDTIwMTEyMTE0NDc1NFowgZYxCzAJBgNVBAYTAlVZMRMw +EQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYDVQQK +DAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dyYW1wb25l +MSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wRjAQBgcqhkjO +PQIBBgUrgQQAHwMyAASjP8fet2r3Ax0C7T8oNTFx7i4F+nAoQnSp0A4G38O9wqJb +0hDT7oeQs6/iiO2kXVSjUDBOMB0GA1UdDgQWBBQIMkaTAcQvn21tTR99e7wan48x +JDAfBgNVHSMEGDAWgBQIMkaTAcQvn21tTR99e7wan48xJDAMBgNVHRMEBTADAQH/ +MAoGCCqGSM49BAMCAzgAMDUCGHCo2k64qybPwSjWSQIWiGN837fquCRexgIZAKyE +hsl/zYrVlzAgMbt4Qaxfsc3pkCKCQg== +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp192k1/key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp192k1/key.pem new file mode 100644 index 0000000..0d87c9e --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp192k1/key.pem @@ -0,0 +1,4 @@ +-----BEGIN EC PRIVATE KEY----- +MFwCAQEEGEvH7flbJYwRGSpW5Qb9L1QTc1rwGQQzcqAHBgUrgQQAH6E0AzIABKM/ +x963avcDHQLtPyg1MXHuLgX6cChCdKnQDgbfw73ColvSENPuh5Czr+KI7aRdVA== +-----END EC PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp224k1/cert.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp224k1/cert.pem new file mode 100644 index 0000000..a542728 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp224k1/cert.pem @@ -0,0 +1,15 @@ +-----BEGIN CERTIFICATE----- +MIICYTCCAhCgAwIBAgIJALJNvSLpCWRaMAoGCCqGSM49BAMCMIGWMQswCQYDVQQG +EwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQ +MA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMMCXNn +cmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMB4X +DTIwMTAyMjE0NDg0N1oXDTIwMTEyMTE0NDg0N1owgZYxCzAJBgNVBAYTAlVZMRMw +EQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYDVQQK +DAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dyYW1wb25l +MSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wTjAQBgcqhkjO +PQIBBgUrgQQAIAM6AARtlgnnpFXkUZb2RyNFzhvrvZtERFdWdmvl1gYM6OnOTGt8 +XJ9GhGV5ZB7l5D87HMgnodtFAQGsfKNQME4wHQYDVR0OBBYEFIWzauR5vkw8KfU8 +PvcA6ymopOBDMB8GA1UdIwQYMBaAFIWzauR5vkw8KfU8PvcA6ymopOBDMAwGA1Ud +EwQFMAMBAf8wCgYIKoZIzj0EAwIDPwAwPAIcHWOdtOdNa4UeXZF6mpFgN9+OQ/0F +A88TjQoyuQIcS8pFpDjFBcqvg3sNQC2/kAiZstKluUecgTiTqQ== +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp224k1/key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp224k1/key.pem new file mode 100644 index 0000000..79ad442 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp224k1/key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MGgCAQEEHJIv5O4agM+/PUqRvFbUsLOmvV6r04pV8dhsklKgBwYFK4EEACChPAM6 +AARtlgnnpFXkUZb2RyNFzhvrvZtERFdWdmvl1gYM6OnOTGt8XJ9GhGV5ZB7l5D87 +HMgnodtFAQGsfA== +-----END EC PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp224r1/cert.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp224r1/cert.pem new file mode 100644 index 0000000..2ef1307 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp224r1/cert.pem @@ -0,0 +1,15 @@ +-----BEGIN CERTIFICATE----- +MIICYzCCAhCgAwIBAgIJAN4gvru+0uLmMAoGCCqGSM49BAMCMIGWMQswCQYDVQQG +EwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQ +MA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMMCXNn +cmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMB4X +DTIwMTAyMjE0NTAwMFoXDTIwMTEyMTE0NTAwMFowgZYxCzAJBgNVBAYTAlVZMRMw +EQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYDVQQK +DAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dyYW1wb25l +MSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wTjAQBgcqhkjO +PQIBBgUrgQQAIQM6AAQpxUjbbBKK0rQj3AKSMtPuZyonJVCGJgIM+bHwFNjvDkyn +6c1RUzzt9ov3aav0vEMImIvfNKNA36NQME4wHQYDVR0OBBYEFNMbbqagCEI02eI+ +dBZIy13PDg71MB8GA1UdIwQYMBaAFNMbbqagCEI02eI+dBZIy13PDg71MAwGA1Ud +EwQFMAMBAf8wCgYIKoZIzj0EAwIDQQAwPgIdAI7PXFlm4E4OnXSRW9TpIZHtYuOE +2vndHyyXhjUCHQDVFQe8ZmFdRBzcAt+XvstfcL1w9PhFrWd64gdd +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp224r1/key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp224r1/key.pem new file mode 100644 index 0000000..44bf9c6 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp224r1/key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MGgCAQEEHL9OzgYSV+mjLmMzO4lIT3qq5LwnNVz75IrUNxWgBwYFK4EEACGhPAM6 +AAQpxUjbbBKK0rQj3AKSMtPuZyonJVCGJgIM+bHwFNjvDkyn6c1RUzzt9ov3aav0 +vEMImIvfNKNA3w== +-----END EC PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp256k1/cert.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp256k1/cert.pem new file mode 100644 index 0000000..2f9213a --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp256k1/cert.pem @@ -0,0 +1,16 @@ +-----BEGIN CERTIFICATE----- +MIICczCCAhigAwIBAgIJAN0eDgzuE3Q+MAoGCCqGSM49BAMCMIGWMQswCQYDVQQG +EwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQ +MA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMMCXNn +cmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMB4X +DTIwMTAyMjE0NTEyOVoXDTIwMTEyMTE0NTEyOVowgZYxCzAJBgNVBAYTAlVZMRMw +EQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYDVQQK +DAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dyYW1wb25l +MSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wVjAQBgcqhkjO +PQIBBgUrgQQACgNCAASbHtnkBpXWOCmdEtm9lcm8gu4Xf2CVNeOcLzXXSNrfF7Y4 +c/B5igk2a2CeJvZjvRoPuwRHwSPGrx69+nOvV4Uto1AwTjAdBgNVHQ4EFgQU81Xs +n+jRqAagYRgyAW6//+Q5NSIwHwYDVR0jBBgwFoAU81Xsn+jRqAagYRgyAW6//+Q5 +NSIwDAYDVR0TBAUwAwEB/zAKBggqhkjOPQQDAgNJADBGAiEAgVvjyi1awrmm3hn8 +10V9ayuiN+YwKcz3ptdP/3SRtpsCIQCsoD/mGQ1EB+zlLxWKlSJKTwQZqgX1DjlY +v8PqnkOGYw== +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp256k1/key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp256k1/key.pem new file mode 100644 index 0000000..08413d6 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp256k1/key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHQCAQEEIIMO7rs2rgAnlbhHK6nYgliJtPywbvGjkQM0FV9dB7ZwoAcGBSuBBAAK +oUQDQgAEmx7Z5AaV1jgpnRLZvZXJvILuF39glTXjnC8110ja3xe2OHPweYoJNmtg +nib2Y70aD7sER8Ejxq8evfpzr1eFLQ== +-----END EC PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp384r1/cert.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp384r1/cert.pem new file mode 100644 index 0000000..615c9ec --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp384r1/cert.pem @@ -0,0 +1,17 @@ +-----BEGIN CERTIFICATE----- +MIICsjCCAjigAwIBAgIJAOA2ufFH/f0PMAoGCCqGSM49BAMCMIGWMQswCQYDVQQG +EwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQ +MA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMMCXNn +cmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMB4X +DTIwMTAyMjE0NTIyNVoXDTIwMTEyMTE0NTIyNVowgZYxCzAJBgNVBAYTAlVZMRMw +EQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYDVQQK +DAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dyYW1wb25l +MSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wdjAQBgcqhkjO +PQIBBgUrgQQAIgNiAATae08yJKjgrKezOWFrYla81C+p8BGu7k1bwKPJSs5tqFVk +WLSuY18YBY2j0WGyqDU4ZgxgoFEtR4FJ0pVbepH1lmbzg5GJK7oDOzBvQHN9btp7 +3FFhdLvY6KvI9bX/iPWjUDBOMB0GA1UdDgQWBBRfFM2YaATdppf2Z2lMfcBsaLZZ +azAfBgNVHSMEGDAWgBRfFM2YaATdppf2Z2lMfcBsaLZZazAMBgNVHRMEBTADAQH/ +MAoGCCqGSM49BAMCA2gAMGUCMBf0N3wKHoId9P5vi6eYBHwiFmxI7wdk62GQHH8e +egzXXfC6K7Oz0qsEsW//HbARvwIxAOt+jRsgzlPznaQ5QlT8OI1yjHggYUFZMG14 +AtFmnlAB9Vcd1qAll/Ldde8yjEwSQQ== +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp384r1/key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp384r1/key.pem new file mode 100644 index 0000000..7522e9e --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp384r1/key.pem @@ -0,0 +1,6 @@ +-----BEGIN EC PRIVATE KEY----- +MIGkAgEBBDBcgw54gCpUOZaiwzTn0harkndq+yamzj0h2iMLszg1uYDGPtCK2MLM ++0OtZdOOsQ6gBwYFK4EEACKhZANiAATae08yJKjgrKezOWFrYla81C+p8BGu7k1b +wKPJSs5tqFVkWLSuY18YBY2j0WGyqDU4ZgxgoFEtR4FJ0pVbepH1lmbzg5GJK7oD +OzBvQHN9btp73FFhdLvY6KvI9bX/iPU= +-----END EC PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp521r1/cert.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp521r1/cert.pem new file mode 100644 index 0000000..03368c1 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp521r1/cert.pem @@ -0,0 +1,19 @@ +-----BEGIN CERTIFICATE----- +MIIC/TCCAl6gAwIBAgIJANrhA1igCab0MAoGCCqGSM49BAMCMIGWMQswCQYDVQQG +EwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQ +MA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMMCXNn +cmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMB4X +DTIwMTAyMjE0NTMyM1oXDTIwMTEyMTE0NTMyM1owgZYxCzAJBgNVBAYTAlVZMRMw +EQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYDVQQK +DAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dyYW1wb25l +MSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wgZswEAYHKoZI +zj0CAQYFK4EEACMDgYYABAFIrNa9taEbntNUmN+0T2hXJPLXrIAFYM1OQyafX1LU +ymjJn9ckveDBWX+xuZU4MXedMFi3Pnrahmxv4KmsvFVpYABI7tSQnrpP89AAIhT5 +JUYXqD/rTV5wR8Wi5f/Bfv3kGTc1jkRZgsXx2B6lhNTADLQhC7FoIgYtM/iog3Mk +MhrNRqNQME4wHQYDVR0OBBYEFIcdUC0QZJCOYsZ5JSIkKCKRp47pMB8GA1UdIwQY +MBaAFIcdUC0QZJCOYsZ5JSIkKCKRp47pMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0E +AwIDgYwAMIGIAkIBKcuPAkfghz8XzMVzSiHtl6Iyry1qoOu+QSbKpzPCUBXdCKim +M9cX5m6QZjAHbBT/g+7RMBRKMFnL40nx7vqfCdgCQgGBvFxW0vHpGEW5GddT4nqu +Dt2mWTe3oj8gJN1HVG8ZR+ynyxZp0/ej5CsSGreUKmz4Dkk5JQvrTbJIH28My9GO +fg== +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp521r1/key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp521r1/key.pem new file mode 100644 index 0000000..72c7513 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/secp521r1/key.pem @@ -0,0 +1,7 @@ +-----BEGIN EC PRIVATE KEY----- +MIHcAgEBBEIBSzfdYfFF7DOL+FCvnczjBdOa877Y5oLQ1wdMPYTGFw6GCfAvHO4/ +SJ8lpGE6gPHtYBE69amMhghrtzrrtwjRAkugBwYFK4EEACOhgYkDgYYABAFIrNa9 +taEbntNUmN+0T2hXJPLXrIAFYM1OQyafX1LUymjJn9ckveDBWX+xuZU4MXedMFi3 +Pnrahmxv4KmsvFVpYABI7tSQnrpP89AAIhT5JUYXqD/rTV5wR8Wi5f/Bfv3kGTc1 +jkRZgsXx2B6lhNTADLQhC7FoIgYtM/iog3MkMhrNRg== +-----END EC PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect113r1/cert.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect113r1/cert.pem new file mode 100644 index 0000000..6635252 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect113r1/cert.pem @@ -0,0 +1,14 @@ +-----BEGIN CERTIFICATE----- +MIICLDCCAfagAwIBAgIJAL5sKl7Iq8jkMAoGCCqGSM49BAMCMIGWMQswCQYDVQQG +EwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQ +MA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMMCXNn +cmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMB4X +DTIwMTAyMjE1MDgwNloXDTIwMTEyMTE1MDgwNlowgZYxCzAJBgNVBAYTAlVZMRMw +EQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYDVQQK +DAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dyYW1wb25l +MSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wNDAQBgcqhkjO +PQIBBgUrgQQABAMgAAQBEpYAjSZ9OQLSAO/vaqkBjv0f0Q5CwjvfjAedBmijUDBO +MB0GA1UdDgQWBBQIsI5HcJVN0ZHGx3aM5UHoUN7UmTAfBgNVHSMEGDAWgBQIsI5H +cJVN0ZHGx3aM5UHoUN7UmTAMBgNVHRMEBTADAQH/MAoGCCqGSM49BAMCAyQAMCEC +Dn7E4/gSNWOLefIp8MKeAg8Aiot3vwQj3xu28d0DjbQ= +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect113r1/key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect113r1/key.pem new file mode 100644 index 0000000..9cc2a50 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect113r1/key.pem @@ -0,0 +1,4 @@ +-----BEGIN EC PRIVATE KEY----- +MEECAQEEDwAwtkZqc/5nr/PCe97A1qAHBgUrgQQABKEiAyAABAESlgCNJn05AtIA +7+9qqQGO/R/RDkLCO9+MB50GaA== +-----END EC PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect113r2/cert.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect113r2/cert.pem new file mode 100644 index 0000000..c6daef8 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect113r2/cert.pem @@ -0,0 +1,14 @@ +-----BEGIN CERTIFICATE----- +MIICKzCCAfagAwIBAgIJAMNN6I9Pgx7tMAoGCCqGSM49BAMCMIGWMQswCQYDVQQG +EwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQ +MA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMMCXNn +cmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMB4X +DTIwMTAyMjE1MDg1N1oXDTIwMTEyMTE1MDg1N1owgZYxCzAJBgNVBAYTAlVZMRMw +EQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYDVQQK +DAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dyYW1wb25l +MSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wNDAQBgcqhkjO +PQIBBgUrgQQABQMgAAQA3h7Lgx9NCHgBNaZriz0AFuAYhDucrO0SDJ+OWgqjUDBO +MB0GA1UdDgQWBBRMr+I8KUs2DBVsEY0U3Geojo+nxTAfBgNVHSMEGDAWgBRMr+I8 +KUs2DBVsEY0U3Geojo+nxTAMBgNVHRMEBTADAQH/MAoGCCqGSM49BAMCAyMAMCAC +DhTJ0XX2cvmqM1qqGSM8Ag4GMO1fVxxNAQ6ZW6iPlw== +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect113r2/key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect113r2/key.pem new file mode 100644 index 0000000..7cf6c7f --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect113r2/key.pem @@ -0,0 +1,4 @@ +-----BEGIN EC PRIVATE KEY----- +MEECAQEEDwDiFe3sPBeN9onjAAhYdKAHBgUrgQQABaEiAyAABADeHsuDH00IeAE1 +pmuLPQAW4BiEO5ys7RIMn45aCg== +-----END EC PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect131r1/cert.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect131r1/cert.pem new file mode 100644 index 0000000..f4bac31 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect131r1/cert.pem @@ -0,0 +1,14 @@ +-----BEGIN CERTIFICATE----- +MIICNTCCAfqgAwIBAgIJANNcx1nzXZLWMAoGCCqGSM49BAMCMIGWMQswCQYDVQQG +EwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQ +MA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMMCXNn +cmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMB4X +DTIwMTAyMjE1MTAxOFoXDTIwMTEyMTE1MTAxOFowgZYxCzAJBgNVBAYTAlVZMRMw +EQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYDVQQK +DAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dyYW1wb25l +MSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wODAQBgcqhkjO +PQIBBgUrgQQAFgMkAAQCcOcbzeJwOSCTTvyK0Z2GkgTm3EY7aBUycoOBPawtRDhy +o1AwTjAdBgNVHQ4EFgQUwFMGKdRexG0/u7nTHw5050Qh0n0wHwYDVR0jBBgwFoAU +wFMGKdRexG0/u7nTHw5050Qh0n0wDAYDVR0TBAUwAwEB/zAKBggqhkjOPQQDAgMp +ADAmAhEB3KkGwm/YMhYm+MpD1TavxgIRAiQBTlFeTnay2NHmpK7hmzE= +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect131r1/key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect131r1/key.pem new file mode 100644 index 0000000..ba133cd --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect131r1/key.pem @@ -0,0 +1,4 @@ +-----BEGIN EC PRIVATE KEY----- +MEcCAQEEEQBOAyh6q3g/f9sFVsKog5RUoAcGBSuBBAAWoSYDJAAEAnDnG83icDkg +k078itGdhpIE5txGO2gVMnKDgT2sLUQ4cg== +-----END EC PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect131r2/cert.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect131r2/cert.pem new file mode 100644 index 0000000..d9c5a3d --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect131r2/cert.pem @@ -0,0 +1,14 @@ +-----BEGIN CERTIFICATE----- +MIICNTCCAfqgAwIBAgIJANJ93q3SQtXBMAoGCCqGSM49BAMCMIGWMQswCQYDVQQG +EwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQ +MA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMMCXNn +cmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMB4X +DTIwMTAyMjE1MTExN1oXDTIwMTEyMTE1MTExN1owgZYxCzAJBgNVBAYTAlVZMRMw +EQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYDVQQK +DAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dyYW1wb25l +MSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wODAQBgcqhkjO +PQIBBgUrgQQAFwMkAAQCydPn7i1Lhr49TTFrj1nNoQQ+DRDvlu8dIFGOxCpY6MNu +o1AwTjAdBgNVHQ4EFgQUiDYSpxQhTNV4+egsyOBlj28ADhEwHwYDVR0jBBgwFoAU +iDYSpxQhTNV4+egsyOBlj28ADhEwDAYDVR0TBAUwAwEB/zAKBggqhkjOPQQDAgMp +ADAmAhECD9yv8NJ2NXNs1L2CflgIlQIRA6jhfCKDO2+aH+GJ4aIKwyI= +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect131r2/key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect131r2/key.pem new file mode 100644 index 0000000..c04e84b --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect131r2/key.pem @@ -0,0 +1,4 @@ +-----BEGIN EC PRIVATE KEY----- +MEcCAQEEEQGitFeh/q5Bd6Fl0spJATLXoAcGBSuBBAAXoSYDJAAEAsnT5+4tS4a+ +PU0xa49ZzaEEPg0Q75bvHSBRjsQqWOjDbg== +-----END EC PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect163k1/cert.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect163k1/cert.pem new file mode 100644 index 0000000..e0ea053 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect163k1/cert.pem @@ -0,0 +1,15 @@ +-----BEGIN CERTIFICATE----- +MIICRTCCAgKgAwIBAgIJAMpwQdqL0//YMAoGCCqGSM49BAMCMIGWMQswCQYDVQQG +EwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQ +MA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMMCXNn +cmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMB4X +DTIwMTAyMjE1MTIyM1oXDTIwMTEyMTE1MTIyM1owgZYxCzAJBgNVBAYTAlVZMRMw +EQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYDVQQK +DAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dyYW1wb25l +MSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wQDAQBgcqhkjO +PQIBBgUrgQQAAQMsAAQBBX+LfbEN3kjzQI0yDAVfXvZ5JP0D3SNSoJFvIFna9Kmo +rQBk3xrznKyjUDBOMB0GA1UdDgQWBBQ6ZLIH+eDn2Srt67oMvHGi+CVT8TAfBgNV +HSMEGDAWgBQ6ZLIH+eDn2Srt67oMvHGi+CVT8TAMBgNVHRMEBTADAQH/MAoGCCqG +SM49BAMCAzEAMC4CFQIaF/tE/zZUim/u1vmMQlKyiDeEQAIVAs3dJwTIMu5QSRDl +2md4d61sgUO2 +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect163k1/key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect163k1/key.pem new file mode 100644 index 0000000..7f2b6f7 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect163k1/key.pem @@ -0,0 +1,4 @@ +-----BEGIN EC PRIVATE KEY----- +MFMCAQEEFQMaGNiMTTaHkdQnlq5G2kgtKRDk06AHBgUrgQQAAaEuAywABAEFf4t9 +sQ3eSPNAjTIMBV9e9nkk/QPdI1KgkW8gWdr0qaitAGTfGvOcrA== +-----END EC PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect163r1/cert.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect163r1/cert.pem new file mode 100644 index 0000000..071d01a --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect163r1/cert.pem @@ -0,0 +1,15 @@ +-----BEGIN CERTIFICATE----- +MIICRTCCAgKgAwIBAgIJAIC8+09qOXM2MAoGCCqGSM49BAMCMIGWMQswCQYDVQQG +EwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQ +MA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMMCXNn +cmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMB4X +DTIwMTAyMjE1MTMxM1oXDTIwMTEyMTE1MTMxM1owgZYxCzAJBgNVBAYTAlVZMRMw +EQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYDVQQK +DAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dyYW1wb25l +MSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wQDAQBgcqhkjO +PQIBBgUrgQQAAgMsAAQFpP35QxbjDHe1kPszsnSjaL+tRFYFZW8RjhqrgizMpHeL +WfMUH0QNmM6jUDBOMB0GA1UdDgQWBBSk2iggGMFDKY/7T2f+MV59VMlnXjAfBgNV +HSMEGDAWgBSk2iggGMFDKY/7T2f+MV59VMlnXjAMBgNVHRMEBTADAQH/MAoGCCqG +SM49BAMCAzEAMC4CFQCSAsb2jcsuDpr5W6EnzPxKadt4lQIVAvxzmJ7ikMmzigHf +7FBKYA+8xSo3 +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect163r1/key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect163r1/key.pem new file mode 100644 index 0000000..a0b2856 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect163r1/key.pem @@ -0,0 +1,4 @@ +-----BEGIN EC PRIVATE KEY----- +MFMCAQEEFQBEnygypbtFl7xgroFi/mVboaq2Q6AHBgUrgQQAAqEuAywABAWk/flD +FuMMd7WQ+zOydKNov61EVgVlbxGOGquCLMykd4tZ8xQfRA2Yzg== +-----END EC PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect163r2/cert.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect163r2/cert.pem new file mode 100644 index 0000000..612441d --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect163r2/cert.pem @@ -0,0 +1,15 @@ +-----BEGIN CERTIFICATE----- +MIICRTCCAgKgAwIBAgIJAJFNe3QpRjZmMAoGCCqGSM49BAMCMIGWMQswCQYDVQQG +EwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQ +MA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMMCXNn +cmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMB4X +DTIwMTAyMjE1MTQwMFoXDTIwMTEyMTE1MTQwMFowgZYxCzAJBgNVBAYTAlVZMRMw +EQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYDVQQK +DAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dyYW1wb25l +MSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wQDAQBgcqhkjO +PQIBBgUrgQQADwMsAAQDEza9nc8/IUYau8pWdRy7tG7Ck20DEUNxjH6h+pOdlHWF +fpSTrIv48zijUDBOMB0GA1UdDgQWBBQeepan2NkEHH6TY559jbjV9xLrdjAfBgNV +HSMEGDAWgBQeepan2NkEHH6TY559jbjV9xLrdjAMBgNVHRMEBTADAQH/MAoGCCqG +SM49BAMCAzEAMC4CFQN+SQM1YCoMTMHXw4BO/149IkIhXgIVASXZ2wQ9NxFFvhYe +RD/zGsmg7yJV +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect163r2/key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect163r2/key.pem new file mode 100644 index 0000000..a34c229 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect163r2/key.pem @@ -0,0 +1,4 @@ +-----BEGIN EC PRIVATE KEY----- +MFMCAQEEFQPZFl1yy3/pJlhIcNZaZOFijgsOg6AHBgUrgQQAD6EuAywABAMTNr2d +zz8hRhq7ylZ1HLu0bsKTbQMRQ3GMfqH6k52UdYV+lJOsi/jzOA== +-----END EC PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect193r1/cert.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect193r1/cert.pem new file mode 100644 index 0000000..0ff9c2d --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect193r1/cert.pem @@ -0,0 +1,15 @@ +-----BEGIN CERTIFICATE----- +MIICVDCCAgqgAwIBAgIJAIPN0o2PBrhtMAoGCCqGSM49BAMCMIGWMQswCQYDVQQG +EwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQ +MA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMMCXNn +cmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMB4X +DTIwMTAyMjE1MTQ1NVoXDTIwMTEyMTE1MTQ1NVowgZYxCzAJBgNVBAYTAlVZMRMw +EQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYDVQQK +DAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dyYW1wb25l +MSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wSDAQBgcqhkjO +PQIBBgUrgQQAGAM0AAQA0JZLmrPHzELd7WVjNgfT8TogrvLOUldfANabpxYF8/eX +zthXSodu5kWi7ozH/UDg26NQME4wHQYDVR0OBBYEFKD5gPHdZrkmo/5/cSIt+x0w +AoHeMB8GA1UdIwQYMBaAFKD5gPHdZrkmo/5/cSIt+x0wAoHeMAwGA1UdEwQFMAMB +Af8wCgYIKoZIzj0EAwIDOAAwNQIZAJY0u7WJFAW/zqGOo60K/gmthXO1Gq1YYAIY +fzCXoCk/nq5PgqpeLb+mPpUH+6We2aZw +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect193r1/key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect193r1/key.pem new file mode 100644 index 0000000..8d6c5d2 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect193r1/key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MF8CAQEEGQDEpj0Addq/hksOJ5jyEUiB8tW3jW4Mym6gBwYFK4EEABihNgM0AAQA +0JZLmrPHzELd7WVjNgfT8TogrvLOUldfANabpxYF8/eXzthXSodu5kWi7ozH/UDg +2w== +-----END EC PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect193r2/cert.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect193r2/cert.pem new file mode 100644 index 0000000..e82bf07 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect193r2/cert.pem @@ -0,0 +1,15 @@ +-----BEGIN CERTIFICATE----- +MIICVDCCAgqgAwIBAgIJAIsy4po8nicaMAoGCCqGSM49BAMCMIGWMQswCQYDVQQG +EwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQ +MA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMMCXNn +cmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMB4X +DTIwMTAyMjE1MTU0NloXDTIwMTEyMTE1MTU0NlowgZYxCzAJBgNVBAYTAlVZMRMw +EQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYDVQQK +DAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dyYW1wb25l +MSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wSDAQBgcqhkjO +PQIBBgUrgQQAGQM0AAQBLDTOZYv87ZapRBUFnH8fnHidKXAJQjObADpiQOHnYrOW +Yu8Bi5hWbo81YbJYuuZRqKNQME4wHQYDVR0OBBYEFIjWyc9dRLeWWC1Xdxvy0/nf +WjJgMB8GA1UdIwQYMBaAFIjWyc9dRLeWWC1Xdxvy0/nfWjJgMAwGA1UdEwQFMAMB +Af8wCgYIKoZIzj0EAwIDOAAwNQIYYW8izB1yebPALdfGdrrpexkEtoUgrnfYAhkA +qEN64B8Uu4Sgyt2n5q1wdLIk0N7KGSVo +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect193r2/key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect193r2/key.pem new file mode 100644 index 0000000..884b0ed --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect193r2/key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MF8CAQEEGQCM6ZdxFCNYoZC6v/pFM9E9U+Ia5CWgiW6gBwYFK4EEABmhNgM0AAQB +LDTOZYv87ZapRBUFnH8fnHidKXAJQjObADpiQOHnYrOWYu8Bi5hWbo81YbJYuuZR +qA== +-----END EC PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect233k1/cert.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect233k1/cert.pem new file mode 100644 index 0000000..eb907ad --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect233k1/cert.pem @@ -0,0 +1,15 @@ +-----BEGIN CERTIFICATE----- +MIICZzCCAhSgAwIBAgIJAIqBAN/vykOnMAoGCCqGSM49BAMCMIGWMQswCQYDVQQG +EwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQ +MA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMMCXNn +cmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMB4X +DTIwMTAyMjE1MTY1OFoXDTIwMTEyMTE1MTY1OFowgZYxCzAJBgNVBAYTAlVZMRMw +EQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYDVQQK +DAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dyYW1wb25l +MSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wUjAQBgcqhkjO +PQIBBgUrgQQAGgM+AAQAPQJFkJ85j1aDkOXUwBmqwxZtm1FFwfNuLLUSfT8Azkg5 +r8Sw4iOppUQBEYrvS/vX3QAW3rshbHbTi+GjUDBOMB0GA1UdDgQWBBQ9dFowA7MS +ek1kvlxFBhJyN6A20zAfBgNVHSMEGDAWgBQ9dFowA7MSek1kvlxFBhJyN6A20zAM +BgNVHRMEBTADAQH/MAoGCCqGSM49BAMCA0EAMD4CHTus0DMwtjp33sdqnvAFvhHX +LfK/bOpUdJesnyrQAh16OG8B82qSRmezAuYrIlb/lPxq46108IHAC3IJEg== +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect233k1/key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect233k1/key.pem new file mode 100644 index 0000000..e2198bc --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect233k1/key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MG4CAQEEHgASBahnBzmUom0nHjtNYzDSBRAS17Ft+Wj5LYigu6AHBgUrgQQAGqFA +Az4ABAA9AkWQnzmPVoOQ5dTAGarDFm2bUUXB824stRJ9PwDOSDmvxLDiI6mlRAER +iu9L+9fdABbeuyFsdtOL4Q== +-----END EC PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect233r1/cert.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect233r1/cert.pem new file mode 100644 index 0000000..43207a1 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect233r1/cert.pem @@ -0,0 +1,15 @@ +-----BEGIN CERTIFICATE----- +MIICaDCCAhSgAwIBAgIJAOZZczaUyKqZMAoGCCqGSM49BAMCMIGWMQswCQYDVQQG +EwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQ +MA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMMCXNn +cmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMB4X +DTIwMTAyMjE1MTc0OFoXDTIwMTEyMTE1MTc0OFowgZYxCzAJBgNVBAYTAlVZMRMw +EQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYDVQQK +DAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dyYW1wb25l +MSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wUjAQBgcqhkjO +PQIBBgUrgQQAGwM+AAQAk8GNL6xAOg6Ej4ZjB5frkUsoiJiDJxaLZShuYdoBS1+3 +7ePxfktwHYIQb7k7PTeA3v8e/06dP3sTIeejUDBOMB0GA1UdDgQWBBRYWTfingrT ++TDrviIuvBa/HLh7dTAfBgNVHSMEGDAWgBRYWTfingrT+TDrviIuvBa/HLh7dTAM +BgNVHRMEBTADAQH/MAoGCCqGSM49BAMCA0IAMD8CHWbqCcCh1eVfPQhG55Z7JNLC +XbqaO/u4Q3nqrP9VAh4A0/0/3MFjbllIpZCi2+vrZZyQahsuJsFQThjJPUc= +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect233r1/key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect233r1/key.pem new file mode 100644 index 0000000..cfd5e53 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect233r1/key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MG4CAQEEHgBI7iWVrG26ChBOlrbDdAAapO+ze9kdq6vmqz3S3qAHBgUrgQQAG6FA +Az4ABACTwY0vrEA6DoSPhmMHl+uRSyiImIMnFotlKG5h2gFLX7ft4/F+S3AdghBv +uTs9N4De/x7/Tp0/exMh5w== +-----END EC PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect239k1/cert.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect239k1/cert.pem new file mode 100644 index 0000000..4f59e42 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect239k1/cert.pem @@ -0,0 +1,15 @@ +-----BEGIN CERTIFICATE----- +MIICaTCCAhSgAwIBAgIJAJt5DxyKc44/MAoGCCqGSM49BAMCMIGWMQswCQYDVQQG +EwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQ +MA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMMCXNn +cmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMB4X +DTIwMTAyMjE1MTgyOVoXDTIwMTEyMTE1MTgyOVowgZYxCzAJBgNVBAYTAlVZMRMw +EQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYDVQQK +DAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dyYW1wb25l +MSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wUjAQBgcqhkjO +PQIBBgUrgQQAAwM+AAR3K2Do0rh9XhKuZMbhbftCleoC2SuxpVQjloQoagdjt0WM +K+7IC2Y/l0W66e3cvU7RhMNgxtQX8VbL0/ajUDBOMB0GA1UdDgQWBBQN+bCZYp93 +zSam3FJBjpJqoOD3azAfBgNVHSMEGDAWgBQN+bCZYp93zSam3FJBjpJqoOD3azAM +BgNVHRMEBTADAQH/MAoGCCqGSM49BAMCA0MAMEACHg9jdB/ZVaGB2HsLUCsubw9z +jcreyoOVPmQ8n/UINgIeFaCy3nPaOcK81k4KdL26M3xBLmbVpIEiN6M4QkOR +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect239k1/key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect239k1/key.pem new file mode 100644 index 0000000..f1183a1 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect239k1/key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MG4CAQEEHgzxvbR4+m7TlLj1S4eHcATA0/55SVI7bzenQ3y2k6AHBgUrgQQAA6FA +Az4ABHcrYOjSuH1eEq5kxuFt+0KV6gLZK7GlVCOWhChqB2O3RYwr7sgLZj+XRbrp +7dy9TtGEw2DG1BfxVsvT9g== +-----END EC PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect283k1/cert.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect283k1/cert.pem new file mode 100644 index 0000000..e8bdec8 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect283k1/cert.pem @@ -0,0 +1,16 @@ +-----BEGIN CERTIFICATE----- +MIICgTCCAiCgAwIBAgIJANV8vUHzt/gfMAoGCCqGSM49BAMCMIGWMQswCQYDVQQG +EwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQ +MA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMMCXNn +cmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMB4X +DTIwMTAyMjE1MTkxN1oXDTIwMTEyMTE1MTkxN1owgZYxCzAJBgNVBAYTAlVZMRMw +EQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYDVQQK +DAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dyYW1wb25l +MSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wXjAQBgcqhkjO +PQIBBgUrgQQAEANKAAQEt08NmTcK5jToT8DDxo2AC4wAjT9DihThZASWZNLaF5Ia +SDoH9LpfH0/18IJfhKkH9Q0iHhRdoyJ8Ys8LS6Ebp1omVZ/neOujUDBOMB0GA1Ud +DgQWBBSZ9eFeNdrsiKvABdOLIw1ZGO9hDTAfBgNVHSMEGDAWgBSZ9eFeNdrsiKvA +BdOLIw1ZGO9hDTAMBgNVHRMEBTADAQH/MAoGCCqGSM49BAMCA08AMEwCJAE468S8 +jL2CUspQnZjGuyV9YLOVDm9lJhpf3eETuRkiGp36wgIkAcIRD7hwu9mA879Zxyjo +57hduLsAInF9OKcVPvHef5NIIvw3 +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect283k1/key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect283k1/key.pem new file mode 100644 index 0000000..8db20c0 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect283k1/key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MIGAAgEBBCQABejkh9MyjuLMoB+4lhNsZY6zX4wPTaB/QMG6wiSvK3FY1NCgBwYF +K4EEABChTANKAAQEt08NmTcK5jToT8DDxo2AC4wAjT9DihThZASWZNLaF5IaSDoH +9LpfH0/18IJfhKkH9Q0iHhRdoyJ8Ys8LS6Ebp1omVZ/neOs= +-----END EC PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect283r1/cert.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect283r1/cert.pem new file mode 100644 index 0000000..5ba16ec --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect283r1/cert.pem @@ -0,0 +1,16 @@ +-----BEGIN CERTIFICATE----- +MIICgTCCAiCgAwIBAgIJALD6GldxMmiwMAoGCCqGSM49BAMCMIGWMQswCQYDVQQG +EwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQ +MA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMMCXNn +cmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMB4X +DTIwMTAyMjE1MjAwN1oXDTIwMTEyMTE1MjAwN1owgZYxCzAJBgNVBAYTAlVZMRMw +EQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYDVQQK +DAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dyYW1wb25l +MSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wXjAQBgcqhkjO +PQIBBgUrgQQAEQNKAAQACZsqFUAt3up+IFvxm2FDO22HzStP7FMYuQFeikrM4vf3 +uTgABX2PafdR9olCgAg91yO4Lyx7hfWx+DOPQ4wXNRkSBHYwcGWjUDBOMB0GA1Ud +DgQWBBS6z8nzFc4Hk/D6qz2QK0JJNeGeXDAfBgNVHSMEGDAWgBS6z8nzFc4Hk/D6 +qz2QK0JJNeGeXDAMBgNVHRMEBTADAQH/MAoGCCqGSM49BAMCA08AMEwCJAIW8YoW +vjlCf3G16w04gXROim6P1Msh8pPp/cuoI6TWUonuUgIkALj8362+OsUO9GVmimag ++WnUOn45tFHNTC6xerBRou+XkWS6 +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect283r1/key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect283r1/key.pem new file mode 100644 index 0000000..608524e --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect283r1/key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MIGAAgEBBCQBKzqJvRt2A+mVHb8GBF43bh6GfwgcctW6C8uOgi1ADDbJHamgBwYF +K4EEABGhTANKAAQACZsqFUAt3up+IFvxm2FDO22HzStP7FMYuQFeikrM4vf3uTgA +BX2PafdR9olCgAg91yO4Lyx7hfWx+DOPQ4wXNRkSBHYwcGU= +-----END EC PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect409k1/cert.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect409k1/cert.pem new file mode 100644 index 0000000..06e4508 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect409k1/cert.pem @@ -0,0 +1,17 @@ +-----BEGIN CERTIFICATE----- +MIICvzCCAkCgAwIBAgIJAIxgju4sd/azMAoGCCqGSM49BAMCMIGWMQswCQYDVQQG +EwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQ +MA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMMCXNn +cmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMB4X +DTIwMTAyMjE1MjA1OFoXDTIwMTEyMTE1MjA1OFowgZYxCzAJBgNVBAYTAlVZMRMw +EQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYDVQQK +DAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dyYW1wb25l +MSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wfjAQBgcqhkjO +PQIBBgUrgQQAJANqAAQA8iSEjTOsbjMPlrxUzPFUP2kMlf/JP0OiB1rYyhuV7p0Z +CmdnEmxGAr9AKkznaC8hl6bOAVudYbsqzkiAcvrT1Rh5CFp7tRFF5XBjJPX8YYFW +lpb8qPDF6upAtcUl36iYHFHQ6jHWO6NQME4wHQYDVR0OBBYEFK+/ZwVR/A0TT9m4 +j4PEVNFAWRJ4MB8GA1UdIwQYMBaAFK+/ZwVR/A0TT9m4j4PEVNFAWRJ4MAwGA1Ud +EwQFMAMBAf8wCgYIKoZIzj0EAwIDbQAwagIzIaQU+0cJ/TuTlyUZVqjKtiIWH09q +aioQrosrAftXIGIpVMYZBgHN2YTWS4b1a+imFyfWAjMRuJMnSCfPj1AlVoJjsFsO +Xaho0SKTov+ztehutwwb9t/aJ7gHOKVlCxgobmPj+dTnCBM= +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect409k1/key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect409k1/key.pem new file mode 100644 index 0000000..aa4769d --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect409k1/key.pem @@ -0,0 +1,6 @@ +-----BEGIN EC PRIVATE KEY----- +MIGwAgEBBDQAH3gL1ntP25XVN/bWZt57jYmM3NV2wyAiwv/G1P9CPTccP1Xqv6K6 +zqk0GipFIQimXxWToAcGBSuBBAAkoWwDagAEAPIkhI0zrG4zD5a8VMzxVD9pDJX/ +yT9Dogda2Moble6dGQpnZxJsRgK/QCpM52gvIZemzgFbnWG7Ks5IgHL609UYeQha +e7URReVwYyT1/GGBVpaW/KjwxerqQLXFJd+omBxR0Oox1js= +-----END EC PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect409r1/cert.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect409r1/cert.pem new file mode 100644 index 0000000..26f8cdd --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect409r1/cert.pem @@ -0,0 +1,17 @@ +-----BEGIN CERTIFICATE----- +MIICwTCCAkCgAwIBAgIJAO8zvhu+v30cMAoGCCqGSM49BAMCMIGWMQswCQYDVQQG +EwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQ +MA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMMCXNn +cmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMB4X +DTIwMTAyMjE1MjEzOVoXDTIwMTEyMTE1MjEzOVowgZYxCzAJBgNVBAYTAlVZMRMw +EQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYDVQQK +DAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dyYW1wb25l +MSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wfjAQBgcqhkjO +PQIBBgUrgQQAJQNqAAQAu4xR12zwPwAKjXSrdc7BrTa5C7mlmQFZjEzqqba/XD/4 +0CcGEjgB9AzKDHQx6xcABPohAKe3FpbgMnSbJIJbSSDbnzoKe4/pJ7a2ACi8Bq1l +LoZ2ywoUtfCNE6ldBt5vfhikO6uQs6NQME4wHQYDVR0OBBYEFIr2tnPESanqmgUB +2ecoFU9P9HN6MB8GA1UdIwQYMBaAFIr2tnPESanqmgUB2ecoFU9P9HN6MAwGA1Ud +EwQFMAMBAf8wCgYIKoZIzj0EAwIDbwAwbAI0AJO4gQQfXQw6zM9TpKYPUkhroAgz +OWtzwaamlld2OGYxr1vY2grZMzY91a4e5cpBAGFNWAI0AKSgtJYkF0ZMS7XpD2C8 +AYYl7QCQy1YAcOEkTQsiqhB7i+7NEKsiORN03CnIfAjE17C0cg== +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect409r1/key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect409r1/key.pem new file mode 100644 index 0000000..b733ba4 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect409r1/key.pem @@ -0,0 +1,6 @@ +-----BEGIN EC PRIVATE KEY----- +MIGwAgEBBDQAgwlj663GE4leq0+5kAqqJNymWK2sRyksL9XCWBdgAcpmWrHytnK0 +PaEJ1FZ4HQpb/vGKoAcGBSuBBAAloWwDagAEALuMUdds8D8ACo10q3XOwa02uQu5 +pZkBWYxM6qm2v1w/+NAnBhI4AfQMygx0MesXAAT6IQCntxaW4DJ0mySCW0kg2586 +CnuP6Se2tgAovAatZS6GdssKFLXwjROpXQbeb34YpDurkLM= +-----END EC PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect571k1/cert.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect571k1/cert.pem new file mode 100644 index 0000000..1bb74c9 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect571k1/cert.pem @@ -0,0 +1,19 @@ +-----BEGIN CERTIFICATE----- +MIIDFDCCAmqgAwIBAgIJAO5isZpzwq0dMAoGCCqGSM49BAMCMIGWMQswCQYDVQQG +EwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQ +MA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMMCXNn +cmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMB4X +DTIwMTAyMjE1MjIzOVoXDTIwMTEyMTE1MjIzOVowgZYxCzAJBgNVBAYTAlVZMRMw +EQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYDVQQK +DAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dyYW1wb25l +MSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wgacwEAYHKoZI +zj0CAQYFK4EEACYDgZIABAI/yZpA7k9SCuiq4l42FycKEMJPuBtk3fa5lRkXUJPY +3HYrf6IclGgtbxvJxemsHfZpTL/88IcZ7W13avfTzbUe/SkPyz6BnAN+G+Vj74sP +VtFxbjvLtZ3gVe7jH7wLN3xGbKWbNjPLu+zxPk0HvnXccWdcflzod3YNvv3aCLXW +CpELlEFKY+OqvRUDf5YoJKNQME4wHQYDVR0OBBYEFBlZP+ipOQyOg6HKfHjtkEaG +jS7WMB8GA1UdIwQYMBaAFBlZP+ipOQyOg6HKfHjtkEaGjS7WMAwGA1UdEwQFMAMB +Af8wCgYIKoZIzj0EAwIDgZcAMIGTAkdAUFf1pnqP3k9TOLCLiXgQLsLovjYXwhut +NP1vqjYxc+Cb/WVgM3fyhzjMEnUMWPydInksxc01LzWNnPtxDa25FnYhQS4DzAJI +AV1RL/d8ibEVd2kFkZCrZq+riLTSMLhkMwz6vubQxYT1cfE8AdpwcwkOBYAdk3/x +4s01ujQ9+XLG1n2Dbrdm2gLIq1IwS57K +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect571k1/key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect571k1/key.pem new file mode 100644 index 0000000..3a55c59 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect571k1/key.pem @@ -0,0 +1,8 @@ +-----BEGIN EC PRIVATE KEY----- +MIHuAgEBBEgA09UA3ggw+ZNqcN5vp3s2fog/jlatxRo/W+fOOiZrTpgYBFZBhuBZ +ssXI1Z733oHBO7t0aXGNV2qo+SISTZovbxrT+imWIdCgBwYFK4EEACahgZUDgZIA +BAI/yZpA7k9SCuiq4l42FycKEMJPuBtk3fa5lRkXUJPY3HYrf6IclGgtbxvJxems +HfZpTL/88IcZ7W13avfTzbUe/SkPyz6BnAN+G+Vj74sPVtFxbjvLtZ3gVe7jH7wL +N3xGbKWbNjPLu+zxPk0HvnXccWdcflzod3YNvv3aCLXWCpELlEFKY+OqvRUDf5Yo +JA== +-----END EC PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect571r1/cert.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect571r1/cert.pem new file mode 100644 index 0000000..f274f6d --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect571r1/cert.pem @@ -0,0 +1,19 @@ +-----BEGIN CERTIFICATE----- +MIIDFTCCAmqgAwIBAgIJAIO4gLeiOi9wMAoGCCqGSM49BAMCMIGWMQswCQYDVQQG +EwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRlbzEQ +MA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMMCXNn +cmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMB4X +DTIwMTAyMjE1MjMxOVoXDTIwMTEyMTE1MjMxOVowgZYxCzAJBgNVBAYTAlVZMRMw +EQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYDVQQK +DAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dyYW1wb25l +MSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wgacwEAYHKoZI +zj0CAQYFK4EEACcDgZIABAaB/iQNzfm6MEcBMWquifUlqufYZplpWqh9iDtajOCM +nz5LvuMwIvR67VopJaAiwl/Bksf/7lIJfc/2BPhDm53Sav8FfAdzBAKea/aIS32e +Tp2B4mi9AapNo/ursGivqo5HPPud3TEJJBb2c+j76Y0gxGgo5bnZcPrkvY/r8bKh +ATBr4ztP/qwKMYHBMVNloqNQME4wHQYDVR0OBBYEFJGLhQkxo1Zz/ZqedGtfVaG3 +Z7hvMB8GA1UdIwQYMBaAFJGLhQkxo1Zz/ZqedGtfVaG3Z7hvMAwGA1UdEwQFMAMB +Af8wCgYIKoZIzj0EAwIDgZgAMIGUAkgD2aD9CTGJr9RelvheunazWinfAZlkNsuA +3l6EoyiGRlwJirlkefQ/nStlZlRk2njk3XlyGkyi4RbNXVEecjAPg1kPin7HTZUC +SAD6ePPmRtGUHuNQLCqOdFleMdzcfnX6ArKJKsMLsjFGqseujJ/BcVvSVBgV/We1 +nHtoTgBSUc/AOT0kcAAXbdF4CULcpGUabQ== +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect571r1/key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect571r1/key.pem new file mode 100644 index 0000000..3f6646b --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/JWT_ECDSA/sect571r1/key.pem @@ -0,0 +1,8 @@ +-----BEGIN EC PRIVATE KEY----- +MIHuAgEBBEgCXHDz4dTad8p+tizZOA0cEycVU7jpfpBnrsZyDYR4LEdHy4FIDaoI +cShqCaC4zrnpxnRxtCQXiwIAZWPN0QIxtdJhekUs2kegBwYFK4EEACehgZUDgZIA +BAaB/iQNzfm6MEcBMWquifUlqufYZplpWqh9iDtajOCMnz5LvuMwIvR67VopJaAi +wl/Bksf/7lIJfc/2BPhDm53Sav8FfAdzBAKea/aIS32eTp2B4mi9AapNo/ursGiv +qo5HPPud3TEJJBb2c+j76Y0gxGgo5bnZcPrkvY/r8bKhATBr4ztP/qwKMYHBMVNl +og== +-----END EC PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha1_1024/sha1_cert.crt b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha1_1024/sha1_cert.crt new file mode 100644 index 0000000..f8b70b5 Binary files /dev/null and b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha1_1024/sha1_cert.crt differ diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha1_1024/sha1_cert.p12 b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha1_1024/sha1_cert.p12 new file mode 100644 index 0000000..7dbb975 Binary files /dev/null and b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha1_1024/sha1_cert.p12 differ diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha1_1024/sha1_cert.pem b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha1_1024/sha1_cert.pem new file mode 100644 index 0000000..13defdf --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha1_1024/sha1_cert.pem @@ -0,0 +1,18 @@ +-----BEGIN CERTIFICATE----- +MIIC/DCCAmWgAwIBAgIJAIh1DtAn5T0IMA0GCSqGSIb3DQEBBQUAMIGWMQswCQYD +VQQGEwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRl +bzEQMA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMM +CXNncmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29t +MB4XDTIwMDcwODE4NDM1N1oXDTI1MDcwNzE4NDM1N1owgZYxCzAJBgNVBAYTAlVZ +MRMwEQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYD +VQQKDAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dyYW1w +b25lMSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wgZ8wDQYJ +KoZIhvcNAQEBBQADgY0AMIGJAoGBAKvo5gGDQ2w0veZSDxd+nJc7w7z/Is+4iGhO +EuK9A/U713RfBdXYx2prp+7BAkUrGYm+Z6SkXZ6r78Tl5D/L2pNeA6nn5geCoWH1 +KSFOlAvEnjXcGvkdo8bIE/Day3PWFdeIGD8Mt0badAoIM+0m6s5jfSu9N8o4I4UX +9O4PoEwhAgMBAAGjUDBOMB0GA1UdDgQWBBSLvqEYCzyExQe0fuRFBXpHjVbb6TAf +BgNVHSMEGDAWgBSLvqEYCzyExQe0fuRFBXpHjVbb6TAMBgNVHRMEBTADAQH/MA0G +CSqGSIb3DQEBBQUAA4GBAArYRju3NQeCspTxvpixMLLPWaYzxRmtUkEz1yr7VhlI +H63RTIqbRcbP+40DRxx83LkIOJRdOcCVeLX3ZutknJglfrqFkUF5grWrhrHpd+IR +SeN3lePMYa3GeeljTyrPINCwnv0YFLQOwRf8UlZcKAquJO2ouQZkVd9t1tRWTvNo +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha1_1024/sha1_cert.pkcs12 b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha1_1024/sha1_cert.pkcs12 new file mode 100644 index 0000000..7dbb975 Binary files /dev/null and b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha1_1024/sha1_cert.pkcs12 differ diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha1_1024/sha1_key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha1_1024/sha1_key.pem new file mode 100644 index 0000000..fddad65 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha1_1024/sha1_key.pem @@ -0,0 +1,17 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIICxjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQIFzcEQrPE6QQCAggA +MBQGCCqGSIb3DQMHBAjw8xlpI9VohQSCAoC7HJhHuBi5nlAiFpOwyc6zgU6iNRkS +3EC48TLyCtOl3OUFkmdEvyuVR744dPBfPMt93mdbQlK+z1fbWOeSs8l4Y5bgXj9j +gNroOOlZ1ritKU2EfCfmpuhbCWmZ731RPBZ8lAWhMIWebjnskPmtnAG2b6FpwVrH +ncHm1b1q443f8j+uhvaOy/k6ICrGtwrBgQ5oYdYyYQ6an2RX3zWGrT5J1H9k2evp +L9KUCV64adB7LN8qQ2O8s7oOvQB3BXICMlWGo+HADT+QxqctoddfOTy2IJFuxvWt +7aMBoI+3FkXt2YaUwwbDRUQgdh/EHYZ4/NkbU3CGglmlRFpuMBe6PkTJb65/IOt9 +kJyCCBDQ1MkCFiRcxdEKThubmuL7/+CP1vn/jLwHRhmYNuBDwnhOch6qfPZcl2Bw +OBSiy1BrwooAIy/9emcOmLWMpBFHYG/mL8ph0PCYZ8o2dQ4FUr91+wi2dmZBK6oB +Y79DISdVnAlGS+iIjrF47uvtUJgCFNC8G/eehBd9eKMA613apbpBPUDXcm7jbGnM +U14WqPuJR9vd9YwwZIXfUJ+OrxpgZdj3y8mS0fItI2vD5TkAhjzqPgNze+lu9PDg +CiejHBzs8fj0XoY/ouoDm1L36v+EV0Pu96kLr4flhaCIB+baBf6b+FEDWeY64WJL +dkZ3iBtI9GdWlm8nGI8zUHNsUPHBdtdN3UDdX0voXB7npcRk0W7kTYnkoSaCfQAZ +vy3/RM+eQb0+sYODDs2h7MVkvCmhCxZDxpn3Zfahaj1DNdGDl3ThxE3+eZqwHp1q +v6sce79ii2azzrGh3b+Qurr/oSurYky0GWSutP6iaSlAZk65ch8wVczw +-----END ENCRYPTED PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha1_1024/sha1d_key.key b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha1_1024/sha1d_key.key new file mode 100644 index 0000000..8a58336 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha1_1024/sha1d_key.key @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXgIBAAKBgQCr6OYBg0NsNL3mUg8XfpyXO8O8/yLPuIhoThLivQP1O9d0XwXV +2Mdqa6fuwQJFKxmJvmekpF2eq+/E5eQ/y9qTXgOp5+YHgqFh9SkhTpQLxJ413Br5 +HaPGyBPw2stz1hXXiBg/DLdG2nQKCDPtJurOY30rvTfKOCOFF/TuD6BMIQIDAQAB +AoGBAIcMzuxvT19JS8oNuxds+t2AMPRfxtxCjr7KXuHLNbnJCii8oZvu0jJTYrkY +3YyzIDvq3gckrPuC/TjElXxczFdhbVjGOoDB6R/ZytD4yDo4Xwi169osKTSe/zHW +Z2rlYB2227LWGHuy5BUk32Hk/xrCVSfx75NKOZyyFvEJc2PFAkEA18eDlqY7Jgz9 +0rzmfOiGCfg/t9zUOra0HYoAq/HjyigMtNhoUCb0shS2dtrYGdYjLv591Var6RAE +dsrk0Oj8GwJBAMv0B7W6gBbRjUkrM/G9kSHztVPcIRPbV7sQEULJn/lWWY5KiSoW +Zo6qACb+C46a0XmPkaSESLV4wRZVdCw95HMCQGHVMdJSGCtOZJ7xyscDXhKTHcCt +PQRJ5iwmb9uF1rPHqMst+02r+/Hp9ji5TJWaQ2WBOWhK3bLT8lIx98DIgdUCQQCG +Ka4Urm1qFUjyk9fkssXQ5scmNg0QSd6JMEWagJWaaGIbBw75v6iROmVFQSKLGW6o +n3e4GEjYD2o87dOw8rnfAkEAqveFw+B8CHhCVEo1DebGUBmkev6X8Vw87CQ8QRAl ++Zx68Qdon2VNmlv7lhz7A4ySBkW2NoW7Lyw6BCPHTsalYg== +-----END RSA PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha1_1024/sha1d_key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha1_1024/sha1d_key.pem new file mode 100644 index 0000000..8a58336 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha1_1024/sha1d_key.pem @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXgIBAAKBgQCr6OYBg0NsNL3mUg8XfpyXO8O8/yLPuIhoThLivQP1O9d0XwXV +2Mdqa6fuwQJFKxmJvmekpF2eq+/E5eQ/y9qTXgOp5+YHgqFh9SkhTpQLxJ413Br5 +HaPGyBPw2stz1hXXiBg/DLdG2nQKCDPtJurOY30rvTfKOCOFF/TuD6BMIQIDAQAB +AoGBAIcMzuxvT19JS8oNuxds+t2AMPRfxtxCjr7KXuHLNbnJCii8oZvu0jJTYrkY +3YyzIDvq3gckrPuC/TjElXxczFdhbVjGOoDB6R/ZytD4yDo4Xwi169osKTSe/zHW +Z2rlYB2227LWGHuy5BUk32Hk/xrCVSfx75NKOZyyFvEJc2PFAkEA18eDlqY7Jgz9 +0rzmfOiGCfg/t9zUOra0HYoAq/HjyigMtNhoUCb0shS2dtrYGdYjLv591Var6RAE +dsrk0Oj8GwJBAMv0B7W6gBbRjUkrM/G9kSHztVPcIRPbV7sQEULJn/lWWY5KiSoW +Zo6qACb+C46a0XmPkaSESLV4wRZVdCw95HMCQGHVMdJSGCtOZJ7xyscDXhKTHcCt +PQRJ5iwmb9uF1rPHqMst+02r+/Hp9ji5TJWaQ2WBOWhK3bLT8lIx98DIgdUCQQCG +Ka4Urm1qFUjyk9fkssXQ5scmNg0QSd6JMEWagJWaaGIbBw75v6iROmVFQSKLGW6o +n3e4GEjYD2o87dOw8rnfAkEAqveFw+B8CHhCVEo1DebGUBmkev6X8Vw87CQ8QRAl ++Zx68Qdon2VNmlv7lhz7A4ySBkW2NoW7Lyw6BCPHTsalYg== +-----END RSA PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha1_1024/sha1e_cert.p12 b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha1_1024/sha1e_cert.p12 new file mode 100644 index 0000000..78a2965 Binary files /dev/null and b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha1_1024/sha1e_cert.p12 differ diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha256_1024/sha256_cert.crt b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha256_1024/sha256_cert.crt new file mode 100644 index 0000000..e06d3d9 Binary files /dev/null and b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha256_1024/sha256_cert.crt differ diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha256_1024/sha256_cert.p12 b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha256_1024/sha256_cert.p12 new file mode 100644 index 0000000..9e93a0a Binary files /dev/null and b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha256_1024/sha256_cert.p12 differ diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha256_1024/sha256_cert.pem b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha256_1024/sha256_cert.pem new file mode 100644 index 0000000..eeee432 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha256_1024/sha256_cert.pem @@ -0,0 +1,18 @@ +-----BEGIN CERTIFICATE----- +MIIC/DCCAmWgAwIBAgIJAPmCVmfcc0IXMA0GCSqGSIb3DQEBCwUAMIGWMQswCQYD +VQQGEwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRl +bzEQMA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMM +CXNncmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29t +MB4XDTIwMDcwODE4NDkxNVoXDTI1MDcwNzE4NDkxNVowgZYxCzAJBgNVBAYTAlVZ +MRMwEQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYD +VQQKDAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dyYW1w +b25lMSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wgZ8wDQYJ +KoZIhvcNAQEBBQADgY0AMIGJAoGBAMZ8m4ftIhfrdugi5kEszRZr5IRuqGDLTex+ +CfVnhnBYXyQgJXeCI0eyRYUAbNzw/9MPdFN//pV26AXeH/ajORVu1JVoOACZdNOI +PFnwXXh8oBxNxLAYlqoK2rAL+/tns8rKqqS4p8HSat9tj07TUXnsYJmmbXJM/eB9 +4Ex66D1ZAgMBAAGjUDBOMB0GA1UdDgQWBBTfXY8eOfDONCZpFE0V34mJJeCYtTAf +BgNVHSMEGDAWgBTfXY8eOfDONCZpFE0V34mJJeCYtTAMBgNVHRMEBTADAQH/MA0G +CSqGSIb3DQEBCwUAA4GBAAPv7AFlCSpJ32c/VYowlbk6UBhOKmVWBQlrAtvVQYtC +KO/y9CEB8ikG19c8lHM9axnsbZR+G7g04Rfuiea3T7VPkSmUXPpz5fl6Zyk4LZg5 +Oji7MMMXGmr+7cpYWRhifCVwoxSgZEXt3d962IZ1Wei0LMO+4w4gnzPxqr8wVHnT +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha256_1024/sha256_key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha256_1024/sha256_key.pem new file mode 100644 index 0000000..7c9b7d5 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha256_1024/sha256_key.pem @@ -0,0 +1,17 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIICxjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQIzBcnfbXhBAICAggA +MBQGCCqGSIb3DQMHBAi28D1y2rL7NwSCAoB3MH/+CGNyX0rdcXdqLix5fVldShH/ ++q+2XM9iDQKbUO9UTMaPtYPlgYi0iYpN8RpwCldryPmyynOtdlntcgDJhYT0BMVq +Huk/DI8FpRGcf2jeEC3NNjqIpsyGblTuXPB6T6gGpZ1a+JVm7XanAkTruZ/TMbDY +pIv7yrj088/Id6C0glX8fSfVM56YPNBxGnkuN1y49aTIKHiM0ORULpQvpP0p//f7 +VhTEqvJibhXBYensdP4FvZslE9LAXdrbD1bI/1i3U5qjE3xR8GsTHmYP+7zd3SWf +KgfU+R/DPY20/6Veh1GHdWRDtPi4W9QGq25LdJ60uA1HVUfljdvtQ2IANi2WKlbW +ElBcE7hi7p/84L6SB3xYzMV17tk4ypVzuhKt0qAr2iPRBuRZ+v8yIj/WuTpf1uYE +ima8bzjAA2kmMfXHsfErVQgHXuZddYFk7fC3OWffXqtzAaxLo38HuiZ1C1eZw0/F +GMO2T5tpBGpw/WcVKWqE/DWDd2Ii2SindxF5YV2BQ3xZPhw/mKVXDP4kjq0gENFa +neo3y1WDfvI8K9eaCjhljbPdkDHw/vfhHZ0ZlfUtIBhz/2KVZMNiVLzc4PHb36dp +T1vZp2IeMVU7ZQMYZUaZfeTJBjOTbxopBC3D19Eyq5FQ15N5OUEaaM+TbkZfYTQE +2WJ4YL3e1yyKa2AVzzvCEhEx4xdfLeCDpXCiufUXUz4dunUA237bz7Pv/vre9YVb +WDcdMQEEgQ67G0a3TRlQ7E3DO6qd6AYPC/EwgMBEuLxbPETIn0hdZW5O54pWO7bv +9XKOR6Ji1K8pkiy0hySexyURWWah9jSlhwKYJtCVZKi7Z0abkiUu+IiU +-----END ENCRYPTED PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha256_1024/sha256d_key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha256_1024/sha256d_key.pem new file mode 100644 index 0000000..f49c6c6 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha256_1024/sha256d_key.pem @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXgIBAAKBgQDGfJuH7SIX63boIuZBLM0Wa+SEbqhgy03sfgn1Z4ZwWF8kICV3 +giNHskWFAGzc8P/TD3RTf/6VdugF3h/2ozkVbtSVaDgAmXTTiDxZ8F14fKAcTcSw +GJaqCtqwC/v7Z7PKyqqkuKfB0mrfbY9O01F57GCZpm1yTP3gfeBMeug9WQIDAQAB +AoGANca07NLWldx5ztMFx0q4FgcNVsQUYoUyi4xqbk6qIe4PeN4syIA9xsMKCsre +s82nwitBvQ3EkAIzQsO3rT7zy9xccIQ5fgB0r/SXAoZP2riArTFsI7qxuJ6baPrN +28o/zdNCHac9cbjoCnfJPbHaDwRimvJfiy/mnUl86IryxvECQQDw72zi0rPaXrQd +ojOsOfw4gvBKMag2gXOyNSRQrzznwe4tRhRcZEO4ZYMab2j19zR14wGaYHTluvD/ +0o1NIsyrAkEA0uW46zaN8Z/zG2CqI88Ka0fwaPCr24uP9jPTRNxsB3oFZseSPnX/ +idGjm62wTTy7P64axbbddjrYMSWmnPhWCwJBAPA1FG7zuMI+5v4gZ7oOuYqx6NVf +uqBU4b9LQiB7BZLeAxL6KnSOtgGSm2nwp0mKo6/gmgmKnyEnBv1Wsu+zgS8CQQCP +BGAJij5p+/kluMDIdc/v/qIG2CcDRDqFUJHV4dCUpWfiUjZXizeWo4bavMeRKT0m +KxBWwfKfCbqwYYMCcdoPAkEA66fbHKCvHigSdqf+t8aixmEjejmUKP+C5Kt/fN65 +h6AwgKdwc9c1MsUAd1Fcqzo+FOOAu0bQzYjEmbgsL42ACA== +-----END RSA PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha256_1024/sha256e_cert.p12 b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha256_1024/sha256e_cert.p12 new file mode 100644 index 0000000..4ae3cd8 Binary files /dev/null and b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha256_1024/sha256e_cert.p12 differ diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha256_2048/sha256_cert.crt b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha256_2048/sha256_cert.crt new file mode 100644 index 0000000..bd788b5 Binary files /dev/null and b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha256_2048/sha256_cert.crt differ diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha256_2048/sha256_cert.p12 b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha256_2048/sha256_cert.p12 new file mode 100644 index 0000000..54cc6fb Binary files /dev/null and b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha256_2048/sha256_cert.p12 differ diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha256_2048/sha256_cert.pem b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha256_2048/sha256_cert.pem new file mode 100644 index 0000000..d9abc2f --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha256_2048/sha256_cert.pem @@ -0,0 +1,24 @@ +-----BEGIN CERTIFICATE----- +MIIEATCCAumgAwIBAgIJAIAqvKHZ+gFhMA0GCSqGSIb3DQEBCwUAMIGWMQswCQYD +VQQGEwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzETMBEGA1UEBwwKTW9udGV2aWRl +bzEQMA4GA1UECgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMM +CXNncmFtcG9uZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29t +MB4XDTIwMDcwODE4NTcxN1oXDTI1MDcwNzE4NTcxN1owgZYxCzAJBgNVBAYTAlVZ +MRMwEQYDVQQIDApNb250ZXZpZGVvMRMwEQYDVQQHDApNb250ZXZpZGVvMRAwDgYD +VQQKDAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJc2dyYW1w +b25lMSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20wggEiMA0G +CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC1zgaU+Wh63p9DNWoAy64252EvZjN4 +9AY3x0QCnAa8JO9Pk7znQwrxEFUKgZzv0GHEYW7+X+uyJr7BW4TA6fuJJ8agE/bm +ZRZyjdJjoue0FML6fbmCZ9Tsxpxe4pzispyWQ8jYT4Kl4I3fdZNUSn4XSidnDKBI +SeC05mrcchDKhInpiYDJ481lsB4JTEti3S4Xy/ToKwY4t6attw6z5QDhBc+Yro+Y +UqruliOAKqcfybe9k07jwMCvFVM1hrYYJ7hwHDSFo3MKwZ0y2gw0w6SgVBxLFo+K +YP3q63b5wVhD8lzaSh+8UcyiHM2/yjEej7EnRFzdclTSNXRFNaiLnEVdAgMBAAGj +UDBOMB0GA1UdDgQWBBQtQAWJRWNr/OswPSAdwCQh0Eei/DAfBgNVHSMEGDAWgBQt +QAWJRWNr/OswPSAdwCQh0Eei/DAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBCwUA +A4IBAQCjHe3JbNKv0Ywc1zlLacUNWcjLbmzvnjs8Wq5oxtf5wG5PUlhLSYZ9MPhu +f95PlibnrO/xVY292P5lo4NKhS7VOonpbPQ/PrCMO84Pz1LGfM/wCWQIowh6VHq1 +8PiZka9zbwl6So0tgClKkFSRk4wpKrWX3+M3+Y+D0brd8sEtA6dXeYHDtqV0YgjK +dZIIOx0vDT4alCoVQrQ1yAIq5INT3cSLgJezIhEadDv3Tc7bMxMFeL+81qHm9Z/9 +/KE6Z+JB0ZEOkF/2NSQJd+Z7MBR8CxOdTQis3ltMoXDatNkjZ2Env40sw4NICB8Y +YhsWMIarew5uNT+RS28YHNlbmogh +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha256_2048/sha256_key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha256_2048/sha256_key.pem new file mode 100644 index 0000000..35a78f2 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha256_2048/sha256_key.pem @@ -0,0 +1,30 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQI5Xxbb/ckzykCAggA +MBQGCCqGSIb3DQMHBAiLR0U2DKvbeQSCBMg5y4x5chPFsx7N081HcFhNVV2xwvIx +vbRcBeBUhiVaJUuJfRSXzwm16oqV7bZj91IkbePXGwkhHPeBoyy0yrNgsfFJ+t05 +lQU7vKxSFCiTdijGVbp2nxntOb1yRPkc2pA0iSSED00QNHpjDgcpywAKPDmRJSyM +mWDmrYzQYLTzyFgmcec53B27DXfHoGHBGwq1lfdKGzlphJPDxd+w+2VuAl33Zuq4 +oriu69l4CHcg64vJAa/Y9BkW3HiAytKaEBHHAuE8W2mHYfW4DwZlBur+lo+aUiNV +4RFOH1xdej/k4feMXsOnYak93gZIbWyr/8MljbQJLNlE+NkheNzAyTT2a9P04JOv +GUqv45EO9PIdDBemJxCiK4wmeoS/KhJ/zyictOsc1W659lzdCpCIecu0t/1La5b2 +/MWIkdDmqvE4CSNEmGNykLejKKjvGwk9hTsnpckoo44eNjSiElcItd6d0nZr8o9Q +h8kK8GF0bRjYYqiXoCO5WCO6h6IcJEVmx58/Y07yQ504Djih5eU5TrbPfVcUNcYy +fWbcai0/X6SSEJXOuvHtx6s+7Y8f3Uo9mh3UI2we4C7zPABvlGTDMRliamcUc4AD +8BCahJZuOTN1mkYae+G1IpFW3E12z7+C9bQ6tuundntPuc+GJvEw/Clss6dZ5b3w ++Gf+5Kc9PlPu/UxGTUFntN5AB2GGheERtw6UFG+Wf34aHg8uYPXnOYXK1ssnhXlI +TxbKSUBiirR/LwoXVapepQdLXfVxirW/QVB42dcH0mjtkgSy5k7teaKZV3eZQhid +Ja9tGq6cMEngzd7BNWA+zzrjn/Jj5DbnnQhYuBr+w82qfiVqc6VYxTCcs2KJK1lU +LuwXfygNcksvw+7w0tLqUWNsY1M1ZtmnSWiAW76G6ARugmTevYa0WXLAo/N74c96 +ORW0n8ZSQa7zhROJgefbXsuG4brTRnQMAJc+SzH09BRU8m3xeo8bygUGrN/aDyQy +DZ37pcWwFXlLRRshYoRqCW7v8TDVnCMSM9aujGnlSyK/l/88BCJuiLziHWPiJgvk +1x68JoEN/fxLh7O3qTYpUiyfVN8LHB6tqqJe97p12BAzo1HX5WSoq2a/oYl4Hqa2 +VfCwiI11NrUpv1EIKfa2yspRk4JVz38dT+KbxB5mz0MgEL8aq/9cJ4ISersTK2UU +ZJQPgPvJzbnXU4Vh0ON4P7f724eZvTxzGiiJZAIWrqiR7TyEd4J65r3FbBU1xpLU +tTgrvv38EkA9+qoAG9CjukGTn1k0T8jNC3vxkn4f2nIMn1n9YbvsiVsjzq1UKzRt +nxHHzMOfKnt092HsO8dtXwZadrpYcoZk9qVx9xbA1RO9rv9CSqLszWThUOT6xXmG +3F2ff9jXJjHtAog70TCrU2/bXZmZCmuHG78aLtSUSyNSgCc+Lp9CBQmc0QHrqjCS +7qwHXhdriOElj0fDwuFOk9pXUfc4t4YDWQGxY7+YWnS7RXCye9YI90U/8TyhLBOs +JZY2DDlOskC0NoIkqHfb2jyHMtW1BzmQIQ0tfKTxTzyg/dOZKJuIWhvpi9LTHDCI ++Er7OrZ0vf91c5FraxPaXatdw4laiNMak9fgWNsp44jIxYHi0zVQLkjQKDuKVoZo +Vzk= +-----END ENCRYPTED PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha256_2048/sha256d_key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha256_2048/sha256d_key.pem new file mode 100644 index 0000000..e41d6f2 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha256_2048/sha256d_key.pem @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEpAIBAAKCAQEAtc4GlPloet6fQzVqAMuuNudhL2YzePQGN8dEApwGvCTvT5O8 +50MK8RBVCoGc79BhxGFu/l/rsia+wVuEwOn7iSfGoBP25mUWco3SY6LntBTC+n25 +gmfU7MacXuKc4rKclkPI2E+CpeCN33WTVEp+F0onZwygSEngtOZq3HIQyoSJ6YmA +yePNZbAeCUxLYt0uF8v06CsGOLemrbcOs+UA4QXPmK6PmFKq7pYjgCqnH8m3vZNO +48DArxVTNYa2GCe4cBw0haNzCsGdMtoMNMOkoFQcSxaPimD96ut2+cFYQ/Jc2kof +vFHMohzNv8oxHo+xJ0Rc3XJU0jV0RTWoi5xFXQIDAQABAoIBAQCT/Go7JXE4YrI8 +4OOyVhkvM9RV4tkPIYNWL+taPGr3BxGNMvLXRClJ5EN00+BNDNAoLC9O/AE8+HDZ +r4c2CL/o+umhL98P10UYZfzVgasdWLEFeQVh8ubM/TYXvlp55W20muSHvuDX6RtS +w7/zItfUWVYNeaeWcBxq5Awj+O1WCoBV8OdWT8av5dyCHquD8rngvxD0gKeHvano +u6fOZN4tsolrB4GWh8B4A08dh4Ktcv/vxOfhzcS9jpT6+Zc5TdriD2fUYsdiw4dB +a4rghI61xbEyR8OC0ytOK5HhpXnTLcOv2zk8YmxW4HrkLWNV8xvzNPsZT9p4gWwB +AOGer07BAoGBAOpOy0rIems7JNFvfnROqW3Nx4rDqCiO+q14t/IBEHQrhdODireO +lrbUIeK9fnbHjuDoI17UTEtPuR5sdoxV4zyXsTIC37b628GlaoPVh3pyi/6o+Ypg +p+JFWmuCaNVRxWiGPtW/or/ulmP5XhcRp7QJIvbuD0aIEa1K1i0R/ZHlAoGBAMai +4rIDB0BnKSQxybSNjfh1ICwzdOuT7SpRD/aOlgcAG/OvyJ1Wk6NoJhL5rJTUA2B9 +es3U3M1jB55wcdQdNdiqVA/reQliLzGXbE5zEQ41oXYJucpTfTU/PbeV/Bj76N+l +o7lwCllo3EaHc0YKOe8/WnIQsjCoRlOcgzsYfI4ZAoGAMeq7cKEpQ3MEMwI3xHuF +qPjwC+YHCyz6xr4zIgGMCdPD3P3nLZfZD/Y9idqo+JEnJU8PSgKchmbjn1GoJ9mc +YapHe8oU8xyaeLTO7mstQ67nmEdTcmGJIrF3w/Oydc/H6K7A8DS1bYJc08uqeeuu ++LIBmu24n2QZr/uDiXKNvOkCgYEAuHRlwxxgzYN+hufdANc6cPCC8cjO2DxDzjn8 +ct6xnsqRKlegGctdyi5avOAxTPscL6wWL7FtYSSG3LBaY7jEWfDBow7tFLOiU5Dj +uG3N9r4Cs5QQfTvOV3Xkn+idc63p8FTmlrreQWzIsI3zk6THa84O9UFf1yNMOzRq +AKSadXECgYBEXyOgHyU2irRKX197nUdQd862tWONqaVNk7xiOSdv3CLRDaMkZrci +mA6diNN+vz3ut57iM7N9Yuqv4Qq/U79wBqElSrjy6Qlr+cVTvwT4RrOXcMfNZ1KN +Pz/h9l/Hce4Oez0GOLn+BffhCF3gHWz6nwfBgVu0V9xQ8eTaQfh4fw== +-----END RSA PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha256_2048/sha256e_cert.p12 b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha256_2048/sha256e_cert.p12 new file mode 100644 index 0000000..02e03cb Binary files /dev/null and b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha256_2048/sha256e_cert.p12 differ diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha512_2048/sha512_cert.crt b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha512_2048/sha512_cert.crt new file mode 100644 index 0000000..72d58e6 Binary files /dev/null and b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha512_2048/sha512_cert.crt differ diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha512_2048/sha512_cert.p12 b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha512_2048/sha512_cert.p12 new file mode 100644 index 0000000..295a14e Binary files /dev/null and b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha512_2048/sha512_cert.p12 differ diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha512_2048/sha512_cert.pem b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha512_2048/sha512_cert.pem new file mode 100644 index 0000000..7669d58 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha512_2048/sha512_cert.pem @@ -0,0 +1,24 @@ +-----BEGIN CERTIFICATE----- +MIID/zCCAuegAwIBAgIJAOHjT2U4H5QqMA0GCSqGSIb3DQEBDQUAMIGVMQswCQYD +VQQGEwJVWTETMBEGA1UECAwKTW9udGV2aWRlbzESMBAGA1UEBwwJTW9udGV2aWVv +MRAwDgYDVQQKDAdHZW5lWHVzMREwDwYDVQQLDAhTZWN1cml0eTESMBAGA1UEAwwJ +c2dyYW1wb25lMSQwIgYJKoZIhvcNAQkBFhVzZ3JhbXBvbmVAZ2VuZXh1cy5jb20w +HhcNMjAwNzA4MTkwOTQ3WhcNMjUwNzA3MTkwOTQ3WjCBlTELMAkGA1UEBhMCVVkx +EzARBgNVBAgMCk1vbnRldmlkZW8xEjAQBgNVBAcMCU1vbnRldmllbzEQMA4GA1UE +CgwHR2VuZVh1czERMA8GA1UECwwIU2VjdXJpdHkxEjAQBgNVBAMMCXNncmFtcG9u +ZTEkMCIGCSqGSIb3DQEJARYVc2dyYW1wb25lQGdlbmV4dXMuY29tMIIBIjANBgkq +hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyQXJ9VaFBni+DvG9BoZWgNlVHXUnkY4t +O96BUjaP5HK2QrnU3KJL3zm+kAkC5V3FjKMaY2QOYaTh70YWNi6uu0gfw8X3dY5S +Z2YWw0KPF38D6/8N2+4bR2PVokSfA+KgBL6oxdM9JDnDau3USMv98pXajL/Us1zD +ea1OToDVjyxTr+4kpt+5nkthiDXdQzrJdhlS2zGPqMTN499Z4gwolmoFN5wf0zCQ +Jb5W6chxRqA99wZpRsJRHQPfHkG7l2xcEW+H7REwrLwCvawClqL8FL3NsRZ1WnX2 +ilRiS6nvusdDegWlBfn7zjnTZioo2tcNWoqYC3GkzUmFuCGd42TtEQIDAQABo1Aw +TjAdBgNVHQ4EFgQU/EBg4UxQv6dKsZ12O8g+sddxpOgwHwYDVR0jBBgwFoAU/EBg +4UxQv6dKsZ12O8g+sddxpOgwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQ0FAAOC +AQEAVjzNE6cAOzZLAoRQUPCqk05ypHX6Snt/+x1VHBoVSk+u8og4u5fZ2w2ZpByi +GL+orU99Lq0JmgQPH77XG4lN91D1kr5FYXfHd8685sMAhQ3btuolrDzS17PDvY3P +1CRVM8zXeeHONvO08iy175Rw67oA+7h2lhLcsSvmLgZLpwUzYAFrRtFocSjULaAt +SEn9AEgm7hCVz0kId9Z/KcTfF1VqVcWDHWveNFbgBNOEk2eg8XZl7V6X9iVYV5iS +V+9SId2HMO5DsUqxccCwq/7y8G1qOhFRvI99hxAppa0DYwRugyclRGHn6RMXxb5R +QYF5drqTdc2LjqVsQvf1bmcKyA== +-----END CERTIFICATE----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha512_2048/sha512_key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha512_2048/sha512_key.pem new file mode 100644 index 0000000..7a73733 --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha512_2048/sha512_key.pem @@ -0,0 +1,30 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQIE0HGSRxYsxYCAggA +MBQGCCqGSIb3DQMHBAi37LLW0B3PawSCBMiF3dEYbxDaktRTRITECQKHDnvJ4suT +hMjKFGEQRU42VOGJtUQjNuRA87xLYWC9n/OghXiJYNQy02VAbcdz1MzSp7HhStYq +muUqze67wNCGrCZYKeK0IvtFpyqMquvRtbV3wOloe3kOhiH+QmqB5Rb9IxwORdsv +OQGJLwy33AHxXjRVAMHICewk5J7EI906eVPONHGchGMzMVSwJJ1xpvSOLLj6AC+i +WnS8tr8WW16BVfcEfm/JfR7lqkxf4E7vV9dYSc8HIOEGFFMeTaoPT8IcxzZiHijx +oYrQyVvinMpwdi6MfJsyNiQfsaPs+GA/JYGkjYzX1n5bkneOZw004K+ASuL1r06Z +mSeW18Nx60Wt9O1QYfnZlAVFMYluiQuJ2Xt/my+R1CirewrMO6DeBCEIY2/TVyxB +yrpJawTYbG3fWhVL8jXsf9Cx+APK7iiuGUdW5BnnDNCF/Hg9AiiOGBk8bnqw+gb6 +sFEVnkFFXFGdU27Yhp/V8MLjTipzSbPBJTg72wBUrLeafyhzXunCDzhIh6mYQFa/ +kOulVoycB0Mwb8lIxArtTWtM/8i/mmCSalslPNiB1MlmN+tvJXMJd2DK2Ox35KmB +nK1z3QCd/+UubSb/OtpzDq1Th5KCNEyqRNpQouaqhHEWyhoUuzX1StPVHAW25aUi +fj5aYxymr/HYzBDGlryA1yjK6nI8zpy6BQDM74C0Wh6jpXtmxqp1VdJU159n1isT +aelEYWzIPFo9ksvlYZjv7mPdi/HOjAwq2Jo9X8ZFoohLNk2NBNVbP+LQgj9Z6ffy +RAg245ifKsHJMW2Vx6+MdbC1ZKNXCF/C63TJHGl0tsQZzQoSZO5aj4ICs1GGR7AW +5NeNI4tcI6t8Q8x4Uxza+0ISJbb205XICh0+8MWX3S+NqU5jdEKX6yIhZ+B5k1tg +bmjnHZh1Lj5UC1Oi6VyyT1toJJ9A2kplm+Ply4zBgVI8frXyJ9dRPqCb066WHhoS +Y2nhhpL3KEVtCWAGVQfneSO1Ogh7JbKPLwOtJk9rDkOTxNErbPl2k4TlAD5flw7s +CNQA/lekG54jRxyMEJ5wR3WCNrfwwmOoQ7MUIKrQaGAyWGokwAux/4W9G4ip9XXD +V9HGLSO3tHj7aSal7OQw1yhrfTuTojiJvBdTC7wvKEQllieRbD4envhl4eiwAgQt +7jcRpS9x+1FOz10JhNvwOScyWtdDlhLa4ISbZ5LZqsQMfIRyh3dO7q3AXaUFZZmZ +CSiZDa6Ika25FuR/mBrtJEviEkKgeUUzhNa6YvACZC4q7fPj52L5ymhtwX0vx+97 +jb9w++qe9zLzyTaLBZUclc1Ibz597HQYjOl6gSwSRnWeiMJAc0d8mWjWvKvxhR5w +2Wx5rIcVXxouIQ9FtlUJ9uB7i3XBuYrq2s4YUL7i6dkG+LvEU71a70EG8ros7x5+ +I8zOGoySK3XOC+nPCXNysESqY/Ra4se/SNmzLJk5SeLfhHNQxDvCVsJmEqqSAQcd +sjp2A5A4mViwaIzGdlUKI9WUhZZ16A2Gp7JsuW1WYeTfdl327wLMM/qKuBlvAyLD +Q+TwdN0DqgyrBMUceivvpVtH8F2ffY0rc8QlbNt8q2KpWoVXe41uq7mxcrTk2xt+ +MCI= +-----END ENCRYPTED PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha512_2048/sha512d_key.pem b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha512_2048/sha512d_key.pem new file mode 100644 index 0000000..d59763c --- /dev/null +++ b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha512_2048/sha512d_key.pem @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEpAIBAAKCAQEAyQXJ9VaFBni+DvG9BoZWgNlVHXUnkY4tO96BUjaP5HK2QrnU +3KJL3zm+kAkC5V3FjKMaY2QOYaTh70YWNi6uu0gfw8X3dY5SZ2YWw0KPF38D6/8N +2+4bR2PVokSfA+KgBL6oxdM9JDnDau3USMv98pXajL/Us1zDea1OToDVjyxTr+4k +pt+5nkthiDXdQzrJdhlS2zGPqMTN499Z4gwolmoFN5wf0zCQJb5W6chxRqA99wZp +RsJRHQPfHkG7l2xcEW+H7REwrLwCvawClqL8FL3NsRZ1WnX2ilRiS6nvusdDegWl +Bfn7zjnTZioo2tcNWoqYC3GkzUmFuCGd42TtEQIDAQABAoIBAQCBOqJ5gNRls6tj +Cg7dqfDkRlMMa+szDHaR3Vm/k2nvj7sRrEtmR0OFTqbuC4z8DMtZvOTS7li8dvX0 +D1dqH5qetSAOiC6sOQFKjXumrRw2G6ZWyZGMSEbrHwgQmBKtubvrMPJosoLEzgmN +rTTiU5l+oM1t3EiNwd28VChaGUKxFcUw39cpPQR2sz24H9DPy3jwA/O2wHRULasm +vDBEmd8MAVZZ2VANzmPwynJl5/CZSJITcQ4sOZcAsj2j0i9eKAI9KF0Tp/oCq/Ly +KftQJzEdtHem6eh3oDxIUK9ewkzA8hzN2uSqV7A5YjljSIUyaE1fPUjAT818XnVw +PD09yh/tAoGBAP/iziliwKQtBI7QMzy5T5scLvfA+30xjR06VW37g4EIbH8m2B22 +orst4MKUr+q8wSAq8Yju5Ox2EKzWFvHQP093HqZQyt7+LeaauD/aCUvnkzX0fU3n +ZC1WBI302rtgc6RsXNPbYbnI8X7JSsmuKSqVHJcYMHffDiaywHm0VTyXAoGBAMkc +uV1vINd0NQwkv4uYnZBwEG54JLxqYmqhb99XlQ7v9Lka69IXBZv0Dajw5uEUdusG +D4gTz9XpkaO86XFSzoYtFcBkKnrECPf50n8HIQYPLSYPKl5y45UaWRqQ7MyJuoM3 +1KkOLg2ZnsRe7nNAQpR4CcNmX16rhtuo3rYCKVCXAoGAIdoBaBw2XAHQnowQmzHw +xBZgaEpReuh5QKqc7qXdac6Re+jJonSs5pJVL6i39RfvfK/xsCnagyXDYvoXovnn +xj1+AoahsAp0TBOf2GKh5DbIlNS5VvsLl6vPgnAoF63U3qWvSh+1t/xLZnh+ulud ++pIrbBm5H8KUfq4bJH6k4BUCgYEArCvlHXJH4WvhBjZnrXDIY6Es0AYXHR7Oho8S +oVfvikwvbFD51nBTIwI6t4kVf1fvvqD/pvWfFnjRcCYIjDXiDMiIOJ8IJvWw3+qG +JK3Lvc48TrrpANbGsx1NbwrnTuwSOsgPTXOQRaBgZakH5q760PQ7F4eK2hdqap8V +mygaip0CgYBUQVRerk8eQMPoUvjCJx2gMFt28DpGzQtiW8AzrvmkVViWxyulfMJd +B4XdmYEdeufM3Co3lcpfyMOVvip9lbv2FlLD4GcsAuajvV/xuqG59GCzII9NPqWy +hVOLUGyTV4PsBUzY14BdgJ4nhihPze7ExoKvx2RKSYmafnD28Ejw0g== +-----END RSA PRIVATE KEY----- diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha512_2048/sha512e_cert.p12 b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha512_2048/sha512e_cert.p12 new file mode 100644 index 0000000..a528c95 Binary files /dev/null and b/test/dotnetframework/SecurityAPITest/dummycerts/RSA_sha512_2048/sha512e_cert.p12 differ diff --git a/test/dotnetframework/SecurityAPITest/dummycerts/Test_sha1_1024_DER/dummy.txt b/test/dotnetframework/SecurityAPITest/dummycerts/Test_sha1_1024_DER/dummy.txt new file mode 100644 index 0000000..e69de29