1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
|
# random keys created by botan
#public static void main(String[] args)
# throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidCipherTextException {
# X9ECParameters spec = SECNamedCurves.getByName("secp521r1");
# ECDomainParameters ecDomain = new ECDomainParameters(spec.getCurve(), spec.getG(), spec.getN());
#
# ECPrivateKeyParameters alice = new ECPrivateKeyParameters(
# new BigInteger("4050298667054381376040649773970530311598264897556821662677634075002761777100287880684822948852132235484464537021197213998300006547176718172344447619746779823", 10), ecDomain);
# ECPrivateKeyParameters bob = new ECPrivateKeyParameters(
# new BigInteger("2294226772740614508941417891614236736606752960073669253551166842586609531509032791476032516821966982891507407145617606630445744825404691681749451640151380153", 10), ecDomain);
# ECPublicKeyParameters alicePublicKey = new ECPublicKeyParameters(
# alice.getParameters().getG().multiply(alice.getD()), alice.getParameters());
# ECPublicKeyParameters bobPublicKey = new ECPublicKeyParameters(bob.getParameters().getG().multiply(bob.getD()),
# bob.getParameters());
#
# byte[] d = new byte[0];
# byte[] e = "Test".getBytes();
# //byte[] e = new byte[0];
# //byte[] iv = new byte[16];
# byte[] iv = Hex.decode("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF");
# int mac_key_len = 128;
# int dem_key_len = 256;
# CipherParameters p = new ParametersWithIV(new IESWithCipherParameters(d, e, mac_key_len, dem_key_len), iv);
#
# IESEngine ecies = new IESEngine(new ECDHBasicAgreement(), new KDF1BytesGenerator(new SHA512Digest()),
# new HMac(new SHA512Digest()), new PaddedBufferedBlockCipher(new CBCBlockCipher(new AESEngine())));
# ecies.init(true, alice, bobPublicKey, p);
#
# byte[] message = Hex.decode("000102030405060708090A0B0C0D0E0F");
# byte[] result = ecies.processBlock(message, 0, message.length);
#
# byte[] ephPublicKey = alicePublicKey.getQ().getEncoded(true);
# byte[] out = Arrays.concatenate(ephPublicKey, result);
#
# System.out.println("Curve = secp521r1");
# System.out.println("PrivateKey = 4050298667054381376040649773970530311598264897556821662677634075002761777100287880684822948852132235484464537021197213998300006547176718172344447619746779823");
# System.out.println("OtherPrivateKey = 2294226772740614508941417891614236736606752960073669253551166842586609531509032791476032516821966982891507407145617606630445744825404691681749451640151380153");
# System.out.println("Kdf = KDF1-18033(SHA-512)");
# System.out.println("Dem = AES-256/CBC");
# System.out.println("DemKeyLen = " + dem_key_len / 8);
# System.out.println("Iv = FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF");
# System.out.println("Mac = HMAC(SHA-512)");
# System.out.println("MacKeyLen = " + mac_key_len / 8 );
# System.out.println("Format = uncompressed");
# System.out.println("CofactorMode = 0");
# System.out.println("OldCofactorMode = 0");
# System.out.println("CheckMode = 0");
# System.out.println("SingleHashMode = 1");
# System.out.println("Label = Test");
# System.out.println("Plaintext = " + Hex.toHexString(message).toUpperCase() );
# System.out.println("Ciphertext = " + Hex.toHexString( out ).toUpperCase());
# }
Curve = secp160r1
PrivateKey = 1239488582848888730519239446720775754920686817364
OtherPrivateKey = 1255825134563225934367124570783723166851629196761
Kdf = KDF2(SHA-1)
Dem = AES-256/CBC
DemKeyLen = 32
Mac = HMAC(SHA-256)
MacKeyLen = 20
Format = compressed
CofactorMode = 0
OldCofactorMode = 0
CheckMode = 0
SingleHashMode = 1
Label =
Plaintext = 00
Ciphertext = 02b26eafa6b51a39790c32a75c2f10b3e8e89d698a6da2667af153734225c8922800db5e10b73975848cceac0fc78cef589b2e93a81cc204dbc7b9b901cbaa4509e61141d7
Curve = secp160r1
PrivateKey = 1239488582848888730519239446720775754920686817364
OtherPrivateKey = 1255825134563225934367124570783723166851629196761
Kdf = KDF1-18033(SHA-1)
Dem = AES-256/CBC
DemKeyLen = 32
Mac = HMAC(SHA-256)
MacKeyLen = 20
Format = compressed
CofactorMode = 0
OldCofactorMode = 0
CheckMode = 0
SingleHashMode = 1
Label =
Plaintext = 00
Ciphertext = 02b26eafa6b51a39790c32a75c2f10b3e8e89d698aa9467d2b3b27cf8b50794387d9736d99eb055524f926f1b4a60371f016977c0e164045a0547f8bd2bcdb29728183c222
Curve = secp521r1
PrivateKey = 4050298667054381376040649773970530311598264897556821662677634075002761777100287880684822948852132235484464537021197213998300006547176718172344447619746779823
OtherPrivateKey = 2294226772740614508941417891614236736606752960073669253551166842586609531509032791476032516821966982891507407145617606630445744825404691681749451640151380153
Kdf = KDF2(SHA-1)
Dem = Camellia-128/CBC
DemKeyLen = 16
Iv = FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
Mac = HMAC(SHA-256)
MacKeyLen = 16
Format = uncompressed
CofactorMode = 0
OldCofactorMode = 0
CheckMode = 0
SingleHashMode = 1
Label = Test
Plaintext = 000102030405060708090A0B0C0D0E0F
Ciphertext = 0401519eaa0489ff9d51e98e4c22349463e2001cd06f8ce47d81d4007a79acf98e92c814686477cea666efc277dc84e15fc95e38aff8e16d478a44cd5c5f1517f8b1f300000591317f261c3d04a7207f01eae3ec70f23600f82c53cc0b85be7ac9f6ce79ef2ab416e5934d61ba9d346385d7545c57f77c7ea7c58e18c70cbfb0a24ae1b994eda8dbc666713558717077dde021d9252b7f68eef0bc369086f6a6cb991fcc2fbcac3671a122ba18541790974cef7420cb53e7d6f30d1b808dddd58a63413f7b
Curve = secp521r1
PrivateKey = 4050298667054381376040649773970530311598264897556821662677634075002761777100287880684822948852132235484464537021197213998300006547176718172344447619746779823
OtherPrivateKey = 2294226772740614508941417891614236736606752960073669253551166842586609531509032791476032516821966982891507407145617606630445744825404691681749451640151380153
Kdf = KDF1-18033(SHA-1)
Dem = Camellia-128/CBC
DemKeyLen = 16
Iv = FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
Mac = HMAC(SHA-256)
MacKeyLen = 16
Format = uncompressed
CofactorMode = 0
OldCofactorMode = 0
CheckMode = 0
SingleHashMode = 1
Label = Test
Plaintext = 000102030405060708090a0b0c0d0e0f
Ciphertext = 0401519eaa0489ff9d51e98e4c22349463e2001cd06f8ce47d81d4007a79acf98e92c814686477cea666efc277dc84e15fc95e38aff8e16d478a44cd5c5f1517f8b1f300000591317f261c3d04a7207f01eae3ec70f23600f82c53cc0b85be7ac9f6ce79ef2ab416e5934d61ba9d346385d7545c57f77c7ea7c58e18c70cbfb0a24ae1b994df33ebfb0412ed20e9b10fa3371b64420cb9075da96e37ee2301092f373a857c8f63180bac35e5728890000f19c6322834e911e74f55c8fcb506a9d1533a75e7
Curve = secp521r1
PrivateKey = 4050298667054381376040649773970530311598264897556821662677634075002761777100287880684822948852132235484464537021197213998300006547176718172344447619746779823
OtherPrivateKey = 2294226772740614508941417891614236736606752960073669253551166842586609531509032791476032516821966982891507407145617606630445744825404691681749451640151380153
Kdf = KDF2(SHA-512)
Dem = AES-256/CBC
DemKeyLen = 32
Iv = FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
Mac = HMAC(SHA-512)
MacKeyLen = 16
Format = compressed
CofactorMode = 0
OldCofactorMode = 0
CheckMode = 0
SingleHashMode = 1
Label = Test
Plaintext = 000102030405060708090A0B0C0D0E0F
Ciphertext = 0201519EAA0489FF9D51E98E4C22349463E2001CD06F8CE47D81D4007A79ACF98E92C814686477CEA666EFC277DC84E15FC95E38AFF8E16D478A44CD5C5F1517F8B1F30C4363152545731911C03AE45244C41218A63E8DED4C56B9AE2FD7C022C75023D42A3D8D31BE83D80802938B5FEA25DA10323FEAC30ECB37C612EBF00D583FA02B0812F3F52F271B0C50AA2798594AF5CDA577C701F693A3255D0321CDFCC88A
Curve = secp521r1
PrivateKey = 4050298667054381376040649773970530311598264897556821662677634075002761777100287880684822948852132235484464537021197213998300006547176718172344447619746779823
OtherPrivateKey = 2294226772740614508941417891614236736606752960073669253551166842586609531509032791476032516821966982891507407145617606630445744825404691681749451640151380153
Kdf = KDF1-18033(SHA-512)
Dem = AES-256/CBC
DemKeyLen = 32
Iv = FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
Mac = HMAC(SHA-512)
MacKeyLen = 16
Format = compressed
CofactorMode = 0
OldCofactorMode = 0
CheckMode = 0
SingleHashMode = 1
Label = Test
Plaintext = 000102030405060708090A0B0C0D0E0F
Ciphertext = 0201519EAA0489FF9D51E98E4C22349463E2001CD06F8CE47D81D4007A79ACF98E92C814686477CEA666EFC277DC84E15FC95E38AFF8E16D478A44CD5C5F1517F8B1F3B4D4D7BF8B86834928A86567A7C5AF80538D7F5EFF49F3A14947503EB8ACCC90D916CDC07C0AC00A9D558857F2C2EC3DC5142713F4A4AE0334987BCC3DCE9ABB4403A674F3821124D29D92F184568BA31FC60F1C0C58B4CBBCD6BD588462FC50
# use secp112r2 - curve with cofactor != 1
Curve = -----BEGIN EC PARAMETERS-----MHMCAQEwGgYHKoZIzj0BAQIPANt8Kr9i415mgHa+rSCLMCAEDmEnwkwF84oKqvZcDvAsBA5R3vGBXbXtdPzDTIXXCQQdBEujCrXokrThZJ3QkoZDrc1G9YguN0fe826VbpcCDjbfCq/YuNdZfKEFINBLAgEE-----END EC PARAMETERS-----
PrivateKey = 656008468895526658474428975817604
OtherPrivateKey = 563449446384594847151017584539074
Kdf = KDF2(SHA-1)
Dem = Camellia-128/CBC
DemKeyLen = 16
Iv = FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
Mac = HMAC(SHA-256)
MacKeyLen = 16
Format = uncompressed
CofactorMode = 0
OldCofactorMode = 1
CheckMode = 0
SingleHashMode = 1
Label = Test
Plaintext = 000102030405060708090A0B0C0D0E0F
Ciphertext = 048c40bda0986dadeb651178b4a8e64b7735fb02f43e621151849ea761a0f79fbb500b76e4eb9cd65281b804406536d04059b60689ed286490afcbf8f7f32dfefff8d37d29d335cb11aef3cc5d65f87571e3c8799974038f9d377a2683
# use secp112r2 - curve with cofactor != 1
Curve = -----BEGIN EC PARAMETERS-----MHMCAQEwGgYHKoZIzj0BAQIPANt8Kr9i415mgHa+rSCLMCAEDmEnwkwF84oKqvZcDvAsBA5R3vGBXbXtdPzDTIXXCQQdBEujCrXokrThZJ3QkoZDrc1G9YguN0fe826VbpcCDjbfCq/YuNdZfKEFINBLAgEE-----END EC PARAMETERS-----
PrivateKey = 656008468895526658474428975817604
OtherPrivateKey = 563449446384594847151017584539074
Kdf = KDF2(SHA-1)
Dem = Camellia-128/CBC
DemKeyLen = 16
Iv = FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
Mac = HMAC(SHA-256)
MacKeyLen = 16
Format = uncompressed
CofactorMode = 1
OldCofactorMode = 0
CheckMode = 0
SingleHashMode = 1
Label = Test
Plaintext = 000102030405060708090A0B0C0D0E0F
Ciphertext = 048c40bda0986dadeb651178b4a8e64b7735fb02f43e621151849ea761230f2bddf1ffa3262673bcb3f468dd8b92c31a32e23935cfd27dfcc123928a18bbc82bdcada733be6d42119d3fb968ac4b77fff9a47d336fa025bfad3ee54286
Curve = -----BEGIN EC PARAMETERS-----MHMCAQEwGgYHKoZIzj0BAQIPANt8Kr9i415mgHa+rSCLMCAEDmEnwkwF84oKqvZcDvAsBA5R3vGBXbXtdPzDTIXXCQQdBEujCrXokrThZJ3QkoZDrc1G9YguN0fe826VbpcCDjbfCq/YuNdZfKEFINBLAgEE-----END EC PARAMETERS-----
PrivateKey = 656008468895526658474428975817604
OtherPrivateKey = 563449446384594847151017584539074
Kdf = KDF1-18033(SHA-1)
Dem = Camellia-128/CBC
DemKeyLen = 16
Iv = FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
Mac = HMAC(SHA-256)
MacKeyLen = 16
Format = uncompressed
CofactorMode = 1
OldCofactorMode = 0
CheckMode = 0
SingleHashMode = 1
Label = Test
Plaintext = 000102030405060708090A0B0C0D0E0F
Ciphertext = 048C40BDA0986DADEB651178B4A8E64B7735FB02F43E621151849EA76156865605D031B2DE966E35FE7A8201139C30B19DF8E3CE86657032AE1A1397FD00B223AFC1123550A8ABB3983A9F62C5CC1D9A34B8BD938921D67AE08E07211E
Curve = -----BEGIN EC PARAMETERS-----MHMCAQEwGgYHKoZIzj0BAQIPANt8Kr9i415mgHa+rSCLMCAEDmEnwkwF84oKqvZcDvAsBA5R3vGBXbXtdPzDTIXXCQQdBEujCrXokrThZJ3QkoZDrc1G9YguN0fe826VbpcCDjbfCq/YuNdZfKEFINBLAgEE-----END EC PARAMETERS-----
PrivateKey = 656008468895526658474428975817604
OtherPrivateKey = 563449446384594847151017584539074
Kdf = KDF2(SHA-512)
Dem = AES-256/CBC
DemKeyLen = 32
Iv = FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
Mac = HMAC(SHA-512)
MacKeyLen = 16
Format = uncompressed
CofactorMode = 1
OldCofactorMode = 0
CheckMode = 0
SingleHashMode = 1
Label = Test
Plaintext = 000102030405060708090A0B0C0D0E0F
Ciphertext = 048C40BDA0986DADEB651178B4A8E64B7735FB02F43E621151849EA7616B60902979DFC4E153E419820187D5240C4056F0B59714BFD01F1F7F6F95BD208C8A415DFC474CE1A39D5129B30787338BF3A1607CBEBA9D182EA586917339748BFFA0D4112D84DCFA199E945E0318504B5BA906D70210E5044462BDC646BE95
Curve = -----BEGIN EC PARAMETERS-----MHMCAQEwGgYHKoZIzj0BAQIPANt8Kr9i415mgHa+rSCLMCAEDmEnwkwF84oKqvZcDvAsBA5R3vGBXbXtdPzDTIXXCQQdBEujCrXokrThZJ3QkoZDrc1G9YguN0fe826VbpcCDjbfCq/YuNdZfKEFINBLAgEE-----END EC PARAMETERS-----
PrivateKey = 656008468895526658474428975817604
OtherPrivateKey = 563449446384594847151017584539074
Kdf = KDF1-18033(SHA-512)
Dem = AES-256/CBC
DemKeyLen = 32
Iv = FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
Mac = HMAC(SHA-512)
MacKeyLen = 16
Format = uncompressed
CofactorMode = 1
OldCofactorMode = 0
CheckMode = 0
SingleHashMode = 1
Label = Test
Plaintext = 000102030405060708090A0B0C0D0E0F
Ciphertext = 048C40BDA0986DADEB651178B4A8E64B7735FB02F43E621151849EA76132283FD2CF897E305A0517EECD84B2D9022E5C5EB8E3BA9489F090070530B3CE946017112D1754A4AE14D981EEB2B4A4A0216D8DEAB1ED4330B49535A132DB0E9D5BD4B9FA1EB042A323A3C262B95980CFFCF77B23B9D17EA2377D2AD1811CE4
######################## bouncycastle does not support aead ciphers with IESEngine -> the following ciphertext has been created with botan (asserts deterministic ciphertext)
Curve = brainpool512r1
PrivateKey = 7978796978847894400103470063598909318992754342406974939475470191530421638356103244921001321651015274653183103561457607601257178840534133802655904526250737
OtherPrivateKey = 2308129338363763325603164530220543667351108423592731601992535938718831256964324847657313285466745344259451280420400800014583532495130674675477133156417282
Kdf = KDF2(SHA-1)
Dem = Twofish/GCM
DemKeyLen = 32
Iv = 00000000000000000000000000000000
Mac = HMAC(SHA-512)
MacKeyLen = 64
Format = compressed
CofactorMode = 0
OldCofactorMode = 0
CheckMode = 0
SingleHashMode = 0
Label = Test
Plaintext = 00
Ciphertext = 02407515774fad019b762e2ba4c04fa6ff35ba7acc356a167cdf83747e5438b5494a6727366f4d031f2c676eed78a99bf74da9e4edd808fc2360927d52213997d35cd8371d89195b5294da4f99ab1126c703093361c9f6067314b39b70762b13fff1d0fb5ad043a67074ad89176af7ea7d562a0f8c5b9f721192c5c5d338ceea8d59c492aebc3de551dd9ed6fc346c02c586
|