You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

keys.md 4.6 kB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. ### 密钥管理
  2. `jdchain-cli`提供基于本地目录的密钥管理:[密钥对列表](#密钥对列表),[显示密钥对](#显示密钥对),[添加密钥对](#添加密钥对),[更新私钥密码](#更新私钥密码),[删除密钥对](#删除密钥对)
  3. ```bash
  4. :bin$ ./jdchain-cli.sh keys -h
  5. Usage: git status [<options>...] [--] [<pathspec>...]
  6. List, create, update or delete keypairs.
  7. -h, --help Show this help message and exit.
  8. --home=<path> Set the home directory.
  9. Default: ../
  10. --pretty Pretty json print
  11. -V, --version Print version information and exit.
  12. Commands:
  13. list List all the keypairs.
  14. show Show keypair.
  15. add Create a new keypair.
  16. update Update privkey password.
  17. delete Delete keypair.
  18. help Displays help information about the specified command
  19. ```
  20. #### 密钥对列表
  21. ```bash
  22. :bin$ ./jdchain-cli.sh keys list -h
  23. List all the keypairs.
  24. Usage: jdchain-cli keys list [-hV] [--pretty] [--home=<path>]
  25. -h, --help Show this help message and exit.
  26. --home=<path> Set the home directory.
  27. --pretty Pretty json print
  28. -V, --version Print version information and exit.
  29. ```
  30. - `home`,指定密钥存储相关目录,`${home}/config/keys`
  31. 如:
  32. ```bash
  33. :bin$ ./jdchain-cli.sh keys list
  34. NAME ALGORITHM ADDRESS PUBKEY
  35. ```
  36. - `NAME`,名称
  37. - `ALGORITHM`,算法
  38. - `ADDRESS`,地址
  39. - `PUBKEY`,公钥
  40. #### 显示密钥对
  41. ```bash
  42. :bin$ ./jdchain-cli.sh keys show -h
  43. Show the keypair.
  44. Usage: jdchain-cli keys show [-hV] [--pretty] [--home=<path>] -n=<name>
  45. -h, --help Show this help message and exit.
  46. --home=<path> Set the home directory.
  47. -n, --name=<name> Name of the key
  48. --pretty Pretty json print
  49. -V, --version Print version information and exit.
  50. ```
  51. - `name`,密钥对名称
  52. 如:
  53. ```bash
  54. :bin$ ./jdchain-cli.sh keys show -n k1
  55. input the password:
  56. > 1
  57. NAME ALGORITHM ADDRESS PUBKEY PRIVKEY PASSWORD
  58. k1 ED25519 LdeNwzRRuF33BNkyzbMuzKV3zFNGMrYBsRXvm 7VeRPc4QsYJX7qpzHBBJTzwvvmXXFVvP1MwmdU7WCBv9Uvc5 177gk2XHAsWRMXyHLLcJsig2jvXWpgo4ZVg2HYgGaiXauAZqPcnsETNeLUeRShw2BKgHVbN 8EjkXVSTxMFjCvNNsTo8RBMDEVQmk7gYkW4SCDuvdsBG
  59. ```
  60. 会显示`k1`所有信息
  61. #### 添加密钥对
  62. ```bash
  63. :bin$ ./jdchain-cli.sh keys add -h
  64. Create a new keypair.
  65. Usage: jdchain-cli keys add [-hV] [--pretty] [-a=<algorithm>] [--home=<path>]
  66. -n=<name>
  67. -a, --algorithm=<algorithm>
  68. Crypto algorithm
  69. -h, --help Show this help message and exit.
  70. --home=<path> Set the home directory.
  71. -n, --name=<name> Name of the key
  72. --pretty Pretty json print
  73. -p, --password=<password>
  74. Password of the key
  75. -V, --version Print version information and exit.
  76. ```
  77. - `a`/`algorithm`,密钥算法:`SM2`,`ED25519`等,默认`ED25519`
  78. - `name`,密钥对名称
  79. 如:
  80. ```bash
  81. :bin$ ./jdchain-cli.sh keys add -n k1
  82. please input password: >
  83. // 输入私钥密码
  84. 1
  85. NAME ALGORITHM ADDRESS PUBKEY
  86. k1 ED25519 LdeP1iczD3zpmcayKAxTfSywict9y2r6Jpq6n 7VeRBamwPeMb7jzTNg3Ap2DscBiy3QE3PK5NqBvv9tUjQVk4
  87. ```
  88. #### 更新私钥密码
  89. ```bash
  90. :bin$ ./jdchain-cli.sh keys update -h
  91. Update privkey password.
  92. Usage: jdchain-cli keys update [-hV] [--pretty] [--home=<path>] -n=<name>
  93. -h, --help Show this help message and exit.
  94. --home=<path> Set the home directory.
  95. -n, --name=<name> Name of the key
  96. --pretty Pretty json print
  97. -V, --version Print version information and exit.
  98. ```
  99. - `name`,密钥对名称
  100. 如:
  101. ```bash
  102. :bin$ ./jdchain-cli.sh keys update -n k1
  103. input the current password:
  104. // 输入当前密码
  105. > 1
  106. input new password:
  107. // 输入新密码
  108. > 2
  109. NAME ALGORITHM ADDRESS PUBKEY
  110. k1 ED25519 LdeP1iczD3zpmcayKAxTfSywict9y2r6Jpq6n 7VeRBamwPeMb7jzTNg3Ap2DscBiy3QE3PK5NqBvv9tUjQVk4
  111. ```
  112. #### 删除密钥对
  113. ```bash
  114. :bin$ ./jdchain-cli.sh keys delete -h
  115. Delete keypair.
  116. Usage: jdchain-cli keys delete [-hV] [--pretty] [--home=<path>] -n=<name>
  117. -h, --help Show this help message and exit.
  118. --home=<path> Set the home directory.
  119. -n, --name=<name> Name of the key
  120. --pretty Pretty json print
  121. -V, --version Print version information and exit.
  122. ```
  123. - `name`,密钥对名称
  124. 如:
  125. ```bash
  126. :bin$ ./jdchain-cli.sh keys delete -n k1
  127. input the current password: >
  128. // 输入当前密码
  129. 2
  130. [k1] deleted
  131. ```