这是从 HSM 发送和接收数据的代码
public class TestHSMJava {
public static void main(String args[]) {
System.out.println("<<< Main Method Entry >>>");
String command = null;
Socket socket = null;
DataOutputStream out = null;
DataInputStream in = null;
byte[] b= new byte[100];
try {
socket = new Socket("10.10.10.10", 7500);
System.out.println("<<< Socket >>> :" + socket);
if (socket != null) {
System.out.println("<<< Connected to HSM >>>:"
+ socket.isConnected());
in = new DataInputStream (new BufferedInputStream(socket.getInputStream()));
out = new DataOutputStream (new BufferedOutputStream(socket.getOutputStream()));
command = "0006303030304e43";
out.writeUTF(command);
System.out.println("Input to HSM : " +command);
out.flush();
String response = in.readUTF();
System.out.println("Output from HSM : " +response);
System.out.println("");
}
}
}
问题是我需要发送哪个命令来执行“GC”命令(将 ZPK 从 LMK 转换为 ZMK 加密)我需要为 TPK 密钥生成一个清晰的组件。通常我会
gc
Enter key length [1,2,3]: 2
Enter key type: 002
Enter key scheme: u
接着
fk
Enter key length [1,2,3]: 2
Enter key type: 002
Enter key scheme: u
Enter component type [X,H,T,E,S]: x
Enter number of components [1-9]: 2
我需要使用 Java 程序执行这些操作。