src/macosx/classes/apple/security/KeychainStore.java

Print this page




  86      * Private keys and certificates are stored in a hashtable.
  87      * Hash entries are keyed by alias names.
  88      */
  89     private Hashtable entries = new Hashtable();
  90 
  91     /**
  92      * Algorithm identifiers and corresponding OIDs for the contents of the PKCS12 bag we get from the Keychain.
  93      */
  94     private static final int keyBag[]  = {1, 2, 840, 113549, 1, 12, 10, 1, 2};
  95     private static final int pbeWithSHAAnd3KeyTripleDESCBC[] =     {1, 2, 840, 113549, 1, 12, 1, 3};
  96     private static ObjectIdentifier PKCS8ShroudedKeyBag_OID;
  97     private static ObjectIdentifier pbeWithSHAAnd3KeyTripleDESCBC_OID;
  98 
  99     /**
 100      * Constnats used in PBE decryption.
 101      */
 102     private static final int iterationCount = 1024;
 103     private static final int SALT_LEN = 20;
 104 
 105     static {
 106         java.security.AccessController.doPrivileged((PrivilegedAction<?>)new sun.security.action.LoadLibraryAction("osx"));






 107         try {
 108             PKCS8ShroudedKeyBag_OID = new ObjectIdentifier(keyBag);
 109             pbeWithSHAAnd3KeyTripleDESCBC_OID = new ObjectIdentifier(pbeWithSHAAnd3KeyTripleDESCBC);
 110         } catch (IOException ioe) {
 111             // should not happen
 112         }
 113     }
 114 
 115     private static void permissionCheck() {
 116         SecurityManager sec = System.getSecurityManager();
 117 
 118         if (sec != null) {
 119             sec.checkPermission(new RuntimePermission("useKeychainStore"));
 120         }
 121     }
 122 
 123 
 124     /**
 125      * Verify the Apple provider in the constructor.
 126      *




  86      * Private keys and certificates are stored in a hashtable.
  87      * Hash entries are keyed by alias names.
  88      */
  89     private Hashtable entries = new Hashtable();
  90 
  91     /**
  92      * Algorithm identifiers and corresponding OIDs for the contents of the PKCS12 bag we get from the Keychain.
  93      */
  94     private static final int keyBag[]  = {1, 2, 840, 113549, 1, 12, 10, 1, 2};
  95     private static final int pbeWithSHAAnd3KeyTripleDESCBC[] =     {1, 2, 840, 113549, 1, 12, 1, 3};
  96     private static ObjectIdentifier PKCS8ShroudedKeyBag_OID;
  97     private static ObjectIdentifier pbeWithSHAAnd3KeyTripleDESCBC_OID;
  98 
  99     /**
 100      * Constnats used in PBE decryption.
 101      */
 102     private static final int iterationCount = 1024;
 103     private static final int SALT_LEN = 20;
 104 
 105     static {
 106         AccessController.doPrivileged(
 107             new PrivilegedAction<Void>() {
 108                 public Void run() {
 109                     System.loadLibrary("osx");
 110                     return null;
 111                 }
 112             });
 113         try {
 114             PKCS8ShroudedKeyBag_OID = new ObjectIdentifier(keyBag);
 115             pbeWithSHAAnd3KeyTripleDESCBC_OID = new ObjectIdentifier(pbeWithSHAAnd3KeyTripleDESCBC);
 116         } catch (IOException ioe) {
 117             // should not happen
 118         }
 119     }
 120 
 121     private static void permissionCheck() {
 122         SecurityManager sec = System.getSecurityManager();
 123 
 124         if (sec != null) {
 125             sec.checkPermission(new RuntimePermission("useKeychainStore"));
 126         }
 127     }
 128 
 129 
 130     /**
 131      * Verify the Apple provider in the constructor.
 132      *