We are developing an hybrid application ( Android , iOS )
and we are facing an issue communicating with our backend services.
We are using untrusted certificate in the development environment and this lead to an error invoking the services using WLResourceRequest in the hybrid code.
The error on the android platform is the following:
java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
And reading from android logcat comes out this:
04-20 12:50:04.300 9427-9450/com.myApp D/wl.resource_request: WLResourceRequest.handleOnFailure in WLResourceRequest.java:658 :: Unexpected errorCode occurred. Please try again.
04-20 12:50:04.308 9427-9450/com.myApp D/com.worklight.androidgap.plugin.WLResourceRequestPlugin: WLResourceRequestPlugin$1$1.onFailure in WLResourceRequestPlugin.java:92 :: inside WLResourceRequestPlugin failure
How can we manage to pass through the certificate validation? or is there something we can do to properly invoke the services?
You can overcome this by adding the CA certificate to your device.
Go to Settings -> Security -> Install from SD card and install the CA certificate to the device.
Related
I've got a WebSphere 9 server for testing web apps on my laptop. I also have Hybris running under Tomcat on my laptop (for testing also). I wrote a Java web app to test punchout functions in Hybris, that runs on my WebSphere server. It had been working, but I had to reinstall WebSphere. Since then, when I try to run my web app in WebSphere, I get this error in WebSphere:
javax.net.ssl.SSLHandshakeException: com.ibm.jsse2.util.h: PKIX path
building failed: java.security.cert.CertPathBuilderException: unable
to find valid certification path to requested target
whenever my app tries to post to Hybris.
In the administrative console of WebSphere, I used the "receive from port" button to get the self-signed certificate from Hybris into the nodedefaultTrustStore in WebSphere. Hybris is at applied.local:9002 on my laptop and the certificate looks like this:
CN=applied.local, OU=applied.local, O=applied.local, L=applied.local,
ST=WI, C=us Valid from Jul 17, 2019 to Apr 11, 2022.
All of this was working previously, but I must have broken something. I must be missing something. I don't understand why it can't "find a valid certification path" to applied.local, since the CN is applied.local, and the certificate is in the trust store in WebSphere.
I got it working, but I don't know why I had to do this to get it working. If someone can explain why - that would be great. Anyway here's what I did:
Added custom variables to WebSphere to define where cacerts was, but default values should have worked, so not sure if this had any effect. In admin console, application servers > server1 > Java and Process Management, process definition, Java Virtual Machine, Customer properties: javax.net.ssl.truststore (path to cacerts in WebSphere), javax.net.ssl.truststoretype jks, and javax.net.ssl.trustStorePassword changeit.
Used a browser to export the self-signed certificate Hybris was using to a file.
Used Ikeyman to import the certificate into cacerts. (There are instructions on how to do this in IBM's pages).
Restarted WebSphere and Hybris and posting from WebSphere to Hybris worked again.
What doesn't make sense to me is that I had previously imported the Hybris self-signed certificate using the "Retrieve from port" button in the admin console for the NodeDefaultTrustStore. That used to work, but now apparently I have to import it into cacerts also or instead?
I was trying to establish a ssl connection to the sever in my application. for this, I generated self-signed certificates and added them to the keystore as well as the java cacerts which is the trust store.
But When I launch my application, I keep getting PKIX path building failed validatorException: unable to find valid path to requested target error
Hence unable to login to my java application.I use java1.8.0_144 version.
Try to login to the website which IDE is complaining about, and see if you are able to access it through the browser.
If so, then check for the certificate being used in the browser and check that certificate is present in your java cacerts.
Hi i usually generated the root CA with openssl and never worked importing that into the cacerts with keytools. You can instead generate it with this application i made out of desperation (it's a Java 11 app):
https://github.com/kendarorg/JavaCaCertGenerator
Its only purpose is to replace the generation of the private key and the root certificate, in a form "fit" for cacerts. From there you can produce the various certificates for the addresses
I try to test MeteorJS on Windows. I downloaded the last version of Meteor (1.5.2).
At my workplace, when I tryed to create a new project with "meteor create simple-todos", as Admin or not, I had an error:
C:\DEV\METEORJS>meteor create simple-todos
=> Errors while creating your project
While downloading blaze#2.3.2...: error: self signed certificate in
certificate chain
While downloading blaze-html-templates#1.1.2...: error: self signed
certificate in certificate chain
While downloading blaze-tools#1.0.10...: error: self signed
certificate in certificate chain
...
At home, I retry this test as Admin, and it run well :
C:\DEV\METEORJS>meteor create simple-todos
Created a new Meteor app in
'simple-todos'.
To run your new app: cd simple-todos meteor
...
What could explain this error?
Could this affect the operation or reliability of an application built with Meteor?
Problem resolved with my "network manager" !
There isn't any proxy on the office's firewall, but there was a module that decrypted the SSL stream. After deactivating it, I was able to create my Meteor project.
Thank you #Styx for giving me the right track (with your first answer).
I am trying to encrypt the push sender password in application-descriptor following Storing properties in encrypted format section of the tutorial.
However, when building the wlapp for iOS, I see following error message in Worklight Studio.
FWLST1040E: iphone build failed: com.worklight.common.util.WorklightCertificateException: Certificate error: Unable to process certificate: apns-certificate-production.p12
It appears that Worklight Studio trying to decrypt the p12 certificate using '${xxxx}' as the password during build process. If I put the password as clear text, build passes. Replacing push sender values for GCM with ${xxx} passes also since there is no iOS-like certificate to decrypt. Only iOS build has problem here.
As far as I understand, the encrypted/configurable fields should be decrypted/replaced at server side during run time, not during the build. Right now, I am not able to build a new wlapp for ios because of this issue.
I am not sure what have I done wrong here. Is there a setting to skip the p12 decryption during build process?
Worklight 6.2:
Created a test=1234 in worklight.properties
Using <pushSender password="${test}" /> in application-descriptor.xml
This passes w/out any errors.
MobileFirst 6,3 7.0:
The same steps as above fail with:
[2015-05-20 10:30:01] FWLST1040E: iphone build failed:
com.worklight.common.util.WorklightCertificateException: Certificate
error: Unable to process certificate: apns-certificate-sandbox.p12
I have opened a bug for it.
Are you sure about the version you're using?
Worklight 6.0.0, targeting iPad.
I have a simple demonstration application, no authentication at present. I am demonstrating use of reverse proxy. So I am building my application using the Build for Remote Server workaround and can see in xcode the correct server specification. I have some adapter calls, but for a particular demo scenario I also want to make an explicit call to
WL.Client.connect( ... );
If I use an http connection I see a request like this:
http://192.168.0.19/MyApp/apps/services/api/Work01/ipad/init
and it works just fine. If instead I use an SSL connection, as expected I see this
https://192.168.0.19:443/Infrabel01/apps/services/api/Work01/ipad/init
And I get the following error.
> [ERROR ] FWLSE0059E: Login into realm 'NullLoginModule' failed. The
> environment 'ipad' supports multiple versions, therefore you must
> request it with a version parameter.. [project Infrabel01] The
> environment 'ipad' supports multiple versions, therefore you must
> request it with a version parameter. [ERROR ]
> FWLSE0117E: Error code: 4, error description: AUTHENTICATION_ERROR,
> error message: An Error occurred while performing authentication using loginModule
> NullLoginModule, User Identity Not available. [project Infrabel01]
> [project Infrabel01]
That "request it with a version parameter" is intriguing. Is there some extra parameter I need to pass? Or is the overall implication that connecting over SSL requires authentication?
I had the same problem.
I have solved it by using the real IP address of the server in the WL app instead of using localhost:
When the emulator is running your app, press the Menu button.
Select to change your server URL
Remove "localhost" and use the IP address.
Accept and try again.
This fixed my problem.
Please make sure your Worklight server or proxy server is enabled SSL with certificate which signed by a trust public CA like Verisign. Worklight not support private CA certificate.