Uploaded image for project: 'Couchbase Lite'
  1. Couchbase Lite
  2. CBL-1322

android:p2p:createIdentity api is throwing keystore exception

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Blocker
    • 2.8.0
    • 2.8.0
    • Java-Android
    • Security Level: Public

    Description

      CBL=2.8.0-273
      Android:-api versions used for peers-28 ,23

      Steps:
      When we are trying to create a certificate using the createIdentity api seeing below error in the testserver app.
      Expected:
      should be able to create identity using the createIdentity api.

      API params:

      Date certTime = calendar.getTime();
      HashMap<String, String> X509Attributes = new HashMap<String, String>();
      X509Attributes.put(TLSIdentity.CERT_ATTRIBUTE_COMMON_NAME, "CBL Test");
      X509Attributes.put(TLSIdentity.CERT_ATTRIBUTE_ORGANIZATION, "Couchbase");
      X509Attributes.put(TLSIdentity.CERT_ATTRIBUTE_ORGANIZATION_UNIT, "Mobile");
      X509Attributes.put(TLSIdentity.CERT_ATTRIBUTE_EMAIL_ADDRESS, "lite@couchbase.com");
      String alias = UUID.randomUUID().toString();

      API
      TLSIdentity.createIdentity(true, X509Attributes, certTime, alias);

       
      ERROR:
      I/System.out: Wed Sep 28 15:42:13 EDT 2022
      W/KeyStore: KeyStore exception
          android.os.ServiceSpecificException:  (code 7)
              at android.os.Parcel.createException(Parcel.java:1956)
              at android.os.Parcel.readException(Parcel.java:1910)
              at android.os.Parcel.readException(Parcel.java:1860)
              at android.security.IKeystoreService$Stub$Proxy.get(IKeystoreService.java:786)
              at android.security.KeyStore.get(KeyStore.java:195)
              at android.security.keystore.AndroidKeyStoreSpi.engineGetCertificateChain(AndroidKeyStoreSpi.java:118)
              at java.security.KeyStore.getCertificateChain(KeyStore.java:1087)
              at com.couchbase.lite.internal.KeyStoreManager.getCertificates(KeyStoreManager.java:248)
              at com.couchbase.lite.internal.KeyStoreManagerDelegate.getCertificateChain(KeyStoreManagerDelegate.java:160)
              at com.couchbase.lite.TLSIdentity.getIdentity(TLSIdentity.java:58)
              at com.couchbase.lite.TLSIdentity.createIdentity(TLSIdentity.java:107)
              at com.couchbase.mobiletestkit.javacommon.RequestHandler.PeerToPeerRequestHandler.serverStart(PeerToPeerRequestHandler.java:304)
              at java.lang.reflect.Method.invoke(Native Method)
              at com.couchbase.mobiletestkit.javacommon.RequestHandlerDispatcher.handle(RequestHandlerDispatcher.java:133)
              at com.couchbase.mobiletestkit.javalistener.Server.handle(Server.java:128)
              at org.nanohttpd.protocols.http.HTTPSession.execute(HTTPSession.java:418)
              at org.nanohttpd.protocols.http.ClientHandler.run(ClientHandler.java:75)
              at java.lang.Thread.run(Thread.java:764)
      W/KeyStore: KeyStore exception
          android.os.ServiceSpecificException:  (code 7)
              at android.os.Parcel.createException(Parcel.java:1956)
              at android.os.Parcel.readException(Parcel.java:1910)
              at android.os.Parcel.readException(Parcel.java:1860)
              at android.security.IKeystoreService$Stub$Proxy.get(IKeystoreService.java:786)
              at android.security.KeyStore.get(KeyStore.java:195)
              at android.security.keystore.AndroidKeyStoreSpi.engineGetCertificateChain(AndroidKeyStoreSpi.java:118)
              at java.security.KeyStoreSpi.engineGetEntry(KeyStoreSpi.java:484)
              at java.security.KeyStore.getEntry(KeyStore.java:1560)
              at com.couchbase.lite.internal.KeyStoreManager.getPrivateKey(KeyStoreManager.java:225)
              at com.couchbase.lite.internal.KeyStoreManagerDelegate.getKey(KeyStoreManagerDelegate.java:152)
              at com.couchbase.lite.TLSIdentity.getIdentity(TLSIdentity.java:64)
              at com.couchbase.lite.TLSIdentity.createIdentity(TLSIdentity.java:107)
              at com.couchbase.mobiletestkit.javacommon.RequestHandler.PeerToPeerRequestHandler.serverStart(PeerToPeerRequestHandler.java:304)
              at java.lang.reflect.Method.invoke(Native Method)
              at com.couchbase.mobiletestkit.javacommon.RequestHandlerDispatcher.handle(RequestHandlerDispatcher.java:133)
              at com.couchbase.mobiletestkit.javalistener.Server.handle(Server.java:128)
              at org.nanohttpd.protocols.http.HTTPSession.execute(HTTPSession.java:418)
              at org.nanohttpd.protocols.http.ClientHandler.run(ClientHandler.java:75)
              at java.lang.Thread.run(Thread.java:764)
       
      
      

      Test:
      pytest -s -rsx --timeout 1800 --liteserv-version=2.8.0-273,2.8.0-273 --liteserv-host=192.168.33.101,192.168.33.126,192.168.33.101 --liteserv-port=8080,8080,8080 --liteserv-platform=android,android,android --create-db-per-test=cbl-test testsuites/CBLTester/p2p_tests/test_peer_to_peer_tls.py --use-local-testserver -k "test_peer_to_peer_tls_any_self_signed_certs_create[True-push_pull-URLEndPoint-True]"

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              blake.meike Blake Meike
              manasa.ghanta Manasa Ghanta (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty