Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
New Developer
jjperezc
Posts: 9
Registered: ‎02-26-2012
My Device: Z10, Bold 9700, Playbook 32 Gb

Exception for untrusted SSL Certificate

Hi,

 

I currently have an application which connects to an https server with an open certificate (actually a certificate from domain.com), this causes that every time the user tries to connect a message about adding an exception for that certrificate is being show (if you add the exception the message is not longer displayed). I need to avoid this behavior because it dosen't look good to the eyes of the users, so is there a way to bypass or workaround this?

 

Thanks in advance,

 

Juan J. Pérez

 

 

New Member
eshaa
Posts: 2
Registered: ‎11-13-2013
My Device: Q10 SQN100-3

Re: Exception for untrusted SSL Certificate

I am also facing similar problem, have you found any solution for it yet?

New Developer
jjperezc
Posts: 9
Registered: ‎02-26-2012
My Device: Z10, Bold 9700, Playbook 32 Gb

Re: Exception for untrusted SSL Certificate

Not yet, but in case you have your services hosted in "domain.com" I found a workaround. You can use your account domian and directory to make it work with domain's cetrificate.

 

https://<username>.domain.com/<anyfile>
... where <username> is your account user and <anyfile> is the name of any file in your web directory 

 

Hope this helps, either way I'm still searching a solution for this.

 

Cheers,

 

Juan J. Pérez

New Contributor
TarunaSharma
Posts: 4
Registered: ‎10-25-2013
My Device: 9800

Re: Exception for untrusted SSL Certificate

Hello friends,

 

I have solved this issue i too have a application in which im fetching some data from a secure webservice(https)

and when i run application it displays SSL certificate error.I add following code of lines in my application main class

 

////////////////////////////////////////

 

 

 


// ASK FOR PERMISSIONS
private static void _assertHasPermissions() {

// Capture the current state of permissions and check against the requirements.
ApplicationPermissionsManager apm = ApplicationPermissionsManager.getInstance();
ApplicationPermissions original = apm.getApplicationPermissions();

// Set up and attach a reason provider
apm.addReasonProvider(ApplicationDescriptor.currentApplicationDescriptor(), new ReasonProvider() {
public String getMessage(int i) {
String msg = "I need the permissions in order to work properly.";

switch (i) {
case ApplicationPermissions.PERMISSION_LOCATION_DATA&colon;
msg = "Needed for location based services.";
break;
case ApplicationPermissions.PERMISSION_FILE_API:
msg = "Needed for accessing pictures on your device.";
break;
case ApplicationPermissions.PERMISSION_INTERNET:
msg = "Needed to connect to the cellular data network.";
break;
case ApplicationPermissions.PERMISSION_RECORDING:
msg = "Needed to access the camera.";
break;
case ApplicationPermissions.PERMISSION_WIFI:
msg = "Needed to access WiFi.";
break;
}

return msg;
}
});

boolean permissionsOk = false;

if (
original.getPermission(ApplicationPermissions.PERMISSION_LOCATION_DATA) ==
ApplicationPermissions.VALUE_ALLOW
&&
original.getPermission(ApplicationPermissions.PERMISSION_FILE_API) ==
ApplicationPermissions.VALUE_ALLOW
&&
original.getPermission(ApplicationPermissions.PERMISSION_INTERNET) ==
ApplicationPermissions.VALUE_ALLOW
&&
original.getPermission(ApplicationPermissions.PERMISSION_RECORDING) ==
ApplicationPermissions.VALUE_ALLOW
&&
original.getPermission(ApplicationPermissions.PERMISSION_WIFI) ==
ApplicationPermissions.VALUE_ALLOW
)
{
permissionsOk = true;
}
else {
// Create a permission request for each of the permissions your application
// needs. Note that you do not want to list all of the possible permission
// values since that provides little value for the application or the user.
// Please only request the permissions needed for your application.
ApplicationPermissions permRequest = new ApplicationPermissions();
permRequest.addPermission(ApplicationPermissions.PERMISSION_LOCATION_DATA);
permRequest.addPermission(ApplicationPermissions.PERMISSION_FILE_API);
permRequest.addPermission(ApplicationPermissions.PERMISSION_INTERNET);
permRequest.addPermission(ApplicationPermissions.PERMISSION_RECORDING);
permRequest.addPermission(ApplicationPermissions.PERMISSION_WIFI);

permissionsOk = apm.invokePermissionsRequest(permRequest);

}

if (permissionsOk) {
// do nothing
}
else {
// exit
System.exit(0);

}

}

 

Hopefuly this peice of code solve your issue to.