|
19 | 19 | import org.bouncycastle.bcpg.SignatureSubpacket;
|
20 | 20 | import org.bouncycastle.bcpg.TrustPacket;
|
21 | 21 | import org.bouncycastle.math.ec.rfc8032.Ed25519;
|
| 22 | +import org.bouncycastle.math.ec.rfc8032.Ed448; |
22 | 23 | import org.bouncycastle.openpgp.operator.PGPContentVerifier;
|
23 | 24 | import org.bouncycastle.openpgp.operator.PGPContentVerifierBuilder;
|
24 | 25 | import org.bouncycastle.openpgp.operator.PGPContentVerifierBuilderProvider;
|
@@ -454,9 +455,19 @@ else if (getKeyAlgorithm() == PublicKeyAlgorithmTags.EDDSA_LEGACY)
|
454 | 455 | {
|
455 | 456 | byte[] a = BigIntegers.asUnsignedByteArray(sigValues[0].getValue());
|
456 | 457 | byte[] b = BigIntegers.asUnsignedByteArray(sigValues[1].getValue());
|
457 |
| - signature = new byte[Ed25519.SIGNATURE_SIZE]; |
458 |
| - System.arraycopy(a, 0, signature, Ed25519.PUBLIC_KEY_SIZE - a.length, a.length); |
459 |
| - System.arraycopy(b, 0, signature, Ed25519.SIGNATURE_SIZE - b.length, b.length); |
| 458 | + if (a.length + b.length == Ed25519.SIGNATURE_SIZE) |
| 459 | + { |
| 460 | + signature = new byte[Ed25519.SIGNATURE_SIZE]; |
| 461 | + System.arraycopy(a, 0, signature, Ed25519.PUBLIC_KEY_SIZE - a.length, a.length); |
| 462 | + System.arraycopy(b, 0, signature, Ed25519.SIGNATURE_SIZE - b.length, b.length); |
| 463 | + } |
| 464 | + else |
| 465 | + { |
| 466 | + signature = new byte[Ed448.SIGNATURE_SIZE]; |
| 467 | + System.arraycopy(a, 0, signature, Ed448.PUBLIC_KEY_SIZE - a.length, a.length); |
| 468 | + System.arraycopy(b, 0, signature, Ed448.SIGNATURE_SIZE - b.length, b.length); |
| 469 | + } |
| 470 | + |
460 | 471 | }
|
461 | 472 | else
|
462 | 473 | {
|
|
0 commit comments