aldm 0 Junior Poster in Training


I have a problems with certificates in j2me.
I need to access web mail using https connection, but there is certificate exception:

javax.microedition.pki.CertificateException: Certificate was issued by an unrecognized entity

I tried to use UserCredentialManager class, but I didn't found detail explanation
how to use this class. Here is a code in j2me:

String nameInfo = new String("CN=az15032");
			 byte[] enrollmentRequest = null;
			 int keyLength = 1024;
			 // User friendly names and prompts.
			 String securityElementID = new String("Bank XYZ");
			 String securityElementPrompt = new String
			 ("Please insert bank XYZ security element before proceeding");
			 String friendlyName = new String("My Credential");
			 // Certificate chain and URI from registration response.
			 byte[] pkiPath=null; 
			 String uri="";     
			 // Obtain a certificate enrollment request message.
			 try {
				 enrollmentRequest = UserCredentialManager.generateCSR
				 (nameInfo, UserCredentialManager.ALGORITHM_RSA, keyLength,
				 securityElementID, securityElementPrompt, false);
				 // Send it to a registration server.
				 // Assign values for pkipath and certificate uri
				 // from the registration response.
				 // Store the certificate on the security element.
				 UserCredentialManager.addCredential(friendlyName,pkiPath, uri);
			 catch (IllegalArgumentException iae) {
			 catch (NullPointerException npe) {
			 catch (CMSMessageSignatureServiceException cmse) {
			 catch (UserCredentialManagerException pkie) {

So, can anyone tell me how can I send CSR request to the registration server
and get pkipath and uri values from response?

If someone could give me example how to use this code for getting certificate
from webiste with username some_username, it would be the best.

I appreciate any kind of help related to this topic.

Thanks in advance,