security Export/import

export [-k keychain] [-t type] [-f format] [-w] [-p format] [-P passphrase] [-o outfile]
            Export one or more items from a keychain to one of a number of external representations.  If
            keychain isn't provided, items will be exported from the user's default keychain.

   import inputfile [-k keychain] [-t type] [-f format] [-w] [-P passphrase] [options...]
            Import one or more items from inputfile into a keychain. If keychain isn't provided, items will
            be imported into the user's default keychain.

            Options:
            -k keychain     Specify keychain into which item(s) will be imported/exported.
            -t type         Specify the type of items to import/export.

                            Import 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.

                            Export types are: certs, allKeys, pubKeys, privKeys, identities, and all.
                            The default is all. An identity consists of both
                            a certificate and the corresponding provate key.

            -f format       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.  The default is openssl if one key
                            is being exported. The default is x509 if one certificate is being exported.

            -w              Specify that private keys are wrapped and must be unwrapped on import/export.
            -x              Specify that private keys are non-extractable after being imported.
            -p              Specifies that PEM armour is to be applied to the exports output data.
            -P passphrase   Specify the unwrapping passphrase immediately. The default is to obtain a secure
                            passphrase via GUI.
            -o outfile      Write the output data to outfile. Default is to write data to stdout.
            -a attrName attrValue
                            Specify optional extended attribute name and value. Can be used multiple times.
                            This is only valid when importing keys.
            -A              Allow any application to access the imported key without warning (insecure, not
                            recommended!)
            -T appPath      Specify an application which may access the imported key (multiple -T options
                            are allowed)

   Examples

            security> import /tmp/certs.pem -k

            security> import /tmp/mycerts.p12 -t agg -k newcert.keychain

            security> import /tmp/mycerts.p12 -f pkcs12 -k newcert.keychain

            security> export -k login.keychain -t certs -o /tmp/certs.pem

            security> export -k newcert.keychain -t identities -f pkcs12 -o /tmp/mycerts.p12

转载于:https://www.cnblogs.com/greywolf/p/3470405.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值