File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -932,11 +932,18 @@ cmd specifies a command to exec. Valid commands are:
932
932
933
933
(defn generate-keypair
934
934
" Generate a keypair, returned as [private public] byte arrays.
935
- Valid types are :rsa and :dsa. key-size is in bytes. passphrase
936
- can be a string or byte array."
937
- [agent key-type key-size passphrase]
935
+ Valid types are :rsa and :dsa. key-size is in bytes. passphrase can be a
936
+ string or byte array. Optionally writes the keypair to the paths specified
937
+ using the :private-key-path and :public-key-path keys."
938
+ [agent key-type key-size passphrase
939
+ & {:keys [comment private-key-path public-key-path]}]
938
940
(let [keypair (KeyPair/genKeyPair agent (key-type key-types) key-size)]
939
- (when passphrase (.setPassphrase keypair passphrase))
941
+ (when passphrase
942
+ (.setPassphrase keypair passphrase))
943
+ (when public-key-path
944
+ (.writePublicKey keypair public-key-path comment))
945
+ (when private-key-path
946
+ (.writePrivateKey keypair private-key-path))
940
947
(let [pub-baos (ByteArrayOutputStream. )
941
948
pri-baos (ByteArrayOutputStream. )]
942
949
(.writePublicKey keypair pub-baos " " )
You can’t perform that action at this time.
0 commit comments