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.
281 .Bl -item -offset -indent
282 Delete keychains and remove them from the search list.
287 .Op Fl a Ns | Ns Ar keychain
288 .Bl -item -offset -indent
291 \&, or the default keychain if none is specified. If the
293 option is specified, all keychains are locked.
300 .Bl -item -offset -indent
303 \&, or the default keychain if none is specified.
306 .Nm set-keychain-settings
310 .Bl -item -offset -indent
313 \&, or the default keychain if none is specified.
315 .Bl -tag -compact -width -indent-indent
317 Lock keychain when the system sleeps.
319 Lock keychain after timeout interval.
323 interval in seconds (omitting this option specifies "no timeout").
327 .Nm set-keychain-password
329 .Op Fl o Ar oldPassword
330 .Op Fl p Ar newPassword
332 .Bl -item -offset -indent
335 \&, or the default keychain if none is specified.
337 .Bl -tag -compact -width -indent-indent
338 .It Fl o Ar oldPassword
339 Old keychain password (if not provided, will prompt)
340 .It Fl p Ar newPassword
341 New keychain password (if not provided, will prompt)
345 .Nm show-keychain-info
348 .Bl -item -offset -indent
349 Show the settings for
356 .Bl -item -offset -indent
357 Dump the contents of one or more keychains.
359 .Bl -tag -compact -width -indent-indent
361 Dump access control list of items
363 Dump (decrypted) data of items
365 Interactive access control list editing mode
367 Dump raw (encrypted) data of items
379 .Op Fl A Ns | Ns Fl T Ar appPath
381 .Bl -item -offset -indent
382 Create an asymmetric key pair.
384 .Bl -tag -compact -width -indent-indent
388 as the algorithm, can be rsa, dh, dsa or fee (default rsa)
390 Specify the keysize in bits (default 512)
392 Make a key valid from the specified date (ex: "13/11/10 3:30pm")
394 Make a key valid to the specified date
396 Make a key valid for the number of days specified from today
398 Use the specified keychain rather than the default
400 Allow any application to access this key without warning (insecure, not recommended!)
402 Specify an application which may access this key (multiple
404 \& options are allowed)
408 .Nm add-generic-password
415 .Bl -item -offset -indent
416 Add a generic password item.
418 .Bl -tag -compact -width -indent-indent
420 Specify account name (required)
422 Specify item creator (optional four-character code)
424 Specify item type (optional four-character code)
426 Specify kind (default is "application password")
428 Specify generic attribute value (optional)
430 Specify comment string (optional)
432 Specify label (if omitted, service name is used as default label)
434 Specify service name (required)
436 Specify password to be added (legacy option, equivalent to
440 Specify password to be added
442 Allow any application to access this item without warning (insecure, not recommended!)
444 Specify an application which may access this item (multiple
446 \& options are allowed)
448 Update item if it already exists (if omitted, the item cannot already exist)
452 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:
454 \& "". If no keychain is specified, the password is added to the default keychain.
458 .Nm add-internet-password
465 .Bl -item -offset -indent
466 Add an internet password item.
468 .Bl -tag -compact -width -indent-indent
470 Specify account name (required)
472 Specify item creator (optional four-character code)
474 Specify item type (optional four-character code)
476 Specify security domain string (optional)
478 Specify kind (default is "application password")
480 Specify comment string (optional)
482 Specify label (if omitted, service name is used as default label)
484 Specify path string (optional)
486 Specify port number (optional)
488 Specify protocol (optional four-character SecProtocolType, e.g. "http", "ftp ")
490 Specify server name (required)
491 .It Fl t Ar authenticationType
492 Specify authentication type (as a four-character SecAuthenticationType, default is "dflt")
494 Specify password to be added
496 Allow any application to access this item without warning (insecure, not recommended!)
498 Specify an application which may access this item (multiple
500 \& options are allowed)
502 Update item if it already exists (if omitted, the item cannot already exist)
506 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:
508 \& "". If no keychain is specified, the password is added to the default keychain.
516 .Bl -item -offset -indent
517 Add certficates contained in the specified
519 to the default keychain. The files must contain one DER encoded X509 certificate each.
520 .Bl -tag -compact -width -indent-indent
524 rather than the default keychain.
528 .Nm find-generic-password
534 .Op Fl Ar keychain...
535 .Bl -item -offset -indent
536 Find a generic password item.
538 .Bl -tag -compact -width -indent-indent
542 Match creator (four-character code)
544 Match type (four-character code)
548 Match value string (generic attribute)
556 Display the password for the item found
558 Display the password(only) for the item found
562 .Nm delete-generic-password
567 .Op Fl Ar keychain...
568 .Bl -item -offset -indent
569 Delete a generic password item.
571 .Bl -tag -compact -width -indent-indent
575 Match creator (four-character code)
577 Match type (four-character code)
581 Match value string (generic attribute)
591 .Nm delete-internet-password
597 .Bl -item -offset -indent
598 Delete an internet password item.
600 .Bl -tag -compact -width -indent-indent
604 Match creator (four-character code)
606 Match type (four-character code)
607 .It Fl d Ar securityDomain
608 Match securityDomain string
620 Match protocol (four-character code)
623 .It Fl t Ar authenticationType
624 Match authenticationType (four-character code)
628 .Nm find-internet-password
635 .Bl -item -offset -indent
636 Find an internet password item.
638 .Bl -tag -compact -width -indent-indent
642 Match creator (four-character code)
644 Match type (four-character code)
645 .It Fl d Ar securityDomain
646 Match securityDomain string
658 Match protocol (four-character code)
661 .It Fl t Ar authenticationType
662 Match authenticationType (four-character code)
664 Display the password for the item found
666 Display the password(only) for the item found
674 .Op Fl e Ar emailAddress
679 .Bl -item -offset -indent
680 Find a certificate item. If no
682 \& arguments are provided, the default search list is used.
685 .Bl -tag -compact -width -indent-indent
687 Find all matching certificates, not just the first one
691 \& when searching (optional)
692 .It Fl e Ar emailAddress
695 \& when searching (optional)
697 Show the email addresses in the certificate
699 Output certificate in pem format. Default is to dump the attributes and keychain the cert is in.
701 Print SHA-1 hash of the certificate
705 .Bl -tag -width -indent
706 .It security> find-certificate -a -p > allcerts.pem
707 Exports all certificates from all keychains into a pem file called allcerts.pem.
708 .It security> find-certificate -a -e me@foo.com -p > certs.pem
709 Exports all certificates from all keychains with the email address
710 me@foo.com into a pem file called certs.pem.
711 .It security> find-certificate -a -c MyName -Z login.keychain | grep ^SHA-1
712 Print the SHA-1 hash of every certificate in 'login.keychain' whose common name includes 'MyName'
722 .Bl -item -offset -indent
723 Find an identity (certificate + private key) satisfying a given policy. If no
725 \& arguments are provided, the X.509 basic policy is assumed. If no
727 \& arguments are provided, the default search list is used.
730 .Bl -tag -compact -width -indent-indent
734 \& to evaluate (multiple -p options are allowed). Supported policies:
735 basic, ssl-client, ssl-server, smime, eap, ipsec, ichat, codesigning,
736 sys-default, sys-kerberos-kdc
738 Specify optional policy-specific
740 \& (e.g. a DNS hostname for SSL, or RFC822 email address for S/MIME)
742 Show valid identities only (default is to show all identities)
746 .Bl -tag -width -indent
747 .It security> find-identity -v -p ssl-client
748 Display valid identities that can be used for SSL client authentication
749 .It security> find-identity -p ssl-server -s www.domain.com
750 Display identities for a SSL server running on the host 'www.domain.com'
751 .It security> find-identity -p smime -s user@domain.com
752 Display identities that can be used to sign a message from 'user@domain.com'
756 .Nm delete-certificate
762 .Bl -item -offset -indent
763 Delete a certificate from a keychain. If no
765 \& arguments are provided, the default search list is used.
767 .Bl -tag -compact -width -indent-indent
769 Specify certificate to delete by its common name
771 Specify certificate to delete by its SHA-1 hash
773 Also delete user trust settings for this certificate
776 The certificate to be deleted must be uniquely specified either by a
777 string found in its common name, or by its SHA-1 hash.
780 .Nm set-identity-preference
788 .Bl -item -offset -indent
789 Set the preferred identity to use for a service.
791 .Bl -tag -compact -width -indent-indent
793 Specify no identity (clears existing preference for the given service)
795 Specify identity by common name of the certificate
797 Specify service (may be a URL, RFC822 email address, DNS host, or other name) for which this identity is to be preferred
799 Specify key usage (optional)
801 Specify identity by SHA-1 hash of certificate (optional)
804 The identity is located by searching the specified keychain(s) for a certificate whose common name contains
805 the given identity string. If no keychains are specified to search, the default search list is used. Different
806 identity preferences can be set for individual key usages. You can differentiate between two identities which contain
807 the same string by providing a SHA-1 hash of the certificate (in addition to, or instead of, the name.)
809 .Sy PARTIAL PATHS AND WILDCARDS
811 Prior to 10.5.4, identity preferences for SSL/TLS client authentication could only be set on a per-URL basis. The
812 URL being visited had to match the service name exactly for the preference to be in effect.
814 In 10.5.4, it became possible to specify identity preferences on a per-server basis, by using
815 a service name with a partial path URL to match more specific paths on the same server. For
816 example, if an identity preference for "https://www.apache-ssl.org/" exists, it will be in effect for
817 "https://www.apache-ssl.org/cgi/cert-export", and so on. Note that partial path URLs must end with a trailing
820 Starting with 10.6, it is possible to specify identity preferences on a per-domain
821 basis, by using the wildcard character '*' as the leftmost component of the service name. Unlike SSL wildcards,
822 an identity preference wildcard can match more than one subdomain. For example, an identity preference for
823 the name "*.army.mil" will match "server1.subdomain1.army.mil" or "server2.subdomain2.army.mil". Likewise,
824 a preference for "*.mil" will match both "server.army.mil" and "server.navy.mil".
828 .Bl -tag -width -indent
829 0 - preference is in effect for all possible key usages (default)
833 8 - signature verification only
834 16 - signing with message recovery only
835 32 - signature verification with message recovery only
836 64 - key wrapping only
837 128 - key unwrapping only
838 256 - key derivation only
839 .It To specify more than one usage, add values together.
843 .Nm get-identity-preference
850 .Bl -item -offset -indent
851 Get the preferred identity to use for a service.
853 .Bl -tag -compact -width -indent-indent
855 Specify service (may be a URL, RFC822 email address, DNS host, or other name)
857 Specify key usage (optional)
859 Output identity certificate in pem format
861 Print common name of the preferred identity certificate
863 Print SHA-1 hash of the preferred identity certificate
869 .Op Fl g Ar dl Ns | Ns Ar cspdl
872 .Bl -item -offset -indent
873 Create a db using the DL. If
877 will prompt the user to type a name.
880 .Bl -tag -compact -width -indent-indent
883 .It Fl g Ar dl Ns | Ns Ar cspdl
884 Use the AppleDL (default) or AppleCspDL
886 Set the file permissions to
890 Force using openparams argument
892 Force using version 0 openparams
896 .Bl -tag -width -indent
897 .It security> create-db -m 0644 test.db
898 .It security> create-db -g cspdl -a test2.db
900 .\"new import/export commands.
909 .Op Fl P Ar passphrase
911 .Bl -item -offset -indent
912 Export one or more items from a keychain to one of a number of external representations. If
914 isn't provided, items will be exported from the user's default keychain.
917 .Bl -tag -compact -width -indent-indent
919 Specify keychain from which item(s) will be exported.
921 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.
923 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.
925 Specifies that private keys are to be wrapped on export.
927 Specifies that PEM armour is to be applied to the output data.
928 .It Fl P Ar passphrase
929 Specify the wrapping passphrase immediately. The default is to obtain a secure passphrase via GUI.
931 Write the output data to
933 \&. Default is to write data to stdout.
937 .Bl -tag -width -indent
938 .It security> export -k login.keychain -t certs -o /tmp/certs.pem
939 .It security> export -k newcert.keychain -t identities -f pkcs12 -o /tmp/mycerts.p12
950 .Op Fl P Ar passphrase
952 .Bl -item -offset -indent
953 Import one or more items from
955 \& into a keychain. If
957 isn't provided, items will be imported into the user's default keychain.
960 .Bl -tag -compact -width -indent-indent
962 Specify keychain into which item(s) will be imported.
964 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.
966 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.
968 Specify that private keys are wrapped and must be unwrapped on import.
970 Specify that private keys are non-extractable after being imported.
971 .It Fl P Ar passphrase
972 Specify the unwrapping passphrase immediately. The default is to obtain a secure passphrase via GUI.
973 .It Fl a Ar attrName Ar attrValue
974 Specify optional extended attribute name and value. Can be used multiple times. This is only valid when importing keys.
976 Allow any application to access the imported key without warning (insecure, not recommended!)
978 Specify an application which may access the imported key (multiple
980 \& options are allowed)
984 .Bl -tag -width -indent
985 .It security> import /tmp/certs.pem -k
986 .It security> import /tmp/mycerts.p12 -t agg -k newcert.keychain
987 .It security> import /tmp/mycerts.p12 -f pkcs12 -k newcert.keychain
989 .\"end of new import/export commands.
993 .Op Fl C Ns | Ns Fl D Ns | Ns Fl E Ns | Ns Fl S
995 .Bl -item -offset -indent
996 Encode or decode CMS messages.
997 .Bl -tag -compact -width -indent-indent
999 create a CMS encrypted message
1001 decode a CMS message
1003 create a CMS enveloped message
1005 create a CMS signed message
1009 .Bl -tag -compact -width -indent-indent
1011 use this detached content file
1013 generate email headers with info about CMS message (output
1017 suppress output of content
1021 .Bl -tag -compact -width -indent-indent
1023 create envelope for comma-delimited list of recipients, where id can be a certificate nickname or email address
1025 include a signing time attribute
1027 hash = MD2|MD4|MD5|SHA1|SHA256|SHA384|SHA512 (default: SHA1)
1029 use certificate named "nick" for signing
1031 include a SMIMECapabilities attribute
1033 do not include content in CMS message
1035 include an EncryptionKeyPreference attribute with certificate (use "NONE" to omit)
1037 find a certificate by subject key ID
1041 .Bl -tag -compact -width -indent-indent
1042 .It Fl e Ar envelope
1043 specify envelope file (valid with
1048 .It Fl k Ar keychain
1049 specify keychain to use
1051 use infile as source of data (default: stdin)
1053 use outfile as destination of data (default: stdout)
1054 .It Fl p Ar password
1055 use password as key db password (default: prompt)
1057 pass data a single byte at a time to CMS
1058 .It Fl u Ar certusage
1059 set type of certificate usage (default: certUsageEmailSigner)
1061 print debugging information
1065 0 - certUsageSSLClient
1066 1 - certUsageSSLServer
1067 2 - certUsageSSLServerWithStepUp
1069 4 - certUsageEmailSigner
1070 5 - certUsageEmailRecipient
1071 6 - certUsageObjectSigner
1072 7 - certUsageUserCertImport
1073 8 - certUsageVerifyCA
1074 9 - certUsageProtectedObjectSigner
1075 10 - certUsageStatusResponder
1081 .Bl -item -offset -indent
1082 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.
1085 .Nm add-trusted-cert
1087 .Op Fl r Ar resultType
1090 .Op Fl s Ar policyString
1091 .Op Fl e Ar allowedError
1092 .Op Fl u Ar keyUsage
1093 .Op Fl k Ar keychain
1094 .Op Fl i Ar settingsFileIn
1095 .Op Fl o Ar settingsFileOut
1098 .Bl -item -offset -indent
1099 Add certificate (in DER or PEM format) from
1101 \& 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.
1104 .Bl -tag -compact -width -indent-indent
1106 Add to admin cert store; default is user.
1107 .It Fl r Ar resultType
1108 resultType = trustRoot|trustAsRoot|deny|unspecified; default is trustRoot.
1110 Specify policy constraint (ssl, smime, codeSign, IPSec, iChat, basic, swUpdate, pkgSign, pkinitClient, pkinitServer, eap).
1111 .It Fl r Ar resultType
1112 resultType = trustRoot|trustAsRoot|deny|unspecified; default is trustRoot.
1114 Specify application constraint.
1115 .It Fl s Ar policyString
1116 Specify policy-specific string.
1117 .It Fl e Ar allowedError
1118 Specify allowed error (an integer value, or one of: certExpired, hostnameMismatch)
1119 .It Fl u Ar keyUsage
1120 Specify key usage, an integer.
1121 .It Fl k Ar keychain
1122 Specify keychain to which cert is added.
1123 .It Fl i Ar settingsFileIn
1124 Input trust settings file; default is user domain.
1125 .It Fl o Ar settingsFileOut
1126 Output trust settings file; default is user domain.
1128 Add default setting instead of per-cert setting. No certFile is specified when using this option
1131 .Sy Key usage codes:
1134 2 - Encrypt/Decrypt Data
1135 4 - Encrypt/Decrypt Key
1136 8 - Sign certificate
1137 16 - Sign revocation
1139 To specify more than one usage, add values together (except -1 - Any).
1142 .Bl -tag -width -indent
1143 .Dl security> add-trusted-cert /tmp/cert.der
1144 .Dl security> add-trusted-cert -d .tmp/cert.der
1148 .Nm remove-trusted-cert
1152 .Bl -item -offset -indent
1153 Remove certificate (in DER or PEM format) in
1155 \& 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.
1158 .Bl -tag -compact -width -indent-indent
1160 Remove from admin cert store; default is user.
1162 Remove Default Root Cert setting instead of an actual cert setting. No certFile is specified when using this option.
1167 .Nm dump-trust-settings
1170 .Bl -item -offset -indent
1171 Display Trust Settings.
1174 .Bl -tag -compact -width -indent-indent
1176 Display trusted system certs; default is user.
1178 Display trusted admin certs; default is user.
1183 .Nm user-trust-settings-enable
1186 .Bl -item -offset -indent
1187 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.
1190 .Bl -tag -compact -width -indent-indent
1192 Disable user-level Trust Settings.
1194 Enable user-level Trust Settings.
1199 .Nm trust-settings-export
1203 .Bl -item -offset -indent
1204 Export Trust Settings to the specified file.
1207 .Bl -tag -compact -width -indent-indent
1209 Export system Trust Settings; default is user.
1211 Export admin Trust Settings; default is user.
1216 .Nm trust-settings-import
1219 .Bl -item -offset -indent
1220 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.
1223 .Bl -tag -compact -width -indent-indent
1225 Import admin Trust Settings; default is user.
1231 .Op Fl c Ar certFile
1232 .Op Fl r Ar rootCertFile
1234 .Op Fl k Ar keychain
1239 .Op Fl e Ar emailAddress
1242 .Bl -item -offset -indent
1243 Verify one or more certificates.
1246 .Bl -tag -compact -width -indent-indent
1247 .It Fl c Ar certFile
1248 Certificate to verify, in DER or PEM format. Can be specified more than once; leaf certificate has to be specified first.
1249 .It Fl r Ar rootCertFile
1250 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.
1252 Specify verification policy (ssl, smime, codeSign, IPSec, iChat, basic, swUpdate, pkgSign, pkinitClient, pkinitServer, eap, appleID, macappstore, timestamping). Default is basic.
1253 .It Fl k Ar keychain
1254 Keychain to search for intermediate certs. Can be specified multiple times. Default is the current user's keychain search list.
1256 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
1258 Avoid searching any keychains.
1260 Use local certificates only. If an issuing CA certificate is missing, this option will avoid accessing the network to fetch it.
1262 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.
1263 .It Fl e Ar emailAddress
1264 Specify email address for the smime policy.
1266 Specify SSL host name for the ssl policy.
1268 Quiet, no stdout or stderr.
1272 .Bl -tag -width -indent
1273 .It security> verify-cert -c applestore0.cer -c applestore1.cer -p ssl -s store.apple.com
1274 .It security> verify-cert -r serverbasic.crt
1282 .Bl -item -offset -indent
1283 Authorize requested right(s). The extend-rights flag will be passed by default.
1286 .Bl -tag -compact -width -indent-indent
1288 Allow user interaction.
1290 Allow returning partial rights.
1292 Destroy acquired rights.
1294 Pre-authorize rights only.
1296 Operate authorization in least privileged mode.
1298 Internalize authref passed on stdin.
1300 Externalize authref to stdout
1302 Wait while holding AuthorizationRef until stdout is closed. This will allow client to read externalized AuthorizationRef from pipe.
1306 .Bl -tag -width -indent
1307 .It security> security authorize -ud my-right
1308 Basic authorization of my-right.
1309 .It security> security -q authorize -uew my-right | security -q authorize -i my-right
1310 Authorizing a right and passing it to another command as a way to add authorization to shell scripts.
1315 .Ar read <right-name>
1318 .Ar write <right-name> [allow|deny|<rulename>]
1321 .Ar remove <right-name>
1322 .Bl -item -offset -indent
1323 Read/Modify authorization policy database. Without a rulename write will read a dictionary as a plist from stdin.
1326 .Bl -tag -width -indent
1327 .It security> security authorizationdb read system.privilege.admin > /tmp/aewp-def
1328 Read definition of system.privilege.admin right.
1329 .It security> security authorizationdb write system.preferences < /tmp/aewp-def
1330 Set system.preferences to definition of system.privilege.admin right.
1331 .It security> security authorizationdb write system.preferences authenticate-admin
1332 Every change to preferences requires an Admin user to authenticate.
1336 .Nm execute-with-privileges
1339 .Bl -item -offset -indent
1340 Execute tool with privileges.
1341 On success stdin will be read and forwarded to the tool.
1349 .Op Fl exclude Ar symbol
1350 .Bl -item -offset -indent
1353 on this process. This can help find memory leaks after running
1357 .Bl -tag -compact -width -indent-indent
1359 Use a stricter algorithm (See
1363 Withhold the hex dumps of the leaked memory.
1365 Don't show stack traces of leaked memory.
1366 .It Fl exclude Ar symbol
1367 Ignore leaks called from
1374 .Op Ar <error code(s)...>
1375 .Bl -item -offset -indent
1376 Display an error string for the given security-related error code.
1377 The error can be in decimal or hex, e.g. 1234 or 0x1234. Multiple
1378 errors can be separated by spaces.
1382 .Sh ENVIRONMENT \" May not be needed
1383 .Bl -tag -width -indent
1384 .It Ev MallocStackLogging
1389 option it's probably a good idea to set this environment variable before
1391 is started. Doing so will allow leaks to display symbolic backtraces.
1394 .Bl -tag -width -indent
1395 .It Pa ~/Library/Preferences/com.apple.security.plist
1397 Property list file containing the current user's default keychain and keychain search list.
1398 .It Pa /Library/Preferences/com.apple.security.plist
1400 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.
1401 .It Pa /Library/Preferences/com.apple.security-common.plist
1403 Property list file containing the common keychain search list, which is appended to every user's search list and to the system search list.
1406 .\" List links in ascending order by section, alphabetically within a section.
1407 .\" Please do not reference files that do not exist without filing a bug report
1410 .\" .Xr systemkeychain 8
1413 was first introduced in Mac OS X version 10.3.
1416 still needs more commands before it can be considered complete.
1417 In particular, it should someday supersede both the