Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8956461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:47:29+00:00 2026-06-15T14:47:29+00:00

I am using self signed certificates for development and testing purposes. I have investigated

  • 0

I am using self signed certificates for development and testing purposes. I have investigated various approaches to get android emulator to accept self signed certificates. Thus far I have found variations of the following approaches:

  1. Providing your own security classes that will accept any certificate.
  2. Create a keystore for your app that contains the self signed public key.
  3. Setting property socket.relaxsslcheck to yes.

The first 2 options are very involved and introduces into your code a dependency on your environment, e.g. dev, test or prod.

Option 3 I like because the environment configuration drives behaviour, not unlike a web container that will provide the configured datasource to apps running in the container. A development environment will point to a development datasource etc. Unfortunately I am struggling to get it to work. I have tried the following:

  • Using adb to set the property

    adb shell setprop socket.relaxsslcheck yes

  • Using System.setProperty

    System.setProperty("socket.relaxsslcheck","yes")

  • Tried to make change /system/build.prop and default.prop

The first option just gets ignored. From what I have read it seems setting the property will take effect after restarted. But the property seems to be volatile, it does not survive an emulator restart.

The System.setProperty(...) approach seems to be too late as the Factory has already been created. Because of above concern (dev environment specific code in code) I would prefer not to go this route, unless there is no alternative.

The last option is supposed to survive emulator restart, but I am unable to write to those files even after running adb root.

I am new to Android dev and would appreciated some guidance on what the best approach is and how to get it to work.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T14:47:31+00:00Added an answer on June 15, 2026 at 2:47 pm

    Well, you have to exactly specify ‘yes’ with that option, i.e.:

    -prop socket.relaxsslcheck=yes
    

    The source code just compares the properties value against ‘yes’ (and does not bother to also test against equivalent values like ‘true’ or ‘1’ …)

    Using the ADT bundle I set that option via

    Run -> Debug Configurations... -> Android Application -> ProjectName -> Target
      -> Additional Emulator Command Line Options
    

    After a restart of the emulator SSLSocketCertificateFactory works at advertised, i.e. it accepts all certificates. One can verify that via looking at the logs:

    12-08 18:10:52.382: W/SSLCertificateSocketFactory(763): 
      *** BYPASSING SSL SECURITY CHECKS (socket.relaxsslcheck=yes) ***
    

    I tested it with a self-created certificate – without that property set connecting fails with a certificate verification error, with that property set (or using SSLCertificateSocketFactory.getInsecure()) the TLS socket connects just fine.

    Btw, SSLSocketCertificateFactory seems to be tricky to use at times – for example I am struggling to get an actual instance from that very Factory – people posting workarounds that basically say: ignore that factory. Googling around some people even recommend against using that factory at all – but without giving much reasons.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For the development we are using a self signed SSL certificate and it seems
I've got a self-signed certificate for testing in development. I've added it under the
I'm trying to test a secure http connection using self signed certificates... just for
I am using a Self signed certificate for HTTPS. I have it ready. Could
I'm developing an android application that uses self-signed certificates with a private key to
I have a self-hosted WCF app using Basic HTTP Binding, no SSL, running in
How can I self-sign an iPhone application using Xcode? I have done the following:
I am using self signed certificate for HTTPS connection to and from Axis2 server.
There are scenarios where you want your application to accept invalid SSL certificates (testing
I created a self-signed certificate (created using OpenSSL) and installed it into the Certificate

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.