Android kSOAP2 SSL self-signed certificates "Security requirements not met - No security header in message"

there is a problem with connecting to SSL WebServices Apache Tomcat, the Java SE client connects fine, but the Android client does not want to connect and displays one of the following errors: 1. "Security requirements are not met - There is no security header in the message", 2. "Java.lang .RuntimeException: java.lang.RuntimeException: error: 0407006A: rsa procedure: RSA_padding_check_PKCS1_type_1: block type is not 01 (SHA-1), "To connect, I describe the following code:

private SSLSocketFactory getSSLSocketFactory() throws KeyStoreException, NoSuchAlgorithmException, KeyManagementException { KeyStore trusted = KeyStore.getInstance("PKCS12"); InputStream in = activity.getResources().openRawResource(R.raw.client_keystore); try { trusted.load(in, "blablabla".toCharArray()); } catch (CertificateException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { try { in.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } TrustManagerFactory tmf = TrustManagerFactory.getInstance("X509"); tmf.init(trusted); SSLContext context = SSLContext.getInstance("SSLv3"); context.init(null, tmf.getTrustManagers(), null); return context.getSocketFactory(); } public String SendRecieveMessage(String xmlData, String nameXML, String methodName, String methodAction) { HttpsTransportSE httpTransport = new KeepAliveHttpsTransportSE("hostname", 8443, "/blablabla/blablabla?wsdl", 1000); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); SoapObject request = new SoapObject(activity.getResources().getString(R.string.SOAP_NAMESPACE), methodName); // set // request Log.e("Sending SOAP", xmlData); String base64 = base64Coder.encodeString(xmlData); request.addProperty(nameXML, base64); envelope.setOutputSoapObject(request); // prepare request try { ((HttpsServiceConnectionSE) httpTransport.getServiceConnection()).setSSLSocketFactory(getSSLSocketFactory()); } catch (KeyManagementException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (KeyStoreException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (NoSuchAlgorithmException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } SoapPrimitive result = null; try { httpTransport.call(methodAction, envelope); result = (SoapPrimitive) envelope.getResponse(); // get if (result != null) { base64 = base64Coder.decodeString(result.toString()); } else { base64 = null; } } catch (IOException e) { // TODO Auto-generated catch block Log.e("ERROR", "SOAPSendRecieve: " + e.getMessage()); base64 = null; } catch (XmlPullParserException e) { // TODO Auto-generated catch block Log.e("ERROR", "SOAPSendRecieve: " + e.getMessage()); base64 = null; } catch (IllegalArgumentException e) { Log.e("ERROR", "SOAPSendRecieve: " + e.getMessage()); base64 = null; } } finally { request = null; result = null; } return base64; } 

It converts the server in blablabla.jks to blablabla.pfx (PKCS # 12), I tried using two programs: "KeyStore Explorer" and "Portecle", and also tried the "BKS" format, the same result, SSL kSOAP2, described in the example on official website, what could be the problem, is it an error due to an incorrect or client problem in the server settings?

Example request and response dump: enter image description here

+4
source share
1 answer

The problem was solved, the server was deployed by the WSIT library, which required protection of the security header, which is "User" and "Password", a SOAP message, since I did not specify these parameters, the server with which I did not connect was described in the message header. thank you for your help.

0
source

All Articles