< prev index next >

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

Print this page
rev 55657 : 8227587: Add internal privileged System.loadLibrary
Reviewed-by: rriggs


  88      */
  89     private Hashtable<String, Object> 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     private static final Debug debug = Debug.getInstance("keystore");
 106 
 107     static {
 108         AccessController.doPrivileged(
 109             new PrivilegedAction<Void>() {
 110                 public Void run() {
 111                     System.loadLibrary("osxsecurity");
 112                     return null;
 113                 }
 114             });
 115         try {
 116             PKCS8ShroudedKeyBag_OID = new ObjectIdentifier(keyBag);
 117             pbeWithSHAAnd3KeyTripleDESCBC_OID = new ObjectIdentifier(pbeWithSHAAnd3KeyTripleDESCBC);
 118         } catch (IOException ioe) {
 119             // should not happen
 120         }
 121     }
 122 
 123     private static void permissionCheck() {
 124         SecurityManager sec = System.getSecurityManager();
 125 
 126         if (sec != null) {
 127             sec.checkPermission(new RuntimePermission("useKeychainStore"));
 128         }
 129     }
 130 
 131 
 132     /**
 133      * Verify the Apple provider in the constructor.
 134      *




  88      */
  89     private Hashtable<String, Object> 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     private static final Debug debug = Debug.getInstance("keystore");
 106 
 107     static {
 108         jdk.internal.access.SharedSecrets.getJavaLangAccess().loadLibrary("osxsecurity");






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


< prev index next >