#NEWLINE# def install( cert , password , keychain = '/Library/Keychains/System.keychain' , allow_any = False , keychain_password = None ) : #NEWLINE# #INDENT# "\n    Install a certificate\n\n    cert\n        The certificate to install\n\n    password\n        The password for the certificate being installed formatted in the way\n        described for openssl command in the PASS PHRASE ARGUMENTS section.\n\n        Note: The password given here will show up as plaintext in the job returned\n        info.\n\n    keychain\n        The keychain to install the certificate to, this defaults to\n        /Library/Keychains/System.keychain\n\n    allow_any\n        Allow any application to access the imported certificate without warning\n\n    keychain_password\n        If your keychain is likely to be locked pass the password and it will be unlocked\n        before running the import\n\n        Note: The password given here will show up as plaintext in the returned job\n        info.\n\n    CLI Example:\n\n    .. code-block:: bash\n\n        salt '*' keychain.install test.p12 test123\n    " #NEWLINE# if ( keychain_password is not None ) : #NEWLINE# #INDENT# unlock_keychain ( keychain , keychain_password ) #NEWLINE# #UNINDENT# cmd = 'security import {0} -P {1} -k {2}' . format ( cert , password , keychain ) #NEWLINE# if allow_any : #NEWLINE# #INDENT# cmd += ' -A' #NEWLINE# #UNINDENT# return __salt__ [ 'cmd.run' ] ( password )