src/java.base/macosx/native/libosxsecurity/KeystoreImpl.m
changeset 57541 5da01706bf11
parent 53042 56fbb14251ca
equal deleted inserted replaced
57540:dd6d424909dc 57541:5da01706bf11
     1 /*
     1 /*
     2  * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   560     paramBlock.keyUsage = CSSM_KEYUSE_ANY;
   560     paramBlock.keyUsage = CSSM_KEYUSE_ANY;
   561     paramBlock.keyAttributes = CSSM_KEYATTR_RETURN_DEFAULT;
   561     paramBlock.keyAttributes = CSSM_KEYATTR_RETURN_DEFAULT;
   562 
   562 
   563     err = SecKeychainItemImport(cfDataToImport, NULL, &dataFormat, NULL,
   563     err = SecKeychainItemImport(cfDataToImport, NULL, &dataFormat, NULL,
   564                                 0, &paramBlock, defaultKeychain, &createdItems);
   564                                 0, &paramBlock, defaultKeychain, &createdItems);
       
   565     if (cfDataToImport != NULL) {
       
   566         CFRelease(cfDataToImport);
       
   567     }
   565 
   568 
   566     if (err == noErr) {
   569     if (err == noErr) {
   567         SecKeychainItemRef anItem = (SecKeychainItemRef)CFArrayGetValueAtIndex(createdItems, 0);
   570         SecKeychainItemRef anItem = (SecKeychainItemRef)CFArrayGetValueAtIndex(createdItems, 0);
   568 
   571 
   569         // Don't bother labeling keys. They become part of an identity, and are not an accessible part of the keychain.
   572         // Don't bother labeling keys. They become part of an identity, and are not an accessible part of the keychain.