Skip to content

Commit

Permalink
fix(739) SignatureECDSAN destroying private key
Browse files Browse the repository at this point in the history
  • Loading branch information
ikucuze committed Jan 7, 2025
1 parent 323a82a commit ba66084
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/com/jcraft/jsch/KeyPairECDSA.java
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,8 @@ public byte[] getSignature(byte[] data) {
.asSubclass(SignatureECDSA.class);
SignatureECDSA ecdsa = c.getDeclaredConstructor().newInstance();
ecdsa.init();
ecdsa.setPrvKey(prv_array);
// issue 739: prv_array could be destroyed by ecdsa signing process if its first bit is 1
ecdsa.setPrvKey(Arrays.copyOf(prv_array, prv_array.length));

ecdsa.update(data);
byte[] sig = ecdsa.sign();
Expand Down

0 comments on commit ba66084

Please sign in to comment.