2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
19 * @author Vladimir N. Molotkov
23 package org.apache.harmony.crypto.tests.javax.crypto;
25 import dalvik.annotation.TestTargetClass;
26 import dalvik.annotation.TestLevel;
27 import dalvik.annotation.TestTargetNew;
29 import java.io.IOException;
30 import java.security.AlgorithmParameters;
31 import java.security.AlgorithmParametersSpi;
32 import java.security.InvalidAlgorithmParameterException;
33 import java.security.InvalidKeyException;
34 import java.security.Key;
35 import java.security.KeyPair;
36 import java.security.KeyPairGenerator;
37 import java.security.NoSuchAlgorithmException;
38 import java.security.NoSuchProviderException;
39 import java.security.Provider;
40 import java.security.Security;
41 import java.security.spec.InvalidKeySpecException;
42 import java.security.spec.InvalidParameterSpecException;
43 import java.security.spec.PKCS8EncodedKeySpec;
44 import java.util.Arrays;
46 import javax.crypto.BadPaddingException;
47 import javax.crypto.Cipher;
48 import javax.crypto.EncryptedPrivateKeyInfo;
49 import javax.crypto.IllegalBlockSizeException;
50 import javax.crypto.KeyGenerator;
51 import javax.crypto.NoSuchPaddingException;
52 import javax.crypto.SecretKeyFactory;
53 import javax.crypto.spec.PBEKeySpec;
54 import javax.crypto.spec.PBEParameterSpec;
56 import org.apache.harmony.crypto.tests.support.EncryptedPrivateKeyInfoData;
58 import junit.framework.TestCase;
60 @TestTargetClass(EncryptedPrivateKeyInfo.class)
62 * Test for EncryptedPrivateKeyInfo class.
64 * All binary data for this test were generated using BEA JRockit j2sdk1.4.2_04
65 * (http://www.bea.com) with security providers list extended by Bouncy Castle's
66 * one (http://www.bouncycastle.org)
68 public class EncryptedPrivateKeyInfoTest extends TestCase {
70 private static final Provider[] provider = Security.getProviders();
73 * Algorithm names/transformations used in roundtrip tests of
74 * getKeySpec(...) methods
76 private static final String[][] algName = {
79 // {"AES", "AES/ECB/PKCS5Padding"},
80 // {"AES", "AES/CBC/PKCS5Padding"},
81 // {"AES", "AES/OFB/PKCS5Padding"},
82 // {"AES", "AES/CFB/PKCS5Padding"},
83 // {"2.16.840.1.101.3.4.1.1", null},
84 // {"2.16.840.1.101.3.4.1.2", null},
85 // {"2.16.840.1.101.3.4.1.3", null},
86 // {"2.16.840.1.101.3.4.1.4", null},
87 // {"2.16.840.1.101.3.4.1.5", null},
88 // {"2.16.840.1.101.3.4.1.21", null},
89 // {"2.16.840.1.101.3.4.1.22", null},
90 // {"2.16.840.1.101.3.4.1.23", null},
91 // {"2.16.840.1.101.3.4.1.24", null},
92 // {"2.16.840.1.101.3.4.1.25", null},
93 // {"2.16.840.1.101.3.4.1.41", null},
94 // {"2.16.840.1.101.3.4.1.42", null},
95 // {"2.16.840.1.101.3.4.1.43", null},
96 // {"2.16.840.1.101.3.4.1.44", null},
97 // {"2.16.840.1.101.3.4.1.45", null},
100 // NO OIDs for Blowfish defined (?)
101 { "Blowfish", null },
102 // {"Blowfish","Blowfish/CBC/PKCS5Padding"},
103 // {"Blowfish","Blowfish/CFB/PKCS5Padding"},
104 // {"Blowfish","Blowfish/OFB/PKCS5Padding"},
105 // {"Blowfish","Blowfish/PCBC/PKCS5Padding"},
107 // DES: OIW OIDs only
108 // {iso(1) identified-organization(3) oiw(14) secsig(3)
109 // algorithms(2) desECB(6)}
115 // {"DES", "DES/CBC/PKCS5Padding"},
116 // {"DES","DES/CFB/PKCS5Padding"},
117 // {"DES","DES/OFB/PKCS5Padding"},
118 // {"DES","DES/PCBC/PKCS5Padding"},
120 // DESede (=TripleDes)
121 //{iso(1) identified-organization(3) oiw(14) secsig(3)
122 // algorithms(2) desEDE(17)}
125 // {"DESede","DESede/CBC/PKCS5Padding"},
126 // {"DESede","DESede/CFB/PKCS5Padding"},
127 // {"DESede","DESede/OFB/PKCS5Padding"},
128 // {"DESede","DESede/PCBC/PKCS5Padding"},
129 { "TripleDES", null },
130 // {"TripleDES","TripleDES/CBC/PKCS5Padding"},
131 // {"TripleDES","TripleDES/CFB/PKCS5Padding"},
132 // {"TripleDES","TripleDES/OFB/PKCS5Padding"},
133 // {"TripleDES","TripleDES/PCBC/PKCS5Padding"},
135 // PBEWith<digest>And<encryption>
136 { "PBEWithMD5AndTripleDES", null },
137 // {iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-5(5)
138 // pbeWithMD5AndDES-CBC(3)}
139 { "PBEWithMD5AndDES", "PBEWithMD5AndDES/CBC/PKCS5Padding", "PBEWithMD5AndDES"},
140 { "PBEWithMD5AndDES", null, "PBEWithMD5AndDES"}, { "PBEWithHmacSHA1AndDESede", null },
142 // {iso(1) member-body(2) us(840) nortelnetworks(113533) entrust(7)
143 // algorithms(66) pbeWithMD5AndCAST5-CBC(12)}
145 // also named pbeWithSHAAnd128BitRC4, pbeWithSHA1And128BitRC4:
146 // {iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-12(12)
147 // pkcs-12-PbeIds(1) pkcs-12-OfflineTransportMode(1)}
149 // {iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-12(12)
150 // pkcs-12-PbeIds(1)} +
151 // pbeWithSHAAnd40BitRC4(2) pbeWithSHAAnd3-KeyTripleDES-CBC(3)
152 // pbeWithSHAAnd2-KeyTripleDES-CBC(4) pbeWithSHAAnd128BitRC2-CBC(5)
153 // pbeWithSHAAnd40BitRC2-CBC(6)
156 { "DiffieHellman", null }, // 1.2.840.10046.2.1
157 // {"DH",null}, // 1.2.840.10046.2.1
158 // {"1.2.840.113549.1.3.1", null},
160 { "DSA", null }, // 1.2.840.10040.4.1
168 // {"1.2.840.113549.1.12.1.1",null},
169 // {"1.2.840.113549.1.12.1.2",null},
170 //{ "1.2.840.113549.1.12.1.3", null, "PBEWithSHA1AndDESede"},
171 //{ "PBEWithSHA1AndDESede", null, "PBEWithSHA1AndDESede"},
172 // {"1.2.840.113549.1.12.1.4",null},
173 // {"1.2.840.113549.1.12.1.5",null},
174 // {"1.2.840.113549.1.12.1.6",null},
175 // {"ELGAMAL/PKCS1", "ELGAMAL/ECB/PKCS1PADDING"},
176 // {"ELGAMAL/PKCS1","ELGAMAL/NONE/PKCS1PADDING"},
177 // {"PBEWITHSHAAND3-KEYTRIPLEDES-CBC", null},
178 // {"PBEWITHSHA1ANDDESEDE", null},
179 // {"PBEWithSHAAnd3KeyTripleDES",null},
180 // {"PBEWITHSHAAND3-KEYTRIPLEDES-CBC",null},
184 // {"RSA/1", "RSA/1/PKCS1PADDING"},
185 // {"RSA/2", "RSA/2/PKCS1PADDING"},
186 // {"RSA/ISO9796-1", "RSA/ECB/ISO9796-1PADDING"},
187 // {"RSA", "RSA/ECB/NOPADDING"},
188 // {"RSA/OAEP", "RSA/ECB/OAEPPADDING"},
189 // {"RSA/PKCS1", "RSA/ECB/PKCS1PADDING"},
190 // {"RSA/ISO9796-1", "RSA/NONE/ISO9796-1PADDING"},
191 // {"RSA", "RSA/NONE/NOPADDING"},
192 // {"RSA/OAEP", "RSA/NONE/OAEPPADDING"},
193 // {"RSA/PKCS1", "RSA/NONE/PKCS1PADDING"},
194 // {"RSA",null}, // 1.2.840.113549.1.1.1
195 // {"1.2.840.113549.1.1.1", null},
198 @Override protected void setUp() throws Exception {
203 level = TestLevel.COMPLETE,
205 method = "getAlgName",
208 public void test_getAlgName () {
209 boolean performed = false;
210 for (int i = 0; i < algName.length; i++) {
212 // generate test data
213 TestDataGenerator g = new TestDataGenerator(algName[i][0],
214 algName[i][1], privateKeyInfoDamaged, null);
216 // create test object
217 EncryptedPrivateKeyInfo epki;
218 if (g.ap() == null) {
219 epki = new EncryptedPrivateKeyInfo(algName[i][0], g.ct());
221 epki = new EncryptedPrivateKeyInfo(g.ap(), g.ct());
224 // call methods under test
225 if (algName[i].length == 3) {
226 assertEquals(algName[i][2], epki.getAlgName());
230 } catch (TestDataGenerator.AllowedFailure allowedFailure) {
231 } catch (NoSuchAlgorithmException allowedFailure) {
234 assertTrue("Test not performed", performed);
238 * Test #1 for <code>EncryptedPrivateKeyInfo(byte[])</code> constructor
240 * Assertion: creates <code>EncryptedPrivateKeyInfo</code> instance <br>
241 * Test preconditions: valid parameters passed <br>
242 * Expected: must pass without any exceptions
244 * @throws IOException
245 * @throws NoSuchAlgorithmException
248 level = TestLevel.PARTIAL_COMPLETE,
249 notes = "This is a complete subset of tests for EncryptedPrivateKeyInfo(byte[]) constructor.",
250 method = "EncryptedPrivateKeyInfo",
251 args = {byte[].class}
253 public final void testEncryptedPrivateKeyInfobyteArray1() throws Exception {
254 new EncryptedPrivateKeyInfo(EncryptedPrivateKeyInfoData
255 .getValidEncryptedPrivateKeyInfoEncoding("DH"));
259 * Test #2 for <code>EncryptedPrivateKeyInfo(byte[])</code> constructor
261 * Assertion: <code>NullPointerException</code> if encoding is
262 * <code>null</code><br>
263 * Test preconditions: <code>null</code> passed as a parameter <br>
264 * Expected: <code>NullPointerException</code>
266 * @throws IOException
269 level = TestLevel.PARTIAL_COMPLETE,
270 notes = "This is a complete subset of tests for EncryptedPrivateKeyInfo(byte[]) constructor.",
271 method = "EncryptedPrivateKeyInfo",
272 args = {byte[].class}
274 public final void testEncryptedPrivateKeyInfobyteArray2()
277 new EncryptedPrivateKeyInfo(null);
278 fail(getName() + ": NullPointerException has not been thrown");
279 } catch (NullPointerException ok) {
284 * Test #3 for <code>EncryptedPrivateKeyInfo(byte[])</code> constructor
286 * Assertion: <code>IOException</code> if encoding is wrong <br>
287 * Test preconditions: wrong encoding passed as a parameter <br>
288 * Expected: <code>IOException</code>
291 level = TestLevel.PARTIAL_COMPLETE,
292 notes = "This is a complete subset of tests for EncryptedPrivateKeyInfo(byte[]) constructor.",
293 method = "EncryptedPrivateKeyInfo",
294 args = {byte[].class}
296 public final void testEncryptedPrivateKeyInfobyteArray3() {
298 new EncryptedPrivateKeyInfo(new byte[0]);
299 fail(getName() + ": IOException has not been thrown");
300 } catch (IOException ok) {
305 * Test #4 for <code>EncryptedPrivateKeyInfo(byte[])</code> constructor
307 * Assertion: <code>IOException</code> if encoding is wrong <br>
308 * Test preconditions: wrong encoding passed as a parameter <br>
309 * Expected: <code>IOException</code>
312 level = TestLevel.PARTIAL_COMPLETE,
313 notes = "This is a complete subset of tests for EncryptedPrivateKeyInfo(byte[]) constructor.",
314 method = "EncryptedPrivateKeyInfo",
315 args = {byte[].class}
317 public final void testEncryptedPrivateKeyInfobyteArray4() {
319 new EncryptedPrivateKeyInfo(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9,
321 fail(getName() + ": IOException has not been thrown");
322 } catch (IOException ok) {
327 * Test #5 for <code>EncryptedPrivateKeyInfo(byte[])</code> constructor
329 * Assertion: <code>IOException</code> if encoding is wrong <br>
330 * Test preconditions: wrong encoding passed as a parameter <br>
331 * Expected: <code>IOException</code>
334 level = TestLevel.PARTIAL_COMPLETE,
335 notes = "This is a complete subset of tests for EncryptedPrivateKeyInfo(byte[]) constructor.",
336 method = "EncryptedPrivateKeyInfo",
337 args = {byte[].class}
339 public final void testEncryptedPrivateKeyInfobyteArray5() throws Exception {
342 // 1: get valid encoding
343 enc = EncryptedPrivateKeyInfoData
344 .getValidEncryptedPrivateKeyInfoEncoding("DSA");
346 // ... and corrupt it (set wrong alg OID length)
349 new EncryptedPrivateKeyInfo(enc);
350 fail(getName() + "(1): IOException has not been thrown");
351 } catch (IOException ok) {
355 // 2: get valid encoding
356 enc = EncryptedPrivateKeyInfoData
357 .getValidEncryptedPrivateKeyInfoEncoding("DSA");
358 // ... and corrupt it (set wrong encrypted data tag)
360 new EncryptedPrivateKeyInfo(enc);
361 fail(getName() + "(2): IOException has not been thrown");
362 } catch (IOException ok) {
366 // 3: get valid encoding
367 enc = EncryptedPrivateKeyInfoData
368 .getValidEncryptedPrivateKeyInfoEncoding("DSA");
369 // ... and corrupt it (set wrong encrypted data length)
371 new EncryptedPrivateKeyInfo(enc);
372 fail(getName() + "(3): IOException has not been thrown");
373 } catch (IOException ok) {
377 // 4: get valid encoding
378 enc = EncryptedPrivateKeyInfoData
379 .getValidEncryptedPrivateKeyInfoEncoding("DSA");
380 // ... and corrupt it (set wrong tag for alg params sequence)
381 enc[17] = (byte) 0x29;
382 EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(enc);
384 if (epki.getAlgParameters() == null) {
385 // This kind of encoding corruption can
386 // be only determined while AlgorithmParameters
387 // initialization BUT No AlgorithmParameters instance
388 // available for algName0[i][0].
389 // So just skip this sub test
391 fail(getName() + "(4): IOException has not been thrown");
394 } catch (IOException ok) {
398 // 5: get valid encoding
399 enc = EncryptedPrivateKeyInfoData
400 .getValidEncryptedPrivateKeyInfoEncoding("DSA");
401 // ... and corrupt it (set wrong length for alg params sequence)
402 enc[20] = (byte) 0x1d;
403 new EncryptedPrivateKeyInfo(enc);
404 fail(getName() + "(5): IOException has not been thrown");
405 } catch (IOException ok) {
409 // 6: get valid encoding
410 enc = EncryptedPrivateKeyInfoData
411 .getValidEncryptedPrivateKeyInfoEncoding("DSA");
412 // ... and corrupt it (set wrong length for alg params sequence)
413 enc[20] = (byte) 0x1f;
414 new EncryptedPrivateKeyInfo(enc);
415 fail(getName() + "(6): IOException has not been thrown");
416 } catch (IOException ok) {
421 * Test #6 for <code>EncryptedPrivateKeyInfo(byte[])</code> constructor
423 * Assertion: byte array is copied to prevent subsequent modification <br>
424 * Test preconditions: valid array passed then modified <br>
425 * Expected: getEncoded(), invoked after above modification, must return
426 * array as it was before the modification
428 * @throws IOException
431 level = TestLevel.PARTIAL_COMPLETE,
432 notes = "This is a complete subset of tests for EncryptedPrivateKeyInfo(byte[]) constructor.",
433 method = "EncryptedPrivateKeyInfo",
434 args = {byte[].class}
436 public final void testEncryptedPrivateKeyInfobyteArray6() throws Exception {
437 byte[] encoded = EncryptedPrivateKeyInfoData
438 .getValidEncryptedPrivateKeyInfoEncoding("DSA");
439 byte[] encodedCopy = encoded.clone();
441 EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(encodedCopy);
442 // modify array passed
443 encodedCopy[9] = (byte) 6;
444 // check that internal state has not been affected
445 assertTrue(Arrays.equals(encoded, epki.getEncoded()));
449 * Test #1 for <code>EncryptedPrivateKeyInfo(String, byte[])</code>
451 * Assertion: creates <code>EncryptedPrivateKeyInfo</code> instance <br>
452 * Test preconditions: valid parameters passed <br>
453 * Expected: must pass without any exceptions
456 level = TestLevel.PARTIAL_COMPLETE,
457 notes = "This is a complete subset of tests for EncryptedPrivateKeyInfo(String, byte[]) constructor.",
458 method = "EncryptedPrivateKeyInfo",
459 args = {java.lang.String.class, byte[].class}
461 public final void testEncryptedPrivateKeyInfoStringbyteArray1() {
462 boolean performed = false;
464 for (int i = 0; i < EncryptedPrivateKeyInfoData.algName0.length; i++) {
466 new EncryptedPrivateKeyInfo(
467 EncryptedPrivateKeyInfoData.algName0[i][0],
468 EncryptedPrivateKeyInfoData.encryptedData);
470 } catch (NoSuchAlgorithmException allowed) {
474 assertTrue("Test not performed", performed);
478 * Test #2 for <code>EncryptedPrivateKeyInfo(String, byte[])</code>
480 * Assertion: <code>NoSuchAlgorithmException</code>- if the specified
481 * algorithm is not supported <br>
482 * Test preconditions: pass nonexistent algorithm name <br>
483 * Expected: <code>NoSuchAlgorithmException</code>
486 level = TestLevel.PARTIAL_COMPLETE,
487 notes = "This is a complete subset of tests for EncryptedPrivateKeyInfo(String, byte[]) constructor.",
488 method = "EncryptedPrivateKeyInfo",
489 args = {java.lang.String.class, byte[].class}
491 public final void testEncryptedPrivateKeyInfoStringbyteArray2() {
493 new EncryptedPrivateKeyInfo("bla-bla",
494 EncryptedPrivateKeyInfoData.encryptedData);
495 fail(getName() + ": NoSuchAlgorithmException has not been thrown");
496 } catch (NoSuchAlgorithmException ok) {
500 new EncryptedPrivateKeyInfo("",
501 EncryptedPrivateKeyInfoData.encryptedData);
502 fail(getName() + ": NoSuchAlgorithmException has not been thrown");
503 } catch (NoSuchAlgorithmException ok) {
508 * Test #3 for <code>EncryptedPrivateKeyInfo(String, byte[])</code>
510 * Assertion: <code>NullPointerException</code>- if the specified
511 * algorithm or encrypted data is <code>null</code><br>
512 * Test preconditions: pass <code>null</code> as algorithm name then as
513 * encrypted data <br>
514 * Expected: <code>NullPointerException</code> in both cases
516 * @throws NoSuchAlgorithmException
519 level = TestLevel.PARTIAL_COMPLETE,
520 notes = "This is a complete subset of tests for EncryptedPrivateKeyInfo(String, byte[]) constructor.",
521 method = "EncryptedPrivateKeyInfo",
522 args = {java.lang.String.class, byte[].class}
524 public final void testEncryptedPrivateKeyInfoStringbyteArray3()
525 throws NoSuchAlgorithmException {
528 new EncryptedPrivateKeyInfo((String) null,
529 EncryptedPrivateKeyInfoData.encryptedData);
530 fail(getName() + ": NullPointerException has not been thrown");
531 } catch (NullPointerException ok) {
534 // pass null as encrypted data
536 new EncryptedPrivateKeyInfo("DSA", null);
537 fail(getName() + ": NullPointerException has not been thrown");
538 } catch (NullPointerException ok) {
543 * Test #4 for <code>EncryptedPrivateKeyInfo(String, byte[])</code>
545 * Assertion: <code>IllegalArgumentException</code>- if encrypted data is
546 * empty, i.e. 0-length <br>
547 * Test preconditions: pass empty encrypted data <br>
548 * Expected: <code>IllegalArgumentException</code>
551 level = TestLevel.PARTIAL_COMPLETE,
552 notes = "This is a complete subset of tests for EncryptedPrivateKeyInfo(String, byte[]) constructor.",
553 method = "EncryptedPrivateKeyInfo",
554 args = {java.lang.String.class, byte[].class}
556 public final void testEncryptedPrivateKeyInfoStringbyteArray4()
559 new EncryptedPrivateKeyInfo("DSA", new byte[] {});
560 fail(getName() + ": IllegalArgumentException has not been thrown");
561 } catch (IllegalArgumentException ok) {
566 * Test #5 for <code>EncryptedPrivateKeyInfo(String, byte[])</code>
568 * Assertion: byte array is copied to prevent subsequent modification <br>
569 * Test preconditions: valid array passed then modified <br>
570 * Expected: getEncryptedData(), invoked after above modification, must
571 * return array as it was before the modification
573 * @throws IOException
576 level = TestLevel.PARTIAL_COMPLETE,
577 notes = "This is a complete subset of tests for EncryptedPrivateKeyInfo(String, byte[]) constructor.",
578 method = "EncryptedPrivateKeyInfo",
579 args = {java.lang.String.class, byte[].class}
581 public final void testEncryptedPrivateKeyInfoStringbyteArray5()
583 byte[] encryptedDataCopy = EncryptedPrivateKeyInfoData.encryptedData
586 EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo("DSA",
588 // modify array passed
589 encryptedDataCopy[0] = (byte) 6;
590 // check that internal state has not been affected
591 assertTrue(Arrays.equals(EncryptedPrivateKeyInfoData.encryptedData,
592 epki.getEncryptedData()));
596 * @tests javax/crypto/EncryptedPrivateKeyInfo(String, byte[])
597 * Checks exception order
600 level = TestLevel.PARTIAL_COMPLETE,
601 notes = "This is a complete subset of tests for EncryptedPrivateKeyInfo(String, byte[]) constructor.",
602 method = "EncryptedPrivateKeyInfo",
603 args = {java.lang.String.class, byte[].class}
605 public final void testEncryptedPrivateKeyInfoStringbyteArray6() {
606 //Regression for HARMONY-768
608 new EncryptedPrivateKeyInfo("0", new byte[] {});
609 fail("NoSuchAlgorithmException expected");
610 } catch (NoSuchAlgorithmException e) {
615 class Mock_AlgorithmParameters extends AlgorithmParameters {
616 protected Mock_AlgorithmParameters(AlgorithmParametersSpi paramSpi, Provider provider, String algorithm) {
617 super(paramSpi, provider, algorithm);
623 * <code>EncryptedPrivateKeyInfo(java.security.AlgorithmParameters, byte[])
626 * Assertion: creates <code>EncryptedPrivateKeyInfo</code> instance <br>
627 * Test preconditions: valid parameters passed <br>
628 * Expected: must pass without any exceptions
630 * @throws IOException
631 * @throws NoSuchAlgorithmException
634 level = TestLevel.PARTIAL_COMPLETE,
635 notes = "Functionality checked. NoSuchAlgorithmException should be tested for complete tests subset.",
636 method = "EncryptedPrivateKeyInfo",
637 args = {java.security.AlgorithmParameters.class, byte[].class}
639 public final void testEncryptedPrivateKeyInfoAlgorithmParametersbyteArray1()
640 throws IOException, NoSuchAlgorithmException {
641 AlgorithmParameters ap = null;
643 boolean performed = false;
644 for (int i = 0; i < EncryptedPrivateKeyInfoData.algName0.length; i++) {
646 ap = AlgorithmParameters
647 .getInstance(EncryptedPrivateKeyInfoData.algName0[i][0]);
648 // use pregenerated AlgorithmParameters encodings
649 ap.init(EncryptedPrivateKeyInfoData.getParametersEncoding(
650 EncryptedPrivateKeyInfoData.algName0[i][0]));
652 new EncryptedPrivateKeyInfo(ap,
653 EncryptedPrivateKeyInfoData.encryptedData);
656 } catch (NoSuchAlgorithmException allowedFailure) {
659 assertTrue("Test not performed", performed);
661 ap = new Mock_AlgorithmParameters(null, null, "Wrong alg name");
664 new EncryptedPrivateKeyInfo(ap,
665 EncryptedPrivateKeyInfoData.encryptedData);
666 fail("NoSuchAlgorithmException expected");
667 } catch (NoSuchAlgorithmException e) {
674 * <code>EncryptedPrivateKeyInfo(java.security.AlgorithmParameters, byte[])
677 * Assertion: <code>NullPointerException</code>- if the specified
678 * algorithm parameters or encrypted data is <code>null</code><br>
679 * Test preconditions: pass <code>null</code> as algorithm parameters then
680 * as encrypted data <br>
681 * Expected: <code>NullPointerException</code> in both cases
683 * @throws NoSuchAlgorithmException
684 * @throws IOException
687 level = TestLevel.PARTIAL_COMPLETE,
688 notes = "NullPointerException checked.",
689 method = "EncryptedPrivateKeyInfo",
690 args = {java.security.AlgorithmParameters.class, byte[].class}
692 public final void testEncryptedPrivateKeyInfoAlgorithmParametersbyteArray2()
693 throws NoSuchAlgorithmException, IOException {
694 // 1: pass null as AlgorithmParameters
696 new EncryptedPrivateKeyInfo((AlgorithmParameters) null,
697 EncryptedPrivateKeyInfoData.encryptedData);
698 fail(getName() + ": NullPointerException has not been thrown");
699 } catch (NullPointerException ok) {
702 // 2: pass null as encrypted data
704 AlgorithmParameters ap = AlgorithmParameters.getInstance("DSA");
705 // use pregenerated AlgorithmParameters encodings
706 ap.init(EncryptedPrivateKeyInfoData.getParametersEncoding("DSA"));
707 new EncryptedPrivateKeyInfo(ap, null);
708 fail(getName() + ": NullPointerException has not been thrown");
709 } catch (NullPointerException ok) {
715 * <code>EncryptedPrivateKeyInfo(java.security.AlgorithmParameters, byte[])
718 * Assertion: <code>IllegalArgumentException</code>- if encrypted data is
719 * empty, i.e. 0-length <br>
720 * Test preconditions: pass empty encrypted data <br>
721 * Expected: <code>IllegalArgumentException</code>
723 * @throws NoSuchAlgorithmException
724 * @throws IOException
727 level = TestLevel.PARTIAL_COMPLETE,
728 notes = "IllegalArgumentException checked.",
729 method = "EncryptedPrivateKeyInfo",
730 args = {java.security.AlgorithmParameters.class, byte[].class}
732 public final void testEncryptedPrivateKeyInfoAlgorithmParametersbyteArray3()
735 AlgorithmParameters ap = AlgorithmParameters.getInstance("DSA");
736 // use pregenerated AlgorithmParameters encodings
737 ap.init(EncryptedPrivateKeyInfoData.getParametersEncoding("DSA"));
739 new EncryptedPrivateKeyInfo(ap, new byte[] {});
740 fail(getName() + ": IllegalArgumentException has not been thrown");
742 } catch (IllegalArgumentException ok) {
748 * <code>EncryptedPrivateKeyInfo(java.security.AlgorithmParameters, byte[])
751 * Assertion: byte array is copied to prevent subsequent modification <br>
752 * Test preconditions: valid array passed then modified <br>
753 * Expected: getEncryptedData(), invoked after above modification, must
754 * return array as it was before the modification
756 * @throws IOException
759 level = TestLevel.PARTIAL_COMPLETE,
760 notes = "Functionality checked.",
761 method = "EncryptedPrivateKeyInfo",
762 args = {java.security.AlgorithmParameters.class, byte[].class}
764 public final void testEncryptedPrivateKeyInfoAlgorithmParametersbyteArray4()
766 AlgorithmParameters ap = AlgorithmParameters.getInstance("DSA");
767 // use pregenerated AlgorithmParameters encodings
768 ap.init(EncryptedPrivateKeyInfoData.getParametersEncoding("DSA"));
770 byte[] encryptedDataCopy = EncryptedPrivateKeyInfoData.encryptedData.clone();
772 EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(ap,
775 // modify array passed
776 encryptedDataCopy[0] = (byte) 6;
778 // check that internal state has not been affected
779 assertTrue(Arrays.equals(EncryptedPrivateKeyInfoData.encryptedData,
780 epki.getEncryptedData()));
784 * Test #1 for <code>getAlgParameters()</code> method <br>
785 * Assertion: returns the algorithm parameters <br>
786 * Test preconditions: test object created using ctor which takes encoded
787 * form as the only parameter; encoded form passed contains algorithm
788 * parameters encoding <br>
789 * Expected: corresponding algorithm parameters must be returned
791 * @throws IOException
794 level = TestLevel.PARTIAL_COMPLETE,
795 notes = "This is a complete subset of tests for getAlgParameters method.",
796 method = "getAlgParameters",
799 public final void testGetAlgParameters01() throws IOException {
800 boolean performed = false;
801 for (int i = 0; i < EncryptedPrivateKeyInfoData.algName0.length; i++) {
803 EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(
804 EncryptedPrivateKeyInfoData
805 .getValidEncryptedPrivateKeyInfoEncoding(
806 EncryptedPrivateKeyInfoData.algName0[i][0]));
808 AlgorithmParameters apar = epki.getAlgParameters();
813 // check that method under test returns
814 // parameters with the same encoded form
817 EncryptedPrivateKeyInfoData
818 .getParametersEncoding(EncryptedPrivateKeyInfoData.algName0[i][0]),
821 } catch (NoSuchAlgorithmException allowedFailure) {
824 assertTrue("Test not performed", performed);
828 level = TestLevel.PARTIAL_COMPLETE,
829 notes = "This is a complete subset of tests for getAlgParameters method.",
830 method = "getAlgParameters",
833 public final void testGetAlgParameters01_01() throws Exception {
834 byte[] validEncodingWithUnknownAlgOID = EncryptedPrivateKeyInfoData
835 .getValidEncryptedPrivateKeyInfoEncoding("DH");
837 validEncodingWithUnknownAlgOID[18] = 0;
838 EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(
839 validEncodingWithUnknownAlgOID);
841 assertNull(epki.getAlgParameters());
845 * Test #2 for <code>getAlgParameters()</code> method <br>
846 * Assertion: returns the algorithm parameters <br>
847 * Test preconditions: test object created using ctor which takes encoded
848 * form as the only parameter; encoded form passed does not contain
849 * algorithm parameters encoding <br>
850 * Expected: <code>null</code> must be returned
852 * @throws IOException
855 level = TestLevel.PARTIAL_COMPLETE,
856 notes = "This is a complete subset of tests for getAlgParameters method.",
857 method = "getAlgParameters",
860 public final void testGetAlgParameters02() throws IOException {
861 boolean performed = false;
862 for (int i = 0; i < EncryptedPrivateKeyInfoData.algName0.length; i++) {
864 EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(
865 EncryptedPrivateKeyInfoData
866 .getValidEncryptedPrivateKeyInfoEncoding(
867 EncryptedPrivateKeyInfoData.algName0[i][0],
870 // check that method under test returns null
871 assertNull(epki.getAlgParameters());
874 } catch (NoSuchAlgorithmException allowedFailure) {
877 assertTrue("Test not performed", performed);
881 * Test #3 for <code>getAlgParameters()</code> method <br>
882 * Assertion: returns the algorithm parameters <br>
883 * Test #6 for <code>EncryptedPrivateKeyInfo(String, byte[])</code>
885 * Assertion: ...This constructor will use null as the value of the
886 * algorithm parameters. <br>
887 * Test preconditions: test object created using ctor which takes algorithm
888 * name and encrypted data as a parameters <br>
889 * Expected: <code>null</code> must be returned
891 * @throws IOException
894 level = TestLevel.PARTIAL_COMPLETE,
895 notes = "This is a complete subset of tests for getAlgParameters method.",
896 method = "getAlgParameters",
899 public final void testGetAlgParameters03() throws IOException {
900 boolean performed = false;
901 for (int i = 0; i < EncryptedPrivateKeyInfoData.algName0.length; i++) {
903 EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(
904 EncryptedPrivateKeyInfoData.algName0[i][0],
905 EncryptedPrivateKeyInfoData.encryptedData);
907 // check that method under test returns null
908 // for object constructed in such a way
909 assertNull(epki.getAlgParameters());
912 } catch (NoSuchAlgorithmException allowedFailure) {
915 assertTrue("Test not performed", performed);
919 * Test #4 for <code>getAlgParameters()</code> method <br>
920 * Assertion: returns the algorithm parameters <br>
921 * Test preconditions: test object created using ctor which takes
922 * AlgorithmParameters and encrypted data as a parameters; <br>
923 * Expected: the same algorithm parameters as ones passed to the ctor must be
926 * @throws IOException
929 level = TestLevel.PARTIAL_COMPLETE,
930 notes = "This is a complete subset of tests for getAlgParameters method.",
931 method = "getAlgParameters",
934 public final void testGetAlgParameters04() throws IOException {
935 boolean performed = false;
936 for (int i = 0; i < EncryptedPrivateKeyInfoData.algName0.length; i++) {
938 AlgorithmParameters ap = AlgorithmParameters
939 .getInstance(EncryptedPrivateKeyInfoData.algName0[i][0]);
940 // use pregenerated AlgorithmParameters encodings
942 .init(EncryptedPrivateKeyInfoData
943 .getParametersEncoding(
944 EncryptedPrivateKeyInfoData.algName0[i][0]));
946 EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(ap,
947 EncryptedPrivateKeyInfoData.encryptedData);
949 // check that method under test returns
950 // the same parameters instance
951 assertSame(ap, epki.getAlgParameters());
954 } catch (NoSuchAlgorithmException allowedFailure) {
957 assertTrue("Test not performed", performed);
961 * Test #1 for <code>getEncryptedData()</code> method <br>
962 * Assertion: returns the encrypted data <br>
963 * Test preconditions: test object created using ctor which takes encoded
964 * form as the only parameter; encoded form passed contains encrypted data
966 * Expected: the equivalent encrypted data must be returned
968 * @throws IOException
971 level = TestLevel.PARTIAL_COMPLETE,
972 notes = "This is a complete subset of tests for getEncryptedData method.",
973 method = "getEncryptedData",
976 public final void testGetEncryptedData01() throws IOException {
977 boolean performed = false;
978 for (int i = 0; i < EncryptedPrivateKeyInfoData.algName0.length; i++) {
980 EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(
981 EncryptedPrivateKeyInfoData
982 .getValidEncryptedPrivateKeyInfoEncoding(
983 EncryptedPrivateKeyInfoData.algName0[i][0]));
985 // check that method under test returns
986 // valid encrypted data
987 assertTrue(Arrays.equals(
988 EncryptedPrivateKeyInfoData.encryptedData, epki
989 .getEncryptedData()));
992 } catch (NoSuchAlgorithmException allowedFailure) {
995 assertTrue("Test not performed", performed);
999 * Test #2 for <code>getEncryptedData()</code> method <br>
1000 * Assertion: returns the encrypted data <br>
1001 * Test preconditions: test object created using ctor which takes algorithm
1002 * name and encrypted data as a parameters <br>
1003 * Expected: the equivalent encrypted data must be returned
1006 level = TestLevel.PARTIAL_COMPLETE,
1007 notes = "This is a complete subset of tests for getEncryptedData method.",
1008 method = "getEncryptedData",
1011 public final void testGetEncryptedData02() {
1012 boolean performed = false;
1013 for (int i = 0; i < EncryptedPrivateKeyInfoData.algName0.length; i++) {
1015 EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(
1016 EncryptedPrivateKeyInfoData.algName0[i][0],
1017 EncryptedPrivateKeyInfoData.encryptedData);
1019 // check that method under test returns
1020 // valid encrypted data
1021 assertTrue(Arrays.equals(
1022 EncryptedPrivateKeyInfoData.encryptedData, epki
1023 .getEncryptedData()));
1026 } catch (NoSuchAlgorithmException allowedFailure) {
1029 assertTrue("Test not performed", performed);
1033 * Test #3 for <code>getEncryptedData()</code> method <br>
1034 * Assertion: returns the encrypted data <br>
1035 * Test preconditions: test object created using ctor which takes algorithm
1036 * parameters and encrypted data as a parameters <br>
1037 * Expected: the equivalent encrypted data must be returned
1039 * @throws IOException
1042 level = TestLevel.PARTIAL_COMPLETE,
1043 notes = "This is a complete subset of tests for getEncryptedData method.",
1044 method = "getEncryptedData",
1047 public final void testGetEncryptedData03() throws IOException {
1048 boolean performed = false;
1049 for (int i = 0; i < EncryptedPrivateKeyInfoData.algName0.length; i++) {
1051 AlgorithmParameters ap = AlgorithmParameters
1052 .getInstance(EncryptedPrivateKeyInfoData.algName0[i][0]);
1053 // use pregenerated AlgorithmParameters encodings
1054 ap.init(EncryptedPrivateKeyInfoData.getParametersEncoding(
1055 EncryptedPrivateKeyInfoData.algName0[i][0]));
1057 EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(ap,
1058 EncryptedPrivateKeyInfoData.encryptedData);
1060 // check that method under test returns
1061 // valid encrypted data
1062 assertTrue(Arrays.equals(
1063 EncryptedPrivateKeyInfoData.encryptedData, epki
1064 .getEncryptedData()));
1067 } catch (NoSuchAlgorithmException allowedFailure) {
1070 assertTrue("Test not performed", performed);
1074 * Test #4 for <code>getEncryptedData()</code> method <br>
1075 * Assertion: returns a new array each time this method is called <br>
1076 * Test preconditions: test object created using ctor which takes algorithm
1077 * name and encrypted data as a parameters <br>
1078 * Expected: refs to encrypted data byte array passed to the ctor and
1079 * returned by the method under test must be different
1082 level = TestLevel.PARTIAL_COMPLETE,
1083 notes = "This is a complete subset of tests for getEncryptedData method.",
1084 method = "getEncryptedData",
1087 public final void testGetEncryptedData04() {
1088 boolean performed = false;
1089 for (int i = 0; i < EncryptedPrivateKeyInfoData.algName0.length; i++) {
1091 EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(
1092 EncryptedPrivateKeyInfoData.algName0[i][0],
1093 EncryptedPrivateKeyInfoData.encryptedData);
1095 // check that method under test returns
1096 // new array each time
1097 byte[] ecd1 = epki.getEncryptedData();
1098 byte[] ecd2 = epki.getEncryptedData();
1099 assertNotSame(EncryptedPrivateKeyInfoData.encryptedData, ecd1);
1100 assertNotSame(EncryptedPrivateKeyInfoData.encryptedData, ecd2);
1101 assertNotSame(ecd1, ecd2);
1104 } catch (NoSuchAlgorithmException allowedFailure) {
1107 assertTrue("Test not performed", performed);
1111 * Test #1 for <code>getEncoded()</code> method <br>
1112 * Assertion: returns the ASN.1 encoding of this object <br>
1113 * Test preconditions: test object created using ctor which takes encoded
1114 * form as the only parameter <br>
1115 * Expected: equivalent encoded form must be returned
1117 * @throws IOException
1120 level = TestLevel.PARTIAL_COMPLETE,
1121 notes = "Can not check IOException",
1122 method = "getEncoded",
1125 public final void testGetEncoded01() throws IOException {
1126 boolean performed = false;
1127 for (int i = 0; i < EncryptedPrivateKeyInfoData.algName0.length; i++) {
1129 byte[] enc = EncryptedPrivateKeyInfoData
1130 .getValidEncryptedPrivateKeyInfoEncoding(
1131 EncryptedPrivateKeyInfoData.algName0[i][0]);
1132 EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(enc);
1134 // check that method under test returns
1135 // valid encoded form
1136 assertTrue(Arrays.equals(enc, epki.getEncoded()));
1139 } catch (NoSuchAlgorithmException allowedFailure) {
1142 assertTrue("Test not performed", performed);
1146 * Test #2 for <code>getEncoded()</code> method <br>
1147 * Assertion: returns the ASN.1 encoding of this object <br>
1148 * Test preconditions: test object created using ctor which takes algorithm
1149 * name and encrypted data as a parameters <br>
1150 * Expected: equivalent encoded form (without alg params) must be returned
1152 * @throws IOException
1155 level = TestLevel.PARTIAL_COMPLETE,
1156 notes = "Can not check IOException",
1157 method = "getEncoded",
1160 public final void testGetEncoded02() throws IOException {
1161 boolean performed = false;
1162 for (int i = 0; i < EncryptedPrivateKeyInfoData.algName0.length; i++) {
1164 EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(
1165 EncryptedPrivateKeyInfoData.algName0[i][0],
1166 EncryptedPrivateKeyInfoData.encryptedData);
1168 // check that method under test returns
1169 // valid encoded form
1170 byte[] refEnc = EncryptedPrivateKeyInfoData
1171 .getValidEncryptedPrivateKeyInfoEncoding(
1172 EncryptedPrivateKeyInfoData.algName0[i][0],
1174 // System.out.println(Array.toString(refEnc, " "));
1175 byte[] actEnc = epki.getEncoded();
1176 // System.out.println(Array.toString(actEnc, " "));
1177 assertTrue(Arrays.equals(refEnc, actEnc));
1180 } catch (NoSuchAlgorithmException allowedFailure) {
1183 assertTrue("Test not performed", performed);
1187 * Test #3 for <code>getEncoded()</code> method <br>
1188 * Assertion: returns the ASN.1 encoding of this object <br>
1189 * Test preconditions: test object created using ctor which takes algorithm
1190 * name and encrypted data as a parameters <br>
1191 * Expected: equivalent encoded form (without alg params) must be returned
1193 * @throws IOException
1196 level = TestLevel.PARTIAL_COMPLETE,
1197 notes = "Can not check IOException",
1198 method = "getEncoded",
1201 public final void testGetEncoded03() throws IOException {
1202 boolean performed = false;
1203 for (int i = 0; i < EncryptedPrivateKeyInfoData.algName0.length; i++) {
1205 AlgorithmParameters ap = AlgorithmParameters
1206 .getInstance(EncryptedPrivateKeyInfoData.algName0[i][0]);
1207 // use pregenerated AlgorithmParameters encodings
1208 ap.init(EncryptedPrivateKeyInfoData.getParametersEncoding(
1209 EncryptedPrivateKeyInfoData.algName0[i][0]));
1211 EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(ap,
1212 EncryptedPrivateKeyInfoData.encryptedData);
1214 // check that method under test returns
1215 // valid encoded form
1216 assertTrue(Arrays.equals(
1217 EncryptedPrivateKeyInfoData
1218 .getValidEncryptedPrivateKeyInfoEncoding(
1219 EncryptedPrivateKeyInfoData.algName0[i][0]),
1220 epki.getEncoded()));
1223 } catch (NoSuchAlgorithmException allowedFailure) {
1226 assertTrue("Test not performed", performed);
1230 * Test #4 for <code>getEncoded()</code> method <br>
1231 * Assertion: returns a new array each time this method is called <br>
1232 * Test preconditions: test object created using ctor which takes algorithm
1233 * name and encrypted data as a parameters <br>
1234 * Expected: several refs to byte array returned by the method under test
1237 * @throws IOException
1240 level = TestLevel.PARTIAL_COMPLETE,
1241 notes = "Can not check IOException",
1242 method = "getEncoded",
1245 public final void testGetEncoded04() throws IOException {
1246 boolean performed = false;
1247 for (int i = 0; i < EncryptedPrivateKeyInfoData.algName0.length; i++) {
1249 EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(
1250 EncryptedPrivateKeyInfoData.algName0[i][0],
1251 EncryptedPrivateKeyInfoData.encryptedData);
1253 // check that method under test returns
1254 // new array each time
1255 byte[] ec1 = epki.getEncoded();
1256 byte[] ec2 = epki.getEncoded();
1257 byte[] ec3 = epki.getEncoded();
1258 assertNotSame(ec1, ec2);
1259 assertNotSame(ec2, ec3);
1260 assertNotSame(ec1, ec3);
1263 } catch (NoSuchAlgorithmException allowedFailure) {
1266 assertTrue("Test not performed", performed);
1270 level = TestLevel.PARTIAL_COMPLETE,
1271 notes = "This is a complete subset of tests for getKeySpec method.",
1272 method = "getKeySpec",
1273 args = {javax.crypto.Cipher.class}
1275 public final void testGetKeySpecCipher01() {
1276 boolean performed = false;
1277 for (int i = 0; i < EncryptedPrivateKeyInfoData.algName0.length; i++) {
1279 EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(
1280 EncryptedPrivateKeyInfoData.algName0[i][0],
1281 EncryptedPrivateKeyInfoData.encryptedData);
1285 // check that method under test throws NPE
1286 epki.getKeySpec((Cipher) null);
1287 fail(getName() + "NullPointerException has not been thrown");
1289 } catch (NullPointerException ok) {
1290 } catch (InvalidKeySpecException e) {
1291 fail(getName() + "Unexpected exception: " + e);
1295 } catch (NoSuchAlgorithmException allowedFailure) {
1298 assertTrue("Test not performed", performed);
1302 * Encrypted data contains valid PKCS8 key info encoding
1305 level = TestLevel.PARTIAL_COMPLETE,
1306 notes = "This is a complete subset of tests for getKeySpec method.",
1307 method = "getKeySpec",
1308 args = {javax.crypto.Cipher.class}
1310 public final void test_ROUNDTRIP_GetKeySpecCipher01() {
1311 boolean performed = false;
1313 for (int i = 0; i < algName.length; i++) {
1315 // generate test data
1316 TestDataGenerator g = new TestDataGenerator(algName[i][0],
1317 algName[i][1], privateKeyInfo, null);
1319 // create test object
1320 EncryptedPrivateKeyInfo epki;
1321 if (g.ap() == null) {
1322 epki = new EncryptedPrivateKeyInfo(algName[i][0], g.ct());
1324 epki = new EncryptedPrivateKeyInfo(g.ap(), g.ct());
1327 // call methods under test
1330 PKCS8EncodedKeySpec eks = epki.getKeySpec(g.c());
1332 if (!Arrays.equals(privateKeyInfo, eks.getEncoded())) {
1333 fail(algName[i][0] + " != " + algName[i][1]);
1335 } catch (InvalidKeySpecException e) {
1336 fail(algName[i][0] + ", " + algName[i][1] + e + "\n");
1340 } catch (TestDataGenerator.AllowedFailure allowedFailure) {
1341 } catch (NoSuchAlgorithmException allowed) {
1344 assertTrue("Test not performed", performed);
1348 * Encrypted data contains invalid PKCS8 key info encoding
1351 level = TestLevel.PARTIAL_COMPLETE,
1352 notes = "This is a complete subset of tests for getKeySpec method.",
1353 method = "getKeySpec",
1354 args = {javax.crypto.Cipher.class}
1356 public final void test_ROUNDTRIP_GetKeySpecCipher02() {
1357 boolean performed = false;
1358 for (int i = 0; i < algName.length; i++) {
1360 // generate test data
1361 TestDataGenerator g = new TestDataGenerator(algName[i][0],
1362 algName[i][1], privateKeyInfoDamaged, null);
1364 // create test object
1365 EncryptedPrivateKeyInfo epki;
1366 if (g.ap() == null) {
1367 epki = new EncryptedPrivateKeyInfo(algName[i][0], g.ct());
1369 epki = new EncryptedPrivateKeyInfo(g.ap(), g.ct());
1372 // call methods under test
1374 epki.getKeySpec(g.c());
1376 // must not get here because decrypted data does
1377 // not represent valid PKCS8 encoding
1378 fail(algName[i][0] + ", " + algName[i][1]);
1379 } catch (InvalidKeySpecException ok) {
1383 } catch (TestDataGenerator.AllowedFailure allowedFailure) {
1384 } catch (NoSuchAlgorithmException allowedFailure) {
1387 assertTrue("Test not performed", performed);
1391 level = TestLevel.PARTIAL_COMPLETE,
1392 notes = "Can not check NoSuchAlgorithmException",
1393 method = "getKeySpec",
1394 args = {java.security.Key.class}
1396 public final void testGetKeySpecKey01() {
1397 boolean performed = false;
1398 for (int i = 0; i < EncryptedPrivateKeyInfoData.algName0.length; i++) {
1400 EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(
1401 EncryptedPrivateKeyInfoData.algName0[i][0],
1402 EncryptedPrivateKeyInfoData.encryptedData);
1406 // check that method under test throws NPE
1407 epki.getKeySpec((Key) null);
1408 fail(getName() + "NullPointerException has not been thrown");
1410 } catch (NullPointerException ok) {
1411 } catch (InvalidKeyException e) {
1412 fail(getName() + "Unexpected exception: " + e);
1416 } catch (NoSuchAlgorithmException allowedFailure) {
1419 assertTrue("Test not performed", performed);
1423 * Encrypted data contains valid PKCS8 key info encoding
1426 level = TestLevel.PARTIAL_COMPLETE,
1427 notes = "Can not check NoSuchAlgorithmException",
1428 method = "getKeySpec",
1429 args = {java.security.Key.class}
1431 public final void test_ROUNDTRIP_GetKeySpecKey01() {
1432 boolean performed = false;
1433 for (int i = 0; i < algName.length; i++) {
1435 // generate test data
1436 TestDataGenerator g = new TestDataGenerator(algName[i][0],
1437 algName[i][1], privateKeyInfo, null);
1439 // create test object
1440 EncryptedPrivateKeyInfo epki;
1441 if (g.ap() == null) {
1442 epki = new EncryptedPrivateKeyInfo(algName[i][0], g.ct());
1444 epki = new EncryptedPrivateKeyInfo(g.ap(), g.ct());
1448 PKCS8EncodedKeySpec eks = epki
1449 .getKeySpec(g.pubK() == null ? g.k() : g.pubK());
1451 if (!Arrays.equals(privateKeyInfo, eks.getEncoded())) {
1452 fail(algName[i][0] + " != " + algName[i][1]);
1454 } catch (InvalidKeyException e) {
1455 fail(algName[i][0] + ", " + algName[i][1] + ": " + e);
1459 } catch (TestDataGenerator.AllowedFailure allowedFailure) {
1460 } catch (NoSuchAlgorithmException allowedFailure) {
1463 assertTrue("Test not performed", performed);
1467 * Encrypted data contains invalid PKCS8 key info encoding
1470 level = TestLevel.PARTIAL_COMPLETE,
1471 notes = "Can not check NoSuchAlgorithmException",
1472 method = "getKeySpec",
1473 args = {java.security.Key.class}
1475 public final void test_ROUNDTRIP_GetKeySpecKey02() {
1476 boolean performed = false;
1477 for (int i = 0; i < algName.length; i++) {
1479 // generate test data
1480 TestDataGenerator g = new TestDataGenerator(algName[i][0],
1481 algName[i][1], privateKeyInfoDamaged, null);
1483 // create test object
1484 EncryptedPrivateKeyInfo epki;
1485 if (g.ap() == null) {
1486 epki = new EncryptedPrivateKeyInfo(algName[i][0], g.ct());
1488 epki = new EncryptedPrivateKeyInfo(g.ap(), g.ct());
1492 epki.getKeySpec(g.pubK() == null ? g.k() : g.pubK());
1493 fail(algName[i][0] + ", " + algName[i][1]);
1494 } catch (InvalidKeyException e) {
1498 } catch (TestDataGenerator.AllowedFailure allowedFailure) {
1499 } catch (NoSuchAlgorithmException allowedFailure) {
1502 assertTrue("Test not performed", performed);
1506 level = TestLevel.PARTIAL_COMPLETE,
1507 notes = "NoSuchAlgorithmException can not be checking",
1508 method = "getKeySpec",
1509 args = {java.security.Key.class, java.lang.String.class}
1511 public final void testGetKeySpecKeyString01() throws Exception {
1512 boolean performed = false;
1513 for (int i = 0; i < EncryptedPrivateKeyInfoData.algName0.length; i++) {
1515 EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(
1516 EncryptedPrivateKeyInfoData.algName0[i][0],
1517 EncryptedPrivateKeyInfoData.encryptedData);
1520 // check that method under test throws NPE
1521 epki.getKeySpec((Key) null, "SomeProviderName");
1522 fail(getName() + "NullPointerException has not been thrown");
1524 } catch (NullPointerException ok) {
1528 epki.getKeySpec(new Key() {
1529 public String getAlgorithm() {
1533 public String getFormat() {
1537 public byte[] getEncoded() {
1538 return new byte[] {};
1540 }, "StrangeProviderName");
1541 fail(getName() + "NoSuchProviderException has not been thrown");
1542 } catch (NoSuchProviderException ok) {
1548 // check that method under test throws NPE
1549 epki.getKeySpec(new Key() {
1550 public String getAlgorithm() {
1554 public String getFormat() {
1558 public byte[] getEncoded() {
1559 return new byte[] {};
1563 fail(getName() + "NullPointerException has not been thrown");
1565 } catch (NullPointerException ok) {
1569 } catch (NoSuchAlgorithmException allowedFailure) {
1572 assertTrue("Test not performed", performed);
1576 * Encrypted data contains valid PKCS8 key info encoding
1579 level = TestLevel.PARTIAL_COMPLETE,
1580 notes = "In subset missed NoSuchProviderException & NoSuchAlgorithmException checking",
1581 method = "getKeySpec",
1582 args = {java.security.Key.class, java.lang.String.class}
1584 public final void test_ROUNDTRIP_GetKeySpecKeyString01() throws Exception {
1585 boolean performed = false;
1586 for (int i = 0; i < algName.length; i++) {
1587 for (int l = 0; l < provider.length; l++) {
1588 if (provider[l] == null) {
1591 TestDataGenerator g;
1593 // generate test data
1594 g = new TestDataGenerator(algName[i][0], algName[i][1],
1595 privateKeyInfo, provider[l]);
1596 } catch (TestDataGenerator.AllowedFailure allowedFailure) {
1601 // create test object
1602 EncryptedPrivateKeyInfo epki;
1603 if (g.ap() == null) {
1604 epki = new EncryptedPrivateKeyInfo(algName[i][0], g
1607 epki = new EncryptedPrivateKeyInfo(g.ap(), g.ct());
1611 PKCS8EncodedKeySpec eks = epki.getKeySpec(
1612 g.pubK() == null ? g.k() : g.pubK(),
1613 provider[l].getName());
1615 if (!Arrays.equals(privateKeyInfo, eks.getEncoded())) {
1616 fail(algName[i][0] + " != " + algName[i][1]);
1618 } catch (InvalidKeyException e) {
1619 fail(algName[i][0] + ", " + algName[i][1] + ": " + e);
1623 } catch (NoSuchAlgorithmException allowedFailure) {
1627 assertTrue("Test not performed", performed);
1631 * Encrypted data contains invalid PKCS8 key info encoding
1634 level = TestLevel.PARTIAL_COMPLETE,
1635 notes = "In subset missed NoSuchProviderException & NoSuchAlgorithmException checking",
1636 method = "getKeySpec",
1637 args = {java.security.Key.class, java.lang.String.class}
1639 public final void test_ROUNDTRIP_GetKeySpecKeyString02() throws Exception {
1640 boolean performed = false;
1641 for (int i = 0; i < algName.length; i++) {
1642 for (int l = 0; l < provider.length; l++) {
1643 if (provider[l] == null) {
1646 TestDataGenerator g;
1648 // generate test data
1649 g = new TestDataGenerator(algName[i][0], algName[i][1],
1650 privateKeyInfoDamaged, provider[l]);
1651 } catch (TestDataGenerator.AllowedFailure allowedFailure) {
1656 // create test object
1657 EncryptedPrivateKeyInfo epki;
1658 if (g.ap() == null) {
1659 epki = new EncryptedPrivateKeyInfo(algName[i][0], g
1662 epki = new EncryptedPrivateKeyInfo(g.ap(), g.ct());
1667 epki.getKeySpec(g.pubK() == null ? g.k() : g.pubK(),
1668 provider[l].getName());
1670 fail(algName[i][0] + ", " + algName[i][1]);
1672 } catch (InvalidKeyException e) {
1676 } catch (NoSuchAlgorithmException allowedFailure) {
1680 assertTrue("Test not performed", performed);
1684 level = TestLevel.PARTIAL_COMPLETE,
1685 notes = "Can not check NoSuchAlgorithmException",
1686 method = "getKeySpec",
1687 args = {java.security.Key.class, java.security.Provider.class}
1689 public final void testGetKeySpecKeyProvider01() throws Exception {
1690 boolean performed = false;
1692 for (int i = 0; i < EncryptedPrivateKeyInfoData.algName0.length; i++) {
1694 EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(
1695 EncryptedPrivateKeyInfoData.algName0[i][0],
1696 EncryptedPrivateKeyInfoData.encryptedData);
1700 // check that method under test throws NPE
1701 epki.getKeySpec((Key) null, (Provider) null);
1702 fail(getName() + "NullPointerException has not been thrown");
1703 } catch (NullPointerException ok) {
1708 // check that method under test throws NPE
1709 epki.getKeySpec(new Key() {
1710 public String getAlgorithm() {
1714 public String getFormat() {
1718 public byte[] getEncoded() {
1719 return new byte[] {};
1721 }, (Provider) null);
1723 fail(getName() + "NullPointerException has not been thrown");
1724 } catch (NullPointerException ok) {
1728 } catch (NoSuchAlgorithmException allowedFailure) {
1731 assertTrue("Test not performed", performed);
1735 * Encrypted data contains valid PKCS8 key info encoding
1738 level = TestLevel.PARTIAL_COMPLETE,
1739 notes = "Can not check NoSuchAlgorithmException",
1740 method = "getKeySpec",
1741 args = {java.security.Key.class, java.security.Provider.class}
1743 public final void test_ROUNDTRIP_GetKeySpecKeyProvider01() {
1744 boolean performed = false;
1746 for (int i = 0; i < algName.length; i++) {
1747 for (int l = 0; l < provider.length; l++) {
1748 if (provider[l] == null) {
1751 TestDataGenerator g;
1753 // generate test data
1754 g = new TestDataGenerator(algName[i][0], algName[i][1],
1755 privateKeyInfo, provider[l]);
1756 } catch (TestDataGenerator.AllowedFailure allowedFailure) {
1760 // create test object
1761 EncryptedPrivateKeyInfo epki;
1762 if (g.ap() == null) {
1763 epki = new EncryptedPrivateKeyInfo(algName[i][0], g
1766 epki = new EncryptedPrivateKeyInfo(g.ap(), g.ct());
1770 PKCS8EncodedKeySpec eks = epki.getKeySpec(
1771 g.pubK() == null ? g.k() : g.pubK(),
1774 if (!Arrays.equals(privateKeyInfo, eks.getEncoded())) {
1775 fail(algName[i][0] + " != " + algName[i][1]);
1777 } catch (InvalidKeyException e) {
1778 fail(algName[i][0] + ", " + algName[i][1] + ": " + e);
1782 } catch (NoSuchAlgorithmException allowedFailure) {
1786 assertTrue("Test not performed", performed);
1790 * Encrypted data contains invalid PKCS8 key info encoding
1793 level = TestLevel.PARTIAL_COMPLETE,
1794 notes = "Can not check NoSuchAlgorithmException",
1795 method = "getKeySpec",
1796 args = {java.security.Key.class, java.security.Provider.class}
1798 public final void test_ROUNDTRIP_GetKeySpecKeyProvider02() {
1799 boolean performed = false;
1801 for (int i = 0; i < algName.length; i++) {
1802 for (int l = 0; l < provider.length; l++) {
1803 if (provider[l] == null) {
1806 TestDataGenerator g;
1808 // generate test data
1809 g = new TestDataGenerator(algName[i][0], algName[i][1],
1810 privateKeyInfoDamaged, provider[l]);
1811 } catch (TestDataGenerator.AllowedFailure allowedFailure) {
1816 // create test object
1817 EncryptedPrivateKeyInfo epki;
1818 if (g.ap() == null) {
1819 epki = new EncryptedPrivateKeyInfo(algName[i][0], g
1822 epki = new EncryptedPrivateKeyInfo(g.ap(), g.ct());
1826 epki.getKeySpec(g.pubK() == null ? g.k() : g.pubK(),
1829 fail(algName[i][0] + ", " + algName[i][1]);
1831 } catch (InvalidKeyException e) {
1834 } catch (NoSuchAlgorithmException allowedFailure) {
1838 assertTrue("Test not performed", performed);
1841 public static class TestDataGenerator {
1843 public static class AllowedFailure extends Exception {
1844 AllowedFailure(String msg) {
1849 private Cipher c = null;
1851 private Key k = null, pubK = null;
1853 private AlgorithmParameters ap = null;
1857 public TestDataGenerator(String algName, String transformation,
1858 byte[] privateKeyInfo, Provider provider) throws AllowedFailure {
1860 c = (provider == null) ? Cipher
1861 .getInstance(transformation != null ? transformation
1862 : algName) : Cipher.getInstance(
1863 transformation != null ? transformation : algName,
1865 } catch (NoSuchAlgorithmException e) {
1866 throw new AllowedFailure(e.getMessage());
1867 } catch (NoSuchPaddingException e) {
1868 throw new AllowedFailure(e.getMessage());
1872 KeyGenerator kg = (provider == null) ? KeyGenerator
1873 .getInstance(algName) : KeyGenerator.getInstance(
1875 k = kg.generateKey();
1876 } catch (NoSuchAlgorithmException e) {
1881 KeyPairGenerator kpg = (provider == null) ? KeyPairGenerator
1882 .getInstance(algName)
1883 : KeyPairGenerator.getInstance(algName, provider);
1884 KeyPair kp = kpg.genKeyPair();
1885 k = kp.getPrivate();
1886 pubK = kp.getPublic();
1887 } catch (NoSuchAlgorithmException e) {
1891 PBEParameterSpec pbeParamSpec = null;
1894 pbeParamSpec = new PBEParameterSpec(new byte[] { 1, 2, 3,
1895 4, 5, 6, 7, 8 }, 10);
1896 SecretKeyFactory skf = (provider == null) ? SecretKeyFactory
1897 .getInstance(algName)
1898 : SecretKeyFactory.getInstance(algName, provider);
1899 PBEKeySpec ks = new PBEKeySpec("12345678".toCharArray());
1901 k = skf.generateSecret(ks);
1902 } catch (InvalidKeySpecException e) {
1903 throw new AllowedFailure(e.getMessage());
1906 } catch (NoSuchAlgorithmException e) {
1907 throw new AllowedFailure(e.getMessage());
1912 if (pbeParamSpec == null) {
1913 c.init(Cipher.ENCRYPT_MODE, k);
1915 c.init(Cipher.ENCRYPT_MODE, k, pbeParamSpec);
1917 } catch (InvalidKeyException e) {
1918 throw new AllowedFailure(e.getMessage());
1919 } catch (SecurityException e) {
1920 throw new AllowedFailure(e.getMessage());
1921 } catch (InvalidAlgorithmParameterException e) {
1922 throw new AllowedFailure(e.getMessage());
1925 ap = c.getParameters();
1928 ct = c.doFinal(privateKeyInfo);
1929 } catch (IllegalStateException e) {
1930 throw new AllowedFailure(e.getMessage());
1931 } catch (IllegalBlockSizeException e) {
1932 throw new AllowedFailure(e.getMessage());
1933 } catch (BadPaddingException e) {
1934 throw new AllowedFailure(e.getMessage());
1935 } catch (RuntimeException e) {
1936 throw new AllowedFailure(e.getMessage());
1940 // try to convert pbeParamSpec->ap
1941 if (pbeParamSpec != null) {
1943 ap = (provider == null) ? AlgorithmParameters
1944 .getInstance(algName) : AlgorithmParameters
1945 .getInstance(algName, provider);
1946 ap.init(pbeParamSpec);
1947 pbeParamSpec = null;
1948 } catch (NoSuchAlgorithmException e) {
1950 throw new AllowedFailure(e.getMessage());
1951 } catch (InvalidParameterSpecException e) {
1953 throw new AllowedFailure(e.getMessage());
1958 c.init(Cipher.DECRYPT_MODE, pubK == null ? k : pubK);
1960 c.init(Cipher.DECRYPT_MODE, pubK == null ? k : pubK, ap);
1963 } catch (InvalidKeyException e) {
1964 throw new AllowedFailure(e.getMessage());
1965 } catch (SecurityException e) {
1966 throw new AllowedFailure(e.getMessage());
1967 } catch (InvalidAlgorithmParameterException e) {
1968 throw new AllowedFailure(e.getMessage());
1984 public byte[] ct() {
1988 public AlgorithmParameters ap() {
1993 // valid PrivateKeyInfo encoding
1994 private static final byte[] privateKeyInfo = { (byte) 0x30, (byte) 0x82,
1995 (byte) 0x02, (byte) 0x77, (byte) 0x02, (byte) 0x01, (byte) 0x00,
1996 (byte) 0x30, (byte) 0x0d, (byte) 0x06, (byte) 0x09, (byte) 0x2a,
1997 (byte) 0x86, (byte) 0x48, (byte) 0x86, (byte) 0xf7, (byte) 0x0d,
1998 (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x05, (byte) 0x00,
1999 (byte) 0x04, (byte) 0x82, (byte) 0x02, (byte) 0x61, (byte) 0x30,
2000 (byte) 0x82, (byte) 0x02, (byte) 0x5d, (byte) 0x02, (byte) 0x01,
2001 (byte) 0x00, (byte) 0x02, (byte) 0x81, (byte) 0x81, (byte) 0x00,
2002 (byte) 0xb2, (byte) 0x4a, (byte) 0x9b, (byte) 0x5b, (byte) 0xba,
2003 (byte) 0x01, (byte) 0xc0, (byte) 0xcd, (byte) 0x65, (byte) 0x09,
2004 (byte) 0x63, (byte) 0x70, (byte) 0x0b, (byte) 0x5a, (byte) 0x1b,
2005 (byte) 0x92, (byte) 0x08, (byte) 0xf8, (byte) 0x55, (byte) 0x5e,
2006 (byte) 0x7c, (byte) 0x1b, (byte) 0x50, (byte) 0x17, (byte) 0xec,
2007 (byte) 0x44, (byte) 0x4c, (byte) 0x58, (byte) 0x42, (byte) 0x2b,
2008 (byte) 0x41, (byte) 0x09, (byte) 0x59, (byte) 0xf2, (byte) 0xe1,
2009 (byte) 0x5d, (byte) 0x43, (byte) 0x71, (byte) 0x4d, (byte) 0x92,
2010 (byte) 0x03, (byte) 0x1d, (byte) 0xb6, (byte) 0x6c, (byte) 0x7f,
2011 (byte) 0x5d, (byte) 0x48, (byte) 0xcd, (byte) 0x17, (byte) 0xec,
2012 (byte) 0xd7, (byte) 0x4c, (byte) 0x39, (byte) 0xb1, (byte) 0x7b,
2013 (byte) 0xe2, (byte) 0xbf, (byte) 0x96, (byte) 0x77, (byte) 0xbe,
2014 (byte) 0xd0, (byte) 0xa0, (byte) 0xf0, (byte) 0x2d, (byte) 0x6b,
2015 (byte) 0x24, (byte) 0xaa, (byte) 0x14, (byte) 0xba, (byte) 0x82,
2016 (byte) 0x79, (byte) 0x10, (byte) 0x9b, (byte) 0x16, (byte) 0x68,
2017 (byte) 0x47, (byte) 0x81, (byte) 0x54, (byte) 0xa2, (byte) 0xfa,
2018 (byte) 0x91, (byte) 0x9e, (byte) 0x0a, (byte) 0x2a, (byte) 0x53,
2019 (byte) 0xa6, (byte) 0xe7, (byte) 0x9e, (byte) 0x7d, (byte) 0x29,
2020 (byte) 0x33, (byte) 0xd8, (byte) 0x05, (byte) 0xfc, (byte) 0x02,
2021 (byte) 0x3f, (byte) 0xbd, (byte) 0xc7, (byte) 0x6e, (byte) 0xed,
2022 (byte) 0xaa, (byte) 0x30, (byte) 0x6c, (byte) 0x5f, (byte) 0x52,
2023 (byte) 0xed, (byte) 0x35, (byte) 0x65, (byte) 0x4b, (byte) 0x0e,
2024 (byte) 0xc8, (byte) 0xa7, (byte) 0x12, (byte) 0x10, (byte) 0x56,
2025 (byte) 0x37, (byte) 0xaf, (byte) 0x11, (byte) 0xfa, (byte) 0x21,
2026 (byte) 0x0e, (byte) 0x99, (byte) 0xff, (byte) 0xfa, (byte) 0x8c,
2027 (byte) 0x65, (byte) 0x8e, (byte) 0x6d, (byte) 0x02, (byte) 0x03,
2028 (byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x02, (byte) 0x81,
2029 (byte) 0x80, (byte) 0x78, (byte) 0x41, (byte) 0x72, (byte) 0x40,
2030 (byte) 0x90, (byte) 0x59, (byte) 0x96, (byte) 0x5d, (byte) 0xf3,
2031 (byte) 0x84, (byte) 0x3d, (byte) 0x99, (byte) 0xd9, (byte) 0x4e,
2032 (byte) 0x51, (byte) 0xc2, (byte) 0x52, (byte) 0x62, (byte) 0x8d,
2033 (byte) 0xd2, (byte) 0x49, (byte) 0x0b, (byte) 0x73, (byte) 0x1e,
2034 (byte) 0x6f, (byte) 0xb2, (byte) 0x31, (byte) 0x7c, (byte) 0x66,
2035 (byte) 0x45, (byte) 0x1e, (byte) 0x7c, (byte) 0xdc, (byte) 0x3a,
2036 (byte) 0xc2, (byte) 0x5f, (byte) 0x51, (byte) 0x9a, (byte) 0x1e,
2037 (byte) 0xa4, (byte) 0x19, (byte) 0x8d, (byte) 0xf4, (byte) 0xf9,
2038 (byte) 0x81, (byte) 0x7e, (byte) 0xbe, (byte) 0x17, (byte) 0xf7,
2039 (byte) 0xc7, (byte) 0x3c, (byte) 0x00, (byte) 0xa1, (byte) 0xf9,
2040 (byte) 0x60, (byte) 0x82, (byte) 0x34, (byte) 0x8f, (byte) 0x9c,
2041 (byte) 0xfd, (byte) 0x0b, (byte) 0x63, (byte) 0x42, (byte) 0x1b,
2042 (byte) 0x7f, (byte) 0x45, (byte) 0xf1, (byte) 0x31, (byte) 0xc3,
2043 (byte) 0x63, (byte) 0x47, (byte) 0x5c, (byte) 0xc1, (byte) 0xb2,
2044 (byte) 0x5f, (byte) 0x57, (byte) 0xee, (byte) 0x02, (byte) 0x9f,
2045 (byte) 0x5e, (byte) 0x08, (byte) 0x48, (byte) 0xba, (byte) 0x74,
2046 (byte) 0xba, (byte) 0x81, (byte) 0xb7, (byte) 0x30, (byte) 0xac,
2047 (byte) 0x4c, (byte) 0x01, (byte) 0x35, (byte) 0xce, (byte) 0x46,
2048 (byte) 0x47, (byte) 0x8c, (byte) 0xe4, (byte) 0x62, (byte) 0x36,
2049 (byte) 0x1a, (byte) 0x65, (byte) 0x0e, (byte) 0x33, (byte) 0x56,
2050 (byte) 0xf9, (byte) 0xb7, (byte) 0xa0, (byte) 0xc4, (byte) 0xb6,
2051 (byte) 0x82, (byte) 0x55, (byte) 0x7d, (byte) 0x36, (byte) 0x55,
2052 (byte) 0xc0, (byte) 0x52, (byte) 0x5e, (byte) 0x35, (byte) 0x54,
2053 (byte) 0xbd, (byte) 0x97, (byte) 0x01, (byte) 0x00, (byte) 0xbf,
2054 (byte) 0x10, (byte) 0xdc, (byte) 0x1b, (byte) 0x51, (byte) 0x02,
2055 (byte) 0x41, (byte) 0x00, (byte) 0xe7, (byte) 0x68, (byte) 0x03,
2056 (byte) 0x3e, (byte) 0x21, (byte) 0x64, (byte) 0x68, (byte) 0x24,
2057 (byte) 0x7b, (byte) 0xd0, (byte) 0x31, (byte) 0xa0, (byte) 0xa2,
2058 (byte) 0xd9, (byte) 0x87, (byte) 0x6d, (byte) 0x79, (byte) 0x81,
2059 (byte) 0x8f, (byte) 0x8f, (byte) 0x2d, (byte) 0x7a, (byte) 0x95,
2060 (byte) 0x2e, (byte) 0x55, (byte) 0x9f, (byte) 0xd7, (byte) 0x86,
2061 (byte) 0x29, (byte) 0x93, (byte) 0xbd, (byte) 0x04, (byte) 0x7e,
2062 (byte) 0x4f, (byte) 0xdb, (byte) 0x56, (byte) 0xf1, (byte) 0x75,
2063 (byte) 0xd0, (byte) 0x4b, (byte) 0x00, (byte) 0x3a, (byte) 0xe0,
2064 (byte) 0x26, (byte) 0xf6, (byte) 0xab, (byte) 0x9e, (byte) 0x0b,
2065 (byte) 0x2a, (byte) 0xf4, (byte) 0xa8, (byte) 0xd7, (byte) 0xff,
2066 (byte) 0xbe, (byte) 0x01, (byte) 0xeb, (byte) 0x9b, (byte) 0x81,
2067 (byte) 0xc7, (byte) 0x5f, (byte) 0x02, (byte) 0x73, (byte) 0xe1,
2068 (byte) 0x2b, (byte) 0x02, (byte) 0x41, (byte) 0x00, (byte) 0xc5,
2069 (byte) 0x3d, (byte) 0x78, (byte) 0xab, (byte) 0xe6, (byte) 0xab,
2070 (byte) 0x3e, (byte) 0x29, (byte) 0xfd, (byte) 0x98, (byte) 0xd0,
2071 (byte) 0xa4, (byte) 0x3e, (byte) 0x58, (byte) 0xee, (byte) 0x48,
2072 (byte) 0x45, (byte) 0xa3, (byte) 0x66, (byte) 0xac, (byte) 0xe9,
2073 (byte) 0x4d, (byte) 0xbd, (byte) 0x60, (byte) 0xea, (byte) 0x24,
2074 (byte) 0xff, (byte) 0xed, (byte) 0x0c, (byte) 0x67, (byte) 0xc5,
2075 (byte) 0xfd, (byte) 0x36, (byte) 0x28, (byte) 0xea, (byte) 0x74,
2076 (byte) 0x88, (byte) 0xd1, (byte) 0xd1, (byte) 0xad, (byte) 0x58,
2077 (byte) 0xd7, (byte) 0xf0, (byte) 0x67, (byte) 0x20, (byte) 0xc1,
2078 (byte) 0xe3, (byte) 0xb3, (byte) 0xdb, (byte) 0x52, (byte) 0xad,
2079 (byte) 0xf3, (byte) 0xc4, (byte) 0x21, (byte) 0xd8, (byte) 0x8c,
2080 (byte) 0x4c, (byte) 0x41, (byte) 0x27, (byte) 0xdb, (byte) 0xd0,
2081 (byte) 0x35, (byte) 0x92, (byte) 0xc7, (byte) 0x02, (byte) 0x41,
2082 (byte) 0x00, (byte) 0xe0, (byte) 0x99, (byte) 0x42, (byte) 0xb4,
2083 (byte) 0x76, (byte) 0x02, (byte) 0x97, (byte) 0x55, (byte) 0xf9,
2084 (byte) 0xda, (byte) 0x3b, (byte) 0xa0, (byte) 0xd7, (byte) 0x0e,
2085 (byte) 0xdc, (byte) 0xf4, (byte) 0x33, (byte) 0x7f, (byte) 0xbd,
2086 (byte) 0xcf, (byte) 0xd0, (byte) 0xeb, (byte) 0x6e, (byte) 0x89,
2087 (byte) 0xf7, (byte) 0x4f, (byte) 0x5a, (byte) 0x07, (byte) 0x7c,
2088 (byte) 0xa9, (byte) 0x49, (byte) 0x47, (byte) 0x68, (byte) 0x35,
2089 (byte) 0xa8, (byte) 0x05, (byte) 0x3d, (byte) 0xfd, (byte) 0x04,
2090 (byte) 0x7b, (byte) 0x17, (byte) 0x31, (byte) 0x0d, (byte) 0xc8,
2091 (byte) 0xa3, (byte) 0x98, (byte) 0x34, (byte) 0xa0, (byte) 0x50,
2092 (byte) 0x44, (byte) 0x00, (byte) 0xf1, (byte) 0x0c, (byte) 0xe6,
2093 (byte) 0xe5, (byte) 0xc4, (byte) 0x41, (byte) 0x3d, (byte) 0xf8,
2094 (byte) 0x3d, (byte) 0x4e, (byte) 0x0b, (byte) 0x1c, (byte) 0xdb,
2095 (byte) 0x02, (byte) 0x41, (byte) 0x00, (byte) 0x82, (byte) 0x9b,
2096 (byte) 0x8a, (byte) 0xfd, (byte) 0xa1, (byte) 0x98, (byte) 0x41,
2097 (byte) 0x68, (byte) 0xc2, (byte) 0xd1, (byte) 0xdf, (byte) 0x4e,
2098 (byte) 0xf3, (byte) 0x2e, (byte) 0x26, (byte) 0x53, (byte) 0x5b,
2099 (byte) 0x31, (byte) 0xb1, (byte) 0x7a, (byte) 0xcc, (byte) 0x5e,
2100 (byte) 0xbb, (byte) 0x09, (byte) 0xa2, (byte) 0xe2, (byte) 0x6f,
2101 (byte) 0x4a, (byte) 0x04, (byte) 0x0d, (byte) 0xef, (byte) 0x90,
2102 (byte) 0x15, (byte) 0xbe, (byte) 0x10, (byte) 0x4a, (byte) 0xac,
2103 (byte) 0x92, (byte) 0xeb, (byte) 0xda, (byte) 0x72, (byte) 0xdb,
2104 (byte) 0x43, (byte) 0x08, (byte) 0xb7, (byte) 0x2b, (byte) 0x4c,
2105 (byte) 0xe1, (byte) 0xbb, (byte) 0x58, (byte) 0xcb, (byte) 0x71,
2106 (byte) 0x80, (byte) 0xad, (byte) 0xbc, (byte) 0xdc, (byte) 0x62,
2107 (byte) 0x5e, (byte) 0x3e, (byte) 0xcb, (byte) 0x92, (byte) 0xda,
2108 (byte) 0xf6, (byte) 0xdf, (byte) 0x02, (byte) 0x40, (byte) 0x4d,
2109 (byte) 0x81, (byte) 0x90, (byte) 0xc5, (byte) 0x77, (byte) 0x30,
2110 (byte) 0xb7, (byte) 0x29, (byte) 0x00, (byte) 0xa8, (byte) 0xf1,
2111 (byte) 0xb4, (byte) 0xae, (byte) 0x52, (byte) 0x63, (byte) 0x00,
2112 (byte) 0xb2, (byte) 0x2d, (byte) 0x3e, (byte) 0x7d, (byte) 0xd6,
2113 (byte) 0x4d, (byte) 0xf9, (byte) 0x8a, (byte) 0xc1, (byte) 0xb1,
2114 (byte) 0x98, (byte) 0x89, (byte) 0x52, (byte) 0x40, (byte) 0x14,
2115 (byte) 0x1b, (byte) 0x0e, (byte) 0x61, (byte) 0x8f, (byte) 0xf4,
2116 (byte) 0xbe, (byte) 0x59, (byte) 0x79, (byte) 0x79, (byte) 0x95,
2117 (byte) 0x19, (byte) 0x5c, (byte) 0x51, (byte) 0x08, (byte) 0x66,
2118 (byte) 0xc1, (byte) 0x42, (byte) 0x30, (byte) 0xb3, (byte) 0x7a,
2119 (byte) 0x86, (byte) 0x9f, (byte) 0x3e, (byte) 0xf5, (byte) 0x19,
2120 (byte) 0xa3, (byte) 0xae, (byte) 0x64, (byte) 0x69, (byte) 0x14,
2121 (byte) 0x07, (byte) 0x50, (byte) 0x97, };
2123 // valid PrivateKeyInfo encoding (Damaged)
2124 private static final byte[] privateKeyInfoDamaged = { (byte) 0x30,
2125 (byte) 0x82, (byte) 0x02, (byte) 0x77, (byte) 0x02, (byte) 0x01,
2126 (byte) 0x00, (byte) 0x30, (byte) 0x0d, (byte) 0x06, (byte) 0x09,
2127 (byte) 0x2a, (byte) 0x86, (byte) 0x48, (byte) 0x86, (byte) 0xf7,
2128 (byte) 0x0d, (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x05,
2129 (byte) 0x00, (byte) 0x04, // private key octet str
2130 (byte) 0x82, (byte) 0x02, (byte) 0x62, // Damage: l=460->461
2132 (byte) 0x30, (byte) 0x82, (byte) 0x02, (byte) 0x5d, (byte) 0x02,
2133 (byte) 0x01, (byte) 0x00, (byte) 0x02, (byte) 0x81, (byte) 0x81,
2134 (byte) 0x00, (byte) 0xb2, (byte) 0x4a, (byte) 0x9b, (byte) 0x5b,
2135 (byte) 0xba, (byte) 0x01, (byte) 0xc0, (byte) 0xcd, (byte) 0x65,
2136 (byte) 0x09, (byte) 0x63, (byte) 0x70, (byte) 0x0b, (byte) 0x5a,
2137 (byte) 0x1b, (byte) 0x92, (byte) 0x08, (byte) 0xf8, (byte) 0x55,
2138 (byte) 0x5e, (byte) 0x7c, (byte) 0x1b, (byte) 0x50, (byte) 0x17,
2139 (byte) 0xec, (byte) 0x44, (byte) 0x4c, (byte) 0x58, (byte) 0x42,
2140 (byte) 0x2b, (byte) 0x41, (byte) 0x09, (byte) 0x59, (byte) 0xf2,
2141 (byte) 0xe1, (byte) 0x5d, (byte) 0x43, (byte) 0x71, (byte) 0x4d,
2142 (byte) 0x92, (byte) 0x03, (byte) 0x1d, (byte) 0xb6, (byte) 0x6c,
2143 (byte) 0x7f, (byte) 0x5d, (byte) 0x48, (byte) 0xcd, (byte) 0x17,
2144 (byte) 0xec, (byte) 0xd7, (byte) 0x4c, (byte) 0x39, (byte) 0xb1,
2145 (byte) 0x7b, (byte) 0xe2, (byte) 0xbf, (byte) 0x96, (byte) 0x77,
2146 (byte) 0xbe, (byte) 0xd0, (byte) 0xa0, (byte) 0xf0, (byte) 0x2d,
2147 (byte) 0x6b, (byte) 0x24, (byte) 0xaa, (byte) 0x14, (byte) 0xba,
2148 (byte) 0x82, (byte) 0x79, (byte) 0x10, (byte) 0x9b, (byte) 0x16,
2149 (byte) 0x68, (byte) 0x47, (byte) 0x81, (byte) 0x54, (byte) 0xa2,
2150 (byte) 0xfa, (byte) 0x91, (byte) 0x9e, (byte) 0x0a, (byte) 0x2a,
2151 (byte) 0x53, (byte) 0xa6, (byte) 0xe7, (byte) 0x9e, (byte) 0x7d,
2152 (byte) 0x29, (byte) 0x33, (byte) 0xd8, (byte) 0x05, (byte) 0xfc,
2153 (byte) 0x02, (byte) 0x3f, (byte) 0xbd, (byte) 0xc7, (byte) 0x6e,
2154 (byte) 0xed, (byte) 0xaa, (byte) 0x30, (byte) 0x6c, (byte) 0x5f,
2155 (byte) 0x52, (byte) 0xed, (byte) 0x35, (byte) 0x65, (byte) 0x4b,
2156 (byte) 0x0e, (byte) 0xc8, (byte) 0xa7, (byte) 0x12, (byte) 0x10,
2157 (byte) 0x56, (byte) 0x37, (byte) 0xaf, (byte) 0x11, (byte) 0xfa,
2158 (byte) 0x21, (byte) 0x0e, (byte) 0x99, (byte) 0xff, (byte) 0xfa,
2159 (byte) 0x8c, (byte) 0x65, (byte) 0x8e, (byte) 0x6d, (byte) 0x02,
2160 (byte) 0x03, (byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x02,
2161 (byte) 0x81, (byte) 0x80, (byte) 0x78, (byte) 0x41, (byte) 0x72,
2162 (byte) 0x40, (byte) 0x90, (byte) 0x59, (byte) 0x96, (byte) 0x5d,
2163 (byte) 0xf3, (byte) 0x84, (byte) 0x3d, (byte) 0x99, (byte) 0xd9,
2164 (byte) 0x4e, (byte) 0x51, (byte) 0xc2, (byte) 0x52, (byte) 0x62,
2165 (byte) 0x8d, (byte) 0xd2, (byte) 0x49, (byte) 0x0b, (byte) 0x73,
2166 (byte) 0x1e, (byte) 0x6f, (byte) 0xb2, (byte) 0x31, (byte) 0x7c,
2167 (byte) 0x66, (byte) 0x45, (byte) 0x1e, (byte) 0x7c, (byte) 0xdc,
2168 (byte) 0x3a, (byte) 0xc2, (byte) 0x5f, (byte) 0x51, (byte) 0x9a,
2169 (byte) 0x1e, (byte) 0xa4, (byte) 0x19, (byte) 0x8d, (byte) 0xf4,
2170 (byte) 0xf9, (byte) 0x81, (byte) 0x7e, (byte) 0xbe, (byte) 0x17,
2171 (byte) 0xf7, (byte) 0xc7, (byte) 0x3c, (byte) 0x00, (byte) 0xa1,
2172 (byte) 0xf9, (byte) 0x60, (byte) 0x82, (byte) 0x34, (byte) 0x8f,
2173 (byte) 0x9c, (byte) 0xfd, (byte) 0x0b, (byte) 0x63, (byte) 0x42,
2174 (byte) 0x1b, (byte) 0x7f, (byte) 0x45, (byte) 0xf1, (byte) 0x31,
2175 (byte) 0xc3, (byte) 0x63, (byte) 0x47, (byte) 0x5c, (byte) 0xc1,
2176 (byte) 0xb2, (byte) 0x5f, (byte) 0x57, (byte) 0xee, (byte) 0x02,
2177 (byte) 0x9f, (byte) 0x5e, (byte) 0x08, (byte) 0x48, (byte) 0xba,
2178 (byte) 0x74, (byte) 0xba, (byte) 0x81, (byte) 0xb7, (byte) 0x30,
2179 (byte) 0xac, (byte) 0x4c, (byte) 0x01, (byte) 0x35, (byte) 0xce,
2180 (byte) 0x46, (byte) 0x47, (byte) 0x8c, (byte) 0xe4, (byte) 0x62,
2181 (byte) 0x36, (byte) 0x1a, (byte) 0x65, (byte) 0x0e, (byte) 0x33,
2182 (byte) 0x56, (byte) 0xf9, (byte) 0xb7, (byte) 0xa0, (byte) 0xc4,
2183 (byte) 0xb6, (byte) 0x82, (byte) 0x55, (byte) 0x7d, (byte) 0x36,
2184 (byte) 0x55, (byte) 0xc0, (byte) 0x52, (byte) 0x5e, (byte) 0x35,
2185 (byte) 0x54, (byte) 0xbd, (byte) 0x97, (byte) 0x01, (byte) 0x00,
2186 (byte) 0xbf, (byte) 0x10, (byte) 0xdc, (byte) 0x1b, (byte) 0x51,
2187 (byte) 0x02, (byte) 0x41, (byte) 0x00, (byte) 0xe7, (byte) 0x68,
2188 (byte) 0x03, (byte) 0x3e, (byte) 0x21, (byte) 0x64, (byte) 0x68,
2189 (byte) 0x24, (byte) 0x7b, (byte) 0xd0, (byte) 0x31, (byte) 0xa0,
2190 (byte) 0xa2, (byte) 0xd9, (byte) 0x87, (byte) 0x6d, (byte) 0x79,
2191 (byte) 0x81, (byte) 0x8f, (byte) 0x8f, (byte) 0x2d, (byte) 0x7a,
2192 (byte) 0x95, (byte) 0x2e, (byte) 0x55, (byte) 0x9f, (byte) 0xd7,
2193 (byte) 0x86, (byte) 0x29, (byte) 0x93, (byte) 0xbd, (byte) 0x04,
2194 (byte) 0x7e, (byte) 0x4f, (byte) 0xdb, (byte) 0x56, (byte) 0xf1,
2195 (byte) 0x75, (byte) 0xd0, (byte) 0x4b, (byte) 0x00, (byte) 0x3a,
2196 (byte) 0xe0, (byte) 0x26, (byte) 0xf6, (byte) 0xab, (byte) 0x9e,
2197 (byte) 0x0b, (byte) 0x2a, (byte) 0xf4, (byte) 0xa8, (byte) 0xd7,
2198 (byte) 0xff, (byte) 0xbe, (byte) 0x01, (byte) 0xeb, (byte) 0x9b,
2199 (byte) 0x81, (byte) 0xc7, (byte) 0x5f, (byte) 0x02, (byte) 0x73,
2200 (byte) 0xe1, (byte) 0x2b, (byte) 0x02, (byte) 0x41, (byte) 0x00,
2201 (byte) 0xc5, (byte) 0x3d, (byte) 0x78, (byte) 0xab, (byte) 0xe6,
2202 (byte) 0xab, (byte) 0x3e, (byte) 0x29, (byte) 0xfd, // 88
2203 (byte) 0x98, (byte) 0xd0, (byte) 0xa4, (byte) 0x3e, (byte) 0x58,
2204 (byte) 0xee, (byte) 0x48, (byte) 0x45, (byte) 0xa3, (byte) 0x66,
2205 (byte) 0xac, (byte) 0xe9, (byte) 0x4d, (byte) 0xbd, (byte) 0x60,
2206 (byte) 0xea, (byte) 0x24, (byte) 0xff, (byte) 0xed, (byte) 0x0c,
2207 (byte) 0x67, (byte) 0xc5, (byte) 0xfd, (byte) 0x36, (byte) 0x28,
2208 (byte) 0xea, (byte) 0x74, (byte) 0x88, (byte) 0xd1, (byte) 0xd1,
2209 (byte) 0xad, (byte) 0x58, (byte) 0xd7, (byte) 0xf0, (byte) 0x67,
2210 (byte) 0x20, (byte) 0xc1, (byte) 0xe3, (byte) 0xb3, (byte) 0xdb,
2211 (byte) 0x52, (byte) 0xad, (byte) 0xf3, (byte) 0xc4, (byte) 0x21,
2212 (byte) 0xd8, (byte) 0x8c, (byte) 0x4c, (byte) 0x41, (byte) 0x27,
2213 (byte) 0xdb, (byte) 0xd0, (byte) 0x35, (byte) 0x92, (byte) 0xc7,
2214 (byte) 0x02, (byte) 0x41, (byte) 0x00, (byte) 0xe0, (byte) 0x99,
2215 (byte) 0x42, (byte) 0xb4, (byte) 0x76, (byte) 0x02, (byte) 0x97,
2216 (byte) 0x55, (byte) 0xf9, (byte) 0xda, (byte) 0x3b, (byte) 0xa0,
2217 (byte) 0xd7, (byte) 0x0e, (byte) 0xdc, (byte) 0xf4, (byte) 0x33,
2218 (byte) 0x7f, (byte) 0xbd, (byte) 0xcf, (byte) 0xd0, (byte) 0xeb,
2219 (byte) 0x6e, (byte) 0x89, (byte) 0xf7, (byte) 0x4f, (byte) 0x5a,
2220 (byte) 0x07, (byte) 0x7c, (byte) 0xa9, (byte) 0x49, (byte) 0x47,
2221 (byte) 0x68, (byte) 0x35, (byte) 0xa8, (byte) 0x05, (byte) 0x3d,
2222 (byte) 0xfd, (byte) 0x04, (byte) 0x7b, (byte) 0x17, (byte) 0x31,
2223 (byte) 0x0d, (byte) 0xc8, (byte) 0xa3, (byte) 0x98, (byte) 0x34,
2224 (byte) 0xa0, (byte) 0x50, (byte) 0x44, (byte) 0x00, (byte) 0xf1,
2225 (byte) 0x0c, (byte) 0xe6, (byte) 0xe5, (byte) 0xc4, (byte) 0x41,
2226 (byte) 0x3d, (byte) 0xf8, (byte) 0x3d, (byte) 0x4e, (byte) 0x0b, // 118
2227 (byte) 0x1c, (byte) 0xdb, (byte) 0x02, (byte) 0x41, (byte) 0x00,
2228 (byte) 0x82, (byte) 0x9b, (byte) 0x8a, (byte) 0xfd, (byte) 0xa1,
2229 (byte) 0x98, (byte) 0x41, (byte) 0x68, (byte) 0xc2, (byte) 0xd1,
2230 (byte) 0xdf, (byte) 0x4e, (byte) 0xf3, (byte) 0x2e, (byte) 0x26,
2231 (byte) 0x53, (byte) 0x5b, (byte) 0x31, (byte) 0xb1, (byte) 0x7a,
2232 (byte) 0xcc, (byte) 0x5e, (byte) 0xbb, (byte) 0x09, (byte) 0xa2,
2233 (byte) 0xe2, (byte) 0x6f, (byte) 0x4a, (byte) 0x04, (byte) 0x0d,
2234 (byte) 0xef, (byte) 0x90, (byte) 0x15, (byte) 0xbe, (byte) 0x10,
2235 (byte) 0x4a, (byte) 0xac, (byte) 0x92, (byte) 0xeb, (byte) 0xda,
2236 (byte) 0x72, (byte) 0xdb, (byte) 0x43, (byte) 0x08, (byte) 0xb7,
2237 (byte) 0x2b, (byte) 0x4c, (byte) 0xe1, (byte) 0xbb, (byte) 0x58,
2238 (byte) 0xcb, (byte) 0x71, (byte) 0x80, (byte) 0xad, (byte) 0xbc,
2239 (byte) 0xdc, (byte) 0x62, (byte) 0x5e, (byte) 0x3e, (byte) 0xcb,
2240 (byte) 0x92, (byte) 0xda, (byte) 0xf6, (byte) 0xdf, (byte) 0x02,
2241 (byte) 0x40, (byte) 0x4d, (byte) 0x81, (byte) 0x90, (byte) 0xc5,
2242 (byte) 0x77, (byte) 0x30, (byte) 0xb7, (byte) 0x29, (byte) 0x00,
2243 (byte) 0xa8, (byte) 0xf1, (byte) 0xb4, (byte) 0xae, (byte) 0x52,
2244 (byte) 0x63, (byte) 0x00, (byte) 0xb2, // 140
2245 (byte) 0x2d, (byte) 0x3e, (byte) 0x7d, (byte) 0xd6, (byte) 0x4d,
2246 (byte) 0xf9, (byte) 0x8a, (byte) 0xc1, (byte) 0xb1, (byte) 0x98,
2247 (byte) 0x89, (byte) 0x52, (byte) 0x40, (byte) 0x14, (byte) 0x1b,
2248 (byte) 0x0e, (byte) 0x61, (byte) 0x8f, (byte) 0xf4, (byte) 0xbe,
2249 (byte) 0x59, (byte) 0x79, (byte) 0x79, (byte) 0x95, (byte) 0x19,
2250 (byte) 0x5c, (byte) 0x51, (byte) 0x08, (byte) 0x66, (byte) 0xc1,
2251 (byte) 0x42, (byte) 0x30, (byte) 0xb3, (byte) 0x7a, (byte) 0x86,
2252 (byte) 0x9f, (byte) 0x3e, (byte) 0xf5, (byte) 0x19, (byte) 0xa3, // 150
2253 (byte) 0xae, (byte) 0x64, (byte) 0x69, (byte) 0x14, (byte) 0x07,
2254 (byte) 0x50, (byte) 0x97, };