1
1
package org .bouncycastle .openpgp .test ;
2
2
3
- import org .bouncycastle .bcpg .*;
3
+ import java .io .IOException ;
4
+ import java .security .InvalidAlgorithmParameterException ;
5
+ import java .security .KeyPair ;
6
+ import java .security .KeyPairGenerator ;
7
+ import java .security .NoSuchAlgorithmException ;
8
+ import java .security .SecureRandom ;
9
+ import java .util .Date ;
10
+
11
+ import org .bouncycastle .bcpg .EdDSAPublicBCPGKey ;
12
+ import org .bouncycastle .bcpg .EdSecretBCPGKey ;
13
+ import org .bouncycastle .bcpg .HashAlgorithmTags ;
14
+ import org .bouncycastle .bcpg .PublicKeyAlgorithmTags ;
4
15
import org .bouncycastle .crypto .AsymmetricCipherKeyPair ;
5
16
import org .bouncycastle .crypto .generators .Ed448KeyPairGenerator ;
6
17
import org .bouncycastle .crypto .params .Ed448KeyGenerationParameters ;
7
18
import org .bouncycastle .jcajce .spec .EdDSAParameterSpec ;
8
19
import org .bouncycastle .jce .provider .BouncyCastleProvider ;
9
- import org .bouncycastle .openpgp .*;
20
+ import org .bouncycastle .openpgp .PGPException ;
21
+ import org .bouncycastle .openpgp .PGPKeyPair ;
22
+ import org .bouncycastle .openpgp .PGPSignature ;
23
+ import org .bouncycastle .openpgp .PGPSignatureGenerator ;
10
24
import org .bouncycastle .openpgp .operator .PGPContentSignerBuilder ;
11
25
import org .bouncycastle .openpgp .operator .PGPContentVerifierBuilderProvider ;
12
26
import org .bouncycastle .openpgp .operator .bc .BcPGPContentSignerBuilder ;
15
29
import org .bouncycastle .openpgp .operator .jcajce .JcaPGPContentSignerBuilder ;
16
30
import org .bouncycastle .openpgp .operator .jcajce .JcaPGPContentVerifierBuilderProvider ;
17
31
import org .bouncycastle .openpgp .operator .jcajce .JcaPGPKeyPair ;
18
-
19
- import java .io .IOException ;
20
- import java .nio .charset .StandardCharsets ;
21
- import java .security .*;
22
- import java .util .Date ;
32
+ import org .bouncycastle .util .Strings ;
23
33
24
34
public class LegacyEd448KeyPairTest
25
35
extends AbstractPgpKeyPairTest
@@ -49,7 +59,7 @@ private void testV4SigningVerificationWithJcaKey()
49
59
KeyPair kp = gen .generateKeyPair ();
50
60
PGPKeyPair keyPair = new JcaPGPKeyPair (PublicKeyAlgorithmTags .EDDSA_LEGACY , kp , date );
51
61
52
- byte [] data = "Hello, World!\n " . getBytes ( StandardCharsets . UTF_8 );
62
+ byte [] data = Strings . toByteArray ( "Hello, World!\n " );
53
63
54
64
PGPContentSignerBuilder contSigBuilder = new JcaPGPContentSignerBuilder (
55
65
keyPair .getPublicKey ().getAlgorithm (),
@@ -76,7 +86,7 @@ private void testV4SigningVerificationWithBcKey()
76
86
AsymmetricCipherKeyPair kp = gen .generateKeyPair ();
77
87
BcPGPKeyPair keyPair = new BcPGPKeyPair (PublicKeyAlgorithmTags .EDDSA_LEGACY , kp , date );
78
88
79
- byte [] data = "Hello, World!\n " . getBytes ( StandardCharsets . UTF_8 );
89
+ byte [] data = Strings . toByteArray ( "Hello, World!\n " );
80
90
81
91
PGPContentSignerBuilder contSigBuilder = new BcPGPContentSignerBuilder (
82
92
keyPair .getPublicKey ().getAlgorithm (),
0 commit comments