Skip to content

Commit

Permalink
Fix loading of certificates without password (#1812)
Browse files Browse the repository at this point in the history
  • Loading branch information
pepone authored Feb 19, 2024
1 parent 765416a commit 67d81c5
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 1 deletion.
2 changes: 1 addition & 1 deletion csharp/src/IceSSL/SSLEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ internal void initialize()
}
else
{
cert = new X509Certificate2(certFile, "", importFlags);
cert = new X509Certificate2(certFile, (string)null, importFlags);
}
_certs.Add(cert);
}
Expand Down
Binary file added csharp/test/IceSSL/certs/password_less_cacert.der
Binary file not shown.
23 changes: 23 additions & 0 deletions csharp/test/IceSSL/certs/password_less_cacert.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
-----BEGIN CERTIFICATE-----
MIID3TCCAsWgAwIBAgIJAId2IR3XPXe2MA0GCSqGSIb3DQEBCwUAMIGOMRgwFgYD
VQQDDA9JY2VSUEMgVGVzdHMgQ0ExDDAKBgNVBAsMA0ljZTEUMBIGA1UECgwLWmVy
b0MsIEluYy4xEDAOBgNVBAcMB0p1cGl0ZXIxEDAOBgNVBAgMB0Zsb3JpZGExCzAJ
BgNVBAYTAlVTMR0wGwYJKoZIhvcNAQkBFg5pbmZvQHplcm9jLmNvbTAeFw0yMzA2
MjgxNjQyNDlaFw0zMzA2MjUxNjQyNDlaMIGOMRgwFgYDVQQDDA9JY2VSUEMgVGVz
dHMgQ0ExDDAKBgNVBAsMA0ljZTEUMBIGA1UECgwLWmVyb0MsIEluYy4xEDAOBgNV
BAcMB0p1cGl0ZXIxEDAOBgNVBAgMB0Zsb3JpZGExCzAJBgNVBAYTAlVTMR0wGwYJ
KoZIhvcNAQkBFg5pbmZvQHplcm9jLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEP
ADCCAQoCggEBAJtcS94H7pMFjlgj/lW+VbTKOy+C0ZOdoQftPvAZtjbl8whSrE3J
aClRk7IhAfaZCaddOdI+IJU0DtImMxgAvRY9y4nZe0/SrAL6GaoG3m0OFriGmFWF
YT0N9u5f0YlUw9J+TowVOJzeN5NUVlLysNKdDrsBjQnMeL+FwplugtNLlD/VIpuo
I73Di8WAwcgQOun3M0f0EwMvAt/MD/i7MmDmTU8VLl3b6fjJtsB50s003iXqRure
uEPzJsC0pEctKKFYRAc6AtW6O2E8G4TwIh0mbSogF0F7UfPZ3/zwb8JR8PSmGZ1U
d65gxd29q0JLvQLMqu34twNMXmKynad8DUUCAwEAAaM8MDowDAYDVR0TBAUwAwEB
/zAdBgNVHQ4EFgQUfkNxyDctNHRfaIHZKoWi1emRvOUwCwYDVR0PBAQDAgGGMA0G
CSqGSIb3DQEBCwUAA4IBAQCbVJuJVOpUUWAZS/2XG83GO1DB0lzUophLuQzkOIVF
nSf82WLcW/6Vzczm/sr5RbKhA1a5S553E4Mxvp5/6Ql9S3jcSRuAa0kpCaYRo4dq
IAncGbM6R25QMVJ/PBlYXG3PpHN52LwKsevnXrMGI6Vm/0l/MrrkK9c6qDOzJNjy
/IjOQxZegse/uAEuzoZBXGuoPfnGsPBztGk4UFYr+ZhYNnAFaNNm5O3Il3/1Gcj6
Mz/U/NPS6YIDgmK/M7kDOw3kiQAgLXBi8NcSqzATW16VeRGfA4LCpdR7IGeaXUzG
k6GmH+qGB/ACdmuTpg2Ivw+xq+oq94CkJMC5PsOTdDGs
-----END CERTIFICATE-----
Binary file added csharp/test/IceSSL/certs/password_less_client.p12
Binary file not shown.
Binary file added csharp/test/IceSSL/certs/password_less_server.p12
Binary file not shown.
26 changes: 26 additions & 0 deletions csharp/test/IceSSL/configuration/AllTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,32 @@ public static Test.ServerFactoryPrx allTests(Test.TestHelper helper, string test
}
Console.Out.WriteLine("ok");

Console.Out.Write("testing certificate without password... ");
Console.Out.Flush();
{
initData = createClientProps(defaultProperties, "password_less_client", "password_less_cacert");
initData.properties.setProperty("IceSSL.Password", "");
Ice.Communicator comm = Ice.Util.initialize(ref args, initData);

Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, "password_less_server", "password_less_cacert");
d["IceSSL.Password"] = "";
Test.ServerPrx server = fact.createServer(d);
try
{
server.ice_ping();
}
catch(Ice.LocalException ex)
{
Console.WriteLine(ex.ToString());
test(false);
}
fact.destroyServer(server);
comm.destroy();
}
Console.Out.WriteLine("ok");

Console.Out.Write("testing certificate verification... ");
Console.Out.Flush();
{
Expand Down

0 comments on commit 67d81c5

Please sign in to comment.