javacommons/security/tsrc/javasrc/com/nokia/mj/impl/security/midp/authentication/InteractiveAuthenticationModuleTests.java
branchRCL_3
changeset 19 04becd199f91
child 78 71ad690e91f5
equal deleted inserted replaced
16:f5050f1da672 19:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 package com.nokia.mj.impl.security.midp.authentication;
       
    20 
       
    21 import java.util.Hashtable;
       
    22 import java.util.Vector;
       
    23 import com.nokia.mj.impl.installer.utils.InstallerMain;
       
    24 import com.nokia.mj.impl.security.midp.authentication.AuthenticationModule;
       
    25 import com.nokia.mj.impl.security.midp.authentication.OcspUserPreferences;
       
    26 import com.nokia.mj.impl.security.common.InstallerSecurityException;
       
    27 import com.nokia.mj.impl.security.midp.common.SecurityAttributes;
       
    28 import com.nokia.mj.impl.security.midp.common.AuthenticationAttribute;
       
    29 import com.nokia.mj.impl.utils.Uid;
       
    30 import com.nokia.mj.impl.storage.*;
       
    31 import com.nokia.mj.impl.security.midp.storage.SecurityStorage;
       
    32 import com.nokia.mj.impl.utils.OtaStatusCode;
       
    33 import com.nokia.mj.impl.utils.Attribute;
       
    34 import com.nokia.mj.impl.security.utils.SecurityErrorMessage;
       
    35 import com.nokia.mj.impl.security.utils.SecurityDetailedErrorMessage;
       
    36 import com.nokia.mj.impl.rt.ui.RuntimeUiFactory;
       
    37 import com.nokia.mj.impl.rt.ui.RuntimeUi;
       
    38 import com.nokia.mj.impl.rt.ui.ConfirmData;
       
    39 
       
    40 import j2meunit.framework.Test;
       
    41 import j2meunit.framework.TestCase;
       
    42 import j2meunit.framework.TestMethod;
       
    43 import j2meunit.framework.TestSuite;
       
    44 
       
    45 /**
       
    46  * InteractiveAuthenticationModule unit tests.
       
    47  */
       
    48 public class InteractiveAuthenticationModuleTests extends AuthenticationModuleTests
       
    49 {
       
    50 
       
    51     private static String TEST_DATA_DIR;
       
    52 
       
    53     private static String OCSP_URL = "http://" + System.getProperty("com.nokia.mj.impl.installer.test.server") + ":8888";
       
    54 
       
    55     static
       
    56     {
       
    57         String platform = System.getProperty("os.name");
       
    58         if (platform != null && platform.equalsIgnoreCase("linux"))
       
    59         {
       
    60             TEST_DATA_DIR = System.getProperty("JAVA_BIN_ROOT") + "/securitytestdata/";
       
    61         }
       
    62         else
       
    63         {
       
    64             TEST_DATA_DIR = "C:\\java\\securitytestdata\\";
       
    65         }
       
    66     }
       
    67 
       
    68     // class to be tested
       
    69     AuthenticationModule authenticationModule;
       
    70 
       
    71     /**
       
    72      * Hashtable holding all the attributes. Tests populate this hashtable
       
    73      * prior to being executed
       
    74      */
       
    75     protected Hashtable allAttributes;
       
    76 
       
    77     // general-purpose constants
       
    78     protected static final String MIDP_PROFILE_ATTRIBUTE_NAME = "MicroEdition-Profile";
       
    79     protected static final String MIDP3 = "MIDP-3.0";
       
    80     protected static final String MIDP2 = "MIDP-2.0";
       
    81     private static final String COMMA = ",";
       
    82 
       
    83     // references to error messages
       
    84     protected SecurityErrorMessage securityErrorMessage = new SecurityErrorMessage();
       
    85     protected SecurityDetailedErrorMessage securityDetailedErrorMessage = new SecurityDetailedErrorMessage();
       
    86 
       
    87 
       
    88     // Begin j2meunit test framework setup
       
    89     public void installerMain(String[] args)
       
    90     {
       
    91         TestSuite suite = new TestSuite(this.getClass().getName());
       
    92 
       
    93         suite.addTest(new InteractiveAuthenticationModuleTests("testOcsp", new TestMethod()
       
    94         {
       
    95             public void run(TestCase tc)
       
    96             {
       
    97                 ((InteractiveAuthenticationModuleTests)tc).testOcsp();
       
    98             }
       
    99         }));
       
   100 
       
   101         com.nokia.mj.impl.utils.OmjTestRunner.run(suite);
       
   102     }
       
   103 
       
   104     public InteractiveAuthenticationModuleTests()
       
   105     {
       
   106     }
       
   107 
       
   108     public InteractiveAuthenticationModuleTests(String aTestName, TestMethod aTestMethod)
       
   109     {
       
   110         super(aTestName, aTestMethod);
       
   111     }
       
   112 
       
   113     public void assertFalse(String aMsg, boolean aCondition)
       
   114     {
       
   115         assertTrue(aMsg, !aCondition);
       
   116     }
       
   117 
       
   118     // End j2meunit test framework setup
       
   119 
       
   120     protected void setUp()
       
   121     {
       
   122         authenticationModule = authenticationModule.getInstance();
       
   123     }
       
   124 
       
   125     protected void tearDown()
       
   126     {
       
   127     }
       
   128 
       
   129     private void testOcsp()
       
   130     {
       
   131         MyOcspEventListener oscpEventListener = new MyOcspEventListener();
       
   132         OcspEvent ocspEvent = null;
       
   133         InstallerSecurityException ocspError = null;
       
   134         OcspChecker ocspChecker = null;
       
   135         boolean sucess = false;
       
   136         allAttributes = new Hashtable();
       
   137         SecurityAttributes securityAttributes;
       
   138         StorageSession session = StorageFactory.createSession();
       
   139         session.open();
       
   140         Uid appUID = Uid.createUid("myUID");
       
   141         OcspSettings ocspSettings = null;
       
   142         OcspUserPreferences ocspUserPreferences = new OcspUserPreferences();
       
   143         SecurityStorage storage = new SecurityStorage();
       
   144         // cancel ocsp when the ocsp is off
       
   145         ocspSettings = new OcspSettings(OcspSettings.OCSP_MODE_UNDEFINED, OcspSettings.OCSP_WARNING_UNDEFINED, false, "0", "0");
       
   146         ocspUserPreferences.setOcspMode(OcspUserPreferences.OCSP_MODE_OFF);
       
   147         ocspUserPreferences.setOcspUrl(null);
       
   148         authenticationModule.setOCSPFlags(ocspSettings);
       
   149         storage.removeAuthenticationStorageData(appUID);
       
   150         allAttributes.clear();
       
   151         allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP3));
       
   152         allAttributes.put(AuthenticationAttribute.MAIN_ATTRIBUTE_PREFIX + "1-1", new Attribute("",        "MIICyjCCAjOgAwIBAgIJALGqj4FMKNfXMA0GCSqGSIb3DQEBBQUAMHMxCzAJBgNVBAYTAmZpMRIwEAYDVQQIEwlQaXJrYW5tYWExEDAOBgNVBAcTB1RhbXBlcmUxDjAMBgNVBAoTBU5va2lhMQ0wCwYDVQQLEwRKYXZhMR8wHQYDVQQDDBZKUF9UaGlyZF9QYXJ0eV9UcnVzdGVkMB4XDTEwMDIwNTEzMzAyMloXDTE1MDIwNDEzMzAyMlowVzELMAkGA1UEBhMCRkkxEDAOBgNVBAcTB1RhbXBlcmUxFzAVBgNVBAMTDk15IENvbW1vbiBOYW1lMR0wGwYDVQQKExRNeSBPcmdhbml6YXRpb24gTmFtZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMGxLn8s08e8/JFPO1nHf26Qdm8cUdMtTaEhhXCPT5T5nB2KSB3RiP8s5GfSRoTwEeL7/nwC3djM1MA/08RlX+FnwPT/8F7xiIiIw+Lx8jQWSgZcboUyVjYtAebCIpMQx86+4jGmzn3ujRz/2bBhxXPwNx2SgAPRanKeZbCtJtx8TYyms4ZNyV4+e59gG7aEmO6UbYs1t2K/aqpNkwpKJ+KXN5tquUYMBvjFFIWBvzLHWHM5zMHmj3wjxxjQjLqJPNgX3cnxKCiCJ3hcDcx0/gKR+DgckiNBq2pkw0p1hp8z8mvxt6uqB7kqM8xkjPnu0axwkJ60UyM6k6nq6PeEq60CAwEAATANBgkqhkiG9w0BAQUFAAOBgQA7OTu36H/9RDPzJM1CE6bgwkjheydGz/5ftu/jJquDz6u2d+5ceg2SQ8jxkBsBBQfQmGZYKoVnM9nJnT6mQwF124vb2bn3PteUIC0ImcUUp4mGeSFyC2ljs05irsDVEAq2gt/q+fo4kDHh5SYB+UE21au96hYz/+xJy4HV5tBcFQ=="));
       
   153         allAttributes.put(AuthenticationAttribute.SECOND_ATTRIBUTE_PREFIX + "1" ,new Attribute("", "p5HbQtH9bV/3imK6rfFRVILj1BzefOP7ebXItNcKeWzSOfeYmebFSJha++GyKY/SM9Zuwrkh4rvFyFc39QdOel3vpUM2FmgnGPwEDbBfVy0TViTYK6SoUCLrBWviKIadbg4N8vVZI/wdrjox+wPUWNVzk+Wflo1rubpJtmIQf29D2F8I+picirvjSj6xSqekr+889P7bNVjyI+OUowZYWftuPi1y81Mo+kRIuaqTzBMCQw7AxMoBAA7BurAiFGtasr8GocuXnNRHb5vKKzA1msY4FJ/k4d9kDjq+OTAfME2nY1Y1qwRrK3WwSaep0+BfIPMb9knwU0ph6OPCMjskUA=="));
       
   154         securityAttributes = new SecurityAttributes();
       
   155         securityAttributes.addDescriptorAttributes(allAttributes);
       
   156         authenticationModule.authenticateJad(appUID,null,securityAttributes.getAuthenticationAttributes());
       
   157         cancelOcsp(appUID);
       
   158         assertTrue(true);
       
   159         // UserInstallation: ocsp undefined, warning undefined, not silent mode, user prefs must, ocsp url not set
       
   160         ocspSettings = new OcspSettings(OcspSettings.OCSP_MODE_UNDEFINED, OcspSettings.OCSP_WARNING_UNDEFINED, false, "0", "0");
       
   161         ocspUserPreferences.setOcspMode(OcspUserPreferences.OCSP_MODE_MUST);
       
   162         ocspUserPreferences.setOcspUrl(null);
       
   163         authenticationModule.setOCSPFlags(ocspSettings);
       
   164         storage.removeAuthenticationStorageData(appUID);
       
   165         oscpEventListener.reset();
       
   166         authenticationModule.registerOcspEventListener(appUID, oscpEventListener);
       
   167         allAttributes.clear();
       
   168         allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP3));
       
   169         allAttributes.put(AuthenticationAttribute.MAIN_ATTRIBUTE_PREFIX + "1-1", new Attribute("",        "MIICyjCCAjOgAwIBAgIJALGqj4FMKNfXMA0GCSqGSIb3DQEBBQUAMHMxCzAJBgNVBAYTAmZpMRIwEAYDVQQIEwlQaXJrYW5tYWExEDAOBgNVBAcTB1RhbXBlcmUxDjAMBgNVBAoTBU5va2lhMQ0wCwYDVQQLEwRKYXZhMR8wHQYDVQQDDBZKUF9UaGlyZF9QYXJ0eV9UcnVzdGVkMB4XDTEwMDIwNTEzMzAyMloXDTE1MDIwNDEzMzAyMlowVzELMAkGA1UEBhMCRkkxEDAOBgNVBAcTB1RhbXBlcmUxFzAVBgNVBAMTDk15IENvbW1vbiBOYW1lMR0wGwYDVQQKExRNeSBPcmdhbml6YXRpb24gTmFtZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMGxLn8s08e8/JFPO1nHf26Qdm8cUdMtTaEhhXCPT5T5nB2KSB3RiP8s5GfSRoTwEeL7/nwC3djM1MA/08RlX+FnwPT/8F7xiIiIw+Lx8jQWSgZcboUyVjYtAebCIpMQx86+4jGmzn3ujRz/2bBhxXPwNx2SgAPRanKeZbCtJtx8TYyms4ZNyV4+e59gG7aEmO6UbYs1t2K/aqpNkwpKJ+KXN5tquUYMBvjFFIWBvzLHWHM5zMHmj3wjxxjQjLqJPNgX3cnxKCiCJ3hcDcx0/gKR+DgckiNBq2pkw0p1hp8z8mvxt6uqB7kqM8xkjPnu0axwkJ60UyM6k6nq6PeEq60CAwEAATANBgkqhkiG9w0BAQUFAAOBgQA7OTu36H/9RDPzJM1CE6bgwkjheydGz/5ftu/jJquDz6u2d+5ceg2SQ8jxkBsBBQfQmGZYKoVnM9nJnT6mQwF124vb2bn3PteUIC0ImcUUp4mGeSFyC2ljs05irsDVEAq2gt/q+fo4kDHh5SYB+UE21au96hYz/+xJy4HV5tBcFQ=="));
       
   170         allAttributes.put(AuthenticationAttribute.SECOND_ATTRIBUTE_PREFIX + "1" ,new Attribute("", "p5HbQtH9bV/3imK6rfFRVILj1BzefOP7ebXItNcKeWzSOfeYmebFSJha++GyKY/SM9Zuwrkh4rvFyFc39QdOel3vpUM2FmgnGPwEDbBfVy0TViTYK6SoUCLrBWviKIadbg4N8vVZI/wdrjox+wPUWNVzk+Wflo1rubpJtmIQf29D2F8I+picirvjSj6xSqekr+889P7bNVjyI+OUowZYWftuPi1y81Mo+kRIuaqTzBMCQw7AxMoBAA7BurAiFGtasr8GocuXnNRHb5vKKzA1msY4FJ/k4d9kDjq+OTAfME2nY1Y1qwRrK3WwSaep0+BfIPMb9knwU0ph6OPCMjskUA=="));
       
   171         securityAttributes = new SecurityAttributes();
       
   172         securityAttributes.addDescriptorAttributes(allAttributes);
       
   173         authenticationModule.authenticateJad(appUID,null,securityAttributes.getAuthenticationAttributes());
       
   174         ocspEvent = oscpEventListener.getEvent();
       
   175         sucess = (ocspEvent != null && ocspEvent.eventId == OcspEventListener.OCSP_START_EVENT);
       
   176         ocspEvent = oscpEventListener.getEvent();
       
   177         authenticationModule.unregisterOcspEventListener(appUID);
       
   178         assertTrue(sucess == true && (ocspEvent != null && ocspEvent.eventId == OcspEventListener.OCSP_FINISH_EVENT && (ocspEvent.eventError instanceof InstallerSecurityException)));
       
   179         ocspError = (InstallerSecurityException)ocspEvent.eventError;
       
   180         assertTrue(ocspError.getOtaStatusCode() == OtaStatusCode.APPLICATION_AUTHENTICATION_FAILURE
       
   181                    && ocspError.getShortMessage().equals(securityErrorMessage.get(SecurityErrorMessage.OCSP_GENERAL_ERR, null))
       
   182                    && ocspError.getDetailedMessage().equals(securityDetailedErrorMessage.get(SecurityDetailedErrorMessage.OCSP_SETTINGS_ERR,
       
   183                            null)));
       
   184         // UserInstallation: ocsp undefined, warning undefined, not silent mode, user prefs on, ocsp url not set -> show warning (choose yes)
       
   185         showGuidelines("At the next prompt, choose YES");
       
   186         ocspSettings = new OcspSettings(OcspSettings.OCSP_MODE_UNDEFINED, OcspSettings.OCSP_WARNING_UNDEFINED, false, "0", "0");
       
   187         ocspUserPreferences.setOcspMode(OcspUserPreferences.OCSP_MODE_ON);
       
   188         ocspUserPreferences.setOcspUrl(null);
       
   189         authenticationModule.setOCSPFlags(ocspSettings);
       
   190         storage.removeAuthenticationStorageData(appUID);
       
   191         oscpEventListener.reset();
       
   192         authenticationModule.registerOcspEventListener(appUID, oscpEventListener);
       
   193         allAttributes.clear();
       
   194         allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP3));
       
   195         allAttributes.put(AuthenticationAttribute.MAIN_ATTRIBUTE_PREFIX + "1-1", new Attribute("",        "MIICyjCCAjOgAwIBAgIJALGqj4FMKNfXMA0GCSqGSIb3DQEBBQUAMHMxCzAJBgNVBAYTAmZpMRIwEAYDVQQIEwlQaXJrYW5tYWExEDAOBgNVBAcTB1RhbXBlcmUxDjAMBgNVBAoTBU5va2lhMQ0wCwYDVQQLEwRKYXZhMR8wHQYDVQQDDBZKUF9UaGlyZF9QYXJ0eV9UcnVzdGVkMB4XDTEwMDIwNTEzMzAyMloXDTE1MDIwNDEzMzAyMlowVzELMAkGA1UEBhMCRkkxEDAOBgNVBAcTB1RhbXBlcmUxFzAVBgNVBAMTDk15IENvbW1vbiBOYW1lMR0wGwYDVQQKExRNeSBPcmdhbml6YXRpb24gTmFtZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMGxLn8s08e8/JFPO1nHf26Qdm8cUdMtTaEhhXCPT5T5nB2KSB3RiP8s5GfSRoTwEeL7/nwC3djM1MA/08RlX+FnwPT/8F7xiIiIw+Lx8jQWSgZcboUyVjYtAebCIpMQx86+4jGmzn3ujRz/2bBhxXPwNx2SgAPRanKeZbCtJtx8TYyms4ZNyV4+e59gG7aEmO6UbYs1t2K/aqpNkwpKJ+KXN5tquUYMBvjFFIWBvzLHWHM5zMHmj3wjxxjQjLqJPNgX3cnxKCiCJ3hcDcx0/gKR+DgckiNBq2pkw0p1hp8z8mvxt6uqB7kqM8xkjPnu0axwkJ60UyM6k6nq6PeEq60CAwEAATANBgkqhkiG9w0BAQUFAAOBgQA7OTu36H/9RDPzJM1CE6bgwkjheydGz/5ftu/jJquDz6u2d+5ceg2SQ8jxkBsBBQfQmGZYKoVnM9nJnT6mQwF124vb2bn3PteUIC0ImcUUp4mGeSFyC2ljs05irsDVEAq2gt/q+fo4kDHh5SYB+UE21au96hYz/+xJy4HV5tBcFQ=="));
       
   196         allAttributes.put(AuthenticationAttribute.SECOND_ATTRIBUTE_PREFIX + "1" ,new Attribute("", "p5HbQtH9bV/3imK6rfFRVILj1BzefOP7ebXItNcKeWzSOfeYmebFSJha++GyKY/SM9Zuwrkh4rvFyFc39QdOel3vpUM2FmgnGPwEDbBfVy0TViTYK6SoUCLrBWviKIadbg4N8vVZI/wdrjox+wPUWNVzk+Wflo1rubpJtmIQf29D2F8I+picirvjSj6xSqekr+889P7bNVjyI+OUowZYWftuPi1y81Mo+kRIuaqTzBMCQw7AxMoBAA7BurAiFGtasr8GocuXnNRHb5vKKzA1msY4FJ/k4d9kDjq+OTAfME2nY1Y1qwRrK3WwSaep0+BfIPMb9knwU0ph6OPCMjskUA=="));
       
   197         securityAttributes = new SecurityAttributes();
       
   198         securityAttributes.addDescriptorAttributes(allAttributes);
       
   199         authenticationModule.authenticateJad(appUID,null,securityAttributes.getAuthenticationAttributes());
       
   200         ocspEvent = oscpEventListener.getEvent();
       
   201         sucess = (ocspEvent != null && ocspEvent.eventId == OcspEventListener.OCSP_START_EVENT);
       
   202         ocspEvent = oscpEventListener.getEvent();
       
   203         authenticationModule.unregisterOcspEventListener(appUID);
       
   204         assertTrue(sucess == true && (ocspEvent != null && ocspEvent.eventId == OcspEventListener.OCSP_FINISH_EVENT));
       
   205         // UserInstallation: ocsp undefined, warning undefined, not silent mode, user prefs on, ocsp url not set -> show warning (choose no)
       
   206         showGuidelines("At the next prompt, choose NO");
       
   207         ocspSettings = new OcspSettings(OcspSettings.OCSP_MODE_UNDEFINED, OcspSettings.OCSP_WARNING_UNDEFINED, false, "0", "0");
       
   208         ocspUserPreferences.setOcspMode(OcspUserPreferences.OCSP_MODE_ON);
       
   209         ocspUserPreferences.setOcspUrl(null);
       
   210         authenticationModule.setOCSPFlags(ocspSettings);
       
   211         storage.removeAuthenticationStorageData(appUID);
       
   212         oscpEventListener.reset();
       
   213         authenticationModule.registerOcspEventListener(appUID, oscpEventListener);
       
   214         allAttributes.clear();
       
   215         allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP3));
       
   216         allAttributes.put(AuthenticationAttribute.MAIN_ATTRIBUTE_PREFIX + "1-1", new Attribute("",        "MIICyjCCAjOgAwIBAgIJALGqj4FMKNfXMA0GCSqGSIb3DQEBBQUAMHMxCzAJBgNVBAYTAmZpMRIwEAYDVQQIEwlQaXJrYW5tYWExEDAOBgNVBAcTB1RhbXBlcmUxDjAMBgNVBAoTBU5va2lhMQ0wCwYDVQQLEwRKYXZhMR8wHQYDVQQDDBZKUF9UaGlyZF9QYXJ0eV9UcnVzdGVkMB4XDTEwMDIwNTEzMzAyMloXDTE1MDIwNDEzMzAyMlowVzELMAkGA1UEBhMCRkkxEDAOBgNVBAcTB1RhbXBlcmUxFzAVBgNVBAMTDk15IENvbW1vbiBOYW1lMR0wGwYDVQQKExRNeSBPcmdhbml6YXRpb24gTmFtZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMGxLn8s08e8/JFPO1nHf26Qdm8cUdMtTaEhhXCPT5T5nB2KSB3RiP8s5GfSRoTwEeL7/nwC3djM1MA/08RlX+FnwPT/8F7xiIiIw+Lx8jQWSgZcboUyVjYtAebCIpMQx86+4jGmzn3ujRz/2bBhxXPwNx2SgAPRanKeZbCtJtx8TYyms4ZNyV4+e59gG7aEmO6UbYs1t2K/aqpNkwpKJ+KXN5tquUYMBvjFFIWBvzLHWHM5zMHmj3wjxxjQjLqJPNgX3cnxKCiCJ3hcDcx0/gKR+DgckiNBq2pkw0p1hp8z8mvxt6uqB7kqM8xkjPnu0axwkJ60UyM6k6nq6PeEq60CAwEAATANBgkqhkiG9w0BAQUFAAOBgQA7OTu36H/9RDPzJM1CE6bgwkjheydGz/5ftu/jJquDz6u2d+5ceg2SQ8jxkBsBBQfQmGZYKoVnM9nJnT6mQwF124vb2bn3PteUIC0ImcUUp4mGeSFyC2ljs05irsDVEAq2gt/q+fo4kDHh5SYB+UE21au96hYz/+xJy4HV5tBcFQ=="));
       
   217         allAttributes.put(AuthenticationAttribute.SECOND_ATTRIBUTE_PREFIX + "1" ,new Attribute("", "p5HbQtH9bV/3imK6rfFRVILj1BzefOP7ebXItNcKeWzSOfeYmebFSJha++GyKY/SM9Zuwrkh4rvFyFc39QdOel3vpUM2FmgnGPwEDbBfVy0TViTYK6SoUCLrBWviKIadbg4N8vVZI/wdrjox+wPUWNVzk+Wflo1rubpJtmIQf29D2F8I+picirvjSj6xSqekr+889P7bNVjyI+OUowZYWftuPi1y81Mo+kRIuaqTzBMCQw7AxMoBAA7BurAiFGtasr8GocuXnNRHb5vKKzA1msY4FJ/k4d9kDjq+OTAfME2nY1Y1qwRrK3WwSaep0+BfIPMb9knwU0ph6OPCMjskUA=="));
       
   218         securityAttributes = new SecurityAttributes();
       
   219         securityAttributes.addDescriptorAttributes(allAttributes);
       
   220         authenticationModule.authenticateJad(appUID,null,securityAttributes.getAuthenticationAttributes());
       
   221         ocspEvent = oscpEventListener.getEvent();
       
   222         sucess = (ocspEvent != null && ocspEvent.eventId == OcspEventListener.OCSP_START_EVENT);
       
   223         ocspEvent = oscpEventListener.getEvent();
       
   224         authenticationModule.unregisterOcspEventListener(appUID);
       
   225         assertTrue(ocspEvent != null && ocspEvent.eventId == OcspEventListener.OCSP_FINISH_EVENT && (ocspEvent.eventError instanceof InstallerSecurityException));
       
   226         ocspError = (InstallerSecurityException)ocspEvent.eventError;
       
   227         assertTrue(ocspError.getOtaStatusCode() == OtaStatusCode.APPLICATION_AUTHENTICATION_FAILURE
       
   228                    && ocspError.getShortMessage().equals(securityErrorMessage.get(SecurityErrorMessage.OCSP_GENERAL_ERR, null))
       
   229                    && ocspError.getDetailedMessage().equals(securityDetailedErrorMessage.get(SecurityDetailedErrorMessage.OCSP_SETTINGS_ERR,
       
   230                            null)));
       
   231         // cancel ocsp when the ocsp is on
       
   232         ocspSettings = new OcspSettings(OcspSettings.OCSP_MODE_UNDEFINED, OcspSettings.OCSP_WARNING_UNDEFINED, false, "0", "0");
       
   233         ocspUserPreferences.setOcspMode(OcspUserPreferences.OCSP_MODE_ON);
       
   234         ocspUserPreferences.setOcspUrl(OCSP_URL);
       
   235         authenticationModule.setOCSPFlags(ocspSettings);
       
   236         storage.removeAuthenticationStorageData(appUID);
       
   237         oscpEventListener.reset();
       
   238         authenticationModule.registerOcspEventListener(appUID, oscpEventListener);
       
   239         allAttributes.clear();
       
   240         allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP3));
       
   241         allAttributes.put(AuthenticationAttribute.MAIN_ATTRIBUTE_PREFIX + "1-1", new Attribute("",        "MIICgTCCAeqgAwIBAgIJAIROWRW4DjXyMA0GCSqGSIb3DQEBBQUAMHMxCzAJBgNVBAYTAmZpMRIwEAYDVQQIEwlQaXJrYW5tYWExEDAOBgNVBAcTB1RhbXBlcmUxDjAMBgNVBAoTBU5va2lhMQ0wCwYDVQQLEwRKYXZhMR8wHQYDVQQDDBZKUF9UaGlyZF9QYXJ0eV9UcnVzdGVkMB4XDTA5MDUyODA4NDc1M1oXDTEwMDUyODA4NDc1M1owgZExCzAJBgNVBAYTAkZJMRAwDgYDVQQHEwdUYW1wZXJlMRcwFQYDVQQDEw5PQ1NQIEdPT0QgQ2VydDEMMAoGA1UEChMDT3JnMSMwIQYDVR0PExpjcml0aWNhbCwgZGlnaXRhbFNpZ25hdHVyZTEkMCIGA1UdJRMbMS4zLjYuMS40LjEuOTQuMS40OS4xLjIuMi4zMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDHoWvDNxIjGzm2J9OmYJtVrUPZJoIXzFVAXpSztxUcsxq18K1y/wsQcxyrjMD4C6eMkxygaDun0sZSHV8MDvt36A9gjoshhRWsV+yXrM3I3XjAFKP/fLrS4nnNJM9OEOpld7kjA+xgV51/Yn3kJyFKQjqbv/WZon7rozt82MspKQIDAQABMA0GCSqGSIb3DQEBBQUAA4GBADMn5WNp0pA7Z/4GRGIk2JMShEvtuHDnYvFg0xWk90rEQoAB6XsMe8IL8e7le9sPvppjiuyImjFTK6bOQYhGAVmjHDlkxlxf5SfRmhRilOl5ZHJKeGIeI696orXiqPiuL6ltb+W9hc0ymu2yZGew1Ptt9+tlYZRT0DuM7zqW3hip"));
       
   242         allAttributes.put(AuthenticationAttribute.SECOND_ATTRIBUTE_PREFIX + "1" ,new Attribute("", "s3Z/MqNA0EXP8le8s5806RbzyNfLgD3DqX+0Tr2LjTJIa5ent1QcP1sqWrJm4XieprCGv3ja7upiVp/rfDYiS7kcXQwVxZy5nxCV0MfpT+wlf42vwE3cd6rbfoAyTH3ErSeQK6VoIyYwoaFIzOZKCIwkplc6+etacxLpCZn26to="));
       
   243         securityAttributes = new SecurityAttributes();
       
   244         securityAttributes.addDescriptorAttributes(allAttributes);
       
   245         authenticationModule.authenticateJad(appUID,null,securityAttributes.getAuthenticationAttributes());
       
   246         cancelOcsp(appUID);
       
   247         ocspEvent = oscpEventListener.getEvent();
       
   248         if (ocspEvent != null && ocspEvent.eventId == OcspEventListener.OCSP_START_EVENT)
       
   249         {
       
   250             ocspEvent = oscpEventListener.getEvent();
       
   251         }
       
   252         sucess = (ocspEvent != null && ocspEvent.eventId == OcspEventListener.OCSP_FINISH_EVENT);
       
   253         authenticationModule.unregisterOcspEventListener(appUID);
       
   254         assertTrue(sucess);
       
   255         // UserInstallation: ocsp undefined, warning undefined, not silent mode, user prefs on, unknown -> fail
       
   256         ocspSettings = new OcspSettings(OcspSettings.OCSP_MODE_UNDEFINED, OcspSettings.OCSP_WARNING_UNDEFINED, false, "0", "0");
       
   257         ocspUserPreferences.setOcspMode(OcspUserPreferences.OCSP_MODE_ON);
       
   258         ocspUserPreferences.setOcspUrl(OCSP_URL);
       
   259         authenticationModule.setOCSPFlags(ocspSettings);
       
   260         storage.removeAuthenticationStorageData(appUID);
       
   261         oscpEventListener.reset();
       
   262         authenticationModule.registerOcspEventListener(appUID, oscpEventListener);
       
   263         allAttributes.clear();
       
   264         allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP3));
       
   265         allAttributes.put(AuthenticationAttribute.MAIN_ATTRIBUTE_PREFIX + "1-1", new Attribute("",        "MIIChDCCAe2gAwIBAgIJAN1kvjmXKegVMA0GCSqGSIb3DQEBBQUAMHMxCzAJBgNVBAYTAmZpMRIwEAYDVQQIEwlQaXJrYW5tYWExEDAOBgNVBAcTB1RhbXBlcmUxDjAMBgNVBAoTBU5va2lhMQ0wCwYDVQQLEwRKYXZhMR8wHQYDVQQDDBZKUF9UaGlyZF9QYXJ0eV9UcnVzdGVkMB4XDTA5MDUyODA4NDkwOVoXDTEwMDUyODA4NDkwOVowgZQxCzAJBgNVBAYTAkZJMRAwDgYDVQQHEwdUYW1wZXJlMRowGAYDVQQDExFPQ1NQIFVOS05PV04gQ2VydDEMMAoGA1UEChMDT3JnMSMwIQYDVR0PExpjcml0aWNhbCwgZGlnaXRhbFNpZ25hdHVyZTEkMCIGA1UdJRMbMS4zLjYuMS40LjEuOTQuMS40OS4xLjIuMi4zMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDIbnFJT2y3ID0lwBix+gGbByuocroHp3preSrSmGG5OC/rZLnp21wdyjMuvo1Ga5WSfzDY6YNaSIlKKxrjYLBW+HJUJaQ0A3w3T38xCAwULEiU8e/hcK3mawlL/llNGqVnRIbpu2cuSD+ICTt7oqVvlo/TQyflRGeWT2WQ3ZBTgwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBABXIPy6FpATzxN2A8Sb8rEowoTDXNK1O4DMQ26Ri+otWDt1iThirqTl3RcuLi6PzkyXElc1VXTYKiUu3MFy5Wq5qCt6Fwntbcwx21MgnuceNqMdksMRDF1YVmZHhIb1ee/MzkuR8y8iSn+xALH+YfKO3faBwVQ9ly1ZQAgil/eBd"));
       
   266         allAttributes.put(AuthenticationAttribute.SECOND_ATTRIBUTE_PREFIX + "1" ,new Attribute("", "dgTivrr4heaBCvnX7aCcAgO0T5reljSYhuX95Rh7+SeDKNQCYqn6q860daWxCP/tk+QceBaGK1ISghzSf1PIPuKPiKhA0ia+dFLYJUjkxYJRZc8XJSRczBaF7eks3rVh5TTQGwzIG0C3w1p4OpSL+pBSO+pMrogWBgq9IL2Pe5c="));
       
   267         securityAttributes = new SecurityAttributes();
       
   268         securityAttributes.addDescriptorAttributes(allAttributes);
       
   269         authenticationModule.authenticateJad(appUID,null,securityAttributes.getAuthenticationAttributes());
       
   270         ocspEvent = oscpEventListener.getEvent();
       
   271         sucess = (ocspEvent != null && ocspEvent.eventId == OcspEventListener.OCSP_START_EVENT);
       
   272         ocspEvent = oscpEventListener.getEvent();
       
   273         authenticationModule.unregisterOcspEventListener(appUID);
       
   274         assertTrue(ocspEvent != null && ocspEvent.eventId == OcspEventListener.OCSP_FINISH_EVENT && (ocspEvent.eventError instanceof InstallerSecurityException));
       
   275         ocspError = (InstallerSecurityException)ocspEvent.eventError;
       
   276         assertTrue(ocspError.getOtaStatusCode() == OtaStatusCode.APPLICATION_AUTHENTICATION_FAILURE
       
   277                    && ocspError.getShortMessage().equals(securityErrorMessage.get(SecurityErrorMessage.OCSP_GENERAL_ERR, null))
       
   278                    && ocspError.getDetailedMessage().equals(securityDetailedErrorMessage.get(SecurityDetailedErrorMessage.OCSP_GENERAL_ERR,
       
   279                            null)));
       
   280         // UserInstallation: ocsp undefined, warning undefined, not silent mode, user prefs on, revoked
       
   281         ocspSettings = new OcspSettings(OcspSettings.OCSP_MODE_UNDEFINED, OcspSettings.OCSP_WARNING_UNDEFINED, false, "0", "0");
       
   282         ocspUserPreferences.setOcspMode(OcspUserPreferences.OCSP_MODE_ON);
       
   283         ocspUserPreferences.setOcspUrl(OCSP_URL);
       
   284         authenticationModule.setOCSPFlags(ocspSettings);
       
   285         storage.removeAuthenticationStorageData(appUID);
       
   286         oscpEventListener.reset();
       
   287         authenticationModule.registerOcspEventListener(appUID, oscpEventListener);
       
   288         allAttributes.clear();
       
   289         allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP3));
       
   290         allAttributes.put(AuthenticationAttribute.MAIN_ATTRIBUTE_PREFIX + "1-1", new Attribute("",        "MIIChDCCAe2gAwIBAgIJAN0+hRIgND0QMA0GCSqGSIb3DQEBBQUAMHMxCzAJBgNVBAYTAmZpMRIwEAYDVQQIEwlQaXJrYW5tYWExEDAOBgNVBAcTB1RhbXBlcmUxDjAMBgNVBAoTBU5va2lhMQ0wCwYDVQQLEwRKYXZhMR8wHQYDVQQDDBZKUF9UaGlyZF9QYXJ0eV9UcnVzdGVkMB4XDTA5MDUyODA4NDg0MFoXDTEwMDUyODA4NDg0MFowgZQxCzAJBgNVBAYTAkZJMRAwDgYDVQQHEwdUYW1wZXJlMRowGAYDVQQDExFPQ1NQIFJFVk9LRUQgQ2VydDEMMAoGA1UEChMDT3JnMSMwIQYDVR0PExpjcml0aWNhbCwgZGlnaXRhbFNpZ25hdHVyZTEkMCIGA1UdJRMbMS4zLjYuMS40LjEuOTQuMS40OS4xLjIuMi4zMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDNss9Gx9Wo7LXBEQSCkIpjwNZlOUEBzByeZ1GjwaEblL+RIlXQfq2DtercXxa9gJlryWIze/9vPX1V0wpEO9+M1fDY7Ro6E59kxfZtBnDoEFjITzChZfwqAxLo+EQUpQ2lN8sjyEW0apy73Odqkikwufzlrr9h/utDcSoED0RIMwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAJMYPjz8Q6DHsnUEva3RS2Yyjk0XcY+ldq4GGpOauY1cbZD5A/fmk/TKJahB1uV5XnuYs65vrJUuxAEzGuTzMOnMwJgAncSXFp2AQL4o02ETrp493BhOi825iwbwaHqqx2ijxJ6Jy84t1Rj+mwkwiLsFsJFMxViV0dxjbwLNQzho"));
       
   291         allAttributes.put(AuthenticationAttribute.SECOND_ATTRIBUTE_PREFIX + "1" ,new Attribute("", "r1aZCR/spVeK4eDOp1awTbas0muOpDI7y1Bz7l5OipxyZqZI4T8vy+e3q/w263bSchhOWZryPbuE6IuaeThE9qa/daK29oxR5JmmfttrlyGTsEap11NCpTCsK03HS8jwzACOD02m9hOS+EIqIdhNmoBB8ZhWdlNirTHw2UgEk/4="));
       
   292         securityAttributes = new SecurityAttributes();
       
   293         securityAttributes.addDescriptorAttributes(allAttributes);
       
   294         authenticationModule.authenticateJad(appUID,null,securityAttributes.getAuthenticationAttributes());
       
   295         ocspEvent = oscpEventListener.getEvent();
       
   296         sucess = (ocspEvent != null && ocspEvent.eventId == OcspEventListener.OCSP_START_EVENT);
       
   297         ocspEvent = oscpEventListener.getEvent();
       
   298         authenticationModule.unregisterOcspEventListener(appUID);
       
   299         assertTrue(ocspEvent != null && ocspEvent.eventId == OcspEventListener.OCSP_FINISH_EVENT && (ocspEvent.eventError instanceof InstallerSecurityException));
       
   300         ocspError = (InstallerSecurityException)ocspEvent.eventError;
       
   301         assertTrue(ocspError.getOtaStatusCode() == OtaStatusCode.APPLICATION_AUTHENTICATION_FAILURE
       
   302                    && ocspError.getShortMessage().equals(securityErrorMessage.get(SecurityErrorMessage.OCSP_GENERAL_ERR, null))
       
   303                    && ocspError.getDetailedMessage().equals(securityDetailedErrorMessage.get(SecurityDetailedErrorMessage.OCSP_REVOKED_ERR,
       
   304                            null)));
       
   305         // UserInstallation: ocsp undefined, warning undefined, not silent mode, user prefs on, good
       
   306         ocspSettings = new OcspSettings(OcspSettings.OCSP_MODE_UNDEFINED, OcspSettings.OCSP_WARNING_UNDEFINED, false, "0", "0");
       
   307         ocspUserPreferences.setOcspMode(OcspUserPreferences.OCSP_MODE_ON);
       
   308         ocspUserPreferences.setOcspUrl(OCSP_URL);
       
   309         authenticationModule.setOCSPFlags(ocspSettings);
       
   310         storage.removeAuthenticationStorageData(appUID);
       
   311         oscpEventListener.reset();
       
   312         authenticationModule.registerOcspEventListener(appUID, oscpEventListener);
       
   313         allAttributes.clear();
       
   314         allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP3));
       
   315         allAttributes.put(AuthenticationAttribute.MAIN_ATTRIBUTE_PREFIX + "1-1", new Attribute("",        "MIICgTCCAeqgAwIBAgIJAIROWRW4DjXyMA0GCSqGSIb3DQEBBQUAMHMxCzAJBgNVBAYTAmZpMRIwEAYDVQQIEwlQaXJrYW5tYWExEDAOBgNVBAcTB1RhbXBlcmUxDjAMBgNVBAoTBU5va2lhMQ0wCwYDVQQLEwRKYXZhMR8wHQYDVQQDDBZKUF9UaGlyZF9QYXJ0eV9UcnVzdGVkMB4XDTA5MDUyODA4NDc1M1oXDTEwMDUyODA4NDc1M1owgZExCzAJBgNVBAYTAkZJMRAwDgYDVQQHEwdUYW1wZXJlMRcwFQYDVQQDEw5PQ1NQIEdPT0QgQ2VydDEMMAoGA1UEChMDT3JnMSMwIQYDVR0PExpjcml0aWNhbCwgZGlnaXRhbFNpZ25hdHVyZTEkMCIGA1UdJRMbMS4zLjYuMS40LjEuOTQuMS40OS4xLjIuMi4zMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDHoWvDNxIjGzm2J9OmYJtVrUPZJoIXzFVAXpSztxUcsxq18K1y/wsQcxyrjMD4C6eMkxygaDun0sZSHV8MDvt36A9gjoshhRWsV+yXrM3I3XjAFKP/fLrS4nnNJM9OEOpld7kjA+xgV51/Yn3kJyFKQjqbv/WZon7rozt82MspKQIDAQABMA0GCSqGSIb3DQEBBQUAA4GBADMn5WNp0pA7Z/4GRGIk2JMShEvtuHDnYvFg0xWk90rEQoAB6XsMe8IL8e7le9sPvppjiuyImjFTK6bOQYhGAVmjHDlkxlxf5SfRmhRilOl5ZHJKeGIeI696orXiqPiuL6ltb+W9hc0ymu2yZGew1Ptt9+tlYZRT0DuM7zqW3hip"));
       
   316         allAttributes.put(AuthenticationAttribute.SECOND_ATTRIBUTE_PREFIX + "1" ,new Attribute("", "s3Z/MqNA0EXP8le8s5806RbzyNfLgD3DqX+0Tr2LjTJIa5ent1QcP1sqWrJm4XieprCGv3ja7upiVp/rfDYiS7kcXQwVxZy5nxCV0MfpT+wlf42vwE3cd6rbfoAyTH3ErSeQK6VoIyYwoaFIzOZKCIwkplc6+etacxLpCZn26to="));
       
   317         securityAttributes = new SecurityAttributes();
       
   318         securityAttributes.addDescriptorAttributes(allAttributes);
       
   319         authenticationModule.authenticateJad(appUID,null,securityAttributes.getAuthenticationAttributes());
       
   320         ocspEvent = oscpEventListener.getEvent();
       
   321         sucess = (ocspEvent != null && ocspEvent.eventId == OcspEventListener.OCSP_START_EVENT);
       
   322         ocspEvent = oscpEventListener.getEvent();
       
   323         authenticationModule.unregisterOcspEventListener(appUID);
       
   324         assertTrue(ocspEvent != null && ocspEvent.eventId == OcspEventListener.OCSP_FINISH_EVENT && ocspEvent.eventError == null);
       
   325         // UserInstallation: ocsp undefined, warning undefined, not silent mode, user prefs must, revoked
       
   326         ocspSettings = new OcspSettings(OcspSettings.OCSP_MODE_UNDEFINED, OcspSettings.OCSP_WARNING_UNDEFINED, false, "0", "0");
       
   327         ocspUserPreferences.setOcspMode(OcspUserPreferences.OCSP_MODE_MUST);
       
   328         ocspUserPreferences.setOcspUrl(OCSP_URL);
       
   329         authenticationModule.setOCSPFlags(ocspSettings);
       
   330         storage.removeAuthenticationStorageData(appUID);
       
   331         oscpEventListener.reset();
       
   332         authenticationModule.registerOcspEventListener(appUID, oscpEventListener);
       
   333         allAttributes.clear();
       
   334         allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP3));
       
   335         allAttributes.put(AuthenticationAttribute.MAIN_ATTRIBUTE_PREFIX + "1-1", new Attribute("",        "MIIChDCCAe2gAwIBAgIJAN0+hRIgND0QMA0GCSqGSIb3DQEBBQUAMHMxCzAJBgNVBAYTAmZpMRIwEAYDVQQIEwlQaXJrYW5tYWExEDAOBgNVBAcTB1RhbXBlcmUxDjAMBgNVBAoTBU5va2lhMQ0wCwYDVQQLEwRKYXZhMR8wHQYDVQQDDBZKUF9UaGlyZF9QYXJ0eV9UcnVzdGVkMB4XDTA5MDUyODA4NDg0MFoXDTEwMDUyODA4NDg0MFowgZQxCzAJBgNVBAYTAkZJMRAwDgYDVQQHEwdUYW1wZXJlMRowGAYDVQQDExFPQ1NQIFJFVk9LRUQgQ2VydDEMMAoGA1UEChMDT3JnMSMwIQYDVR0PExpjcml0aWNhbCwgZGlnaXRhbFNpZ25hdHVyZTEkMCIGA1UdJRMbMS4zLjYuMS40LjEuOTQuMS40OS4xLjIuMi4zMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDNss9Gx9Wo7LXBEQSCkIpjwNZlOUEBzByeZ1GjwaEblL+RIlXQfq2DtercXxa9gJlryWIze/9vPX1V0wpEO9+M1fDY7Ro6E59kxfZtBnDoEFjITzChZfwqAxLo+EQUpQ2lN8sjyEW0apy73Odqkikwufzlrr9h/utDcSoED0RIMwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAJMYPjz8Q6DHsnUEva3RS2Yyjk0XcY+ldq4GGpOauY1cbZD5A/fmk/TKJahB1uV5XnuYs65vrJUuxAEzGuTzMOnMwJgAncSXFp2AQL4o02ETrp493BhOi825iwbwaHqqx2ijxJ6Jy84t1Rj+mwkwiLsFsJFMxViV0dxjbwLNQzho"));
       
   336         allAttributes.put(AuthenticationAttribute.SECOND_ATTRIBUTE_PREFIX + "1" ,new Attribute("", "r1aZCR/spVeK4eDOp1awTbas0muOpDI7y1Bz7l5OipxyZqZI4T8vy+e3q/w263bSchhOWZryPbuE6IuaeThE9qa/daK29oxR5JmmfttrlyGTsEap11NCpTCsK03HS8jwzACOD02m9hOS+EIqIdhNmoBB8ZhWdlNirTHw2UgEk/4="));
       
   337         securityAttributes = new SecurityAttributes();
       
   338         securityAttributes.addDescriptorAttributes(allAttributes);
       
   339         authenticationModule.authenticateJad(appUID,null,securityAttributes.getAuthenticationAttributes());
       
   340         ocspEvent = oscpEventListener.getEvent();
       
   341         sucess = (ocspEvent != null && ocspEvent.eventId == OcspEventListener.OCSP_START_EVENT);
       
   342         ocspEvent = oscpEventListener.getEvent();
       
   343         authenticationModule.unregisterOcspEventListener(appUID);
       
   344         assertTrue(ocspEvent != null && ocspEvent.eventId == OcspEventListener.OCSP_FINISH_EVENT && (ocspEvent.eventError instanceof InstallerSecurityException));
       
   345         ocspError = (InstallerSecurityException)ocspEvent.eventError;
       
   346         assertTrue(ocspError.getOtaStatusCode() == OtaStatusCode.APPLICATION_AUTHENTICATION_FAILURE
       
   347                    && ocspError.getShortMessage().equals(securityErrorMessage.get(SecurityErrorMessage.OCSP_GENERAL_ERR, null))
       
   348                    && ocspError.getDetailedMessage().equals(securityDetailedErrorMessage.get(SecurityDetailedErrorMessage.OCSP_REVOKED_ERR,
       
   349                            null)));
       
   350         // UserInstallation: ocsp undefined, warning undefined, not silent mode, user prefs must, good
       
   351         ocspSettings = new OcspSettings(OcspSettings.OCSP_MODE_UNDEFINED, OcspSettings.OCSP_WARNING_UNDEFINED, false, "0", "0");
       
   352         ocspUserPreferences.setOcspMode(OcspUserPreferences.OCSP_MODE_MUST);
       
   353         ocspUserPreferences.setOcspUrl(OCSP_URL);
       
   354         authenticationModule.setOCSPFlags(ocspSettings);
       
   355         storage.removeAuthenticationStorageData(appUID);
       
   356         oscpEventListener.reset();
       
   357         authenticationModule.registerOcspEventListener(appUID, oscpEventListener);
       
   358         allAttributes.clear();
       
   359         allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP3));
       
   360         allAttributes.put(AuthenticationAttribute.MAIN_ATTRIBUTE_PREFIX + "1-1", new Attribute("",        "MIICgTCCAeqgAwIBAgIJAIROWRW4DjXyMA0GCSqGSIb3DQEBBQUAMHMxCzAJBgNVBAYTAmZpMRIwEAYDVQQIEwlQaXJrYW5tYWExEDAOBgNVBAcTB1RhbXBlcmUxDjAMBgNVBAoTBU5va2lhMQ0wCwYDVQQLEwRKYXZhMR8wHQYDVQQDDBZKUF9UaGlyZF9QYXJ0eV9UcnVzdGVkMB4XDTA5MDUyODA4NDc1M1oXDTEwMDUyODA4NDc1M1owgZExCzAJBgNVBAYTAkZJMRAwDgYDVQQHEwdUYW1wZXJlMRcwFQYDVQQDEw5PQ1NQIEdPT0QgQ2VydDEMMAoGA1UEChMDT3JnMSMwIQYDVR0PExpjcml0aWNhbCwgZGlnaXRhbFNpZ25hdHVyZTEkMCIGA1UdJRMbMS4zLjYuMS40LjEuOTQuMS40OS4xLjIuMi4zMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDHoWvDNxIjGzm2J9OmYJtVrUPZJoIXzFVAXpSztxUcsxq18K1y/wsQcxyrjMD4C6eMkxygaDun0sZSHV8MDvt36A9gjoshhRWsV+yXrM3I3XjAFKP/fLrS4nnNJM9OEOpld7kjA+xgV51/Yn3kJyFKQjqbv/WZon7rozt82MspKQIDAQABMA0GCSqGSIb3DQEBBQUAA4GBADMn5WNp0pA7Z/4GRGIk2JMShEvtuHDnYvFg0xWk90rEQoAB6XsMe8IL8e7le9sPvppjiuyImjFTK6bOQYhGAVmjHDlkxlxf5SfRmhRilOl5ZHJKeGIeI696orXiqPiuL6ltb+W9hc0ymu2yZGew1Ptt9+tlYZRT0DuM7zqW3hip"));
       
   361         allAttributes.put(AuthenticationAttribute.SECOND_ATTRIBUTE_PREFIX + "1" ,new Attribute("", "s3Z/MqNA0EXP8le8s5806RbzyNfLgD3DqX+0Tr2LjTJIa5ent1QcP1sqWrJm4XieprCGv3ja7upiVp/rfDYiS7kcXQwVxZy5nxCV0MfpT+wlf42vwE3cd6rbfoAyTH3ErSeQK6VoIyYwoaFIzOZKCIwkplc6+etacxLpCZn26to="));
       
   362         securityAttributes = new SecurityAttributes();
       
   363         securityAttributes.addDescriptorAttributes(allAttributes);
       
   364         authenticationModule.authenticateJad(appUID,null,securityAttributes.getAuthenticationAttributes());
       
   365         ocspEvent = oscpEventListener.getEvent();
       
   366         sucess = (ocspEvent != null && ocspEvent.eventId == OcspEventListener.OCSP_START_EVENT);
       
   367         ocspEvent = oscpEventListener.getEvent();
       
   368         authenticationModule.unregisterOcspEventListener(appUID);
       
   369         assertTrue(ocspEvent != null && ocspEvent.eventId == OcspEventListener.OCSP_FINISH_EVENT && ocspEvent.eventError == null);
       
   370         // UserInstallation: ocsp undefined, warning undefined, not silent mode, user prefs must, unknown
       
   371         ocspSettings = new OcspSettings(OcspSettings.OCSP_MODE_UNDEFINED, OcspSettings.OCSP_WARNING_UNDEFINED, false, "0", "0");
       
   372         ocspUserPreferences.setOcspMode(OcspUserPreferences.OCSP_MODE_MUST);
       
   373         ocspUserPreferences.setOcspUrl(OCSP_URL);
       
   374         authenticationModule.setOCSPFlags(ocspSettings);
       
   375         storage.removeAuthenticationStorageData(appUID);
       
   376         oscpEventListener.reset();
       
   377         authenticationModule.registerOcspEventListener(appUID, oscpEventListener);
       
   378         allAttributes.clear();
       
   379         allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP3));
       
   380         allAttributes.put(AuthenticationAttribute.MAIN_ATTRIBUTE_PREFIX + "1-1", new Attribute("",        "MIIChDCCAe2gAwIBAgIJAN1kvjmXKegVMA0GCSqGSIb3DQEBBQUAMHMxCzAJBgNVBAYTAmZpMRIwEAYDVQQIEwlQaXJrYW5tYWExEDAOBgNVBAcTB1RhbXBlcmUxDjAMBgNVBAoTBU5va2lhMQ0wCwYDVQQLEwRKYXZhMR8wHQYDVQQDDBZKUF9UaGlyZF9QYXJ0eV9UcnVzdGVkMB4XDTA5MDUyODA4NDkwOVoXDTEwMDUyODA4NDkwOVowgZQxCzAJBgNVBAYTAkZJMRAwDgYDVQQHEwdUYW1wZXJlMRowGAYDVQQDExFPQ1NQIFVOS05PV04gQ2VydDEMMAoGA1UEChMDT3JnMSMwIQYDVR0PExpjcml0aWNhbCwgZGlnaXRhbFNpZ25hdHVyZTEkMCIGA1UdJRMbMS4zLjYuMS40LjEuOTQuMS40OS4xLjIuMi4zMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDIbnFJT2y3ID0lwBix+gGbByuocroHp3preSrSmGG5OC/rZLnp21wdyjMuvo1Ga5WSfzDY6YNaSIlKKxrjYLBW+HJUJaQ0A3w3T38xCAwULEiU8e/hcK3mawlL/llNGqVnRIbpu2cuSD+ICTt7oqVvlo/TQyflRGeWT2WQ3ZBTgwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBABXIPy6FpATzxN2A8Sb8rEowoTDXNK1O4DMQ26Ri+otWDt1iThirqTl3RcuLi6PzkyXElc1VXTYKiUu3MFy5Wq5qCt6Fwntbcwx21MgnuceNqMdksMRDF1YVmZHhIb1ee/MzkuR8y8iSn+xALH+YfKO3faBwVQ9ly1ZQAgil/eBd"));
       
   381         allAttributes.put(AuthenticationAttribute.SECOND_ATTRIBUTE_PREFIX + "1" ,new Attribute("", "dgTivrr4heaBCvnX7aCcAgO0T5reljSYhuX95Rh7+SeDKNQCYqn6q860daWxCP/tk+QceBaGK1ISghzSf1PIPuKPiKhA0ia+dFLYJUjkxYJRZc8XJSRczBaF7eks3rVh5TTQGwzIG0C3w1p4OpSL+pBSO+pMrogWBgq9IL2Pe5c="));
       
   382         securityAttributes = new SecurityAttributes();
       
   383         securityAttributes.addDescriptorAttributes(allAttributes);
       
   384         authenticationModule.authenticateJad(appUID,null,securityAttributes.getAuthenticationAttributes());
       
   385         ocspEvent = oscpEventListener.getEvent();
       
   386         sucess = (ocspEvent != null && ocspEvent.eventId == OcspEventListener.OCSP_START_EVENT);
       
   387         ocspEvent = oscpEventListener.getEvent();
       
   388         authenticationModule.unregisterOcspEventListener(appUID);
       
   389         assertTrue(ocspEvent != null && ocspEvent.eventId == OcspEventListener.OCSP_FINISH_EVENT && (ocspEvent.eventError instanceof InstallerSecurityException));
       
   390         ocspError = (InstallerSecurityException)ocspEvent.eventError;
       
   391         assertTrue(ocspError.getOtaStatusCode() == OtaStatusCode.APPLICATION_AUTHENTICATION_FAILURE
       
   392                    && ocspError.getShortMessage().equals(securityErrorMessage.get(SecurityErrorMessage.OCSP_GENERAL_ERR, null))
       
   393                    && ocspError.getDetailedMessage().equals(securityDetailedErrorMessage.get(SecurityDetailedErrorMessage.OCSP_GENERAL_ERR,
       
   394                            null)));
       
   395         // PreInstallation: ocsp enabled, warning ignore, silent mode, revoked
       
   396         ocspSettings = new OcspSettings(OcspSettings.OCSP_MODE_ENABLED, OcspSettings.OCSP_WARNING_IGNORE, true, "0", "0");
       
   397         ocspUserPreferences.setOcspMode(-1);
       
   398         ocspUserPreferences.setOcspUrl(OCSP_URL);
       
   399         authenticationModule.setOCSPFlags(ocspSettings);
       
   400         storage.removeAuthenticationStorageData(appUID);
       
   401         oscpEventListener.reset();
       
   402         authenticationModule.registerOcspEventListener(appUID, oscpEventListener);
       
   403         allAttributes.clear();
       
   404         allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP3));
       
   405         allAttributes.put(AuthenticationAttribute.MAIN_ATTRIBUTE_PREFIX + "1-1", new Attribute("",        "MIIChDCCAe2gAwIBAgIJAN0+hRIgND0QMA0GCSqGSIb3DQEBBQUAMHMxCzAJBgNVBAYTAmZpMRIwEAYDVQQIEwlQaXJrYW5tYWExEDAOBgNVBAcTB1RhbXBlcmUxDjAMBgNVBAoTBU5va2lhMQ0wCwYDVQQLEwRKYXZhMR8wHQYDVQQDDBZKUF9UaGlyZF9QYXJ0eV9UcnVzdGVkMB4XDTA5MDUyODA4NDg0MFoXDTEwMDUyODA4NDg0MFowgZQxCzAJBgNVBAYTAkZJMRAwDgYDVQQHEwdUYW1wZXJlMRowGAYDVQQDExFPQ1NQIFJFVk9LRUQgQ2VydDEMMAoGA1UEChMDT3JnMSMwIQYDVR0PExpjcml0aWNhbCwgZGlnaXRhbFNpZ25hdHVyZTEkMCIGA1UdJRMbMS4zLjYuMS40LjEuOTQuMS40OS4xLjIuMi4zMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDNss9Gx9Wo7LXBEQSCkIpjwNZlOUEBzByeZ1GjwaEblL+RIlXQfq2DtercXxa9gJlryWIze/9vPX1V0wpEO9+M1fDY7Ro6E59kxfZtBnDoEFjITzChZfwqAxLo+EQUpQ2lN8sjyEW0apy73Odqkikwufzlrr9h/utDcSoED0RIMwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAJMYPjz8Q6DHsnUEva3RS2Yyjk0XcY+ldq4GGpOauY1cbZD5A/fmk/TKJahB1uV5XnuYs65vrJUuxAEzGuTzMOnMwJgAncSXFp2AQL4o02ETrp493BhOi825iwbwaHqqx2ijxJ6Jy84t1Rj+mwkwiLsFsJFMxViV0dxjbwLNQzho"));
       
   406         allAttributes.put(AuthenticationAttribute.SECOND_ATTRIBUTE_PREFIX + "1" ,new Attribute("", "r1aZCR/spVeK4eDOp1awTbas0muOpDI7y1Bz7l5OipxyZqZI4T8vy+e3q/w263bSchhOWZryPbuE6IuaeThE9qa/daK29oxR5JmmfttrlyGTsEap11NCpTCsK03HS8jwzACOD02m9hOS+EIqIdhNmoBB8ZhWdlNirTHw2UgEk/4="));
       
   407         securityAttributes = new SecurityAttributes();
       
   408         securityAttributes.addDescriptorAttributes(allAttributes);
       
   409         authenticationModule.authenticateJad(appUID,null,securityAttributes.getAuthenticationAttributes());
       
   410         ocspEvent = oscpEventListener.getEvent();
       
   411         sucess = (ocspEvent != null && ocspEvent.eventId == OcspEventListener.OCSP_START_EVENT);
       
   412         ocspEvent = oscpEventListener.getEvent();
       
   413         authenticationModule.unregisterOcspEventListener(appUID);
       
   414         assertTrue(ocspEvent != null && ocspEvent.eventId == OcspEventListener.OCSP_FINISH_EVENT && (ocspEvent.eventError instanceof InstallerSecurityException));
       
   415         ocspError = (InstallerSecurityException)ocspEvent.eventError;
       
   416         assertTrue(ocspError.getOtaStatusCode() == OtaStatusCode.APPLICATION_AUTHENTICATION_FAILURE
       
   417                    && ocspError.getShortMessage().equals(securityErrorMessage.get(SecurityErrorMessage.OCSP_GENERAL_ERR, null))
       
   418                    && ocspError.getDetailedMessage().equals(securityDetailedErrorMessage.get(SecurityDetailedErrorMessage.OCSP_REVOKED_ERR,
       
   419                            null)));
       
   420         // PreInstallation: ocsp enabled, warning ignore, silent mode, good
       
   421         ocspSettings = new OcspSettings(OcspSettings.OCSP_MODE_ENABLED, OcspSettings.OCSP_WARNING_IGNORE, true, "0", "0");
       
   422         ocspUserPreferences.setOcspMode(-1);
       
   423         ocspUserPreferences.setOcspUrl(OCSP_URL);
       
   424         authenticationModule.setOCSPFlags(ocspSettings);
       
   425         storage.removeAuthenticationStorageData(appUID);
       
   426         oscpEventListener.reset();
       
   427         authenticationModule.registerOcspEventListener(appUID, oscpEventListener);
       
   428         allAttributes.clear();
       
   429         allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP3));
       
   430         allAttributes.put(AuthenticationAttribute.MAIN_ATTRIBUTE_PREFIX + "1-1", new Attribute("",        "MIICgTCCAeqgAwIBAgIJAIROWRW4DjXyMA0GCSqGSIb3DQEBBQUAMHMxCzAJBgNVBAYTAmZpMRIwEAYDVQQIEwlQaXJrYW5tYWExEDAOBgNVBAcTB1RhbXBlcmUxDjAMBgNVBAoTBU5va2lhMQ0wCwYDVQQLEwRKYXZhMR8wHQYDVQQDDBZKUF9UaGlyZF9QYXJ0eV9UcnVzdGVkMB4XDTA5MDUyODA4NDc1M1oXDTEwMDUyODA4NDc1M1owgZExCzAJBgNVBAYTAkZJMRAwDgYDVQQHEwdUYW1wZXJlMRcwFQYDVQQDEw5PQ1NQIEdPT0QgQ2VydDEMMAoGA1UEChMDT3JnMSMwIQYDVR0PExpjcml0aWNhbCwgZGlnaXRhbFNpZ25hdHVyZTEkMCIGA1UdJRMbMS4zLjYuMS40LjEuOTQuMS40OS4xLjIuMi4zMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDHoWvDNxIjGzm2J9OmYJtVrUPZJoIXzFVAXpSztxUcsxq18K1y/wsQcxyrjMD4C6eMkxygaDun0sZSHV8MDvt36A9gjoshhRWsV+yXrM3I3XjAFKP/fLrS4nnNJM9OEOpld7kjA+xgV51/Yn3kJyFKQjqbv/WZon7rozt82MspKQIDAQABMA0GCSqGSIb3DQEBBQUAA4GBADMn5WNp0pA7Z/4GRGIk2JMShEvtuHDnYvFg0xWk90rEQoAB6XsMe8IL8e7le9sPvppjiuyImjFTK6bOQYhGAVmjHDlkxlxf5SfRmhRilOl5ZHJKeGIeI696orXiqPiuL6ltb+W9hc0ymu2yZGew1Ptt9+tlYZRT0DuM7zqW3hip"));
       
   431         allAttributes.put(AuthenticationAttribute.SECOND_ATTRIBUTE_PREFIX + "1" ,new Attribute("", "s3Z/MqNA0EXP8le8s5806RbzyNfLgD3DqX+0Tr2LjTJIa5ent1QcP1sqWrJm4XieprCGv3ja7upiVp/rfDYiS7kcXQwVxZy5nxCV0MfpT+wlf42vwE3cd6rbfoAyTH3ErSeQK6VoIyYwoaFIzOZKCIwkplc6+etacxLpCZn26to="));
       
   432         securityAttributes = new SecurityAttributes();
       
   433         securityAttributes.addDescriptorAttributes(allAttributes);
       
   434         authenticationModule.authenticateJad(appUID,null,securityAttributes.getAuthenticationAttributes());
       
   435         ocspEvent = oscpEventListener.getEvent();
       
   436         sucess = (ocspEvent != null && ocspEvent.eventId == OcspEventListener.OCSP_START_EVENT);
       
   437         ocspEvent = oscpEventListener.getEvent();
       
   438         authenticationModule.unregisterOcspEventListener(appUID);
       
   439         assertTrue(ocspEvent != null && ocspEvent.eventId == OcspEventListener.OCSP_FINISH_EVENT && ocspEvent.eventError == null);
       
   440         // PreInstallation: ocsp enabled, warning ignore, silent mode, unknown
       
   441         ocspSettings = new OcspSettings(OcspSettings.OCSP_MODE_ENABLED, OcspSettings.OCSP_WARNING_IGNORE, true, "0", "0");
       
   442         ocspUserPreferences.setOcspMode(-1);
       
   443         ocspUserPreferences.setOcspUrl(OCSP_URL);
       
   444         authenticationModule.setOCSPFlags(ocspSettings);
       
   445         storage.removeAuthenticationStorageData(appUID);
       
   446         oscpEventListener.reset();
       
   447         authenticationModule.registerOcspEventListener(appUID, oscpEventListener);
       
   448         allAttributes.clear();
       
   449         allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP3));
       
   450         allAttributes.put(AuthenticationAttribute.MAIN_ATTRIBUTE_PREFIX + "1-1", new Attribute("",        "MIIChDCCAe2gAwIBAgIJAN1kvjmXKegVMA0GCSqGSIb3DQEBBQUAMHMxCzAJBgNVBAYTAmZpMRIwEAYDVQQIEwlQaXJrYW5tYWExEDAOBgNVBAcTB1RhbXBlcmUxDjAMBgNVBAoTBU5va2lhMQ0wCwYDVQQLEwRKYXZhMR8wHQYDVQQDDBZKUF9UaGlyZF9QYXJ0eV9UcnVzdGVkMB4XDTA5MDUyODA4NDkwOVoXDTEwMDUyODA4NDkwOVowgZQxCzAJBgNVBAYTAkZJMRAwDgYDVQQHEwdUYW1wZXJlMRowGAYDVQQDExFPQ1NQIFVOS05PV04gQ2VydDEMMAoGA1UEChMDT3JnMSMwIQYDVR0PExpjcml0aWNhbCwgZGlnaXRhbFNpZ25hdHVyZTEkMCIGA1UdJRMbMS4zLjYuMS40LjEuOTQuMS40OS4xLjIuMi4zMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDIbnFJT2y3ID0lwBix+gGbByuocroHp3preSrSmGG5OC/rZLnp21wdyjMuvo1Ga5WSfzDY6YNaSIlKKxrjYLBW+HJUJaQ0A3w3T38xCAwULEiU8e/hcK3mawlL/llNGqVnRIbpu2cuSD+ICTt7oqVvlo/TQyflRGeWT2WQ3ZBTgwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBABXIPy6FpATzxN2A8Sb8rEowoTDXNK1O4DMQ26Ri+otWDt1iThirqTl3RcuLi6PzkyXElc1VXTYKiUu3MFy5Wq5qCt6Fwntbcwx21MgnuceNqMdksMRDF1YVmZHhIb1ee/MzkuR8y8iSn+xALH+YfKO3faBwVQ9ly1ZQAgil/eBd"));
       
   451         allAttributes.put(AuthenticationAttribute.SECOND_ATTRIBUTE_PREFIX + "1" ,new Attribute("", "dgTivrr4heaBCvnX7aCcAgO0T5reljSYhuX95Rh7+SeDKNQCYqn6q860daWxCP/tk+QceBaGK1ISghzSf1PIPuKPiKhA0ia+dFLYJUjkxYJRZc8XJSRczBaF7eks3rVh5TTQGwzIG0C3w1p4OpSL+pBSO+pMrogWBgq9IL2Pe5c="));
       
   452         securityAttributes = new SecurityAttributes();
       
   453         securityAttributes.addDescriptorAttributes(allAttributes);
       
   454         authenticationModule.authenticateJad(appUID,null,securityAttributes.getAuthenticationAttributes());
       
   455         ocspEvent = oscpEventListener.getEvent();
       
   456         sucess = (ocspEvent != null && ocspEvent.eventId == OcspEventListener.OCSP_START_EVENT);
       
   457         ocspEvent = oscpEventListener.getEvent();
       
   458         authenticationModule.unregisterOcspEventListener(appUID);
       
   459         assertTrue(ocspEvent != null && ocspEvent.eventId == OcspEventListener.OCSP_FINISH_EVENT && (ocspEvent.eventError instanceof InstallerSecurityException));
       
   460         ocspError = (InstallerSecurityException)ocspEvent.eventError;
       
   461         assertTrue(ocspError.getOtaStatusCode() == OtaStatusCode.APPLICATION_AUTHENTICATION_FAILURE
       
   462                    && ocspError.getShortMessage().equals(securityErrorMessage.get(SecurityErrorMessage.OCSP_GENERAL_ERR, null))
       
   463                    && ocspError.getDetailedMessage().equals(securityDetailedErrorMessage.get(SecurityDetailedErrorMessage.OCSP_GENERAL_ERR,
       
   464                            null)));
       
   465         // PreInstallation: ocsp enabled, warning confirm, not silent mode, revoked
       
   466         ocspSettings = new OcspSettings(OcspSettings.OCSP_MODE_ENABLED, OcspSettings.OCSP_WARNING_CONFIRM, false, "0", "0");
       
   467         ocspUserPreferences.setOcspMode(-1);
       
   468         ocspUserPreferences.setOcspUrl(OCSP_URL);
       
   469         authenticationModule.setOCSPFlags(ocspSettings);
       
   470         storage.removeAuthenticationStorageData(appUID);
       
   471         oscpEventListener.reset();
       
   472         authenticationModule.registerOcspEventListener(appUID, oscpEventListener);
       
   473         allAttributes.clear();
       
   474         allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP3));
       
   475         allAttributes.put(AuthenticationAttribute.MAIN_ATTRIBUTE_PREFIX + "1-1", new Attribute("",        "MIIChDCCAe2gAwIBAgIJAN0+hRIgND0QMA0GCSqGSIb3DQEBBQUAMHMxCzAJBgNVBAYTAmZpMRIwEAYDVQQIEwlQaXJrYW5tYWExEDAOBgNVBAcTB1RhbXBlcmUxDjAMBgNVBAoTBU5va2lhMQ0wCwYDVQQLEwRKYXZhMR8wHQYDVQQDDBZKUF9UaGlyZF9QYXJ0eV9UcnVzdGVkMB4XDTA5MDUyODA4NDg0MFoXDTEwMDUyODA4NDg0MFowgZQxCzAJBgNVBAYTAkZJMRAwDgYDVQQHEwdUYW1wZXJlMRowGAYDVQQDExFPQ1NQIFJFVk9LRUQgQ2VydDEMMAoGA1UEChMDT3JnMSMwIQYDVR0PExpjcml0aWNhbCwgZGlnaXRhbFNpZ25hdHVyZTEkMCIGA1UdJRMbMS4zLjYuMS40LjEuOTQuMS40OS4xLjIuMi4zMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDNss9Gx9Wo7LXBEQSCkIpjwNZlOUEBzByeZ1GjwaEblL+RIlXQfq2DtercXxa9gJlryWIze/9vPX1V0wpEO9+M1fDY7Ro6E59kxfZtBnDoEFjITzChZfwqAxLo+EQUpQ2lN8sjyEW0apy73Odqkikwufzlrr9h/utDcSoED0RIMwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAJMYPjz8Q6DHsnUEva3RS2Yyjk0XcY+ldq4GGpOauY1cbZD5A/fmk/TKJahB1uV5XnuYs65vrJUuxAEzGuTzMOnMwJgAncSXFp2AQL4o02ETrp493BhOi825iwbwaHqqx2ijxJ6Jy84t1Rj+mwkwiLsFsJFMxViV0dxjbwLNQzho"));
       
   476         allAttributes.put(AuthenticationAttribute.SECOND_ATTRIBUTE_PREFIX + "1" ,new Attribute("", "r1aZCR/spVeK4eDOp1awTbas0muOpDI7y1Bz7l5OipxyZqZI4T8vy+e3q/w263bSchhOWZryPbuE6IuaeThE9qa/daK29oxR5JmmfttrlyGTsEap11NCpTCsK03HS8jwzACOD02m9hOS+EIqIdhNmoBB8ZhWdlNirTHw2UgEk/4="));
       
   477         securityAttributes = new SecurityAttributes();
       
   478         securityAttributes.addDescriptorAttributes(allAttributes);
       
   479         authenticationModule.authenticateJad(appUID,null,securityAttributes.getAuthenticationAttributes());
       
   480         ocspEvent = oscpEventListener.getEvent();
       
   481         sucess = (ocspEvent != null && ocspEvent.eventId == OcspEventListener.OCSP_START_EVENT);
       
   482         ocspEvent = oscpEventListener.getEvent();
       
   483         authenticationModule.unregisterOcspEventListener(appUID);
       
   484         assertTrue(ocspEvent != null && ocspEvent.eventId == OcspEventListener.OCSP_FINISH_EVENT && (ocspEvent.eventError instanceof InstallerSecurityException));
       
   485         ocspError = (InstallerSecurityException)ocspEvent.eventError;
       
   486         assertTrue(ocspError.getOtaStatusCode() == OtaStatusCode.APPLICATION_AUTHENTICATION_FAILURE
       
   487                    && ocspError.getShortMessage().equals(securityErrorMessage.get(SecurityErrorMessage.OCSP_GENERAL_ERR, null))
       
   488                    && ocspError.getDetailedMessage().equals(securityDetailedErrorMessage.get(SecurityDetailedErrorMessage.OCSP_REVOKED_ERR,
       
   489                            null)));
       
   490         // PreInstallation: ocsp enabled, warning confirm, not silent mode, good
       
   491         ocspSettings = new OcspSettings(OcspSettings.OCSP_MODE_ENABLED, OcspSettings.OCSP_WARNING_CONFIRM, false, "0", "0");
       
   492         ocspUserPreferences.setOcspMode(-1);
       
   493         ocspUserPreferences.setOcspUrl(OCSP_URL);
       
   494         authenticationModule.setOCSPFlags(ocspSettings);
       
   495         storage.removeAuthenticationStorageData(appUID);
       
   496         oscpEventListener.reset();
       
   497         authenticationModule.registerOcspEventListener(appUID, oscpEventListener);
       
   498         allAttributes.clear();
       
   499         allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP3));
       
   500         allAttributes.put(AuthenticationAttribute.MAIN_ATTRIBUTE_PREFIX + "1-1", new Attribute("",        "MIICgTCCAeqgAwIBAgIJAIROWRW4DjXyMA0GCSqGSIb3DQEBBQUAMHMxCzAJBgNVBAYTAmZpMRIwEAYDVQQIEwlQaXJrYW5tYWExEDAOBgNVBAcTB1RhbXBlcmUxDjAMBgNVBAoTBU5va2lhMQ0wCwYDVQQLEwRKYXZhMR8wHQYDVQQDDBZKUF9UaGlyZF9QYXJ0eV9UcnVzdGVkMB4XDTA5MDUyODA4NDc1M1oXDTEwMDUyODA4NDc1M1owgZExCzAJBgNVBAYTAkZJMRAwDgYDVQQHEwdUYW1wZXJlMRcwFQYDVQQDEw5PQ1NQIEdPT0QgQ2VydDEMMAoGA1UEChMDT3JnMSMwIQYDVR0PExpjcml0aWNhbCwgZGlnaXRhbFNpZ25hdHVyZTEkMCIGA1UdJRMbMS4zLjYuMS40LjEuOTQuMS40OS4xLjIuMi4zMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDHoWvDNxIjGzm2J9OmYJtVrUPZJoIXzFVAXpSztxUcsxq18K1y/wsQcxyrjMD4C6eMkxygaDun0sZSHV8MDvt36A9gjoshhRWsV+yXrM3I3XjAFKP/fLrS4nnNJM9OEOpld7kjA+xgV51/Yn3kJyFKQjqbv/WZon7rozt82MspKQIDAQABMA0GCSqGSIb3DQEBBQUAA4GBADMn5WNp0pA7Z/4GRGIk2JMShEvtuHDnYvFg0xWk90rEQoAB6XsMe8IL8e7le9sPvppjiuyImjFTK6bOQYhGAVmjHDlkxlxf5SfRmhRilOl5ZHJKeGIeI696orXiqPiuL6ltb+W9hc0ymu2yZGew1Ptt9+tlYZRT0DuM7zqW3hip"));
       
   501         allAttributes.put(AuthenticationAttribute.SECOND_ATTRIBUTE_PREFIX + "1" ,new Attribute("", "s3Z/MqNA0EXP8le8s5806RbzyNfLgD3DqX+0Tr2LjTJIa5ent1QcP1sqWrJm4XieprCGv3ja7upiVp/rfDYiS7kcXQwVxZy5nxCV0MfpT+wlf42vwE3cd6rbfoAyTH3ErSeQK6VoIyYwoaFIzOZKCIwkplc6+etacxLpCZn26to="));
       
   502         securityAttributes = new SecurityAttributes();
       
   503         securityAttributes.addDescriptorAttributes(allAttributes);
       
   504         authenticationModule.authenticateJad(appUID,null,securityAttributes.getAuthenticationAttributes());
       
   505         ocspEvent = oscpEventListener.getEvent();
       
   506         sucess = (ocspEvent != null && ocspEvent.eventId == OcspEventListener.OCSP_START_EVENT);
       
   507         ocspEvent = oscpEventListener.getEvent();
       
   508         authenticationModule.unregisterOcspEventListener(appUID);
       
   509         assertTrue(ocspEvent != null && ocspEvent.eventId == OcspEventListener.OCSP_FINISH_EVENT && ocspEvent.eventError == null);
       
   510         // PreInstallation: ocsp enabled, warning confirm, not silent mode, unknown
       
   511         ocspSettings = new OcspSettings(OcspSettings.OCSP_MODE_ENABLED, OcspSettings.OCSP_WARNING_CONFIRM, false, "0", "0");
       
   512         ocspUserPreferences.setOcspMode(-1);
       
   513         ocspUserPreferences.setOcspUrl(OCSP_URL);
       
   514         authenticationModule.setOCSPFlags(ocspSettings);
       
   515         storage.removeAuthenticationStorageData(appUID);
       
   516         oscpEventListener.reset();
       
   517         authenticationModule.registerOcspEventListener(appUID, oscpEventListener);
       
   518         allAttributes.clear();
       
   519         allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP3));
       
   520         allAttributes.put(AuthenticationAttribute.MAIN_ATTRIBUTE_PREFIX + "1-1", new Attribute("",        "MIIChDCCAe2gAwIBAgIJAN1kvjmXKegVMA0GCSqGSIb3DQEBBQUAMHMxCzAJBgNVBAYTAmZpMRIwEAYDVQQIEwlQaXJrYW5tYWExEDAOBgNVBAcTB1RhbXBlcmUxDjAMBgNVBAoTBU5va2lhMQ0wCwYDVQQLEwRKYXZhMR8wHQYDVQQDDBZKUF9UaGlyZF9QYXJ0eV9UcnVzdGVkMB4XDTA5MDUyODA4NDkwOVoXDTEwMDUyODA4NDkwOVowgZQxCzAJBgNVBAYTAkZJMRAwDgYDVQQHEwdUYW1wZXJlMRowGAYDVQQDExFPQ1NQIFVOS05PV04gQ2VydDEMMAoGA1UEChMDT3JnMSMwIQYDVR0PExpjcml0aWNhbCwgZGlnaXRhbFNpZ25hdHVyZTEkMCIGA1UdJRMbMS4zLjYuMS40LjEuOTQuMS40OS4xLjIuMi4zMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDIbnFJT2y3ID0lwBix+gGbByuocroHp3preSrSmGG5OC/rZLnp21wdyjMuvo1Ga5WSfzDY6YNaSIlKKxrjYLBW+HJUJaQ0A3w3T38xCAwULEiU8e/hcK3mawlL/llNGqVnRIbpu2cuSD+ICTt7oqVvlo/TQyflRGeWT2WQ3ZBTgwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBABXIPy6FpATzxN2A8Sb8rEowoTDXNK1O4DMQ26Ri+otWDt1iThirqTl3RcuLi6PzkyXElc1VXTYKiUu3MFy5Wq5qCt6Fwntbcwx21MgnuceNqMdksMRDF1YVmZHhIb1ee/MzkuR8y8iSn+xALH+YfKO3faBwVQ9ly1ZQAgil/eBd"));
       
   521         allAttributes.put(AuthenticationAttribute.SECOND_ATTRIBUTE_PREFIX + "1" ,new Attribute("", "dgTivrr4heaBCvnX7aCcAgO0T5reljSYhuX95Rh7+SeDKNQCYqn6q860daWxCP/tk+QceBaGK1ISghzSf1PIPuKPiKhA0ia+dFLYJUjkxYJRZc8XJSRczBaF7eks3rVh5TTQGwzIG0C3w1p4OpSL+pBSO+pMrogWBgq9IL2Pe5c="));
       
   522         securityAttributes = new SecurityAttributes();
       
   523         securityAttributes.addDescriptorAttributes(allAttributes);
       
   524         authenticationModule.authenticateJad(appUID,null,securityAttributes.getAuthenticationAttributes());
       
   525         ocspEvent = oscpEventListener.getEvent();
       
   526         sucess = (ocspEvent != null && ocspEvent.eventId == OcspEventListener.OCSP_START_EVENT);
       
   527         ocspEvent = oscpEventListener.getEvent();
       
   528         authenticationModule.unregisterOcspEventListener(appUID);
       
   529         assertTrue(ocspEvent != null && ocspEvent.eventId == OcspEventListener.OCSP_FINISH_EVENT && (ocspEvent.eventError instanceof InstallerSecurityException));
       
   530         ocspError = (InstallerSecurityException)ocspEvent.eventError;
       
   531         assertTrue(ocspError.getOtaStatusCode() == OtaStatusCode.APPLICATION_AUTHENTICATION_FAILURE
       
   532                    && ocspError.getShortMessage().equals(securityErrorMessage.get(SecurityErrorMessage.OCSP_GENERAL_ERR, null))
       
   533                    && ocspError.getDetailedMessage().equals(securityDetailedErrorMessage.get(SecurityDetailedErrorMessage.OCSP_GENERAL_ERR,
       
   534                            null)));
       
   535     }
       
   536 
       
   537     public static void showGuidelines(String guidelines)
       
   538     {
       
   539         RuntimeUi ui = RuntimeUiFactory.getRuntimeUi(
       
   540                            true /* aIdentified */);
       
   541         ConfirmData cData = new ConfirmData(
       
   542             guidelines,
       
   543             null /*answerOptions*/,
       
   544             0 /* highlight always the first option */);
       
   545         ui.confirm("Test guidance",cData);
       
   546         ui.destroy();
       
   547     }
       
   548 
       
   549     class OcspCancelThread extends Thread
       
   550     {
       
   551         OcspCancelThread(Uid msUid, Monitor ocspCancelMonitor)
       
   552         {
       
   553             this.msUid = msUid;
       
   554             this.ocspCancelMonitor = ocspCancelMonitor;
       
   555         }
       
   556         public void run()
       
   557         {
       
   558             authenticationModule.cancelOcspCheck(msUid);
       
   559             ocspCancelMonitor.notifyMonitor();
       
   560         }
       
   561         private Uid msUid;
       
   562         private Monitor ocspCancelMonitor;
       
   563     }
       
   564 
       
   565     private void cancelOcsp(Uid msUid)
       
   566     {
       
   567         Monitor ocspCancelMonitor = new Monitor();
       
   568         OcspCancelThread t = new OcspCancelThread(msUid, ocspCancelMonitor);
       
   569         t.start();
       
   570         // wait for the thread to finish
       
   571         ocspCancelMonitor.waitOnMonitor();
       
   572     }
       
   573 }