jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/SunPKCS11.java
changeset 44545 83b611b88ac8
parent 43248 5e15de85a1a0
equal deleted inserted replaced
44480:2c33418a6d57 44545:83b611b88ac8
    75     private CallbackHandler pHandler;
    75     private CallbackHandler pHandler;
    76     private final Object LOCK_HANDLER = new Object();
    76     private final Object LOCK_HANDLER = new Object();
    77 
    77 
    78     final boolean removable;
    78     final boolean removable;
    79 
    79 
    80     final Module nssModule;
    80     final Secmod.Module nssModule;
    81 
    81 
    82     final boolean nssUseSecmodTrust;
    82     final boolean nssUseSecmodTrust;
    83 
    83 
    84     private volatile Token token;
    84     private volatile Token token;
    85 
    85 
   146         long slotID = config.getSlotID();
   146         long slotID = config.getSlotID();
   147         int slotListIndex = config.getSlotListIndex();
   147         int slotListIndex = config.getSlotListIndex();
   148 
   148 
   149         boolean useSecmod = config.getNssUseSecmod();
   149         boolean useSecmod = config.getNssUseSecmod();
   150         boolean nssUseSecmodTrust = config.getNssUseSecmodTrust();
   150         boolean nssUseSecmodTrust = config.getNssUseSecmodTrust();
   151         Module nssModule = null;
   151         Secmod.Module nssModule = null;
   152 
   152 
   153         //
   153         //
   154         // Initialization via Secmod. The way this works is as follows:
   154         // Initialization via Secmod. The way this works is as follows:
   155         // SunPKCS11 is either in normal mode or in NSS Secmod mode.
   155         // SunPKCS11 is either in normal mode or in NSS Secmod mode.
   156         // Secmod is activated by specifying one or more of the following
   156         // Secmod is activated by specifying one or more of the following
   215                 }
   215                 }
   216             } catch (IOException e) {
   216             } catch (IOException e) {
   217                 // XXX which exception to throw
   217                 // XXX which exception to throw
   218                 throw new ProviderException("Could not initialize NSS", e);
   218                 throw new ProviderException("Could not initialize NSS", e);
   219             }
   219             }
   220             List<Module> modules = secmod.getModules();
   220             List<Secmod.Module> modules = secmod.getModules();
   221             if (config.getShowInfo()) {
   221             if (config.getShowInfo()) {
   222                 System.out.println("NSS modules: " + modules);
   222                 System.out.println("NSS modules: " + modules);
   223             }
   223             }
   224 
   224 
   225             String moduleName = config.getNssModule();
   225             String moduleName = config.getNssModule();
   256                 if (moduleIndex < 1) {
   256                 if (moduleIndex < 1) {
   257                     throw new ProviderException
   257                     throw new ProviderException
   258                             ("Invalid external module: " + moduleName);
   258                             ("Invalid external module: " + moduleName);
   259                 }
   259                 }
   260                 int k = 0;
   260                 int k = 0;
   261                 for (Module module : modules) {
   261                 for (Secmod.Module module : modules) {
   262                     if (module.getType() == ModuleType.EXTERNAL) {
   262                     if (module.getType() == ModuleType.EXTERNAL) {
   263                         if (++k == moduleIndex) {
   263                         if (++k == moduleIndex) {
   264                             nssModule = module;
   264                             nssModule = module;
   265                             break;
   265                             break;
   266                         }
   266                         }