Greetings, I would like to know if you can help me with the following problem:
I made connection with the ejbca using java, and it works fine, however, I wanted to do the same using Net Framework C # and it was impossible, I connect to the ejbca using the SOAP service, I can ask for the version of the ejbca and it answers me No problem; But when executing a command to request any information about certificates or users, an error occurs, apparently it was related to the sending of the superuser certificate at the moment of making the request, I investigated and solved it, but now it generates another error and this related to the address of the request, this is the url of the ejbca: http: // ubuntu-ejbca: 8080 / ejbca / ejbcaws / ejbcaws, when making the request it gives me an error because I am using http, it tells me that I should use https; But if I put https, it fails because it is not supported in the ejbca, and the SOAP service by default configures http and not https. I enclose a part of the code that I am using, I appreciate any help you can provide me in this regard.
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"><meta content="Microsoft Word 15 (filtered medium)" name="Generator"><style><!-- /* Font Definitions */ @font-face {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4;} @font-face {font-family:Consolas; panose-1:2 11 6 9 2 2 4 3 2 4;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0cm; font-size:11.0pt; font-family:"Calibri",sans-serif;} a:link, span.MsoHyperlink {mso-style-priority:99; color:blue; text-decoration:underline;} .MsoChpDefault {mso-style-type:export-only;} @page WordSection1 {size:612.0pt 792.0pt; margin:70.85pt 3.0cm 70.85pt 3.0cm;} div.WordSection1 {page:WordSection1;} --></style>
Greetings, I would like to know if you can help me with the following problem:
I made connection with the ejbca using java, and it works fine, however, I wanted to do the same using Net Framework C # and it was impossible, I connect to the ejbca using the SOAP service, I can ask for the version of the ejbca and it answers me No problem; But when executing a command to request any information about certificates or users, an error occurs, apparently it was related to the sending of the superuser certificate at the moment of making the request, I investigated and solved it, but now it generates another error and this related to the address of the request, this is the url of the ejbca: http: // ubuntu-ejbca: 8080 / ejbca / ejbcaws / ejbcaws, when making the request it gives me an error because I am using http, it tells me that I should use https; But if I put https, it fails because it is not supported in the ejbca, and the SOAP service by default configures http and not https. I enclose a part of the code that I am using, I appreciate any help you can provide me in this regard.
<o:p> </o:p>
string password = "d7190b8f9c2d60655ce0f869c59737100598d2a1";
// The path to the certificate.
string certificado = @"c:\certificados\superadmin.p12";
<o:p> </o:p>
// Load the certificate into an X509Certificate object.
X509Certificate2 certi = new X509Certificate2(certificado, password);
<o:p> </o:p>
var servicio = new ServicioEjbca.EjbcaWSClient();
/
servicio.ClientCredentials.ClientCertificate.SetCertificate(
StoreLocation.CurrentUser,
StoreName.My,
X509FindType.FindBySerialNumber,
"6265c0ef4d079653a1551879c816f358ad7cacc8"
);
/
servicio.ClientCredentials.ClientCertificate.Certificate = certi;
var emisor = servicio.ClientCredentials.ClientCertificate.Certificate.Issuer;
// Get the value.
string resultsTrue = certi.ToString(true);
// Display the value to the console.
Console.WriteLine(resultsTrue);
// Get the value.
string resultsFalse = certi.ToString(false);
<o:p> </o:p>
// Display the value to the console.
Console.WriteLine(resultsFalse);
Console.WriteLine($"Emisor de certificado: {emisor}");
var version = servicio.getEjbcaVersion();
Console.WriteLine($"Versión de EJBCA -> {version}");
var estado = servicio.State;
Console.WriteLine($"Estado de EJBCA -> {estado}");
// Fail
var elementos = servicio.getAvailableCAs();
<o:p> </o:p>
<o:p> </o:p>
// App.Config
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="EjbcaWSServiceSoapBinding" >
<security mode="Transport">
<transport clientCredentialType="Certificate" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://ubuntu-ejbca:8080/ejbca/ejbcaws/ejbcaws"
binding="basicHttpBinding" bindingConfiguration="EjbcaWSServiceSoapBinding"
contract="ServicioEjbca.EjbcaWS" name="EjbcaWSPort" />
</client>
</system.serviceModel>
<o:p> </o:p>
<o:p> </o:p>
<o:p> </o:p>
What could I be missing?
<o:p> </o:p>
Enviado desde Correo para Windows 10
<o:p> </o:p>
C# is commonly used with EJBCA WS API.
Did you perform the "HTTP Protocol Behaviour Configuration" when configuring your application server?
https://doc.primekey.com/ejbca/ejbca-installation/application-servers/wildfly-18-jboss-eap-7-3#WildFly18/JBossEAP7.3-HTTPProtocolBehaviorConfiguration
There are some settings there for wsdl-url.
With this configured it mirrors the request URL.
<wsdl:service name="EjbcaWSService">
<wsdl:port binding="tns:EjbcaWSServiceSoapBinding" name="EjbcaWSPort">
<soap:address location="https://localhost:8443/ejbca/ejbcaws/ejbcaws">
</soap:address></wsdl:port></wsdl:service>
Cheers,
Tomas
Save time and money with an Enterprise support subscription. Please see www.primekey.com for more information.
https://www.primekey.com/products/software/