1 .\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples.
3 .\"man mdoc.samples for a complete listing of options
4 .\"man mdoc for the short list of editing options
5 .Dd March 1, 2012 \" DATE
6 .Dt security 1 \" Program name and manual section number
8 .Sh NAME \" Section Header - required - don't modify
10 .\" The following lines are read in generating the apropos(man -k) database. Use only key
11 .\" words here as the database is built based on the words here and in the .ND line.
12 .\" Use .Nm macro to designate other names for the documented program.
13 .Nd Command line interface to keychains and Security framework
14 .Sh SYNOPSIS \" Section Header - required - don't modify
16 .Op Fl hilqv \" [-hilqv]
17 .Op Fl p Ar prompt \" [-p prompt]
18 .Op Ar command \" [command]
19 .Op Ar command_options \" [command_options]
20 .Op Ar command_args \" [command_args]
21 .Sh DESCRIPTION \" Section Header - required - don't modify
22 A simple command line interface which lets you administer keychains,
23 manipulate keys and certificates, and do just about anything the
24 Security framework is capable of from the command line.
30 supplied and report if anything went wrong.
38 will enter interactive mode and allow the user to enter multiple commands on stdin. When EOF is read from stdin
42 Here is a complete list of the options available:
43 .Bl -tag -width -indent
45 If no arguments are specified, show a list of all commands. If arguments are provided, show usage for each the specified commands. This option is essentially the same as the
51 in interactive mode. A prompt
56 will be displayed and the user will be able to type commands on stdin until an EOF is encountered.
61 .Dl "/usr/bin/leaks -nocontext"
62 on itself to see if the command(s) you executed had any leaks.
64 This option implies the
66 option but changes the default prompt to the argument specified instead.
77 .Sh "SECURITY COMMAND SUMMARY"
79 provides a rich variety of commands
83 , each of which often has a wealth of options, to allow access to
84 the broad functionality provided by the Security framework. However,
85 you don't have to master every detail for
89 Here are brief descriptions of all the
93 .Bl -tag -width user-trust-settings-enable -compact
95 Show all commands, or show usage for a command.
97 Display or manipulate the keychain search list.
98 .It Nm default-keychain
99 Display or set the default keychain.
100 .It Nm login-keychain
101 Display or set the login keychain.
102 .It Nm create-keychain
104 .It Nm delete-keychain
105 Delete keychains and remove them from the search list.
107 Lock the specified keychain.
108 .It Nm unlock-keychain
109 Unlock the specified keychain.
110 .It Nm set-keychain-settings
111 Set settings for a keychain.
112 .It Nm set-keychain-password
113 Set password for a keychain.
114 .It Nm show-keychain-info
115 Show the settings for keychain.
117 Dump the contents of one or more keychains.
118 .It Nm create-keypair
119 Create an asymmetric key pair.
120 .It Nm add-generic-password
121 Add a generic password item.
122 .It Nm add-internet-password
123 Add an internet password item.
124 .It Nm add-certificates
125 Add certificates to a keychain.
126 .It Nm find-generic-password
127 Find a generic password item.
128 .It Nm delete-generic-password
129 Delete a generic password item.
130 .It Nm find-internet-password
131 Find an internet password item.
132 .It Nm delete-internet-password
133 Delete an internet password item.
134 .It Nm find-certificate
135 Find a certificate item.
137 Find an identity (certificate + private key).
138 .It Nm delete-certificate
139 Delete a certificate from a keychain.
140 .It Nm set-identity-preference
141 Set the preferred identity to use for a service.
142 .It Nm get-identity-preference
143 Get the preferred identity to use for a service.
145 Create a db using the DL.
147 Export items from a keychain.
149 Import items into a keychain.
151 Encode or decode CMS messages.
153 Install (or re-install) the MDS database.
154 .It Nm add-trusted-cert
155 Add trusted certificate(s).
156 .It Nm remove-trusted-cert
157 Remove trusted certificate(s).
158 .It Nm dump-trust-settings
159 Display contents of trust settings.
160 .It Nm user-trust-settings-enable
161 Display or manipulate user-level trust settings.
162 .It Nm trust-settings-export
163 Export trust settings.
164 .It Nm trust-settings-import
165 Import trust settings.
167 Verify certificate(s).
169 Perform authorization operations.
170 .It Nm authorizationdb
171 Make changes to the authorization policy database.
172 .It Nm execute-with-privileges
173 Execute tool with privileges.
179 Display a descriptive message for the given error code(s).
181 .Sh "COMMON COMMAND OPTIONS"
182 This section describes the
184 that are available across all
187 .Bl -tag -width -indent
189 Show a usage message for the specified command. This option is
190 essentially the same as the
194 .Sh "SECURITY COMMANDS"
195 Here (finally) are details on all the
197 commands and the options each accepts.
202 .Bl -item -offset -indent
203 Show all commands, or show usage for a command.
208 .Op Fl d Ar user Ns | Ns Ar system Ns | Ns Ar common Ns | Ns Ar dynamic
209 .Op Fl s Op Ar keychain...
210 .Bl -item -offset -indent
211 Display or manipulate the keychain search list.
213 .Bl -tag -compact -width -indent
214 .It Fl d Ar user Ns | Ns Ar system Ns | Ns Ar common Ns | Ns Ar dynamic
215 Use the specified preference domain.
217 Set the search list to the specified keychains.
223 .Op Fl d Ar user Ns | Ns Ar system Ns | Ns Ar common Ns | Ns Ar dynamic
224 .Op Fl s Op Ar keychain
225 .Bl -item -offset -indent
226 Display or set the default keychain.
228 .Bl -tag -compact -width -indent
229 .It Fl d Ar user Ns | Ns Ar system Ns | Ns Ar common Ns | Ns Ar dynamic
230 Use the specified preference domain.
232 Set the default keychain to the specified
234 Unset it if no keychain is specified.
240 .Op Fl d Ar user Ns | Ns Ar system Ns | Ns Ar common Ns | Ns Ar dynamic
241 .Op Fl s Op Ar keychain
242 .Bl -item -offset -indent
243 Display or set the login keychain.
245 .Bl -tag -compact -width -indent
246 .It Fl d Ar user Ns | Ns Ar system Ns | Ns Ar common Ns | Ns Ar dynamic
247 Use the specified preference domain.
249 Set the login keychain to the specified
251 Unset it if no keychain is specified.
259 .Bl -item -offset -indent
262 .Bl -tag -compact -width -indent-indent
264 Prompt the user for a password using the SecurityAgent.
268 as the password for the keychains being created.
275 are specified, the user is prompted for a password on the command line. Use
276 of the -p option is insecure.
282 .Bl -item -offset -indent
283 Delete keychains and remove them from the search list.
288 .Op Fl a Ns | Ns Ar keychain
289 .Bl -item -offset -indent
292 \&, or the default keychain if none is specified. If the
294 option is specified, all keychains are locked.
301 .Bl -item -offset -indent
304 \&, or the default keychain if none is specified.
307 .Nm set-keychain-settings
311 .Bl -item -offset -indent
314 \&, or the default keychain if none is specified.
316 .Bl -tag -compact -width -indent-indent
318 Lock keychain when the system sleeps.
320 Lock keychain after timeout interval.
324 interval in seconds (omitting this option specifies "no timeout").
328 .Nm set-keychain-password
330 .Op Fl o Ar oldPassword
331 .Op Fl p Ar newPassword
333 .Bl -item -offset -indent
336 \&, or the default keychain if none is specified.
338 .Bl -tag -compact -width -indent-indent
339 .It Fl o Ar oldPassword
340 Old keychain password (if not provided, will prompt)
341 .It Fl p Ar newPassword
342 New keychain password (if not provided, will prompt)
346 .Nm show-keychain-info
349 .Bl -item -offset -indent
350 Show the settings for
357 .Bl -item -offset -indent
358 Dump the contents of one or more keychains.
360 .Bl -tag -compact -width -indent-indent
362 Dump access control list of items
364 Dump (decrypted) data of items
366 Interactive access control list editing mode
368 Dump raw (encrypted) data of items
380 .Op Fl A Ns | Ns Fl T Ar appPath
382 .Bl -item -offset -indent
383 Create an asymmetric key pair.
385 .Bl -tag -compact -width -indent-indent
389 as the algorithm, can be rsa, dh, dsa or fee (default rsa)
391 Specify the keysize in bits (default 512)
393 Make a key valid from the specified date (ex: "13/11/10 3:30pm")
395 Make a key valid to the specified date
397 Make a key valid for the number of days specified from today
399 Use the specified keychain rather than the default
401 Allow any application to access this key without warning (insecure, not recommended!)
403 Specify an application which may access this key (multiple
405 \& options are allowed)
409 .Nm add-generic-password
416 .Bl -item -offset -indent
417 Add a generic password item.
419 .Bl -tag -compact -width -indent-indent
421 Specify account name (required)
423 Specify item creator (optional four-character code)
425 Specify item type (optional four-character code)
427 Specify kind (default is "application password")
429 Specify generic attribute value (optional)
431 Specify comment string (optional)
433 Specify label (if omitted, service name is used as default label)
435 Specify service name (required)
437 Specify password to be added (legacy option, equivalent to
441 Specify password to be added. Put at end of command to be prompted (recommended)
443 Allow any application to access this item without warning (insecure, not recommended!)
445 Specify an application which may access this item (multiple
447 \& options are allowed)
449 Update item if it already exists (if omitted, the item cannot already exist)
453 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:
455 \& "". If no keychain is specified, the password is added to the default keychain.
459 .Nm add-internet-password
466 .Bl -item -offset -indent
467 Add an internet password item.
469 .Bl -tag -compact -width -indent-indent
471 Specify account name (required)
473 Specify item creator (optional four-character code)
475 Specify item type (optional four-character code)
477 Specify security domain string (optional)
479 Specify kind (default is "application password")
481 Specify comment string (optional)
483 Specify label (if omitted, service name is used as default label)
485 Specify path string (optional)
487 Specify port number (optional)
489 Specify protocol (optional four-character SecProtocolType, e.g. "http", "ftp ")
491 Specify server name (required)
492 .It Fl t Ar authenticationType
493 Specify authentication type (as a four-character SecAuthenticationType, default is "dflt")
495 Specify password to be added. Put at end of command to be prompted (recommended)
497 Allow any application to access this item without warning (insecure, not recommended!)
499 Specify an application which may access this item (multiple
501 \& options are allowed)
503 Update item if it already exists (if omitted, the item cannot already exist)
507 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:
509 \& "". If no keychain is specified, the password is added to the default keychain.
517 .Bl -item -offset -indent
518 Add certficates contained in the specified
520 to the default keychain. The files must contain one DER encoded X509 certificate each.
521 .Bl -tag -compact -width -indent-indent
525 rather than the default keychain.
529 .Nm find-generic-password
535 .Op Fl Ar keychain...
536 .Bl -item -offset -indent
537 Find a generic password item.
539 .Bl -tag -compact -width -indent-indent
543 Match creator (four-character code)
545 Match type (four-character code)
549 Match value string (generic attribute)
557 Display the password for the item found
559 Display the password(only) for the item found
563 .Nm delete-generic-password
568 .Op Fl Ar keychain...
569 .Bl -item -offset -indent
570 Delete a generic password item.
572 .Bl -tag -compact -width -indent-indent
576 Match creator (four-character code)
578 Match type (four-character code)
582 Match value string (generic attribute)
592 .Nm delete-internet-password
598 .Bl -item -offset -indent
599 Delete an internet password item.
601 .Bl -tag -compact -width -indent-indent
605 Match creator (four-character code)
607 Match type (four-character code)
608 .It Fl d Ar securityDomain
609 Match securityDomain string
621 Match protocol (four-character code)
624 .It Fl t Ar authenticationType
625 Match authenticationType (four-character code)
629 .Nm find-internet-password
636 .Bl -item -offset -indent
637 Find an internet password item.
639 .Bl -tag -compact -width -indent-indent
643 Match creator (four-character code)
645 Match type (four-character code)
646 .It Fl d Ar securityDomain
647 Match securityDomain string
659 Match protocol (four-character code)
662 .It Fl t Ar authenticationType
663 Match authenticationType (four-character code)
665 Display the password for the item found
667 Display the password(only) for the item found
675 .Op Fl e Ar emailAddress
680 .Bl -item -offset -indent
681 Find a certificate item. If no
683 \& arguments are provided, the default search list is used.
686 .Bl -tag -compact -width -indent-indent
688 Find all matching certificates, not just the first one
692 \& when searching (optional)
693 .It Fl e Ar emailAddress
696 \& when searching (optional)
698 Show the email addresses in the certificate
700 Output certificate in pem format. Default is to dump the attributes and keychain the cert is in.
702 Print SHA-1 hash of the certificate
706 .Bl -tag -width -indent
707 .It security> find-certificate -a -p > allcerts.pem
708 Exports all certificates from all keychains into a pem file called allcerts.pem.
709 .It security> find-certificate -a -e me@foo.com -p > certs.pem
710 Exports all certificates from all keychains with the email address
711 me@foo.com into a pem file called certs.pem.
712 .It security> find-certificate -a -c MyName -Z login.keychain | grep ^SHA-1
713 Print the SHA-1 hash of every certificate in 'login.keychain' whose common name includes 'MyName'
723 .Bl -item -offset -indent
724 Find an identity (certificate + private key) satisfying a given policy. If no
726 \& arguments are provided, the X.509 basic policy is assumed. If no
728 \& arguments are provided, the default search list is used.
731 .Bl -tag -compact -width -indent-indent
735 \& to evaluate (multiple -p options are allowed). Supported policies:
736 basic, ssl-client, ssl-server, smime, eap, ipsec, ichat, codesigning,
737 sys-default, sys-kerberos-kdc
739 Specify optional policy-specific
741 \& (e.g. a DNS hostname for SSL, or RFC822 email address for S/MIME)
743 Show valid identities only (default is to show all identities)
747 .Bl -tag -width -indent
748 .It security> find-identity -v -p ssl-client
749 Display valid identities that can be used for SSL client authentication
750 .It security> find-identity -p ssl-server -s www.domain.com
751 Display identities for a SSL server running on the host 'www.domain.com'
752 .It security> find-identity -p smime -s user@domain.com
753 Display identities that can be used to sign a message from 'user@domain.com'
757 .Nm delete-certificate
763 .Bl -item -offset -indent
764 Delete a certificate from a keychain. If no
766 \& arguments are provided, the default search list is used.
768 .Bl -tag -compact -width -indent-indent
770 Specify certificate to delete by its common name
772 Specify certificate to delete by its SHA-1 hash
774 Also delete user trust settings for this certificate
777 The certificate to be deleted must be uniquely specified either by a
778 string found in its common name, or by its SHA-1 hash.
781 .Nm set-identity-preference
789 .Bl -item -offset -indent
790 Set the preferred identity to use for a service.
792 .Bl -tag -compact -width -indent-indent
794 Specify no identity (clears existing preference for the given service)
796 Specify identity by common name of the certificate
798 Specify service (may be a URL, RFC822 email address, DNS host, or other name) for which this identity is to be preferred
800 Specify key usage (optional)
802 Specify identity by SHA-1 hash of certificate (optional)
805 The identity is located by searching the specified keychain(s) for a certificate whose common name contains
806 the given identity string. If no keychains are specified to search, the default search list is used. Different
807 identity preferences can be set for individual key usages. You can differentiate between two identities which contain
808 the same string by providing a SHA-1 hash of the certificate (in addition to, or instead of, the name.)
810 .Sy PARTIAL PATHS AND WILDCARDS
812 Prior to 10.5.4, identity preferences for SSL/TLS client authentication could only be set on a per-URL basis. The
813 URL being visited had to match the service name exactly for the preference to be in effect.
815 In 10.5.4, it became possible to specify identity preferences on a per-server basis, by using
816 a service name with a partial path URL to match more specific paths on the same server. For
817 example, if an identity preference for "https://www.apache-ssl.org/" exists, it will be in effect for
818 "https://www.apache-ssl.org/cgi/cert-export", and so on. Note that partial path URLs must end with a trailing
821 Starting with 10.6, it is possible to specify identity preferences on a per-domain
822 basis, by using the wildcard character '*' as the leftmost component of the service name. Unlike SSL wildcards,
823 an identity preference wildcard can match more than one subdomain. For example, an identity preference for
824 the name "*.army.mil" will match "server1.subdomain1.army.mil" or "server2.subdomain2.army.mil". Likewise,
825 a preference for "*.mil" will match both "server.army.mil" and "server.navy.mil".
829 .Bl -tag -width -indent
830 0 - preference is in effect for all possible key usages (default)
834 8 - signature verification only
835 16 - signing with message recovery only
836 32 - signature verification with message recovery only
837 64 - key wrapping only
838 128 - key unwrapping only
839 256 - key derivation only
840 .It To specify more than one usage, add values together.
844 .Nm get-identity-preference
851 .Bl -item -offset -indent
852 Get the preferred identity to use for a service.
854 .Bl -tag -compact -width -indent-indent
856 Specify service (may be a URL, RFC822 email address, DNS host, or other name)
858 Specify key usage (optional)
860 Output identity certificate in pem format
862 Print common name of the preferred identity certificate
864 Print SHA-1 hash of the preferred identity certificate
870 .Op Fl g Ar dl Ns | Ns Ar cspdl
873 .Bl -item -offset -indent
874 Create a db using the DL. If
878 will prompt the user to type a name.
881 .Bl -tag -compact -width -indent-indent
884 .It Fl g Ar dl Ns | Ns Ar cspdl
885 Use the AppleDL (default) or AppleCspDL
887 Set the file permissions to
891 Force using openparams argument
893 Force using version 0 openparams
897 .Bl -tag -width -indent
898 .It security> create-db -m 0644 test.db
899 .It security> create-db -g cspdl -a test2.db
901 .\"new import/export commands.
910 .Op Fl P Ar passphrase
912 .Bl -item -offset -indent
913 Export one or more items from a keychain to one of a number of external representations. If
915 isn't provided, items will be exported from the user's default keychain.
918 .Bl -tag -compact -width -indent-indent
920 Specify keychain from which item(s) will be exported.
922 Specify the type of items to export. Possible types are certs, allKeys, pubKeys, privKeys, identities, and all. The default is all. An identity consists of both a certificate and the corresponding private key.
924 Specify the format of the exported data. Possible formats are openssl, bsafe, pkcs7, pkcs8, pkcs12, x509, openssh1, openssh2, and pemseq. The default is pemseq if more than one item is being exported. The default is openssl if one key is being exported. The default is x509 if one certificate is being exported.
926 Specifies that private keys are to be wrapped on export.
928 Specifies that PEM armour is to be applied to the output data.
929 .It Fl P Ar passphrase
930 Specify the wrapping passphrase immediately. The default is to obtain a secure passphrase via GUI.
932 Write the output data to
934 \&. Default is to write data to stdout.
938 .Bl -tag -width -indent
939 .It security> export -k login.keychain -t certs -o /tmp/certs.pem
940 .It security> export -k newcert.keychain -t identities -f pkcs12 -o /tmp/mycerts.p12
951 .Op Fl P Ar passphrase
953 .Bl -item -offset -indent
954 Import one or more items from
956 \& into a keychain. If
958 isn't provided, items will be imported into the user's default keychain.
961 .Bl -tag -compact -width -indent-indent
963 Specify keychain into which item(s) will be imported.
965 Specify the type of items to import. Possible types are cert, pub, priv, session, cert, and agg. Pub, priv, and session refer to keys; agg is one of the aggregate types (pkcs12 and PEM sequence). The command can often figure out what item_type an item contains based in the filename and/or item_format.
967 Specify the format of the exported data. Possible formats are openssl, bsafe, raw, pkcs7, pkcs8, pkcs12, x509, openssh1, openssh2, and pemseq. The command can often figure out what format an item is in based in the filename and/or item_type.
969 Specify that private keys are wrapped and must be unwrapped on import.
971 Specify that private keys are non-extractable after being imported.
972 .It Fl P Ar passphrase
973 Specify the unwrapping passphrase immediately. The default is to obtain a secure passphrase via GUI.
974 .It Fl a Ar attrName Ar attrValue
975 Specify optional extended attribute name and value. Can be used multiple times. This is only valid when importing keys.
977 Allow any application to access the imported key without warning (insecure, not recommended!)
979 Specify an application which may access the imported key (multiple
981 \& options are allowed)
985 .Bl -tag -width -indent
986 .It security> import /tmp/certs.pem -k
987 .It security> import /tmp/mycerts.p12 -t agg -k newcert.keychain
988 .It security> import /tmp/mycerts.p12 -f pkcs12 -k newcert.keychain
990 .\"end of new import/export commands.
994 .Op Fl C Ns | Ns Fl D Ns | Ns Fl E Ns | Ns Fl S
996 .Bl -item -offset -indent
997 Encode or decode CMS messages.
998 .Bl -tag -compact -width -indent-indent
1000 create a CMS encrypted message
1002 decode a CMS message
1004 create a CMS enveloped message
1006 create a CMS signed message
1010 .Bl -tag -compact -width -indent-indent
1012 use this detached content file
1014 generate email headers with info about CMS message (output
1018 suppress output of content
1022 .Bl -tag -compact -width -indent-indent
1024 create envelope for comma-delimited list of recipients, where id can be a certificate nickname or email address
1026 include a signing time attribute
1028 hash = MD2|MD4|MD5|SHA1|SHA256|SHA384|SHA512 (default: SHA1)
1030 use certificate named "nick" for signing
1032 include a SMIMECapabilities attribute
1034 do not include content in CMS message
1036 include an EncryptionKeyPreference attribute with certificate (use "NONE" to omit)
1038 find a certificate by subject key ID
1042 .Bl -tag -compact -width -indent-indent
1043 .It Fl e Ar envelope
1044 specify envelope file (valid with
1049 .It Fl k Ar keychain
1050 specify keychain to use
1052 use infile as source of data (default: stdin)
1054 use outfile as destination of data (default: stdout)
1055 .It Fl p Ar password
1056 use password as key db password (default: prompt)
1058 pass data a single byte at a time to CMS
1059 .It Fl u Ar certusage
1060 set type of certificate usage (default: certUsageEmailSigner)
1062 print debugging information
1066 0 - certUsageSSLClient
1067 1 - certUsageSSLServer
1068 2 - certUsageSSLServerWithStepUp
1070 4 - certUsageEmailSigner
1071 5 - certUsageEmailRecipient
1072 6 - certUsageObjectSigner
1073 7 - certUsageUserCertImport
1074 8 - certUsageVerifyCA
1075 9 - certUsageProtectedObjectSigner
1076 10 - certUsageStatusResponder
1082 .Bl -item -offset -indent
1083 Install (or re-install) the Module Directory Services (MDS) database. This is a system tool which is not normally used by users. There are no options.
1086 .Nm add-trusted-cert
1088 .Op Fl r Ar resultType
1091 .Op Fl s Ar policyString
1092 .Op Fl e Ar allowedError
1093 .Op Fl u Ar keyUsage
1094 .Op Fl k Ar keychain
1095 .Op Fl i Ar settingsFileIn
1096 .Op Fl o Ar settingsFileOut
1099 .Bl -item -offset -indent
1100 Add certificate (in DER or PEM format) from
1102 \& to per-user or local Admin Trust Settings. When modifying per-user Trust Settings, user authentication is required via an authentication dialog. When modifying admin Trust Settings, the process must be running as root, or admin authentication is required.
1105 .Bl -tag -compact -width -indent-indent
1107 Add to admin cert store; default is user.
1108 .It Fl r Ar resultType
1109 resultType = trustRoot|trustAsRoot|deny|unspecified; default is trustRoot.
1111 Specify policy constraint (ssl, smime, codeSign, IPSec, basic, swUpdate, pkgSign, eap, macappstore, appleID, timestamping).
1112 .It Fl r Ar resultType
1113 resultType = trustRoot|trustAsRoot|deny|unspecified; default is trustRoot.
1115 Specify application constraint.
1116 .It Fl s Ar policyString
1117 Specify policy-specific string.
1118 .It Fl e Ar allowedError
1119 Specify allowed error (an integer value, or one of: certExpired, hostnameMismatch)
1120 .It Fl u Ar keyUsage
1121 Specify key usage, an integer.
1122 .It Fl k Ar keychain
1123 Specify keychain to which cert is added.
1124 .It Fl i Ar settingsFileIn
1125 Input trust settings file; default is user domain.
1126 .It Fl o Ar settingsFileOut
1127 Output trust settings file; default is user domain.
1129 Add default setting instead of per-cert setting. No certFile is specified when using this option
1132 .Sy Key usage codes:
1135 2 - Encrypt/Decrypt Data
1136 4 - Encrypt/Decrypt Key
1137 8 - Sign certificate
1138 16 - Sign revocation
1140 To specify more than one usage, add values together (except -1 - Any).
1143 .Bl -tag -width -indent
1144 .Dl security> add-trusted-cert /tmp/cert.der
1145 .Dl security> add-trusted-cert -d .tmp/cert.der
1149 .Nm remove-trusted-cert
1153 .Bl -item -offset -indent
1154 Remove certificate (in DER or PEM format) in
1156 \& from per-user or local Admin Trust Settings. When modifying per-user Trust Settings, user authentication is required via an authentication dialog. When modifying admin Trust Settings, the process must be running as root, or admin authentication is required.
1159 .Bl -tag -compact -width -indent-indent
1161 Remove from admin cert store; default is user.
1163 Remove Default Root Cert setting instead of an actual cert setting. No certFile is specified when using this option.
1168 .Nm dump-trust-settings
1171 .Bl -item -offset -indent
1172 Display Trust Settings.
1175 .Bl -tag -compact -width -indent-indent
1177 Display trusted system certs; default is user.
1179 Display trusted admin certs; default is user.
1184 .Nm user-trust-settings-enable
1187 .Bl -item -offset -indent
1188 Display or manipulate user-level Trust Settings. With no arguments, shows the current state of the user-level Trust Settings enable. Otherwise enables or disables user-level Trust Settings.
1191 .Bl -tag -compact -width -indent-indent
1193 Disable user-level Trust Settings.
1195 Enable user-level Trust Settings.
1200 .Nm trust-settings-export
1204 .Bl -item -offset -indent
1205 Export Trust Settings to the specified file.
1208 .Bl -tag -compact -width -indent-indent
1210 Export system Trust Settings; default is user.
1212 Export admin Trust Settings; default is user.
1217 .Nm trust-settings-import
1220 .Bl -item -offset -indent
1221 Import Trust Settings from the specified file. When modifying per-user Trust Settings, user authentication is required via an authentication dialog. When modifying admin Trust Settings, the process must be running as root, or admin authentication is required.
1224 .Bl -tag -compact -width -indent-indent
1226 Import admin Trust Settings; default is user.
1232 .Op Fl c Ar certFile
1233 .Op Fl r Ar rootCertFile
1235 .Op Fl k Ar keychain
1240 .Op Fl e Ar emailAddress
1243 .Bl -item -offset -indent
1244 Verify one or more certificates.
1247 .Bl -tag -compact -width -indent-indent
1248 .It Fl c Ar certFile
1249 Certificate to verify, in DER or PEM format. Can be specified more than once; leaf certificate has to be specified first.
1250 .It Fl r Ar rootCertFile
1251 Root certificate, in DER or PEM format. Can be specified more than once. If not specified, the system anchor certificates are used. If one root certificate is specified, and zero (non-root) certificates are specified, the root certificate is verified against itself.
1253 Specify verification policy (ssl, smime, codeSign, IPSec, basic, swUpdate, pkgSign, eap, appleID, macappstore, timestamping). Default is basic.
1254 .It Fl k Ar keychain
1255 Keychain to search for intermediate certs. Can be specified multiple times. Default is the current user's keychain search list.
1257 Date to set for verification. Specified in the format of YYYY-MM-DD-hh:mm:ss (time optional). e.g: 2016-04-25-15:59:59 for April 25, 2016 at 3:59:59 pm in GMT
1259 Avoid searching any keychains.
1261 Use local certificates only. If an issuing CA certificate is missing, this option will avoid accessing the network to fetch it.
1263 Specifies that the leaf certificate is a CA cert. By default, a leaf certificate with a Basic Constraints extension with the CA bit set fails verification.
1264 .It Fl e Ar emailAddress
1265 Specify email address for the smime policy.
1267 Specify SSL host name for the ssl policy.
1269 Quiet, no stdout or stderr.
1273 .Bl -tag -width -indent
1274 .It security> verify-cert -c applestore0.cer -c applestore1.cer -p ssl -s store.apple.com
1275 .It security> verify-cert -r serverbasic.crt
1283 .Bl -item -offset -indent
1284 Authorize requested right(s). The extend-rights flag will be passed by default.
1287 .Bl -tag -compact -width -indent-indent
1289 Allow user interaction.
1291 Allow returning partial rights.
1293 Destroy acquired rights.
1295 Pre-authorize rights only.
1297 Operate authorization in least privileged mode.
1299 Internalize authref passed on stdin.
1301 Externalize authref to stdout
1303 Wait while holding AuthorizationRef until stdout is closed. This will allow client to read externalized AuthorizationRef from pipe.
1307 .Bl -tag -width -indent
1308 .It security> security authorize -ud my-right
1309 Basic authorization of my-right.
1310 .It security> security -q authorize -uew my-right | security -q authorize -i my-right
1311 Authorizing a right and passing it to another command as a way to add authorization to shell scripts.
1316 .Ar read <right-name>
1319 .Ar write <right-name> [allow|deny|<rulename>]
1322 .Ar remove <right-name>
1323 .Bl -item -offset -indent
1324 Read/Modify authorization policy database. Without a rulename write will read a dictionary as a plist from stdin.
1327 .Bl -tag -width -indent
1328 .It security> security authorizationdb read system.privilege.admin > /tmp/aewp-def
1329 Read definition of system.privilege.admin right.
1330 .It security> security authorizationdb write system.preferences < /tmp/aewp-def
1331 Set system.preferences to definition of system.privilege.admin right.
1332 .It security> security authorizationdb write system.preferences authenticate-admin
1333 Every change to preferences requires an Admin user to authenticate.
1337 .Nm execute-with-privileges
1340 .Bl -item -offset -indent
1341 Execute tool with privileges.
1342 On success stdin will be read and forwarded to the tool.
1350 .Op Fl exclude Ar symbol
1351 .Bl -item -offset -indent
1354 on this process. This can help find memory leaks after running
1358 .Bl -tag -compact -width -indent-indent
1360 Use a stricter algorithm (See
1364 Withhold the hex dumps of the leaked memory.
1366 Don't show stack traces of leaked memory.
1367 .It Fl exclude Ar symbol
1368 Ignore leaks called from
1378 .Bl -item -offset -indent
1379 Enable, disable or list disabled smartcard tokens.
1382 .Bl -tag -compact -width -indent-indent
1384 List disabled smartcard tokens.
1386 Enable smartcard token.
1388 Disable smartcard token.
1391 .Sy To list tokens available in the system
1393 .Bl -tag -compact -width -indent
1394 .It pluginkit -m -p com.apple.ctk-tokens
1399 .Bl -tag -compact -width -indent
1400 .It security smartcards token -l
1401 .It security smartcards token -d com.apple.CryptoTokenKit.pivtoken
1402 .It security smartcards token -e com.apple.CryptoTokenKit.pivtoken
1408 .Op Ar <error code(s)...>
1409 .Bl -item -offset -indent
1410 Display an error string for the given security-related error code.
1411 The error can be in decimal or hex, e.g. 1234 or 0x1234. Multiple
1412 errors can be separated by spaces.
1416 .Sh ENVIRONMENT \" May not be needed
1417 .Bl -tag -width -indent
1418 .It Ev MallocStackLogging
1423 option it's probably a good idea to set this environment variable before
1425 is started. Doing so will allow leaks to display symbolic backtraces.
1428 .Bl -tag -width -indent
1429 .It Pa ~/Library/Preferences/com.apple.security.plist
1431 Property list file containing the current user's default keychain and keychain search list.
1432 .It Pa /Library/Preferences/com.apple.security.plist
1434 Property list file containing the system default keychain and keychain search list. This is used by processes started at boot time, or those requesting to use the system search domain, such as system daemons.
1435 .It Pa /Library/Preferences/com.apple.security-common.plist
1437 Property list file containing the common keychain search list, which is appended to every user's search list and to the system search list.
1440 .\" List links in ascending order by section, alphabetically within a section.
1441 .\" Please do not reference files that do not exist without filing a bug report
1445 .\" .Xr systemkeychain 8
1448 was first introduced in Mac OS X version 10.3.
1451 still needs more commands before it can be considered complete.
1452 In particular, it should someday supersede both the