Certificate was issued by an unrecognized Entity
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 unrec开发者_开发百科ognized 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?
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
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.
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.
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.
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.
A Certificate Manager is provided by the J2ME Wireless Toolkit to help you maintain the certificates in the Default Emulator’s keystore (J2ME keystore).
- Open J2ME Wireless Toolkit ($WTK_HOME/bin/ktoolbar)
- Choose File -> Utilities
- Choose Manage Certificates
Importing From the J2SE Keystore
To import a certificate from a J2SE Keystore using the Certificate Manager:
- Choose Action -> Import J2SE Certificate.
- Specify a security domain to associate with the certificate to be imported.
- Choose a keystore file from the file chooser.
- Enter the password in the password dialog box to access the keystore.
- 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.
精彩评论