Certificate was issued by an unrecognized Entity

寵の児 提交于 2019-12-31 06:03:08

问题


I am creating an application in Eclipse to translate text from english to french using googleAPI. I am passing the url in this format url="https://www.googleapis.com/language/translate/v2?key&q=Hello&source=en&target=fr"; I am using HttpConnection

I am getting this error :

certificate was issued by an unrecognized entity

I read all other forums and tried to invoke GoogleAPi in SDK3.0 but still same error comes. All the forums are saying that it is due to emulator and this is the really case. when i deploy app in phone it works fine.

Can anybody tell how to solve this problem so it does not give this error in emulator?


回答1:


The problem is that the emulator is missing the root certificate used for the site (but your phone isn't).

What you need to do is to import the correct certificate into the keystore for the emulator.

Alternative 1

  1. Find out which root certificate that was used for the site. You can do this by browsing to the address using e.g. Firefox and viewing the certificate information (click the blue name to the left in the location bar, More Information..., View Certificate, Details). In this case it was Equifax Secure CA.

  2. Save the certificate to a file. In Firefox you can do this by clicking the top certificate and then the Export... button. The certificate is now stored in a format that is readable by the keystore for Java SE but not ME.

  3. Import the key into a temporary Java SE keystore using the following command:

    keytool -import -alias [any name] -file [path to certificate file]

    A new keystore will (by default) be created in your home directory (which would be C:\Users\[username]\.keystore on Windows 7)

    keytool is located in the bin directory of your JRE installation.

  4. Import the certificate from the Java SE keystore into the ME keystore using:

    mekeytool -import -MEkeystore C:\Users\[username]/javame-sdk/3.0/work/[id of emulator profile]/appdb/_main.ks -alias [same alias as before]

    You can find the id of the emulator profile by running the emulator and checking the id in the title-bar

    keytoolme is located in the bin directory of your Jave ME SDK installation

This is usually the easiest way to get it working. An alternative is to get the certificate from the system-wide keystore with root certificates and thereby skipping step 2 and 3.

Alternative 2

First find the alias of the certificate you want to import:

keytool -list -v -keystore "C:\Program Files (x86)\Java\jre6\lib\security\cacerts"

or

keytool -list -keystore "C:\Program Files (x86)\Java\jre6\lib\security\cacerts"

In this case it is equifaxsecureca.

Then import it:

mekeytool -import -MEkeystore C:\Users\[username]/javame-sdk/3.0/work/[id]/appdb/_main.ks -alias equifaxsecureca -keystore "C:\Program Files (x86)\Java\jre6\lib\security\cacerts"

In Windows 7 you need to run this from a shell with administrator privileges.




回答2:


A Certificate Manager is provided by the J2ME Wireless Toolkit to help you maintain the certificates in the Default Emulator’s keystore (J2ME keystore).

  1. Open J2ME Wireless Toolkit ($WTK_HOME/bin/ktoolbar)
  2. Choose File -> Utilities
  3. Choose Manage Certificates

Importing From the J2SE Keystore

To import a certificate from a J2SE Keystore using the Certificate Manager:

  1. Choose Action -> Import J2SE Certificate.
  2. Specify a security domain to associate with the certificate to be imported.
  3. Choose a keystore file from the file chooser.
  4. Enter the password in the password dialog box to access the keystore.
  5. Select the alias for the certificate in the Alias List in the Select alias dialog box.

The certificate is appended to the list of certificates in the J2ME Keystore. You can select the certificate to view its key information in the J2ME Key Details pane.



来源:https://stackoverflow.com/questions/4666487/certificate-was-issued-by-an-unrecognized-entity

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!