macOS 存取keychain 密码

macOS 通过 Keychain 存取密码 - 简书

Mac之Security工具使用总结_fswy的博客-CSDN博客

 Security是Mac系统中钥匙串和安全模块的命令行管理工具,(图形化工具为Keychain Access.app)。钥匙串(Keychain)实质上就是一个用于存放证书、密钥、密码等安全认证实体的仓库,在计算机中保存为一个.keychain的文件,默认存放在以下目录中(使用这几个目录中的钥匙串时不需要写路径,直接用文件名即可,Security工具会自动搜索):

  ~/Library/Keychains/
  /Library/Keychains/
 -/Network/Library/Keychains/

Keychain 是一个保存密码、证书等私密文件的一个库;

create keychain

delete keychain

unlock keychain

lock keychain

set-keychain-password

password 是保存在keychain里的一个元素。

add-generic-password

delete-generic-password

find-generic-password

 

> security add-generic-password --help

Usage: add-generic-password [-a account] [-s service] [-w password] [options...] [-A|-T appPath] [keychain]

    -a  Specify account name (required)

    -c  Specify item creator (optional four-character code)

    -C  Specify item type (optional four-character code)

    -D  Specify kind (default is "application password")

    -G  Specify generic attribute (optional)

    -j  Specify comment string (optional)

    -l  Specify label (if omitted, service name is used as default label)

    -s  Specify service name (required)

    -p  Specify password to be added (legacy option, equivalent to -w)

    -w  Specify password to be added

    -X  Specify password data to be added as a hexadecimal string

    -A  Allow any application to access this item without warning (insecure, not recommended!)

    -T  Specify an application which may access this item (multiple -T options are allowed)

    -U  Update item if it already exists (if omitted, the item cannot already exist)

By default, the application which creates an item is trusted to access its data without warning.

You can remove this default access by explicitly specifying an empty app pathname: -T ""

If no keychain is specified, the password is added to the default keychain.

Use of the -p or -w options is insecure. Specify -w as the last option to be prompted.

你可能感兴趣的:(macos)