web stats
addIdentity with key data - Mirth Community

Go Back   Mirth Community > Mirth Connect > General Discussion

Thread Tools Display Modes
Old 03-03-2020, 03:13 PM
sunguk sunguk is offline
What's HL7?
Join Date: Oct 2019
Posts: 2
sunguk is on a distinguished road
Default addIdentity with key data

We have to use javascript to implement SFTP in Mirth and we are trying to use below method.
Also, We can't use file name approach in javascript as there are restriction.

JSch addIdentity(String name, byte[] prvkey, byte[] pubkey, byte[] passphrase)
name - a name identifying the key pair.
prvkey - the private key data. This will be zeroed out after creating the Identity object.
pubkey - the public key data.
passphrase - the passphrase necessary to access the private key.

We have public and private keys but I am not sure how to convert those strings to byte[] prvkey and byte[] pubkey parameters in above method.

We have tried below approach but generated the "Can't find method com.jcraft.jsch.JSch.addIdentity(string,java.lang. String,java.lang.String,java.lang.String)"
var pubkey = "AAAAB3NzaC1yc2EAAAAD";
var publickey = FileUtil.encode(new java.lang.String(pubkey).getBytes());
Reply With Quote
Old 03-09-2020, 04:00 PM
agermano agermano is offline
Mirth Guru
Join Date: Apr 2017
Location: Indiana, USA
Posts: 1,165
agermano is on a distinguished road

If pubkey is a base64 encoded string and you want to get an array of the bytes it represents, you want
var publickey = FileUtil.decode(pubkey);
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -8. The time now is 05:44 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Mirth Corporation