1/* 2 * Copyright (C) 2010 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package libcore.java.security; 18 19import static java.nio.charset.StandardCharsets.UTF_8; 20import static org.mockito.Mockito.doReturn; 21import static org.mockito.Mockito.mock; 22import static org.mockito.Mockito.spy; 23import static org.mockito.Mockito.verify; 24 25import java.lang.reflect.Method; 26import java.math.BigInteger; 27import java.security.AlgorithmParameters; 28import java.security.InvalidKeyException; 29import java.security.InvalidParameterException; 30import java.security.KeyFactory; 31import java.security.KeyPair; 32import java.security.KeyPairGenerator; 33import java.security.MessageDigest; 34import java.security.PrivateKey; 35import java.security.Provider; 36import java.security.PublicKey; 37import java.security.Security; 38import java.security.Signature; 39import java.security.SignatureException; 40import java.security.SignatureSpi; 41import java.security.spec.DSAPrivateKeySpec; 42import java.security.spec.DSAPublicKeySpec; 43import java.security.spec.ECFieldFp; 44import java.security.spec.ECParameterSpec; 45import java.security.spec.ECPoint; 46import java.security.spec.ECPublicKeySpec; 47import java.security.spec.EllipticCurve; 48import java.security.spec.InvalidKeySpecException; 49import java.security.spec.InvalidParameterSpecException; 50import java.security.spec.MGF1ParameterSpec; 51import java.security.spec.PSSParameterSpec; 52import java.security.spec.RSAPrivateCrtKeySpec; 53import java.security.spec.RSAPrivateKeySpec; 54import java.security.spec.RSAPublicKeySpec; 55import java.security.spec.X509EncodedKeySpec; 56import java.util.ArrayList; 57import java.util.Arrays; 58import java.util.Collections; 59import java.util.HashMap; 60import java.util.List; 61import java.util.Locale; 62import java.util.Map; 63import java.util.Set; 64import java.util.concurrent.Callable; 65import java.util.concurrent.CountDownLatch; 66import java.util.concurrent.ExecutorService; 67import java.util.concurrent.Executors; 68import java.util.concurrent.TimeUnit; 69import junit.framework.TestCase; 70 71import libcore.util.HexEncoding; 72 73import dalvik.system.VMRuntime; 74import sun.security.jca.Providers; 75 76public class SignatureTest extends TestCase { 77 78 // Allow access to deprecated BC algorithms in this test, so we can ensure they 79 // continue to work 80 @Override 81 public void setUp() throws Exception { 82 super.setUp(); 83 Providers.setMaximumAllowableApiLevelForBcDeprecation( 84 VMRuntime.getRuntime().getTargetSdkVersion()); 85 } 86 87 @Override 88 public void tearDown() throws Exception { 89 Providers.setMaximumAllowableApiLevelForBcDeprecation( 90 Providers.DEFAULT_MAXIMUM_ALLOWABLE_TARGET_API_LEVEL_FOR_BC_DEPRECATION); 91 super.tearDown(); 92 } 93 94 private static abstract class MockProvider extends Provider { 95 public MockProvider(String name) { 96 super(name, 1.0, "Mock provider used for testing"); 97 setup(); 98 } 99 100 public abstract void setup(); 101 } 102 103 public void testSignature_getInstance_SuppliedProviderNotRegistered_Success() throws Exception { 104 Provider mockProvider = new MockProvider("MockProvider") { 105 @Override 106 public void setup() { 107 put("Signature.FOO", MockSignatureSpi.AllKeyTypes.class.getName()); 108 } 109 }; 110 111 { 112 Signature s = Signature.getInstance("FOO", mockProvider); 113 s.initSign(new MockPrivateKey()); 114 assertEquals(mockProvider, s.getProvider()); 115 } 116 } 117 118 public void testSignature_getInstance_DoesNotSupportKeyClass_Success() throws Exception { 119 Provider mockProvider = new MockProvider("MockProvider") { 120 @Override 121 public void setup() { 122 put("Signature.FOO", MockSignatureSpi.AllKeyTypes.class.getName()); 123 put("Signature.FOO SupportedKeyClasses", "None"); 124 } 125 }; 126 127 Security.addProvider(mockProvider); 128 try { 129 Signature s = Signature.getInstance("FOO", mockProvider); 130 s.initSign(new MockPrivateKey()); 131 assertEquals(mockProvider, s.getProvider()); 132 } finally { 133 Security.removeProvider(mockProvider.getName()); 134 } 135 } 136 137 /** 138 * Several exceptions can be thrown by init. Check that in this case we throw the right one, 139 * as the error could fall under the umbrella of other exceptions. 140 * http://b/18987633 141 */ 142 public void testSignature_init_DoesNotSupportKeyClass_throwsInvalidKeyException() 143 throws Exception { 144 Provider mockProvider = new MockProvider("MockProvider") { 145 @Override 146 public void setup() { 147 put("Signature.FOO", MockSignatureSpi.AllKeyTypes.class.getName()); 148 put("Signature.FOO SupportedKeyClasses", "None"); 149 } 150 }; 151 152 Security.addProvider(mockProvider); 153 try { 154 Signature s = Signature.getInstance("FOO"); 155 s.initSign(new MockPrivateKey()); 156 fail("Expected InvalidKeyException"); 157 } catch (InvalidKeyException expected) { 158 } finally { 159 Security.removeProvider(mockProvider.getName()); 160 } 161 } 162 163 public void testSignature_getInstance_OnlyUsesSpecifiedProvider_SameNameAndClass_Success() 164 throws Exception { 165 Provider mockProvider = new MockProvider("MockProvider") { 166 @Override 167 public void setup() { 168 put("Signature.FOO", MockSignatureSpi.AllKeyTypes.class.getName()); 169 } 170 }; 171 172 Security.addProvider(mockProvider); 173 try { 174 { 175 Provider mockProvider2 = new MockProvider("MockProvider") { 176 @Override 177 public void setup() { 178 put("Signature.FOO", MockSignatureSpi.AllKeyTypes.class.getName()); 179 } 180 }; 181 Signature s = Signature.getInstance("FOO", mockProvider2); 182 assertEquals(mockProvider2, s.getProvider()); 183 } 184 } finally { 185 Security.removeProvider(mockProvider.getName()); 186 } 187 } 188 189 public void testSignature_getInstance_DelayedInitialization_KeyType() throws Exception { 190 Provider mockProviderSpecific = new MockProvider("MockProviderSpecific") { 191 @Override 192 public void setup() { 193 put("Signature.FOO", MockSignatureSpi.SpecificKeyTypes.class.getName()); 194 put("Signature.FOO SupportedKeyClasses", MockPrivateKey.class.getName()); 195 } 196 }; 197 Provider mockProviderSpecific2 = new MockProvider("MockProviderSpecific2") { 198 @Override 199 public void setup() { 200 put("Signature.FOO", MockSignatureSpi.SpecificKeyTypes2.class.getName()); 201 put("Signature.FOO SupportedKeyClasses", MockPrivateKey2.class.getName()); 202 } 203 }; 204 Provider mockProviderAll = new MockProvider("MockProviderAll") { 205 @Override 206 public void setup() { 207 put("Signature.FOO", MockSignatureSpi.AllKeyTypes.class.getName()); 208 } 209 }; 210 211 Security.addProvider(mockProviderSpecific); 212 Security.addProvider(mockProviderSpecific2); 213 Security.addProvider(mockProviderAll); 214 215 try { 216 { 217 Signature s = Signature.getInstance("FOO"); 218 s.initSign(new MockPrivateKey()); 219 assertEquals(mockProviderSpecific, s.getProvider()); 220 221 try { 222 s.initSign(new MockPrivateKey2()); 223 assertEquals(mockProviderSpecific2, s.getProvider()); 224 if (StandardNames.IS_RI) { 225 fail("RI was broken before; fix tests now that it works!"); 226 } 227 } catch (InvalidKeyException e) { 228 if (!StandardNames.IS_RI) { 229 fail("Non-RI should select the right provider"); 230 } 231 } 232 } 233 234 { 235 Signature s = Signature.getInstance("FOO"); 236 s.initSign(new PrivateKey() { 237 @Override 238 public String getAlgorithm() { 239 throw new UnsupportedOperationException("not implemented"); 240 } 241 242 @Override 243 public String getFormat() { 244 throw new UnsupportedOperationException("not implemented"); 245 } 246 247 @Override 248 public byte[] getEncoded() { 249 throw new UnsupportedOperationException("not implemented"); 250 } 251 }); 252 assertEquals(mockProviderAll, s.getProvider()); 253 } 254 255 { 256 Signature s = Signature.getInstance("FOO"); 257 assertEquals(mockProviderSpecific, s.getProvider()); 258 } 259 } finally { 260 Security.removeProvider(mockProviderSpecific.getName()); 261 Security.removeProvider(mockProviderSpecific2.getName()); 262 Security.removeProvider(mockProviderAll.getName()); 263 } 264 } 265 266 private static class MySignature extends Signature { 267 protected MySignature(String algorithm) { 268 super(algorithm); 269 } 270 271 @Override 272 protected void engineInitVerify(PublicKey publicKey) throws InvalidKeyException { 273 } 274 275 @Override 276 protected void engineInitSign(PrivateKey privateKey) throws InvalidKeyException { 277 } 278 279 @Override 280 protected void engineUpdate(byte b) throws SignatureException { 281 } 282 283 @Override 284 protected void engineUpdate(byte[] b, int off, int len) throws SignatureException { 285 } 286 287 @Override 288 protected byte[] engineSign() throws SignatureException { 289 return new byte[10]; 290 } 291 292 @Override 293 protected boolean engineVerify(byte[] sigBytes) throws SignatureException { 294 return true; 295 } 296 297 @Override 298 protected void engineSetParameter(String param, Object value) { 299 throw new UnsupportedOperationException(); 300 } 301 302 @Override 303 protected Object engineGetParameter(String param) throws InvalidParameterException { 304 throw new UnsupportedOperationException(); 305 } 306 } 307 308 public void testSignature_signArray_nullArray_throws() throws Exception { 309 try { 310 Signature s = new MySignature("FOO"); 311 s.sign(null /* outbuf */, 1 /* offset */, 1 /* length */); 312 fail(); 313 } catch (IllegalArgumentException expected) { 314 } 315 } 316 317 public void testSignature_signArray_negativeOffset_throws() throws Exception { 318 try { 319 Signature s = new MySignature("FOO"); 320 s.sign(new byte[4], -1 /* offset */, 1 /* length */); 321 fail(); 322 } catch (IllegalArgumentException expected) { 323 } 324 } 325 326 public void testSignature_signArray_negativeLength_throws() throws Exception { 327 try { 328 Signature s = new MySignature("FOO"); 329 s.sign(new byte[4], 1 /* offset */ , -1 /* length */); 330 fail(); 331 } catch (IllegalArgumentException expected) { 332 } 333 } 334 335 public void testSignature_signArray_invalidLengths_throws() throws Exception { 336 try { 337 Signature s = new MySignature("FOO"); 338 // Start at offset 3 with length 2, thus attempting to overread from an array of size 4. 339 s.sign(new byte[4], 3 /* offset */ , 2 /* length */); 340 fail(); 341 } catch (IllegalArgumentException expected) { 342 } 343 } 344 345 private static PublicKey createPublicKey() throws Exception { 346 X509EncodedKeySpec keySpec = new X509EncodedKeySpec(PK_BYTES); 347 KeyFactory keyFactory = KeyFactory.getInstance("RSA"); 348 return keyFactory.generatePublic(keySpec); 349 } 350 351 public void testSignature_verifyArray_nullArray_throws() throws Exception { 352 try { 353 Signature s = new MySignature("FOO"); 354 s.initVerify(createPublicKey()); 355 s.verify(null /* outbuf */, 1 /* offset */, 1 /* length */); 356 fail(); 357 } catch (IllegalArgumentException expected) { 358 } 359 } 360 361 public void testSignature_verifyArray_negativeOffset_throws() throws Exception { 362 try { 363 Signature s = new MySignature("FOO"); 364 s.initVerify(createPublicKey()); 365 s.verify(new byte[4], -1 /* offset */, 1 /* length */); 366 fail(); 367 } catch (IllegalArgumentException expected) { 368 } 369 } 370 371 public void testSignature_verifyArray_negativeLength_throws() throws Exception { 372 try { 373 Signature s = new MySignature("FOO"); 374 s.initVerify(createPublicKey()); 375 s.verify(new byte[4], 1 /* offset */ , -1 /* length */); 376 fail(); 377 } catch (IllegalArgumentException expected) { 378 } 379 } 380 381 public void testSignature_verifyArray_invalidLengths_throws() throws Exception { 382 try { 383 Signature s = new MySignature("FOO"); 384 s.initVerify(createPublicKey()); 385 // Start at offset 3 with length 2, thus attempting to overread from an array of size 4. 386 s.verify(new byte[4], 3 /* offset */ , 2 /* length */); 387 fail(); 388 } catch (IllegalArgumentException expected) { 389 } 390 } 391 392 public void testSignature_verifyArray_correctParameters_ok() throws Exception { 393 Signature s = new MySignature("FOO"); 394 s.initVerify(createPublicKey()); 395 // Start at offset 3 with length 2, thus attempting to overread from an array of size 4. 396 s.verify(new byte[4], 1 /* offset */, 2 /* length */); 397 } 398 399 public void testSignature_updateArray_nullArray_throws() throws Exception { 400 try { 401 Signature s = new MySignature("FOO"); 402 s.initVerify(createPublicKey()); 403 s.update(null /* outbuf */, 1 /* offset */, 1 /* length */); 404 fail(); 405 } catch (IllegalArgumentException expected) { 406 } 407 } 408 409 public void testSignature_updateArray_negativeOffset_throws() throws Exception { 410 try { 411 Signature s = new MySignature("FOO"); 412 s.initVerify(createPublicKey()); 413 s.update(new byte[4], -1 /* offset */, 1 /* length */); 414 fail(); 415 } catch (IllegalArgumentException expected) { 416 } 417 } 418 419 public void testSignature_updateArray_negativeLength_throws() throws Exception { 420 try { 421 Signature s = new MySignature("FOO"); 422 s.initVerify(createPublicKey()); 423 s.update(new byte[4], 1 /* offset */ , -1 /* length */); 424 fail(); 425 } catch (IllegalArgumentException expected) { 426 } 427 } 428 429 public void testSignature_updateArray_invalidLengths_throws() throws Exception { 430 try { 431 Signature s = new MySignature("FOO"); 432 s.initVerify(createPublicKey()); 433 // Start at offset 3 with length 2, thus attempting to overread from an array of size 4. 434 s.update(new byte[4], 3 /* offset */ , 2 /* length */); 435 fail(); 436 } catch (IllegalArgumentException expected) { 437 } 438 } 439 440 public void testSignature_updateArray_wrongState_throws() throws Exception { 441 try { 442 Signature s = new MySignature("FOO"); 443 s.update(new byte[4], 0 /* offset */ , 1 /* length */); 444 fail(); 445 } catch (SignatureException expected) { 446 } 447 } 448 449 public void testSignature_updateArray_correctStateAndParameters_ok() throws Exception { 450 Signature s = new MySignature("FOO"); 451 s.initVerify(createPublicKey()); 452 s.update(new byte[4], 0 /* offset */ , 1 /* length */); 453 } 454 455 public void testSignature_getProvider_Subclass() throws Exception { 456 Provider mockProviderNonSpi = new MockProvider("MockProviderNonSpi") { 457 @Override 458 public void setup() { 459 put("Signature.FOO", MySignature.class.getName()); 460 } 461 }; 462 463 Security.addProvider(mockProviderNonSpi); 464 465 try { 466 Signature s = new MySignature("FOO"); 467 assertNull(s.getProvider()); 468 } finally { 469 Security.removeProvider(mockProviderNonSpi.getName()); 470 } 471 } 472 473 // 20 bytes for DSA 474 private final byte[] DATA = new byte[20]; 475 476 public void test_getInstance() throws Exception { 477 Provider[] providers = Security.getProviders(); 478 for (Provider provider : providers) { 479 // Do not test AndroidKeyStore's Signature. It needs an AndroidKeyStore-specific key. 480 // It's OKish not to test AndroidKeyStore's Signature here because it's tested 481 // by cts/tests/test/keystore. 482 if (provider.getName().startsWith("AndroidKeyStore")) { 483 continue; 484 } 485 Set<Provider.Service> services = provider.getServices(); 486 for (Provider.Service service : services) { 487 String type = service.getType(); 488 if (!type.equals("Signature")) { 489 continue; 490 } 491 String algorithm = service.getAlgorithm(); 492 try { 493 KeyPair kp = keyPair(algorithm, provider.getName()); 494 // Signature.getInstance(String) 495 Signature sig1 = Signature.getInstance(algorithm); 496 assertEquals(algorithm, sig1.getAlgorithm()); 497 test_Signature(sig1, kp); 498 499 // Signature.getInstance(String, Provider) 500 Signature sig2 = Signature.getInstance(algorithm, provider); 501 assertEquals(algorithm, sig2.getAlgorithm()); 502 assertEquals(provider, sig2.getProvider()); 503 test_Signature(sig2, kp); 504 505 // Signature.getInstance(String, String) 506 Signature sig3 = Signature.getInstance(algorithm, provider.getName()); 507 assertEquals(algorithm, sig3.getAlgorithm()); 508 assertEquals(provider, sig3.getProvider()); 509 test_Signature(sig3, kp); 510 } catch (Exception e) { 511 throw new Exception("Problem testing Signature." + algorithm, e); 512 } 513 } 514 } 515 } 516 517 private final Map<String, KeyPair> keypairAlgorithmToInstance 518 = new HashMap<String, KeyPair>(); 519 520 private KeyPair keyPair(String sigAlgorithm, String providerName) throws Exception { 521 String sigAlgorithmUpperCase = sigAlgorithm.toUpperCase(Locale.US); 522 if (sigAlgorithmUpperCase.endsWith("ENCRYPTION")) { 523 sigAlgorithm = sigAlgorithm.substring(0, sigAlgorithm.length()-"ENCRYPTION".length()); 524 sigAlgorithmUpperCase = sigAlgorithm.toUpperCase(Locale.US); 525 } 526 527 String kpAlgorithm; 528 // note ECDSA must be before DSA 529 if (sigAlgorithmUpperCase.endsWith("ECDSA")) { 530 kpAlgorithm = "EC"; 531 } else if (sigAlgorithmUpperCase.endsWith("DSA")) { 532 kpAlgorithm = "DSA"; 533 } else if ((sigAlgorithmUpperCase.endsWith("RSA")) 534 || (sigAlgorithmUpperCase.endsWith("RSA/PSS"))) { 535 kpAlgorithm = "RSA"; 536 } else { 537 throw new Exception("Unknown KeyPair algorithm for Signature algorithm " 538 + sigAlgorithm); 539 } 540 541 KeyPair kp = keypairAlgorithmToInstance.get(kpAlgorithm); 542 if (kp == null) { 543 kp = KeyPairGenerator.getInstance(kpAlgorithm).generateKeyPair(); 544 keypairAlgorithmToInstance.put(kpAlgorithm, kp); 545 } 546 return kp; 547 } 548 549 private void test_Signature(Signature sig, KeyPair keyPair) throws Exception { 550 sig.initSign(keyPair.getPrivate()); 551 sig.update(DATA); 552 byte[] signature = sig.sign(); 553 assertNotNull(sig.getAlgorithm(), signature); 554 assertTrue(sig.getAlgorithm(), signature.length > 0); 555 556 sig.initVerify(keyPair.getPublic()); 557 sig.update(DATA); 558 assertTrue(sig.getAlgorithm(), sig.verify(signature)); 559 560 // After verify, should be reusable as if we are after initVerify 561 sig.update(DATA); 562 assertTrue(sig.getAlgorithm(), sig.verify(signature)); 563 564 /* 565 * The RI appears to clear out the input data in RawDSA while calling 566 * verify a second time. 567 */ 568 if (StandardNames.IS_RI && "NONEwithDSA".equalsIgnoreCase(sig.getAlgorithm())) { 569 try { 570 sig.verify(signature); 571 fail("Expected RI to have a NONEwithDSA bug"); 572 } catch (SignatureException bug) { 573 } 574 } else { 575 // Calling Signature.verify a second time should not throw 576 // http://code.google.com/p/android/issues/detail?id=34933 577 sig.verify(signature); 578 } 579 580 testSignature_MultipleThreads_Misuse(sig); 581 } 582 583 private static final byte[] PK_BYTES = HexEncoding.decode( 584 "30819f300d06092a864886f70d010101050003818d0030818902818100cd769d178f61475fce3001" 585 + "2604218320c77a427121d3b41dd76756c8fc0c428cd15cb754adc85466f47547b1c85623d9c17fc6" 586 + "4f202fca21099caf99460c824ad657caa8c2db34996838d32623c4f23c8b6a4e6698603901262619" 587 + "4840e0896b1a6ec4f6652484aad04569bb6a885b822a10d700224359c632dc7324520cbb3d020301" 588 + "0001"); 589 private static final byte[] CONTENT = HexEncoding.decode( 590 "f2fa9d73656e00fa01edc12e73656e2e7670632e6432004867268c46dd95030b93ce7260423e5c00" 591 + "fabd4d656d6265727300fa018dc12e73656e2e7670632e643100d7c258dc00fabd44657669636573" 592 + "00faa54b65797300fa02b5c12e4d2e4b009471968cc68835f8a68dde10f53d19693d480de767e5fb" 593 + "976f3562324006372300fabdfd04e1f51ef3aa00fa8d00000001a203e202859471968cc68835f8a6" 594 + "8dde10f53d19693d480de767e5fb976f356232400637230002bab504e1f51ef5810002c29d28463f" 595 + "0003da8d000001e201eaf2fa9d73656e00fa01edc12e73656e2e7670632e6432004867268c46dd95" 596 + "030b93ce7260423e5c00fabd4d656d6265727300fa018dc12e73656e2e7670632e643100d7c258dc" 597 + "00fabd4465766963657300faa54b65797300fa02b5c12e4d2e4b009471968cc68835f8a68dde10f5" 598 + "3d19693d480de767e5fb976f3562324006372300fabdfd04e1f51ef3aa000003e202859471968cc6" 599 + "8835f8a68dde10f53d19693d480de767e5fb976f3562324006372300000000019a0a9530819f300d" 600 + "06092a864886f70d010101050003818d0030818902818100cd769d178f61475fce30012604218320" 601 + "c77a427121d3b41dd76756c8fc0c428cd15cb754adc85466f47547b1c85623d9c17fc64f202fca21" 602 + "099caf99460c824ad657caa8c2db34996838d32623c4f23c8b6a4e66986039012626194840e0896b" 603 + "1a6ec4f6652484aad04569bb6a885b822a10d700224359c632dc7324520cbb3d020301000100"); 604 private static final byte[] SIGNATURE = HexEncoding.decode( 605 "b4016456148cd2e9f580470aad63d19c1fee52b38c9dcb5b4d61a7ca369a7277497775d106d86394" 606 + "a69229184333b5a3e6261d5bcebdb02530ca9909f4d790199eae7c140f7db39dee2232191bdf0bfb" 607 + "34fdadc44326b9b3f3fa828652bab07f0362ac141c8c3784ebdec44e0b156a5e7bccdc81a56fe954" 608 + "56ac8c0e4ae12d97"); 609 610 611 /** 612 * This should actually fail because the ASN.1 encoding is incorrect. It is 613 * missing the NULL in the AlgorithmIdentifier field. 614 * <p> 615 * http://code.google.com/p/android/issues/detail?id=18566 <br/> 616 * http://b/5038554 617 */ 618 public void test18566_AlgorithmOid_MissingNull_Failure() throws Exception { 619 X509EncodedKeySpec keySpec = new X509EncodedKeySpec(PK_BYTES); 620 KeyFactory keyFactory = KeyFactory.getInstance("RSA"); 621 PublicKey pk = keyFactory.generatePublic(keySpec); 622 623 Signature sig = Signature.getInstance("SHA256withRSA"); 624 sig.initVerify(pk); 625 sig.update(CONTENT); 626 assertFalse(sig.verify(SIGNATURE)); 627 } 628 629 /* 630 * Test vectors generated with this private key: 631 * 632 * -----BEGIN RSA PRIVATE KEY----- 633 * MIIEpAIBAAKCAQEA4Ec+irjyKE/rnnQv+XSPoRjtmGM8kvUq63ouvg075gMpvnZq 634 * 0Q62pRXQ0s/ZvqeTDwwwZTeJn3lYzT6FsB+IGFJNMSWEqUslHjYltUFB7b/uGYgI 635 * 4buX/Hy0m56qr2jpyY19DtxTu8D6ADQ1bWMF+7zDxwAUBThqu8hzyw8+90JfPTPf 636 * ezFa4DbSoLZq/UdQOxab8247UWJRW3Ff2oPeryxYrrmr+zCXw8yd2dvl7ylsF2E5 637 * Ao6KZx5jBW1F9AGI0sQTNJCEXeUsJTTpxrJHjAe9rpKII7YtBmx3cPn2Pz26JH9T 638 * CER0e+eqqF2FO4vSRKzsPePImrRkU6tNJMOsaQIDAQABAoIBADd4R3al8XaY9ayW 639 * DfuDobZ1ZOZIvQWXz4q4CHGG8macJ6nsvdSA8Bl6gNBzCebGqW+SUzHlf4tKxvTU 640 * XtpFojJpwJ/EKMB6Tm7fc4oV3sl/q9Lyu0ehTyDqcvz+TDbgGtp3vRN82NTaELsW 641 * LpSkZilx8XX5hfoYjwVsuX7igW9Dq503R2Ekhs2owWGWwwgYqZXshdOEZ3kSZ7O/ 642 * IfJzcQppJYYldoQcW2cSwS1L0govMpmtt8E12l6VFavadufK8qO+gFUdBzt4vxFi 643 * xIrSt/R0OgI47k0lL31efmUzzK5kzLOTYAdaL9HgNOw65c6cQIzL8OJeQRQCFoez 644 * 3UdUroECgYEA9UGIS8Nzeyki1BGe9F4t7izUy7dfRVBaFXqlAJ+Zxzot8HJKxGAk 645 * MGMy6omBd2NFRl3G3x4KbxQK/ztzluaomUrF2qloc0cv43dJ0U6z4HXmKdvrNYMz 646 * im82SdCiZUp6Qv2atr+krE1IHTkLsimwZL3DEcwb4bYxidp8QM3s8rECgYEA6hp0 647 * LduIHO23KIyH442GjdekCdFaQ/RF1Td6C1cx3b/KLa8oqOE81cCvzsM0fXSjniNa 648 * PNljPydN4rlPkt9DgzkR2enxz1jyfeLgj/RZZMcg0+whOdx8r8kSlTzeyy81Wi4s 649 * NaUPrXVMs7IxZkJLo7bjESoriYw4xcFe2yOGkzkCgYBRgo8exv2ZYCmQG68dfjN7 650 * pfCvJ+mE6tiVrOYr199O5FoiQInyzBUa880XP84EdLywTzhqLNzA4ANrokGfVFeS 651 * YtRxAL6TGYSj76Bb7PFBV03AebOpXEqD5sQ/MhTW3zLVEt4ZgIXlMeYWuD/X3Z0f 652 * TiYHwzM9B8VdEH0dOJNYcQKBgQDbT7UPUN6O21P/NMgJMYigUShn2izKBIl3WeWH 653 * wkQBDa+GZNWegIPRbBZHiTAfZ6nweAYNg0oq29NnV1toqKhCwrAqibPzH8zsiiL+ 654 * OVeVxcbHQitOXXSh6ajzDndZufwtY5wfFWc+hOk6XvFQb0MVODw41Fy9GxQEj0ch 655 * 3IIyYQKBgQDYEUWTr0FfthLb8ZI3ENVNB0hiBadqO0MZSWjA3/HxHvD2GkozfV/T 656 * dBu8lkDkR7i2tsR8OsEgQ1fTsMVbqShr2nP2KSlvX6kUbYl2NX08dR51FIaWpAt0 657 * aFyCzjCQLWOdck/yTV4ulAfuNO3tLjtN9lqpvP623yjQe6aQPxZXaA== 658 * -----END RSA PRIVATE KEY----- 659 * 660 */ 661 662 private static final BigInteger RSA_2048_modulus = new BigInteger(new byte[] { 663 (byte) 0x00, (byte) 0xe0, (byte) 0x47, (byte) 0x3e, (byte) 0x8a, (byte) 0xb8, (byte) 0xf2, (byte) 0x28, 664 (byte) 0x4f, (byte) 0xeb, (byte) 0x9e, (byte) 0x74, (byte) 0x2f, (byte) 0xf9, (byte) 0x74, (byte) 0x8f, 665 (byte) 0xa1, (byte) 0x18, (byte) 0xed, (byte) 0x98, (byte) 0x63, (byte) 0x3c, (byte) 0x92, (byte) 0xf5, 666 (byte) 0x2a, (byte) 0xeb, (byte) 0x7a, (byte) 0x2e, (byte) 0xbe, (byte) 0x0d, (byte) 0x3b, (byte) 0xe6, 667 (byte) 0x03, (byte) 0x29, (byte) 0xbe, (byte) 0x76, (byte) 0x6a, (byte) 0xd1, (byte) 0x0e, (byte) 0xb6, 668 (byte) 0xa5, (byte) 0x15, (byte) 0xd0, (byte) 0xd2, (byte) 0xcf, (byte) 0xd9, (byte) 0xbe, (byte) 0xa7, 669 (byte) 0x93, (byte) 0x0f, (byte) 0x0c, (byte) 0x30, (byte) 0x65, (byte) 0x37, (byte) 0x89, (byte) 0x9f, 670 (byte) 0x79, (byte) 0x58, (byte) 0xcd, (byte) 0x3e, (byte) 0x85, (byte) 0xb0, (byte) 0x1f, (byte) 0x88, 671 (byte) 0x18, (byte) 0x52, (byte) 0x4d, (byte) 0x31, (byte) 0x25, (byte) 0x84, (byte) 0xa9, (byte) 0x4b, 672 (byte) 0x25, (byte) 0x1e, (byte) 0x36, (byte) 0x25, (byte) 0xb5, (byte) 0x41, (byte) 0x41, (byte) 0xed, 673 (byte) 0xbf, (byte) 0xee, (byte) 0x19, (byte) 0x88, (byte) 0x08, (byte) 0xe1, (byte) 0xbb, (byte) 0x97, 674 (byte) 0xfc, (byte) 0x7c, (byte) 0xb4, (byte) 0x9b, (byte) 0x9e, (byte) 0xaa, (byte) 0xaf, (byte) 0x68, 675 (byte) 0xe9, (byte) 0xc9, (byte) 0x8d, (byte) 0x7d, (byte) 0x0e, (byte) 0xdc, (byte) 0x53, (byte) 0xbb, 676 (byte) 0xc0, (byte) 0xfa, (byte) 0x00, (byte) 0x34, (byte) 0x35, (byte) 0x6d, (byte) 0x63, (byte) 0x05, 677 (byte) 0xfb, (byte) 0xbc, (byte) 0xc3, (byte) 0xc7, (byte) 0x00, (byte) 0x14, (byte) 0x05, (byte) 0x38, 678 (byte) 0x6a, (byte) 0xbb, (byte) 0xc8, (byte) 0x73, (byte) 0xcb, (byte) 0x0f, (byte) 0x3e, (byte) 0xf7, 679 (byte) 0x42, (byte) 0x5f, (byte) 0x3d, (byte) 0x33, (byte) 0xdf, (byte) 0x7b, (byte) 0x31, (byte) 0x5a, 680 (byte) 0xe0, (byte) 0x36, (byte) 0xd2, (byte) 0xa0, (byte) 0xb6, (byte) 0x6a, (byte) 0xfd, (byte) 0x47, 681 (byte) 0x50, (byte) 0x3b, (byte) 0x16, (byte) 0x9b, (byte) 0xf3, (byte) 0x6e, (byte) 0x3b, (byte) 0x51, 682 (byte) 0x62, (byte) 0x51, (byte) 0x5b, (byte) 0x71, (byte) 0x5f, (byte) 0xda, (byte) 0x83, (byte) 0xde, 683 (byte) 0xaf, (byte) 0x2c, (byte) 0x58, (byte) 0xae, (byte) 0xb9, (byte) 0xab, (byte) 0xfb, (byte) 0x30, 684 (byte) 0x97, (byte) 0xc3, (byte) 0xcc, (byte) 0x9d, (byte) 0xd9, (byte) 0xdb, (byte) 0xe5, (byte) 0xef, 685 (byte) 0x29, (byte) 0x6c, (byte) 0x17, (byte) 0x61, (byte) 0x39, (byte) 0x02, (byte) 0x8e, (byte) 0x8a, 686 (byte) 0x67, (byte) 0x1e, (byte) 0x63, (byte) 0x05, (byte) 0x6d, (byte) 0x45, (byte) 0xf4, (byte) 0x01, 687 (byte) 0x88, (byte) 0xd2, (byte) 0xc4, (byte) 0x13, (byte) 0x34, (byte) 0x90, (byte) 0x84, (byte) 0x5d, 688 (byte) 0xe5, (byte) 0x2c, (byte) 0x25, (byte) 0x34, (byte) 0xe9, (byte) 0xc6, (byte) 0xb2, (byte) 0x47, 689 (byte) 0x8c, (byte) 0x07, (byte) 0xbd, (byte) 0xae, (byte) 0x92, (byte) 0x88, (byte) 0x23, (byte) 0xb6, 690 (byte) 0x2d, (byte) 0x06, (byte) 0x6c, (byte) 0x77, (byte) 0x70, (byte) 0xf9, (byte) 0xf6, (byte) 0x3f, 691 (byte) 0x3d, (byte) 0xba, (byte) 0x24, (byte) 0x7f, (byte) 0x53, (byte) 0x08, (byte) 0x44, (byte) 0x74, 692 (byte) 0x7b, (byte) 0xe7, (byte) 0xaa, (byte) 0xa8, (byte) 0x5d, (byte) 0x85, (byte) 0x3b, (byte) 0x8b, 693 (byte) 0xd2, (byte) 0x44, (byte) 0xac, (byte) 0xec, (byte) 0x3d, (byte) 0xe3, (byte) 0xc8, (byte) 0x9a, 694 (byte) 0xb4, (byte) 0x64, (byte) 0x53, (byte) 0xab, (byte) 0x4d, (byte) 0x24, (byte) 0xc3, (byte) 0xac, 695 (byte) 0x69, 696 }); 697 698 private static final BigInteger RSA_2048_privateExponent = new BigInteger(new byte[] { 699 (byte) 0x37, (byte) 0x78, (byte) 0x47, (byte) 0x76, (byte) 0xa5, (byte) 0xf1, (byte) 0x76, (byte) 0x98, 700 (byte) 0xf5, (byte) 0xac, (byte) 0x96, (byte) 0x0d, (byte) 0xfb, (byte) 0x83, (byte) 0xa1, (byte) 0xb6, 701 (byte) 0x75, (byte) 0x64, (byte) 0xe6, (byte) 0x48, (byte) 0xbd, (byte) 0x05, (byte) 0x97, (byte) 0xcf, 702 (byte) 0x8a, (byte) 0xb8, (byte) 0x08, (byte) 0x71, (byte) 0x86, (byte) 0xf2, (byte) 0x66, (byte) 0x9c, 703 (byte) 0x27, (byte) 0xa9, (byte) 0xec, (byte) 0xbd, (byte) 0xd4, (byte) 0x80, (byte) 0xf0, (byte) 0x19, 704 (byte) 0x7a, (byte) 0x80, (byte) 0xd0, (byte) 0x73, (byte) 0x09, (byte) 0xe6, (byte) 0xc6, (byte) 0xa9, 705 (byte) 0x6f, (byte) 0x92, (byte) 0x53, (byte) 0x31, (byte) 0xe5, (byte) 0x7f, (byte) 0x8b, (byte) 0x4a, 706 (byte) 0xc6, (byte) 0xf4, (byte) 0xd4, (byte) 0x5e, (byte) 0xda, (byte) 0x45, (byte) 0xa2, (byte) 0x32, 707 (byte) 0x69, (byte) 0xc0, (byte) 0x9f, (byte) 0xc4, (byte) 0x28, (byte) 0xc0, (byte) 0x7a, (byte) 0x4e, 708 (byte) 0x6e, (byte) 0xdf, (byte) 0x73, (byte) 0x8a, (byte) 0x15, (byte) 0xde, (byte) 0xc9, (byte) 0x7f, 709 (byte) 0xab, (byte) 0xd2, (byte) 0xf2, (byte) 0xbb, (byte) 0x47, (byte) 0xa1, (byte) 0x4f, (byte) 0x20, 710 (byte) 0xea, (byte) 0x72, (byte) 0xfc, (byte) 0xfe, (byte) 0x4c, (byte) 0x36, (byte) 0xe0, (byte) 0x1a, 711 (byte) 0xda, (byte) 0x77, (byte) 0xbd, (byte) 0x13, (byte) 0x7c, (byte) 0xd8, (byte) 0xd4, (byte) 0xda, 712 (byte) 0x10, (byte) 0xbb, (byte) 0x16, (byte) 0x2e, (byte) 0x94, (byte) 0xa4, (byte) 0x66, (byte) 0x29, 713 (byte) 0x71, (byte) 0xf1, (byte) 0x75, (byte) 0xf9, (byte) 0x85, (byte) 0xfa, (byte) 0x18, (byte) 0x8f, 714 (byte) 0x05, (byte) 0x6c, (byte) 0xb9, (byte) 0x7e, (byte) 0xe2, (byte) 0x81, (byte) 0x6f, (byte) 0x43, 715 (byte) 0xab, (byte) 0x9d, (byte) 0x37, (byte) 0x47, (byte) 0x61, (byte) 0x24, (byte) 0x86, (byte) 0xcd, 716 (byte) 0xa8, (byte) 0xc1, (byte) 0x61, (byte) 0x96, (byte) 0xc3, (byte) 0x08, (byte) 0x18, (byte) 0xa9, 717 (byte) 0x95, (byte) 0xec, (byte) 0x85, (byte) 0xd3, (byte) 0x84, (byte) 0x67, (byte) 0x79, (byte) 0x12, 718 (byte) 0x67, (byte) 0xb3, (byte) 0xbf, (byte) 0x21, (byte) 0xf2, (byte) 0x73, (byte) 0x71, (byte) 0x0a, 719 (byte) 0x69, (byte) 0x25, (byte) 0x86, (byte) 0x25, (byte) 0x76, (byte) 0x84, (byte) 0x1c, (byte) 0x5b, 720 (byte) 0x67, (byte) 0x12, (byte) 0xc1, (byte) 0x2d, (byte) 0x4b, (byte) 0xd2, (byte) 0x0a, (byte) 0x2f, 721 (byte) 0x32, (byte) 0x99, (byte) 0xad, (byte) 0xb7, (byte) 0xc1, (byte) 0x35, (byte) 0xda, (byte) 0x5e, 722 (byte) 0x95, (byte) 0x15, (byte) 0xab, (byte) 0xda, (byte) 0x76, (byte) 0xe7, (byte) 0xca, (byte) 0xf2, 723 (byte) 0xa3, (byte) 0xbe, (byte) 0x80, (byte) 0x55, (byte) 0x1d, (byte) 0x07, (byte) 0x3b, (byte) 0x78, 724 (byte) 0xbf, (byte) 0x11, (byte) 0x62, (byte) 0xc4, (byte) 0x8a, (byte) 0xd2, (byte) 0xb7, (byte) 0xf4, 725 (byte) 0x74, (byte) 0x3a, (byte) 0x02, (byte) 0x38, (byte) 0xee, (byte) 0x4d, (byte) 0x25, (byte) 0x2f, 726 (byte) 0x7d, (byte) 0x5e, (byte) 0x7e, (byte) 0x65, (byte) 0x33, (byte) 0xcc, (byte) 0xae, (byte) 0x64, 727 (byte) 0xcc, (byte) 0xb3, (byte) 0x93, (byte) 0x60, (byte) 0x07, (byte) 0x5a, (byte) 0x2f, (byte) 0xd1, 728 (byte) 0xe0, (byte) 0x34, (byte) 0xec, (byte) 0x3a, (byte) 0xe5, (byte) 0xce, (byte) 0x9c, (byte) 0x40, 729 (byte) 0x8c, (byte) 0xcb, (byte) 0xf0, (byte) 0xe2, (byte) 0x5e, (byte) 0x41, (byte) 0x14, (byte) 0x02, 730 (byte) 0x16, (byte) 0x87, (byte) 0xb3, (byte) 0xdd, (byte) 0x47, (byte) 0x54, (byte) 0xae, (byte) 0x81, 731 }); 732 733 private static final BigInteger RSA_2048_publicExponent = new BigInteger(new byte[] { 734 (byte) 0x01, (byte) 0x00, (byte) 0x01, 735 }); 736 737 private static final BigInteger RSA_2048_primeP = new BigInteger(new byte[] { 738 (byte) 0x00, (byte) 0xf5, (byte) 0x41, (byte) 0x88, (byte) 0x4b, (byte) 0xc3, (byte) 0x73, (byte) 0x7b, 739 (byte) 0x29, (byte) 0x22, (byte) 0xd4, (byte) 0x11, (byte) 0x9e, (byte) 0xf4, (byte) 0x5e, (byte) 0x2d, 740 (byte) 0xee, (byte) 0x2c, (byte) 0xd4, (byte) 0xcb, (byte) 0xb7, (byte) 0x5f, (byte) 0x45, (byte) 0x50, 741 (byte) 0x5a, (byte) 0x15, (byte) 0x7a, (byte) 0xa5, (byte) 0x00, (byte) 0x9f, (byte) 0x99, (byte) 0xc7, 742 (byte) 0x3a, (byte) 0x2d, (byte) 0xf0, (byte) 0x72, (byte) 0x4a, (byte) 0xc4, (byte) 0x60, (byte) 0x24, 743 (byte) 0x30, (byte) 0x63, (byte) 0x32, (byte) 0xea, (byte) 0x89, (byte) 0x81, (byte) 0x77, (byte) 0x63, 744 (byte) 0x45, (byte) 0x46, (byte) 0x5d, (byte) 0xc6, (byte) 0xdf, (byte) 0x1e, (byte) 0x0a, (byte) 0x6f, 745 (byte) 0x14, (byte) 0x0a, (byte) 0xff, (byte) 0x3b, (byte) 0x73, (byte) 0x96, (byte) 0xe6, (byte) 0xa8, 746 (byte) 0x99, (byte) 0x4a, (byte) 0xc5, (byte) 0xda, (byte) 0xa9, (byte) 0x68, (byte) 0x73, (byte) 0x47, 747 (byte) 0x2f, (byte) 0xe3, (byte) 0x77, (byte) 0x49, (byte) 0xd1, (byte) 0x4e, (byte) 0xb3, (byte) 0xe0, 748 (byte) 0x75, (byte) 0xe6, (byte) 0x29, (byte) 0xdb, (byte) 0xeb, (byte) 0x35, (byte) 0x83, (byte) 0x33, 749 (byte) 0x8a, (byte) 0x6f, (byte) 0x36, (byte) 0x49, (byte) 0xd0, (byte) 0xa2, (byte) 0x65, (byte) 0x4a, 750 (byte) 0x7a, (byte) 0x42, (byte) 0xfd, (byte) 0x9a, (byte) 0xb6, (byte) 0xbf, (byte) 0xa4, (byte) 0xac, 751 (byte) 0x4d, (byte) 0x48, (byte) 0x1d, (byte) 0x39, (byte) 0x0b, (byte) 0xb2, (byte) 0x29, (byte) 0xb0, 752 (byte) 0x64, (byte) 0xbd, (byte) 0xc3, (byte) 0x11, (byte) 0xcc, (byte) 0x1b, (byte) 0xe1, (byte) 0xb6, 753 (byte) 0x31, (byte) 0x89, (byte) 0xda, (byte) 0x7c, (byte) 0x40, (byte) 0xcd, (byte) 0xec, (byte) 0xf2, 754 (byte) 0xb1, 755 }); 756 757 private static final BigInteger RSA_2048_primeQ = new BigInteger(new byte[] { 758 (byte) 0x00, (byte) 0xea, (byte) 0x1a, (byte) 0x74, (byte) 0x2d, (byte) 0xdb, (byte) 0x88, (byte) 0x1c, 759 (byte) 0xed, (byte) 0xb7, (byte) 0x28, (byte) 0x8c, (byte) 0x87, (byte) 0xe3, (byte) 0x8d, (byte) 0x86, 760 (byte) 0x8d, (byte) 0xd7, (byte) 0xa4, (byte) 0x09, (byte) 0xd1, (byte) 0x5a, (byte) 0x43, (byte) 0xf4, 761 (byte) 0x45, (byte) 0xd5, (byte) 0x37, (byte) 0x7a, (byte) 0x0b, (byte) 0x57, (byte) 0x31, (byte) 0xdd, 762 (byte) 0xbf, (byte) 0xca, (byte) 0x2d, (byte) 0xaf, (byte) 0x28, (byte) 0xa8, (byte) 0xe1, (byte) 0x3c, 763 (byte) 0xd5, (byte) 0xc0, (byte) 0xaf, (byte) 0xce, (byte) 0xc3, (byte) 0x34, (byte) 0x7d, (byte) 0x74, 764 (byte) 0xa3, (byte) 0x9e, (byte) 0x23, (byte) 0x5a, (byte) 0x3c, (byte) 0xd9, (byte) 0x63, (byte) 0x3f, 765 (byte) 0x27, (byte) 0x4d, (byte) 0xe2, (byte) 0xb9, (byte) 0x4f, (byte) 0x92, (byte) 0xdf, (byte) 0x43, 766 (byte) 0x83, (byte) 0x39, (byte) 0x11, (byte) 0xd9, (byte) 0xe9, (byte) 0xf1, (byte) 0xcf, (byte) 0x58, 767 (byte) 0xf2, (byte) 0x7d, (byte) 0xe2, (byte) 0xe0, (byte) 0x8f, (byte) 0xf4, (byte) 0x59, (byte) 0x64, 768 (byte) 0xc7, (byte) 0x20, (byte) 0xd3, (byte) 0xec, (byte) 0x21, (byte) 0x39, (byte) 0xdc, (byte) 0x7c, 769 (byte) 0xaf, (byte) 0xc9, (byte) 0x12, (byte) 0x95, (byte) 0x3c, (byte) 0xde, (byte) 0xcb, (byte) 0x2f, 770 (byte) 0x35, (byte) 0x5a, (byte) 0x2e, (byte) 0x2c, (byte) 0x35, (byte) 0xa5, (byte) 0x0f, (byte) 0xad, 771 (byte) 0x75, (byte) 0x4c, (byte) 0xb3, (byte) 0xb2, (byte) 0x31, (byte) 0x66, (byte) 0x42, (byte) 0x4b, 772 (byte) 0xa3, (byte) 0xb6, (byte) 0xe3, (byte) 0x11, (byte) 0x2a, (byte) 0x2b, (byte) 0x89, (byte) 0x8c, 773 (byte) 0x38, (byte) 0xc5, (byte) 0xc1, (byte) 0x5e, (byte) 0xdb, (byte) 0x23, (byte) 0x86, (byte) 0x93, 774 (byte) 0x39, 775 }); 776 777 /* Test data is: "Android.\n" */ 778 private static final byte[] Vector1Data = new byte[] { 779 (byte) 0x41, (byte) 0x6e, (byte) 0x64, (byte) 0x72, (byte) 0x6f, (byte) 0x69, (byte) 0x64, (byte) 0x2e, 780 (byte) 0x0a, 781 }; 782 783 private static final byte[] SHA1withRSA_Vector1Signature = { 784 (byte) 0x6d, (byte) 0x5b, (byte) 0xff, (byte) 0x68, (byte) 0xda, (byte) 0x18, (byte) 0x98, (byte) 0x72, 785 (byte) 0x5c, (byte) 0x1f, (byte) 0x46, (byte) 0x51, (byte) 0x77, (byte) 0x15, (byte) 0x11, (byte) 0xcb, 786 (byte) 0xe0, (byte) 0xb9, (byte) 0x3b, (byte) 0x7d, (byte) 0xf5, (byte) 0x96, (byte) 0x98, (byte) 0x24, 787 (byte) 0x85, (byte) 0x9d, (byte) 0x3e, (byte) 0xed, (byte) 0x9b, (byte) 0xb2, (byte) 0x8a, (byte) 0x91, 788 (byte) 0xfb, (byte) 0xf6, (byte) 0x85, (byte) 0x64, (byte) 0x74, (byte) 0x18, (byte) 0xb5, (byte) 0x1c, 789 (byte) 0xb3, (byte) 0x8d, (byte) 0x99, (byte) 0x0d, (byte) 0xdf, (byte) 0xaa, (byte) 0xa6, (byte) 0xa1, 790 (byte) 0xc3, (byte) 0xb6, (byte) 0x25, (byte) 0xb3, (byte) 0x06, (byte) 0xe0, (byte) 0xef, (byte) 0x28, 791 (byte) 0xb0, (byte) 0x4d, (byte) 0x50, (byte) 0xc7, (byte) 0x75, (byte) 0x39, (byte) 0xb9, (byte) 0x2c, 792 (byte) 0x47, (byte) 0xb5, (byte) 0xe2, (byte) 0x96, (byte) 0xf8, (byte) 0xf6, (byte) 0xcb, (byte) 0xa0, 793 (byte) 0x58, (byte) 0xc9, (byte) 0x3e, (byte) 0xd5, (byte) 0xfc, (byte) 0x26, (byte) 0xd9, (byte) 0x55, 794 (byte) 0x73, (byte) 0x39, (byte) 0x75, (byte) 0xb3, (byte) 0xb0, (byte) 0x0a, (byte) 0x5f, (byte) 0x5e, 795 (byte) 0x3b, (byte) 0x4a, (byte) 0x2e, (byte) 0xb1, (byte) 0x0e, (byte) 0x7d, (byte) 0xe5, (byte) 0xcc, 796 (byte) 0x04, (byte) 0x2c, (byte) 0xd1, (byte) 0x0a, (byte) 0x32, (byte) 0xaa, (byte) 0xd9, (byte) 0x8d, 797 (byte) 0x1f, (byte) 0xcb, (byte) 0xe3, (byte) 0x7f, (byte) 0x63, (byte) 0x12, (byte) 0xb1, (byte) 0x98, 798 (byte) 0x46, (byte) 0x46, (byte) 0x07, (byte) 0xd9, (byte) 0x49, (byte) 0xd2, (byte) 0xbf, (byte) 0xb5, 799 (byte) 0xbc, (byte) 0xbb, (byte) 0xfd, (byte) 0x1c, (byte) 0xd7, (byte) 0x11, (byte) 0x94, (byte) 0xaa, 800 (byte) 0x5f, (byte) 0x7b, (byte) 0xb2, (byte) 0x0c, (byte) 0x5d, (byte) 0x94, (byte) 0x53, (byte) 0x5e, 801 (byte) 0x81, (byte) 0x5c, (byte) 0xbb, (byte) 0x1d, (byte) 0x4f, (byte) 0x30, (byte) 0xcd, (byte) 0xf8, 802 (byte) 0xd7, (byte) 0xa5, (byte) 0xfa, (byte) 0x5e, (byte) 0xe0, (byte) 0x19, (byte) 0x3f, (byte) 0xa4, 803 (byte) 0xaa, (byte) 0x56, (byte) 0x4e, (byte) 0xec, (byte) 0xeb, (byte) 0xee, (byte) 0xa2, (byte) 0x6c, 804 (byte) 0xc9, (byte) 0x4f, (byte) 0xc2, (byte) 0xcc, (byte) 0x2a, (byte) 0xbc, (byte) 0x5b, (byte) 0x09, 805 (byte) 0x10, (byte) 0x73, (byte) 0x61, (byte) 0x0c, (byte) 0x04, (byte) 0xb6, (byte) 0xb7, (byte) 0x2c, 806 (byte) 0x37, (byte) 0xd2, (byte) 0xca, (byte) 0x2d, (byte) 0x54, (byte) 0xf2, (byte) 0xf7, (byte) 0x77, 807 (byte) 0xe1, (byte) 0xba, (byte) 0x9f, (byte) 0x29, (byte) 0x07, (byte) 0xa2, (byte) 0x74, (byte) 0xc6, 808 (byte) 0xe9, (byte) 0x1e, (byte) 0xde, (byte) 0xd7, (byte) 0x9c, (byte) 0x4b, (byte) 0xb7, (byte) 0x66, 809 (byte) 0x52, (byte) 0xe8, (byte) 0xac, (byte) 0xf6, (byte) 0x76, (byte) 0xab, (byte) 0x16, (byte) 0x82, 810 (byte) 0x96, (byte) 0x87, (byte) 0x40, (byte) 0x0f, (byte) 0xad, (byte) 0x2d, (byte) 0x46, (byte) 0xa6, 811 (byte) 0x28, (byte) 0x04, (byte) 0x13, (byte) 0xc2, (byte) 0xce, (byte) 0x50, (byte) 0x56, (byte) 0x6d, 812 (byte) 0xbe, (byte) 0x0c, (byte) 0x91, (byte) 0xd0, (byte) 0x8e, (byte) 0x80, (byte) 0x9e, (byte) 0x91, 813 (byte) 0x8f, (byte) 0x62, (byte) 0xb3, (byte) 0x57, (byte) 0xd6, (byte) 0xae, (byte) 0x53, (byte) 0x91, 814 (byte) 0x83, (byte) 0xe9, (byte) 0x38, (byte) 0x77, (byte) 0x8f, (byte) 0x20, (byte) 0xdd, (byte) 0x13, 815 (byte) 0x7d, (byte) 0x15, (byte) 0x44, (byte) 0x7e, (byte) 0xb5, (byte) 0x00, (byte) 0xd6, (byte) 0x45, 816 }; 817 818 private static final byte[] Vector2Data = new byte[] { 819 (byte) 0x54, (byte) 0x68, (byte) 0x69, (byte) 0x73, (byte) 0x20, (byte) 0x69, (byte) 0x73, (byte) 0x20, 820 (byte) 0x61, (byte) 0x20, (byte) 0x73, (byte) 0x69, (byte) 0x67, (byte) 0x6e, (byte) 0x65, (byte) 0x64, 821 (byte) 0x20, (byte) 0x6d, (byte) 0x65, (byte) 0x73, (byte) 0x73, (byte) 0x61, (byte) 0x67, (byte) 0x65, 822 (byte) 0x20, (byte) 0x66, (byte) 0x72, (byte) 0x6f, (byte) 0x6d, (byte) 0x20, (byte) 0x4b, (byte) 0x65, 823 (byte) 0x6e, (byte) 0x6e, (byte) 0x79, (byte) 0x20, (byte) 0x52, (byte) 0x6f, (byte) 0x6f, (byte) 0x74, 824 (byte) 0x2e, (byte) 0x0a, 825 }; 826 827 private static final byte[] SHA1withRSA_Vector2Signature = new byte[] { 828 (byte) 0x2e, (byte) 0xa6, (byte) 0x33, (byte) 0xd1, (byte) 0x9d, (byte) 0xfc, (byte) 0x4e, (byte) 0x27, 829 (byte) 0xb3, (byte) 0xa8, (byte) 0x9a, (byte) 0xf2, (byte) 0x48, (byte) 0x62, (byte) 0x15, (byte) 0xa2, 830 (byte) 0xce, (byte) 0x5f, (byte) 0x2b, (byte) 0x0e, (byte) 0xc5, (byte) 0x26, (byte) 0xba, (byte) 0xd9, 831 (byte) 0x0f, (byte) 0x60, (byte) 0xeb, (byte) 0xf0, (byte) 0xd5, (byte) 0x5c, (byte) 0x6b, (byte) 0x23, 832 (byte) 0x11, (byte) 0x95, (byte) 0xa4, (byte) 0xbd, (byte) 0x11, (byte) 0x68, (byte) 0xe7, (byte) 0x3a, 833 (byte) 0x37, (byte) 0x3d, (byte) 0x79, (byte) 0xb8, (byte) 0x4f, (byte) 0xe9, (byte) 0xa1, (byte) 0x88, 834 (byte) 0xfb, (byte) 0xa9, (byte) 0x8b, (byte) 0x34, (byte) 0xa1, (byte) 0xe0, (byte) 0xca, (byte) 0x11, 835 (byte) 0xdd, (byte) 0xd0, (byte) 0x83, (byte) 0x7f, (byte) 0xc1, (byte) 0x0b, (byte) 0x16, (byte) 0x61, 836 (byte) 0xac, (byte) 0x09, (byte) 0xa2, (byte) 0xdd, (byte) 0x40, (byte) 0x5b, (byte) 0x8c, (byte) 0x7a, 837 (byte) 0xb2, (byte) 0xb4, (byte) 0x02, (byte) 0x7c, (byte) 0xd4, (byte) 0x9a, (byte) 0xe6, (byte) 0xa5, 838 (byte) 0x1a, (byte) 0x27, (byte) 0x77, (byte) 0x70, (byte) 0xe3, (byte) 0xe3, (byte) 0x71, (byte) 0xc7, 839 (byte) 0x59, (byte) 0xc7, (byte) 0x9f, (byte) 0xb8, (byte) 0xef, (byte) 0xe7, (byte) 0x15, (byte) 0x02, 840 (byte) 0x0d, (byte) 0x70, (byte) 0xdc, (byte) 0x2c, (byte) 0xe9, (byte) 0xf7, (byte) 0x63, (byte) 0x2a, 841 (byte) 0xb5, (byte) 0xee, (byte) 0x9f, (byte) 0x29, (byte) 0x56, (byte) 0x86, (byte) 0x99, (byte) 0xb3, 842 (byte) 0x0f, (byte) 0xe5, (byte) 0x1f, (byte) 0x76, (byte) 0x22, (byte) 0x3b, (byte) 0x7f, (byte) 0xa9, 843 (byte) 0x9e, (byte) 0xd4, (byte) 0xc4, (byte) 0x83, (byte) 0x5d, (byte) 0x57, (byte) 0xcc, (byte) 0x37, 844 (byte) 0xcb, (byte) 0x9a, (byte) 0x9e, (byte) 0x73, (byte) 0x44, (byte) 0x93, (byte) 0xb4, (byte) 0xf1, 845 (byte) 0x6b, (byte) 0x98, (byte) 0xa0, (byte) 0x57, (byte) 0xbb, (byte) 0x5e, (byte) 0x8f, (byte) 0x89, 846 (byte) 0x5b, (byte) 0x97, (byte) 0x26, (byte) 0xe4, (byte) 0xd0, (byte) 0x51, (byte) 0x0a, (byte) 0x5a, 847 (byte) 0xb7, (byte) 0x12, (byte) 0x1a, (byte) 0x6d, (byte) 0xb0, (byte) 0x79, (byte) 0x30, (byte) 0x51, 848 (byte) 0x83, (byte) 0x2e, (byte) 0xe2, (byte) 0x7a, (byte) 0x67, (byte) 0x66, (byte) 0xd3, (byte) 0x95, 849 (byte) 0xca, (byte) 0xfc, (byte) 0xcb, (byte) 0x92, (byte) 0x79, (byte) 0x32, (byte) 0x26, (byte) 0x86, 850 (byte) 0xe1, (byte) 0x0d, (byte) 0xd8, (byte) 0x19, (byte) 0xfa, (byte) 0x65, (byte) 0x37, (byte) 0xc9, 851 (byte) 0x4c, (byte) 0x2a, (byte) 0xe1, (byte) 0x42, (byte) 0xc7, (byte) 0xd4, (byte) 0xb7, (byte) 0xeb, 852 (byte) 0x1f, (byte) 0xc3, (byte) 0x53, (byte) 0x64, (byte) 0x6f, (byte) 0x2b, (byte) 0x78, (byte) 0x18, 853 (byte) 0x03, (byte) 0xda, (byte) 0x8d, (byte) 0x62, (byte) 0x24, (byte) 0x70, (byte) 0xab, (byte) 0xe6, 854 (byte) 0x16, (byte) 0x13, (byte) 0x24, (byte) 0x6b, (byte) 0x5f, (byte) 0xd3, (byte) 0xec, (byte) 0xc1, 855 (byte) 0x58, (byte) 0x64, (byte) 0xbd, (byte) 0x30, (byte) 0x98, (byte) 0x5e, (byte) 0x33, (byte) 0xce, 856 (byte) 0x87, (byte) 0x64, (byte) 0x14, (byte) 0x07, (byte) 0x85, (byte) 0x43, (byte) 0x3e, (byte) 0x9f, 857 (byte) 0x27, (byte) 0x9f, (byte) 0x63, (byte) 0x66, (byte) 0x9d, (byte) 0x26, (byte) 0x19, (byte) 0xc0, 858 (byte) 0x02, (byte) 0x08, (byte) 0x15, (byte) 0xcb, (byte) 0xb4, (byte) 0xaa, (byte) 0x4a, (byte) 0xc8, 859 (byte) 0xc0, (byte) 0x09, (byte) 0x15, (byte) 0x7d, (byte) 0x8a, (byte) 0x21, (byte) 0xbc, (byte) 0xa3, 860 }; 861 862 /* 863 * echo 'Android.' | openssl dgst -sha224 -binary -sign privkey.pem | recode ../x1 | sed 's/0x/(byte) 0x/g' 864 */ 865 private static final byte[] SHA224withRSA_Vector2Signature = new byte[] { 866 (byte) 0xBD, (byte) 0x3F, (byte) 0xD4, (byte) 0x20, (byte) 0x5B, (byte) 0xC0, (byte) 0x89, (byte) 0x4F, 867 (byte) 0x99, (byte) 0x6C, (byte) 0xF4, (byte) 0xA4, (byte) 0x70, (byte) 0xE3, (byte) 0x5B, (byte) 0x33, 868 (byte) 0xB3, (byte) 0xCA, (byte) 0xFE, (byte) 0x1F, (byte) 0xB9, (byte) 0x3A, (byte) 0xD6, (byte) 0x9B, 869 (byte) 0x1E, (byte) 0xDA, (byte) 0x65, (byte) 0x06, (byte) 0xBD, (byte) 0xC3, (byte) 0x2B, (byte) 0xF8, 870 (byte) 0x0E, (byte) 0xA0, (byte) 0xB5, (byte) 0x33, (byte) 0x7F, (byte) 0x15, (byte) 0xDC, (byte) 0xBB, 871 (byte) 0xDC, (byte) 0x98, (byte) 0x96, (byte) 0xF5, (byte) 0xF8, (byte) 0xE5, (byte) 0x55, (byte) 0x7D, 872 (byte) 0x48, (byte) 0x51, (byte) 0xC5, (byte) 0xAE, (byte) 0x12, (byte) 0xA2, (byte) 0x61, (byte) 0xC7, 873 (byte) 0xA2, (byte) 0x00, (byte) 0x0F, (byte) 0x35, (byte) 0x54, (byte) 0x3C, (byte) 0x7E, (byte) 0x97, 874 (byte) 0x19, (byte) 0x2D, (byte) 0x8F, (byte) 0xFD, (byte) 0x51, (byte) 0x04, (byte) 0x72, (byte) 0x23, 875 (byte) 0x65, (byte) 0x16, (byte) 0x41, (byte) 0x12, (byte) 0x46, (byte) 0xD6, (byte) 0x20, (byte) 0xB6, 876 (byte) 0x4E, (byte) 0xD6, (byte) 0xE8, (byte) 0x60, (byte) 0x91, (byte) 0x05, (byte) 0xCA, (byte) 0x57, 877 (byte) 0x6F, (byte) 0x53, (byte) 0xA4, (byte) 0x05, (byte) 0x2A, (byte) 0x37, (byte) 0xDD, (byte) 0x2E, 878 (byte) 0xA4, (byte) 0xC7, (byte) 0xBF, (byte) 0x9E, (byte) 0xF6, (byte) 0xD5, (byte) 0xD4, (byte) 0x34, 879 (byte) 0xB8, (byte) 0xB3, (byte) 0x8B, (byte) 0x66, (byte) 0x2C, (byte) 0xB6, (byte) 0x5F, (byte) 0xA4, 880 (byte) 0xB7, (byte) 0x77, (byte) 0xF8, (byte) 0x9A, (byte) 0x9C, (byte) 0x44, (byte) 0x9F, (byte) 0xF0, 881 (byte) 0xCA, (byte) 0x53, (byte) 0x56, (byte) 0x2F, (byte) 0x99, (byte) 0x2E, (byte) 0x4B, (byte) 0xA2, 882 (byte) 0x26, (byte) 0x50, (byte) 0x30, (byte) 0x97, (byte) 0x2B, (byte) 0x4B, (byte) 0x0C, (byte) 0x3E, 883 (byte) 0x28, (byte) 0x0B, (byte) 0x88, (byte) 0x87, (byte) 0x9E, (byte) 0xCE, (byte) 0xCB, (byte) 0x57, 884 (byte) 0x72, (byte) 0x6B, (byte) 0xF6, (byte) 0xD6, (byte) 0xAA, (byte) 0x4D, (byte) 0x5F, (byte) 0x19, 885 (byte) 0x7A, (byte) 0xAD, (byte) 0x44, (byte) 0x09, (byte) 0x33, (byte) 0x62, (byte) 0xC8, (byte) 0x56, 886 (byte) 0x82, (byte) 0x84, (byte) 0xBF, (byte) 0x52, (byte) 0xC6, (byte) 0xA2, (byte) 0x2B, (byte) 0xE3, 887 (byte) 0xC2, (byte) 0x7F, (byte) 0xE3, (byte) 0x06, (byte) 0xC3, (byte) 0x30, (byte) 0xB8, (byte) 0xD4, 888 (byte) 0x01, (byte) 0xE6, (byte) 0x3D, (byte) 0xDB, (byte) 0xCA, (byte) 0xE4, (byte) 0xFB, (byte) 0xA8, 889 (byte) 0x7B, (byte) 0x2D, (byte) 0x8F, (byte) 0x39, (byte) 0x7A, (byte) 0x63, (byte) 0x9F, (byte) 0x02, 890 (byte) 0xE8, (byte) 0x91, (byte) 0xD1, (byte) 0xEE, (byte) 0x60, (byte) 0xEE, (byte) 0xCA, (byte) 0xF2, 891 (byte) 0x33, (byte) 0x7D, (byte) 0xF2, (byte) 0x41, (byte) 0x52, (byte) 0x0B, (byte) 0x9B, (byte) 0x1B, 892 (byte) 0x2D, (byte) 0x89, (byte) 0x38, (byte) 0xEC, (byte) 0x24, (byte) 0x60, (byte) 0x40, (byte) 0x40, 893 (byte) 0x6F, (byte) 0xB6, (byte) 0x6F, (byte) 0x86, (byte) 0xB5, (byte) 0x0A, (byte) 0x3D, (byte) 0x98, 894 (byte) 0x77, (byte) 0x3F, (byte) 0x59, (byte) 0x41, (byte) 0x3E, (byte) 0x4D, (byte) 0xE4, (byte) 0x4E, 895 (byte) 0x91, (byte) 0xCD, (byte) 0x8E, (byte) 0x33, (byte) 0x60, (byte) 0x16, (byte) 0x8D, (byte) 0xAB, 896 (byte) 0x04, (byte) 0x14, (byte) 0xE8, (byte) 0x76, (byte) 0xF1, (byte) 0x06, (byte) 0xCD, (byte) 0x4A, 897 (byte) 0x88, (byte) 0xC7, (byte) 0x69, (byte) 0x6B, (byte) 0xC6, (byte) 0xDA, (byte) 0x9E, (byte) 0x09 898 }; 899 900 private static final byte[] SHA256withRSA_Vector2Signature = new byte[] { 901 (byte) 0x18, (byte) 0x6e, (byte) 0x31, (byte) 0x1f, (byte) 0x1d, (byte) 0x44, (byte) 0x09, (byte) 0x3e, 902 (byte) 0xa0, (byte) 0xc4, (byte) 0x3d, (byte) 0xb4, (byte) 0x1b, (byte) 0xf2, (byte) 0xd8, (byte) 0xa4, 903 (byte) 0x59, (byte) 0xab, (byte) 0xb5, (byte) 0x37, (byte) 0x28, (byte) 0xb8, (byte) 0x94, (byte) 0x6b, 904 (byte) 0x6f, (byte) 0x13, (byte) 0x54, (byte) 0xff, (byte) 0xac, (byte) 0x15, (byte) 0x84, (byte) 0xd0, 905 (byte) 0xc9, (byte) 0x15, (byte) 0x5b, (byte) 0x69, (byte) 0x05, (byte) 0xf1, (byte) 0x44, (byte) 0xfd, 906 (byte) 0xde, (byte) 0xe8, (byte) 0xb4, (byte) 0x12, (byte) 0x59, (byte) 0x9e, (byte) 0x4c, (byte) 0x0b, 907 (byte) 0xd5, (byte) 0x49, (byte) 0x33, (byte) 0x28, (byte) 0xe0, (byte) 0xcb, (byte) 0x87, (byte) 0x85, 908 (byte) 0xd8, (byte) 0x18, (byte) 0x6f, (byte) 0xfe, (byte) 0xa2, (byte) 0x23, (byte) 0x82, (byte) 0xf0, 909 (byte) 0xe5, (byte) 0x39, (byte) 0x1b, (byte) 0x8c, (byte) 0x93, (byte) 0x11, (byte) 0x49, (byte) 0x72, 910 (byte) 0x2a, (byte) 0x5b, (byte) 0x25, (byte) 0xff, (byte) 0x4e, (byte) 0x88, (byte) 0x70, (byte) 0x9d, 911 (byte) 0x9d, (byte) 0xff, (byte) 0xe2, (byte) 0xc0, (byte) 0x7e, (byte) 0xc8, (byte) 0x03, (byte) 0x40, 912 (byte) 0xbe, (byte) 0x44, (byte) 0x09, (byte) 0xeb, (byte) 0x9e, (byte) 0x8e, (byte) 0x88, (byte) 0xe4, 913 (byte) 0x98, (byte) 0x82, (byte) 0x06, (byte) 0xa4, (byte) 0x9d, (byte) 0x63, (byte) 0x88, (byte) 0x65, 914 (byte) 0xa3, (byte) 0x8e, (byte) 0x0d, (byte) 0x22, (byte) 0xf3, (byte) 0x33, (byte) 0xf2, (byte) 0x40, 915 (byte) 0xe8, (byte) 0x91, (byte) 0x67, (byte) 0x72, (byte) 0x29, (byte) 0x1c, (byte) 0x08, (byte) 0xff, 916 (byte) 0x54, (byte) 0xa0, (byte) 0xcc, (byte) 0xad, (byte) 0x84, (byte) 0x88, (byte) 0x4b, (byte) 0x3b, 917 (byte) 0xef, (byte) 0xf9, (byte) 0x5e, (byte) 0xb3, (byte) 0x41, (byte) 0x6a, (byte) 0xbd, (byte) 0x94, 918 (byte) 0x16, (byte) 0x7d, (byte) 0x9d, (byte) 0x53, (byte) 0x77, (byte) 0xf1, (byte) 0x6a, (byte) 0x95, 919 (byte) 0x57, (byte) 0xad, (byte) 0x65, (byte) 0x9d, (byte) 0x75, (byte) 0x95, (byte) 0xf6, (byte) 0x6a, 920 (byte) 0xd2, (byte) 0x88, (byte) 0xea, (byte) 0x5b, (byte) 0xa2, (byte) 0x94, (byte) 0x8f, (byte) 0x5e, 921 (byte) 0x84, (byte) 0x18, (byte) 0x19, (byte) 0x46, (byte) 0x83, (byte) 0x0b, (byte) 0x6d, (byte) 0x5b, 922 (byte) 0xb9, (byte) 0xdb, (byte) 0xa4, (byte) 0xe5, (byte) 0x17, (byte) 0x02, (byte) 0x9e, (byte) 0x11, 923 (byte) 0xed, (byte) 0xd9, (byte) 0x7b, (byte) 0x83, (byte) 0x87, (byte) 0x89, (byte) 0xf3, (byte) 0xe4, 924 (byte) 0xbf, (byte) 0x0e, (byte) 0xe8, (byte) 0xdc, (byte) 0x55, (byte) 0x9c, (byte) 0xf7, (byte) 0xc9, 925 (byte) 0xc3, (byte) 0xe2, (byte) 0x2c, (byte) 0xf7, (byte) 0x8c, (byte) 0xaa, (byte) 0x17, (byte) 0x1f, 926 (byte) 0xd1, (byte) 0xc7, (byte) 0x74, (byte) 0xc7, (byte) 0x8e, (byte) 0x1c, (byte) 0x5b, (byte) 0xd2, 927 (byte) 0x31, (byte) 0x74, (byte) 0x43, (byte) 0x9a, (byte) 0x52, (byte) 0xbf, (byte) 0x89, (byte) 0xc5, 928 (byte) 0xb4, (byte) 0x80, (byte) 0x6a, (byte) 0x9e, (byte) 0x05, (byte) 0xdb, (byte) 0xbb, (byte) 0x07, 929 (byte) 0x8c, (byte) 0x08, (byte) 0x61, (byte) 0xba, (byte) 0xa4, (byte) 0xbc, (byte) 0x80, (byte) 0x3a, 930 (byte) 0xdd, (byte) 0x3b, (byte) 0x1a, (byte) 0x8c, (byte) 0x21, (byte) 0xd8, (byte) 0xa3, (byte) 0xc0, 931 (byte) 0xc7, (byte) 0xd1, (byte) 0x08, (byte) 0xe1, (byte) 0x34, (byte) 0x99, (byte) 0xc0, (byte) 0xcf, 932 (byte) 0x80, (byte) 0xff, (byte) 0xfa, (byte) 0x07, (byte) 0xef, (byte) 0x5c, (byte) 0x45, (byte) 0xe5, 933 }; 934 935 private static final byte[] SHA384withRSA_Vector2Signature = new byte[] { 936 (byte) 0xaf, (byte) 0xf7, (byte) 0x7a, (byte) 0xc2, (byte) 0xbb, (byte) 0xb8, (byte) 0xbd, (byte) 0xe3, 937 (byte) 0x42, (byte) 0xaa, (byte) 0x16, (byte) 0x8a, (byte) 0x52, (byte) 0x6c, (byte) 0x99, (byte) 0x66, 938 (byte) 0x08, (byte) 0xbe, (byte) 0x15, (byte) 0xd9, (byte) 0x7c, (byte) 0x60, (byte) 0x2c, (byte) 0xac, 939 (byte) 0x4d, (byte) 0x4c, (byte) 0xf4, (byte) 0xdf, (byte) 0xbc, (byte) 0x16, (byte) 0x58, (byte) 0x0a, 940 (byte) 0x4e, (byte) 0xde, (byte) 0x8d, (byte) 0xb3, (byte) 0xbd, (byte) 0x03, (byte) 0x4e, (byte) 0x23, 941 (byte) 0x40, (byte) 0xa5, (byte) 0x80, (byte) 0xae, (byte) 0x83, (byte) 0xb4, (byte) 0x0f, (byte) 0x99, 942 (byte) 0x44, (byte) 0xc3, (byte) 0x5e, (byte) 0xdb, (byte) 0x59, (byte) 0x1d, (byte) 0xea, (byte) 0x7b, 943 (byte) 0x4d, (byte) 0xf3, (byte) 0xd2, (byte) 0xad, (byte) 0xbd, (byte) 0x21, (byte) 0x9f, (byte) 0x8e, 944 (byte) 0x87, (byte) 0x8f, (byte) 0x12, (byte) 0x13, (byte) 0x33, (byte) 0xf1, (byte) 0xc0, (byte) 0x9d, 945 (byte) 0xe7, (byte) 0xec, (byte) 0x6e, (byte) 0xad, (byte) 0xea, (byte) 0x5d, (byte) 0x69, (byte) 0xbb, 946 (byte) 0xab, (byte) 0x5b, (byte) 0xd8, (byte) 0x55, (byte) 0x56, (byte) 0xc8, (byte) 0xda, (byte) 0x81, 947 (byte) 0x41, (byte) 0xfb, (byte) 0xd3, (byte) 0x11, (byte) 0x6c, (byte) 0x97, (byte) 0xa7, (byte) 0xc3, 948 (byte) 0xf1, (byte) 0x31, (byte) 0xbf, (byte) 0xbe, (byte) 0x3f, (byte) 0xdb, (byte) 0x35, (byte) 0x85, 949 (byte) 0xb7, (byte) 0xb0, (byte) 0x75, (byte) 0x7f, (byte) 0xaf, (byte) 0xfb, (byte) 0x65, (byte) 0x61, 950 (byte) 0xc7, (byte) 0x0e, (byte) 0x63, (byte) 0xb5, (byte) 0x7d, (byte) 0x95, (byte) 0xe9, (byte) 0x16, 951 (byte) 0x9d, (byte) 0x6a, (byte) 0x00, (byte) 0x9f, (byte) 0x5e, (byte) 0xcd, (byte) 0xff, (byte) 0xa6, 952 (byte) 0xbc, (byte) 0x71, (byte) 0xf2, (byte) 0x2c, (byte) 0xd3, (byte) 0x68, (byte) 0xb9, (byte) 0x3f, 953 (byte) 0xaa, (byte) 0x06, (byte) 0xf1, (byte) 0x9c, (byte) 0x7e, (byte) 0xca, (byte) 0x4a, (byte) 0xfe, 954 (byte) 0xb1, (byte) 0x73, (byte) 0x19, (byte) 0x80, (byte) 0x05, (byte) 0xa6, (byte) 0x85, (byte) 0x14, 955 (byte) 0xda, (byte) 0x7a, (byte) 0x16, (byte) 0x7a, (byte) 0xc2, (byte) 0x46, (byte) 0x57, (byte) 0xa7, 956 (byte) 0xc0, (byte) 0xbf, (byte) 0xcd, (byte) 0xdc, (byte) 0x2f, (byte) 0x64, (byte) 0xf6, (byte) 0x6d, 957 (byte) 0xdc, (byte) 0xcb, (byte) 0x5a, (byte) 0x29, (byte) 0x95, (byte) 0x1c, (byte) 0xfe, (byte) 0xf2, 958 (byte) 0xda, (byte) 0x7e, (byte) 0xcb, (byte) 0x26, (byte) 0x12, (byte) 0xc6, (byte) 0xb0, (byte) 0xba, 959 (byte) 0x84, (byte) 0x9b, (byte) 0x4f, (byte) 0xba, (byte) 0x1b, (byte) 0x78, (byte) 0x25, (byte) 0xb8, 960 (byte) 0x8f, (byte) 0x2e, (byte) 0x51, (byte) 0x5f, (byte) 0x9e, (byte) 0xfc, (byte) 0x40, (byte) 0xbc, 961 (byte) 0x85, (byte) 0xcd, (byte) 0x86, (byte) 0x7f, (byte) 0x88, (byte) 0xc5, (byte) 0xaa, (byte) 0x2b, 962 (byte) 0x78, (byte) 0xb1, (byte) 0x9c, (byte) 0x51, (byte) 0x9a, (byte) 0xe1, (byte) 0xe1, (byte) 0xc0, 963 (byte) 0x40, (byte) 0x47, (byte) 0xcb, (byte) 0xa4, (byte) 0xb7, (byte) 0x6c, (byte) 0x31, (byte) 0xf2, 964 (byte) 0xc8, (byte) 0x9a, (byte) 0xad, (byte) 0x0b, (byte) 0xd3, (byte) 0xf6, (byte) 0x85, (byte) 0x9a, 965 (byte) 0x8f, (byte) 0x4f, (byte) 0xc9, (byte) 0xd8, (byte) 0x33, (byte) 0x7c, (byte) 0x45, (byte) 0x30, 966 (byte) 0xea, (byte) 0x17, (byte) 0xd3, (byte) 0xe3, (byte) 0x90, (byte) 0x2c, (byte) 0xda, (byte) 0xde, 967 (byte) 0x41, (byte) 0x17, (byte) 0x3f, (byte) 0x08, (byte) 0xb9, (byte) 0x34, (byte) 0xc0, (byte) 0xd1, 968 }; 969 970 private static final byte[] SHA512withRSA_Vector2Signature = new byte[] { 971 (byte) 0x19, (byte) 0xe2, (byte) 0xe5, (byte) 0xf3, (byte) 0x18, (byte) 0x83, (byte) 0xec, (byte) 0xf0, 972 (byte) 0xab, (byte) 0x50, (byte) 0x05, (byte) 0x4b, (byte) 0x5f, (byte) 0x22, (byte) 0xfc, (byte) 0x82, 973 (byte) 0x6d, (byte) 0xca, (byte) 0xe7, (byte) 0xbe, (byte) 0x23, (byte) 0x94, (byte) 0xfa, (byte) 0xf9, 974 (byte) 0xa4, (byte) 0x8a, (byte) 0x95, (byte) 0x4d, (byte) 0x14, (byte) 0x08, (byte) 0x8b, (byte) 0x5e, 975 (byte) 0x03, (byte) 0x1b, (byte) 0x74, (byte) 0xde, (byte) 0xc1, (byte) 0x45, (byte) 0x9c, (byte) 0xce, 976 (byte) 0x1d, (byte) 0xac, (byte) 0xab, (byte) 0xd3, (byte) 0xa8, (byte) 0xc3, (byte) 0xca, (byte) 0x67, 977 (byte) 0x80, (byte) 0xf6, (byte) 0x03, (byte) 0x46, (byte) 0x65, (byte) 0x77, (byte) 0x59, (byte) 0xbb, 978 (byte) 0xb8, (byte) 0x83, (byte) 0xee, (byte) 0xc2, (byte) 0x3e, (byte) 0x78, (byte) 0xdd, (byte) 0x89, 979 (byte) 0xcd, (byte) 0x9b, (byte) 0x78, (byte) 0x35, (byte) 0xa9, (byte) 0x09, (byte) 0xc8, (byte) 0x77, 980 (byte) 0xdd, (byte) 0xd3, (byte) 0xa0, (byte) 0x64, (byte) 0xb0, (byte) 0x74, (byte) 0x48, (byte) 0x51, 981 (byte) 0x4f, (byte) 0xa0, (byte) 0xae, (byte) 0x33, (byte) 0xb3, (byte) 0x28, (byte) 0xb0, (byte) 0xa8, 982 (byte) 0x78, (byte) 0x8f, (byte) 0xa2, (byte) 0x32, (byte) 0xa6, (byte) 0x0a, (byte) 0xaa, (byte) 0x09, 983 (byte) 0xb5, (byte) 0x8d, (byte) 0x4c, (byte) 0x44, (byte) 0x46, (byte) 0xb4, (byte) 0xd2, (byte) 0x06, 984 (byte) 0x6b, (byte) 0x8c, (byte) 0x51, (byte) 0x6e, (byte) 0x9c, (byte) 0xfa, (byte) 0x1f, (byte) 0x94, 985 (byte) 0x3e, (byte) 0x19, (byte) 0x9c, (byte) 0x63, (byte) 0xfe, (byte) 0xa9, (byte) 0x9a, (byte) 0xe3, 986 (byte) 0x6c, (byte) 0x82, (byte) 0x64, (byte) 0x5f, (byte) 0xca, (byte) 0xc2, (byte) 0x8d, (byte) 0x66, 987 (byte) 0xbe, (byte) 0x12, (byte) 0x6e, (byte) 0xb6, (byte) 0x35, (byte) 0x6d, (byte) 0xaa, (byte) 0xed, 988 (byte) 0x4b, (byte) 0x50, (byte) 0x08, (byte) 0x1c, (byte) 0xbf, (byte) 0x07, (byte) 0x70, (byte) 0x78, 989 (byte) 0xc0, (byte) 0xbb, (byte) 0xc5, (byte) 0x8d, (byte) 0x6c, (byte) 0x8d, (byte) 0x35, (byte) 0xff, 990 (byte) 0x04, (byte) 0x81, (byte) 0xd8, (byte) 0xf4, (byte) 0xd2, (byte) 0x4a, (byte) 0xc3, (byte) 0x05, 991 (byte) 0x23, (byte) 0xcb, (byte) 0xeb, (byte) 0x20, (byte) 0xb1, (byte) 0xd4, (byte) 0x2d, (byte) 0xd8, 992 (byte) 0x7a, (byte) 0xd4, (byte) 0x7e, (byte) 0xf6, (byte) 0xa9, (byte) 0xe8, (byte) 0x72, (byte) 0x69, 993 (byte) 0xfe, (byte) 0xab, (byte) 0x54, (byte) 0x4d, (byte) 0xd1, (byte) 0xf4, (byte) 0x6b, (byte) 0x83, 994 (byte) 0x31, (byte) 0x17, (byte) 0xed, (byte) 0x26, (byte) 0xe9, (byte) 0xd2, (byte) 0x5b, (byte) 0xad, 995 (byte) 0x42, (byte) 0x42, (byte) 0xa5, (byte) 0x8f, (byte) 0x98, (byte) 0x7c, (byte) 0x1b, (byte) 0x5c, 996 (byte) 0x8e, (byte) 0x88, (byte) 0x56, (byte) 0x20, (byte) 0x8e, (byte) 0x48, (byte) 0xf9, (byte) 0x4d, 997 (byte) 0x82, (byte) 0x91, (byte) 0xcb, (byte) 0xc8, (byte) 0x1c, (byte) 0x7c, (byte) 0xa5, (byte) 0x69, 998 (byte) 0x1b, (byte) 0x40, (byte) 0xc2, (byte) 0x4c, (byte) 0x25, (byte) 0x16, (byte) 0x4f, (byte) 0xfa, 999 (byte) 0x09, (byte) 0xeb, (byte) 0xf5, (byte) 0x6c, (byte) 0x55, (byte) 0x3c, (byte) 0x6e, (byte) 0xf7, 1000 (byte) 0xc0, (byte) 0xc1, (byte) 0x34, (byte) 0xd1, (byte) 0x53, (byte) 0xa3, (byte) 0x69, (byte) 0x64, 1001 (byte) 0xee, (byte) 0xf4, (byte) 0xf9, (byte) 0xc7, (byte) 0x96, (byte) 0x60, (byte) 0x84, (byte) 0x87, 1002 (byte) 0xb4, (byte) 0xc7, (byte) 0x3c, (byte) 0x26, (byte) 0xa7, (byte) 0x3a, (byte) 0xbf, (byte) 0x95, 1003 }; 1004 1005 private static final byte[] MD5withRSA_Vector2Signature = new byte[] { 1006 (byte) 0x04, (byte) 0x17, (byte) 0x83, (byte) 0x10, (byte) 0xe2, (byte) 0x6e, (byte) 0xdf, (byte) 0xa9, 1007 (byte) 0xae, (byte) 0xd2, (byte) 0xdc, (byte) 0x5f, (byte) 0x70, (byte) 0x1d, (byte) 0xaf, (byte) 0x54, 1008 (byte) 0xc0, (byte) 0x5f, (byte) 0x0b, (byte) 0x2c, (byte) 0xe6, (byte) 0xd0, (byte) 0x00, (byte) 0x18, 1009 (byte) 0x4c, (byte) 0xf6, (byte) 0x8f, (byte) 0x18, (byte) 0x10, (byte) 0x74, (byte) 0x90, (byte) 0x99, 1010 (byte) 0xa9, (byte) 0x90, (byte) 0x3c, (byte) 0x5a, (byte) 0x38, (byte) 0xd3, (byte) 0x3d, (byte) 0x48, 1011 (byte) 0xcf, (byte) 0x31, (byte) 0xaf, (byte) 0x12, (byte) 0x98, (byte) 0xfb, (byte) 0x66, (byte) 0xe8, 1012 (byte) 0x58, (byte) 0xec, (byte) 0xca, (byte) 0xe1, (byte) 0x42, (byte) 0xf9, (byte) 0x84, (byte) 0x17, 1013 (byte) 0x6f, (byte) 0x4c, (byte) 0x3e, (byte) 0xc4, (byte) 0x40, (byte) 0xc6, (byte) 0x70, (byte) 0xb0, 1014 (byte) 0x38, (byte) 0xf3, (byte) 0x47, (byte) 0xeb, (byte) 0x6f, (byte) 0xcb, (byte) 0xea, (byte) 0x21, 1015 (byte) 0x41, (byte) 0xf3, (byte) 0xa0, (byte) 0x3e, (byte) 0x42, (byte) 0xad, (byte) 0xa5, (byte) 0xad, 1016 (byte) 0x5d, (byte) 0x2c, (byte) 0x1a, (byte) 0x8e, (byte) 0x3e, (byte) 0xb3, (byte) 0xa5, (byte) 0x78, 1017 (byte) 0x3d, (byte) 0x56, (byte) 0x09, (byte) 0x93, (byte) 0xc9, (byte) 0x93, (byte) 0xd3, (byte) 0xd2, 1018 (byte) 0x9a, (byte) 0xc5, (byte) 0xa5, (byte) 0x2e, (byte) 0xb2, (byte) 0xd8, (byte) 0x37, (byte) 0xc7, 1019 (byte) 0x13, (byte) 0x1a, (byte) 0x0b, (byte) 0xda, (byte) 0x50, (byte) 0x28, (byte) 0x6d, (byte) 0x47, 1020 (byte) 0x65, (byte) 0x52, (byte) 0xcd, (byte) 0xe7, (byte) 0xec, (byte) 0x57, (byte) 0x00, (byte) 0x41, 1021 (byte) 0x34, (byte) 0x28, (byte) 0xb9, (byte) 0x8b, (byte) 0x03, (byte) 0x41, (byte) 0xb6, (byte) 0xd5, 1022 (byte) 0xa8, (byte) 0xef, (byte) 0xd3, (byte) 0xdd, (byte) 0x80, (byte) 0xd5, (byte) 0x69, (byte) 0xe4, 1023 (byte) 0xf0, (byte) 0x4d, (byte) 0xa4, (byte) 0x7d, (byte) 0x60, (byte) 0x2f, (byte) 0xef, (byte) 0x79, 1024 (byte) 0x07, (byte) 0x75, (byte) 0xeb, (byte) 0xf7, (byte) 0x4b, (byte) 0x43, (byte) 0x41, (byte) 0xdb, 1025 (byte) 0x33, (byte) 0xad, (byte) 0x9c, (byte) 0x7b, (byte) 0x78, (byte) 0x83, (byte) 0x34, (byte) 0x77, 1026 (byte) 0xe4, (byte) 0x80, (byte) 0xbe, (byte) 0xe6, (byte) 0x6f, (byte) 0xdd, (byte) 0xac, (byte) 0xa5, 1027 (byte) 0x37, (byte) 0xcf, (byte) 0xb5, (byte) 0x44, (byte) 0x11, (byte) 0x77, (byte) 0x96, (byte) 0x45, 1028 (byte) 0xf9, (byte) 0xae, (byte) 0x48, (byte) 0xa6, (byte) 0xbe, (byte) 0x30, (byte) 0x32, (byte) 0xeb, 1029 (byte) 0x43, (byte) 0x6f, (byte) 0x66, (byte) 0x39, (byte) 0x57, (byte) 0xf8, (byte) 0xe6, (byte) 0x60, 1030 (byte) 0x31, (byte) 0xd0, (byte) 0xfc, (byte) 0xcf, (byte) 0x9f, (byte) 0xe5, (byte) 0x3d, (byte) 0xcf, 1031 (byte) 0xbd, (byte) 0x7b, (byte) 0x13, (byte) 0x20, (byte) 0xce, (byte) 0x11, (byte) 0xfd, (byte) 0xe5, 1032 (byte) 0xff, (byte) 0x90, (byte) 0x85, (byte) 0xdf, (byte) 0xca, (byte) 0x3d, (byte) 0xd9, (byte) 0x44, 1033 (byte) 0x16, (byte) 0xc2, (byte) 0x32, (byte) 0x28, (byte) 0xc7, (byte) 0x01, (byte) 0x6d, (byte) 0xea, 1034 (byte) 0xcb, (byte) 0x0d, (byte) 0x85, (byte) 0x08, (byte) 0x6f, (byte) 0xcb, (byte) 0x41, (byte) 0x6a, 1035 (byte) 0x3c, (byte) 0x0f, (byte) 0x3d, (byte) 0x38, (byte) 0xb5, (byte) 0x61, (byte) 0xc5, (byte) 0x64, 1036 (byte) 0x64, (byte) 0x81, (byte) 0x4c, (byte) 0xcd, (byte) 0xd1, (byte) 0x6a, (byte) 0x87, (byte) 0x28, 1037 (byte) 0x02, (byte) 0xaf, (byte) 0x8f, (byte) 0x59, (byte) 0xe5, (byte) 0x67, (byte) 0x25, (byte) 0x00, 1038 }; 1039 1040 /* 1041 * openssl rsautl -raw -sign -inkey rsa.key | recode ../x1 | sed 's/0x/(byte) 0x/g' 1042 */ 1043 private static final byte[] NONEwithRSA_Vector1Signature = new byte[] { 1044 (byte) 0x35, (byte) 0x43, (byte) 0x38, (byte) 0x44, (byte) 0xAD, (byte) 0x3F, 1045 (byte) 0x97, (byte) 0x02, (byte) 0xFB, (byte) 0x59, (byte) 0x1F, (byte) 0x4A, 1046 (byte) 0x2B, (byte) 0xB9, (byte) 0x06, (byte) 0xEC, (byte) 0x66, (byte) 0xE6, 1047 (byte) 0xD2, (byte) 0xC5, (byte) 0x8B, (byte) 0x7B, (byte) 0xE3, (byte) 0x18, 1048 (byte) 0xBF, (byte) 0x07, (byte) 0xD6, (byte) 0x01, (byte) 0xF9, (byte) 0xD9, 1049 (byte) 0x89, (byte) 0xC4, (byte) 0xDB, (byte) 0x00, (byte) 0x68, (byte) 0xFF, 1050 (byte) 0x9B, (byte) 0x43, (byte) 0x90, (byte) 0xF2, (byte) 0xDB, (byte) 0x83, 1051 (byte) 0xF4, (byte) 0x7E, (byte) 0xC6, (byte) 0x81, (byte) 0x01, (byte) 0x3A, 1052 (byte) 0x0B, (byte) 0xE5, (byte) 0xED, (byte) 0x08, (byte) 0x73, (byte) 0x3E, 1053 (byte) 0xE1, (byte) 0x3F, (byte) 0xDF, (byte) 0x1F, (byte) 0x07, (byte) 0x6D, 1054 (byte) 0x22, (byte) 0x8D, (byte) 0xCC, (byte) 0x4E, (byte) 0xE3, (byte) 0x9A, 1055 (byte) 0xBC, (byte) 0xCC, (byte) 0x8F, (byte) 0x9E, (byte) 0x9B, (byte) 0x02, 1056 (byte) 0x48, (byte) 0x00, (byte) 0xAC, (byte) 0x9F, (byte) 0xA4, (byte) 0x8F, 1057 (byte) 0x87, (byte) 0xA1, (byte) 0xA8, (byte) 0xE6, (byte) 0x9D, (byte) 0xCD, 1058 (byte) 0x8B, (byte) 0x05, (byte) 0xE9, (byte) 0xD2, (byte) 0x05, (byte) 0x8D, 1059 (byte) 0xC9, (byte) 0x95, (byte) 0x16, (byte) 0xD0, (byte) 0xCD, (byte) 0x43, 1060 (byte) 0x25, (byte) 0x8A, (byte) 0x11, (byte) 0x46, (byte) 0xD7, (byte) 0x74, 1061 (byte) 0x4C, (byte) 0xCF, (byte) 0x58, (byte) 0xF9, (byte) 0xA1, (byte) 0x30, 1062 (byte) 0x84, (byte) 0x52, (byte) 0xC9, (byte) 0x01, (byte) 0x5F, (byte) 0x24, 1063 (byte) 0x4C, (byte) 0xB1, (byte) 0x9F, (byte) 0x7D, (byte) 0x12, (byte) 0x38, 1064 (byte) 0x27, (byte) 0x0F, (byte) 0x5E, (byte) 0xFF, (byte) 0xE0, (byte) 0x55, 1065 (byte) 0x8B, (byte) 0xA3, (byte) 0xAD, (byte) 0x60, (byte) 0x35, (byte) 0x83, 1066 (byte) 0x58, (byte) 0xAF, (byte) 0x99, (byte) 0xDE, (byte) 0x3F, (byte) 0x5D, 1067 (byte) 0x80, (byte) 0x80, (byte) 0xFF, (byte) 0x9B, (byte) 0xDE, (byte) 0x5C, 1068 (byte) 0xAB, (byte) 0x97, (byte) 0x43, (byte) 0x64, (byte) 0xD9, (byte) 0x9F, 1069 (byte) 0xFB, (byte) 0x67, (byte) 0x65, (byte) 0xA5, (byte) 0x99, (byte) 0xE7, 1070 (byte) 0xE6, (byte) 0xEB, (byte) 0x05, (byte) 0x95, (byte) 0xFC, (byte) 0x46, 1071 (byte) 0x28, (byte) 0x4B, (byte) 0xD8, (byte) 0x8C, (byte) 0xF5, (byte) 0x0A, 1072 (byte) 0xEB, (byte) 0x1F, (byte) 0x30, (byte) 0xEA, (byte) 0xE7, (byte) 0x67, 1073 (byte) 0x11, (byte) 0x25, (byte) 0xF0, (byte) 0x44, (byte) 0x75, (byte) 0x74, 1074 (byte) 0x94, (byte) 0x06, (byte) 0x78, (byte) 0xD0, (byte) 0x21, (byte) 0xF4, 1075 (byte) 0x3F, (byte) 0xC8, (byte) 0xC4, (byte) 0x4A, (byte) 0x57, (byte) 0xBE, 1076 (byte) 0x02, (byte) 0x3C, (byte) 0x93, (byte) 0xF6, (byte) 0x95, (byte) 0xFB, 1077 (byte) 0xD1, (byte) 0x77, (byte) 0x8B, (byte) 0x43, (byte) 0xF0, (byte) 0xB9, 1078 (byte) 0x7D, (byte) 0xE0, (byte) 0x32, (byte) 0xE1, (byte) 0x72, (byte) 0xB5, 1079 (byte) 0x62, (byte) 0x3F, (byte) 0x86, (byte) 0xC3, (byte) 0xD4, (byte) 0x5F, 1080 (byte) 0x5E, (byte) 0x54, (byte) 0x1B, (byte) 0x5B, (byte) 0xE6, (byte) 0x74, 1081 (byte) 0xA1, (byte) 0x0B, (byte) 0xE5, (byte) 0x18, (byte) 0xD2, (byte) 0x4F, 1082 (byte) 0x93, (byte) 0xF3, (byte) 0x09, (byte) 0x58, (byte) 0xCE, (byte) 0xF0, 1083 (byte) 0xA3, (byte) 0x61, (byte) 0xE4, (byte) 0x6E, (byte) 0x46, (byte) 0x45, 1084 (byte) 0x89, (byte) 0x50, (byte) 0xBD, (byte) 0x03, (byte) 0x3F, (byte) 0x38, 1085 (byte) 0xDA, (byte) 0x5D, (byte) 0xD0, (byte) 0x1B, (byte) 0x1F, (byte) 0xB1, 1086 (byte) 0xEE, (byte) 0x89, (byte) 0x59, (byte) 0xC5, 1087 }; 1088 1089 /* 1090 * echo "This is a signed message from Kenny Root." | openssl sha1 -binary -out digest.bin \ 1091 * && openssl pkeyutl -sign -in digest.bin -inkey privkey.pem \ 1092 * -pkeyopt rsa_padding_mode:pss -pkeyopt digest:sha1 -pkeyopt rsa_pss_saltlen:20 \ 1093 * | recode ../x1 | sed 's/0x/(byte) 0x/g' 1094 */ 1095 private static final byte[] SHA1withRSAPSS_Vector2Signature = new byte[] { 1096 (byte) 0x66, (byte) 0xE3, (byte) 0xA5, (byte) 0x20, (byte) 0xE9, (byte) 0x5D, 1097 (byte) 0xDF, (byte) 0x99, (byte) 0xA6, (byte) 0x04, (byte) 0x77, (byte) 0xF8, 1098 (byte) 0x39, (byte) 0x78, (byte) 0x74, (byte) 0xF5, (byte) 0xC2, (byte) 0x4E, 1099 (byte) 0x9E, (byte) 0xEB, (byte) 0x24, (byte) 0xDE, (byte) 0xB4, (byte) 0x36, 1100 (byte) 0x69, (byte) 0x1F, (byte) 0xAC, (byte) 0x01, (byte) 0xFF, (byte) 0x5A, 1101 (byte) 0xE3, (byte) 0x89, (byte) 0x8A, (byte) 0xE9, (byte) 0x92, (byte) 0x32, 1102 (byte) 0xA7, (byte) 0xA4, (byte) 0xC0, (byte) 0x25, (byte) 0x00, (byte) 0x14, 1103 (byte) 0xFF, (byte) 0x38, (byte) 0x19, (byte) 0x37, (byte) 0x84, (byte) 0x1A, 1104 (byte) 0x3D, (byte) 0xCA, (byte) 0xEE, (byte) 0xF3, (byte) 0xC6, (byte) 0x91, 1105 (byte) 0xED, (byte) 0x02, (byte) 0xE6, (byte) 0x1D, (byte) 0x73, (byte) 0xDA, 1106 (byte) 0xD4, (byte) 0x55, (byte) 0x93, (byte) 0x54, (byte) 0x9A, (byte) 0xE6, 1107 (byte) 0x2E, (byte) 0x7D, (byte) 0x5C, (byte) 0x41, (byte) 0xAF, (byte) 0xED, 1108 (byte) 0xAD, (byte) 0x8E, (byte) 0x7F, (byte) 0x47, (byte) 0x3B, (byte) 0x23, 1109 (byte) 0xC3, (byte) 0xB8, (byte) 0xBB, (byte) 0xCD, (byte) 0x87, (byte) 0xC4, 1110 (byte) 0xA3, (byte) 0x32, (byte) 0x16, (byte) 0x57, (byte) 0xCC, (byte) 0xB8, 1111 (byte) 0xB6, (byte) 0x96, (byte) 0x84, (byte) 0x1A, (byte) 0xBC, (byte) 0xF8, 1112 (byte) 0x09, (byte) 0x53, (byte) 0xB0, (byte) 0x9D, (byte) 0xE1, (byte) 0x6F, 1113 (byte) 0xB2, (byte) 0xEB, (byte) 0x83, (byte) 0xDC, (byte) 0x61, (byte) 0x31, 1114 (byte) 0xD7, (byte) 0x02, (byte) 0xB4, (byte) 0xD1, (byte) 0xBA, (byte) 0xBD, 1115 (byte) 0xF0, (byte) 0x78, (byte) 0xC6, (byte) 0xBE, (byte) 0x1F, (byte) 0xB0, 1116 (byte) 0xE1, (byte) 0xCA, (byte) 0x32, (byte) 0x57, (byte) 0x9F, (byte) 0x8C, 1117 (byte) 0xD3, (byte) 0xBB, (byte) 0x04, (byte) 0x1B, (byte) 0x30, (byte) 0x74, 1118 (byte) 0x5D, (byte) 0xEA, (byte) 0xD3, (byte) 0x6B, (byte) 0x74, (byte) 0x31, 1119 (byte) 0x6F, (byte) 0x33, (byte) 0x5A, (byte) 0x70, (byte) 0x96, (byte) 0x8B, 1120 (byte) 0xCB, (byte) 0x22, (byte) 0xF3, (byte) 0xAA, (byte) 0x74, (byte) 0x82, 1121 (byte) 0xB2, (byte) 0x82, (byte) 0x71, (byte) 0x4D, (byte) 0x42, (byte) 0x13, 1122 (byte) 0x3F, (byte) 0xEA, (byte) 0xE3, (byte) 0x39, (byte) 0xC5, (byte) 0x03, 1123 (byte) 0x27, (byte) 0xFF, (byte) 0x78, (byte) 0xB2, (byte) 0xA6, (byte) 0x71, 1124 (byte) 0x07, (byte) 0x1C, (byte) 0xB3, (byte) 0x97, (byte) 0xFB, (byte) 0xE8, 1125 (byte) 0x85, (byte) 0x6D, (byte) 0x14, (byte) 0xDF, (byte) 0xF9, (byte) 0x7D, 1126 (byte) 0x0D, (byte) 0x0C, (byte) 0x9F, (byte) 0xC3, (byte) 0xE2, (byte) 0xDB, 1127 (byte) 0xE0, (byte) 0xA5, (byte) 0x05, (byte) 0xBC, (byte) 0x47, (byte) 0x36, 1128 (byte) 0xEB, (byte) 0x1E, (byte) 0xBA, (byte) 0x60, (byte) 0x12, (byte) 0x19, 1129 (byte) 0xA5, (byte) 0x7E, (byte) 0x55, (byte) 0x0C, (byte) 0x9B, (byte) 0xD4, 1130 (byte) 0x9A, (byte) 0xE9, (byte) 0x72, (byte) 0x5C, (byte) 0x5B, (byte) 0xF4, 1131 (byte) 0xAA, (byte) 0x4A, (byte) 0x12, (byte) 0x8B, (byte) 0xC2, (byte) 0x8E, 1132 (byte) 0xC2, (byte) 0x9A, (byte) 0x3E, (byte) 0x0C, (byte) 0x40, (byte) 0xA4, 1133 (byte) 0x0A, (byte) 0xFF, (byte) 0xF8, (byte) 0xC1, (byte) 0x85, (byte) 0x59, 1134 (byte) 0xDA, (byte) 0xC6, (byte) 0x8C, (byte) 0x83, (byte) 0x2A, (byte) 0x68, 1135 (byte) 0x84, (byte) 0x53, (byte) 0x17, (byte) 0x28, (byte) 0x78, (byte) 0x3F, 1136 (byte) 0x5A, (byte) 0xA4, (byte) 0x04, (byte) 0xE6, (byte) 0x23, (byte) 0x8D, 1137 (byte) 0x2A, (byte) 0x71, (byte) 0xC1, (byte) 0xBC, (byte) 0x1C, (byte) 0xFD, 1138 (byte) 0x75, (byte) 0x16, (byte) 0x6E, (byte) 0x85, 1139 }; 1140 private static final PSSParameterSpec SHA1withRSAPSS_Vector2Signature_ParameterSpec = 1141 new PSSParameterSpec("SHA-1", "MGF1", MGF1ParameterSpec.SHA1, 20, 1); 1142 1143 /* 1144 * echo "This is a signed message from Kenny Root." | openssl sha1 -binary -out digest.bin \ 1145 * && openssl pkeyutl -sign -in digest.bin -inkey privkey.pem \ 1146 * -pkeyopt rsa_padding_mode:pss -pkeyopt digest:sha1 -pkeyopt rsa_pss_saltlen:0 \ 1147 * | recode ../x1 | sed 's/0x/(byte) 0x/g' 1148 */ 1149 private static final byte[] SHA1withRSAPSS_NoSalt_Vector2Signature = new byte[] { 1150 (byte) 0x31, (byte) 0x61, (byte) 0xA5, (byte) 0x47, (byte) 0x28, (byte) 0x44, 1151 (byte) 0x48, (byte) 0x5A, (byte) 0xDA, (byte) 0x78, (byte) 0xA7, (byte) 0x85, 1152 (byte) 0xE9, (byte) 0x64, (byte) 0x69, (byte) 0xCF, (byte) 0x14, (byte) 0x07, 1153 (byte) 0x3F, (byte) 0xA8, (byte) 0xDB, (byte) 0xFC, (byte) 0xB7, (byte) 0x89, 1154 (byte) 0x87, (byte) 0x74, (byte) 0xB9, (byte) 0x81, (byte) 0x37, (byte) 0x62, 1155 (byte) 0xD1, (byte) 0x07, (byte) 0x0F, (byte) 0x3D, (byte) 0xDF, (byte) 0xA8, 1156 (byte) 0x84, (byte) 0x38, (byte) 0x31, (byte) 0xEB, (byte) 0x17, (byte) 0x3F, 1157 (byte) 0xE0, (byte) 0x28, (byte) 0x75, (byte) 0x1F, (byte) 0xE9, (byte) 0x4D, 1158 (byte) 0xD3, (byte) 0x62, (byte) 0xFA, (byte) 0xCF, (byte) 0xCC, (byte) 0x2E, 1159 (byte) 0xC7, (byte) 0x81, (byte) 0xE1, (byte) 0xEA, (byte) 0xEC, (byte) 0x78, 1160 (byte) 0xFE, (byte) 0x19, (byte) 0x59, (byte) 0x54, (byte) 0x1D, (byte) 0x27, 1161 (byte) 0xED, (byte) 0x0C, (byte) 0x54, (byte) 0xDF, (byte) 0xE3, (byte) 0x44, 1162 (byte) 0x31, (byte) 0x21, (byte) 0x31, (byte) 0xA7, (byte) 0x23, (byte) 0xC4, 1163 (byte) 0xE2, (byte) 0x69, (byte) 0x8A, (byte) 0xB3, (byte) 0x1A, (byte) 0x72, 1164 (byte) 0x4F, (byte) 0x4E, (byte) 0x82, (byte) 0x86, (byte) 0x2D, (byte) 0x2B, 1165 (byte) 0x85, (byte) 0xFE, (byte) 0x4A, (byte) 0x28, (byte) 0x90, (byte) 0xF7, 1166 (byte) 0xDF, (byte) 0xD6, (byte) 0xB1, (byte) 0x3E, (byte) 0xC6, (byte) 0xFB, 1167 (byte) 0x76, (byte) 0x7B, (byte) 0x3D, (byte) 0x12, (byte) 0x81, (byte) 0x6E, 1168 (byte) 0xFD, (byte) 0x00, (byte) 0x7D, (byte) 0xD0, (byte) 0xDC, (byte) 0x25, 1169 (byte) 0xD0, (byte) 0x86, (byte) 0x6C, (byte) 0xE8, (byte) 0x0F, (byte) 0x09, 1170 (byte) 0x82, (byte) 0x74, (byte) 0x89, (byte) 0x79, (byte) 0x69, (byte) 0x73, 1171 (byte) 0x37, (byte) 0x64, (byte) 0xEE, (byte) 0x53, (byte) 0x57, (byte) 0x20, 1172 (byte) 0xFA, (byte) 0x0B, (byte) 0x4A, (byte) 0x5A, (byte) 0x4D, (byte) 0x33, 1173 (byte) 0xAC, (byte) 0x8B, (byte) 0x04, (byte) 0xA5, (byte) 0x4A, (byte) 0x1A, 1174 (byte) 0x9B, (byte) 0x66, (byte) 0xAA, (byte) 0x0B, (byte) 0x3D, (byte) 0x15, 1175 (byte) 0xD9, (byte) 0x3E, (byte) 0x2F, (byte) 0xD2, (byte) 0xA1, (byte) 0x28, 1176 (byte) 0x13, (byte) 0x59, (byte) 0x98, (byte) 0xC3, (byte) 0x45, (byte) 0x7C, 1177 (byte) 0xEE, (byte) 0x60, (byte) 0xD0, (byte) 0xBD, (byte) 0x42, (byte) 0x16, 1178 (byte) 0x84, (byte) 0x19, (byte) 0xF6, (byte) 0xD9, (byte) 0xF7, (byte) 0x7D, 1179 (byte) 0x77, (byte) 0xAD, (byte) 0x60, (byte) 0xE2, (byte) 0xE3, (byte) 0x22, 1180 (byte) 0xB9, (byte) 0xFA, (byte) 0xD5, (byte) 0xFA, (byte) 0x6E, (byte) 0x1F, 1181 (byte) 0x69, (byte) 0x3F, (byte) 0xB1, (byte) 0xA7, (byte) 0x1A, (byte) 0x22, 1182 (byte) 0xF7, (byte) 0x31, (byte) 0x97, (byte) 0x68, (byte) 0x62, (byte) 0x0F, 1183 (byte) 0x39, (byte) 0xB0, (byte) 0xE7, (byte) 0x63, (byte) 0xAE, (byte) 0x65, 1184 (byte) 0x69, (byte) 0xD0, (byte) 0xD3, (byte) 0x56, (byte) 0xC9, (byte) 0xA6, 1185 (byte) 0xA4, (byte) 0xA5, (byte) 0xA4, (byte) 0x61, (byte) 0xA9, (byte) 0xC4, 1186 (byte) 0x45, (byte) 0xCD, (byte) 0x49, (byte) 0x76, (byte) 0xC8, (byte) 0x53, 1187 (byte) 0x46, (byte) 0xD0, (byte) 0x63, (byte) 0x35, (byte) 0x89, (byte) 0x04, 1188 (byte) 0x22, (byte) 0xD7, (byte) 0xB6, (byte) 0x63, (byte) 0xAF, (byte) 0xC2, 1189 (byte) 0x97, (byte) 0x10, (byte) 0xDF, (byte) 0xDE, (byte) 0xE6, (byte) 0x39, 1190 (byte) 0x25, (byte) 0x2F, (byte) 0xEA, (byte) 0xD8, (byte) 0x56, (byte) 0x5A, 1191 (byte) 0xC1, (byte) 0xB8, (byte) 0xCA, (byte) 0xC1, (byte) 0x8A, (byte) 0xB8, 1192 (byte) 0x87, (byte) 0x2F, (byte) 0xCD, (byte) 0x21, 1193 }; 1194 private static final PSSParameterSpec SHA1withRSAPSS_NoSalt_Vector2Signature_ParameterSpec = 1195 new PSSParameterSpec("SHA-1", "MGF1", MGF1ParameterSpec.SHA1, 0, 1); 1196 1197 /* 1198 * echo "This is a signed message from Kenny Root." | openssl sha1 -binary -out digest.bin \ 1199 * && openssl pkeyutl -sign -in digest.bin -inkey privkey.pem \ 1200 * -pkeyopt rsa_padding_mode:pss -pkeyopt digest:sha1 -pkeyopt rsa_pss_saltlen:234 \ 1201 * | recode ../x1 | sed 's/0x/(byte) 0x/g' 1202 */ 1203 private static final byte[] SHA1withRSAPSS_MaxSalt_Vector2Signature = new byte[] { 1204 (byte) 0x49, (byte) 0xDB, (byte) 0xAD, (byte) 0x48, (byte) 0x7C, (byte) 0x06, 1205 (byte) 0x03, (byte) 0x7C, (byte) 0x58, (byte) 0xE1, (byte) 0x38, (byte) 0x20, 1206 (byte) 0x46, (byte) 0x28, (byte) 0x60, (byte) 0x64, (byte) 0x94, (byte) 0x51, 1207 (byte) 0xA3, (byte) 0xD1, (byte) 0xC9, (byte) 0x52, (byte) 0xC6, (byte) 0x2A, 1208 (byte) 0xB3, (byte) 0xCC, (byte) 0xD6, (byte) 0x19, (byte) 0x50, (byte) 0x99, 1209 (byte) 0x60, (byte) 0x58, (byte) 0xA2, (byte) 0x86, (byte) 0xA8, (byte) 0x74, 1210 (byte) 0x50, (byte) 0x8C, (byte) 0x0E, (byte) 0x32, (byte) 0x58, (byte) 0x56, 1211 (byte) 0x6D, (byte) 0x30, (byte) 0x38, (byte) 0xFB, (byte) 0x26, (byte) 0xC3, 1212 (byte) 0xFD, (byte) 0x8E, (byte) 0x36, (byte) 0x73, (byte) 0x82, (byte) 0x9A, 1213 (byte) 0xB4, (byte) 0xE5, (byte) 0x22, (byte) 0x96, (byte) 0x55, (byte) 0x3C, 1214 (byte) 0x18, (byte) 0xD7, (byte) 0x46, (byte) 0xF1, (byte) 0x7C, (byte) 0xE6, 1215 (byte) 0x8E, (byte) 0x0A, (byte) 0x18, (byte) 0xA7, (byte) 0x29, (byte) 0x96, 1216 (byte) 0x8D, (byte) 0xFC, (byte) 0x0E, (byte) 0xBE, (byte) 0x91, (byte) 0xA0, 1217 (byte) 0xF8, (byte) 0xE2, (byte) 0x70, (byte) 0x5A, (byte) 0xE3, (byte) 0x76, 1218 (byte) 0xAC, (byte) 0x18, (byte) 0x10, (byte) 0xB4, (byte) 0xB1, (byte) 0xFF, 1219 (byte) 0x58, (byte) 0xBC, (byte) 0x10, (byte) 0xF5, (byte) 0x88, (byte) 0x2F, 1220 (byte) 0x0B, (byte) 0x10, (byte) 0x9D, (byte) 0x52, (byte) 0x2D, (byte) 0x42, 1221 (byte) 0xDB, (byte) 0xFD, (byte) 0xA7, (byte) 0x23, (byte) 0x3C, (byte) 0x4B, 1222 (byte) 0xB3, (byte) 0xD2, (byte) 0x96, (byte) 0x1B, (byte) 0xCE, (byte) 0xB3, 1223 (byte) 0xA3, (byte) 0xC3, (byte) 0x42, (byte) 0xA4, (byte) 0x0E, (byte) 0x35, 1224 (byte) 0x5C, (byte) 0xC2, (byte) 0x32, (byte) 0xC7, (byte) 0x8C, (byte) 0xFC, 1225 (byte) 0x7F, (byte) 0xE0, (byte) 0xF7, (byte) 0x1D, (byte) 0x38, (byte) 0x21, 1226 (byte) 0x3C, (byte) 0xDF, (byte) 0x82, (byte) 0x1A, (byte) 0xBD, (byte) 0x83, 1227 (byte) 0xE9, (byte) 0x56, (byte) 0xF0, (byte) 0xF1, (byte) 0x54, (byte) 0x76, 1228 (byte) 0xE3, (byte) 0xCE, (byte) 0x86, (byte) 0x69, (byte) 0xC2, (byte) 0x61, 1229 (byte) 0x6D, (byte) 0x8E, (byte) 0xF5, (byte) 0xA3, (byte) 0x61, (byte) 0xCA, 1230 (byte) 0x16, (byte) 0xCB, (byte) 0x7A, (byte) 0xF5, (byte) 0xBF, (byte) 0x36, 1231 (byte) 0xCB, (byte) 0x7D, (byte) 0xB1, (byte) 0xE9, (byte) 0x70, (byte) 0x41, 1232 (byte) 0xCF, (byte) 0x89, (byte) 0x51, (byte) 0x13, (byte) 0xCC, (byte) 0x95, 1233 (byte) 0x50, (byte) 0xC8, (byte) 0xB6, (byte) 0x30, (byte) 0x35, (byte) 0xE3, 1234 (byte) 0x13, (byte) 0x08, (byte) 0xF6, (byte) 0xBE, (byte) 0x20, (byte) 0xF1, 1235 (byte) 0x48, (byte) 0x4D, (byte) 0x46, (byte) 0x95, (byte) 0xFE, (byte) 0x9E, 1236 (byte) 0xD2, (byte) 0xD5, (byte) 0x29, (byte) 0x81, (byte) 0x2E, (byte) 0x0F, 1237 (byte) 0x6F, (byte) 0xA7, (byte) 0x02, (byte) 0x15, (byte) 0xCA, (byte) 0x75, 1238 (byte) 0x77, (byte) 0x29, (byte) 0x7C, (byte) 0x3A, (byte) 0xE3, (byte) 0x2B, 1239 (byte) 0xD7, (byte) 0x3D, (byte) 0x5C, (byte) 0x94, (byte) 0x3B, (byte) 0x2A, 1240 (byte) 0x91, (byte) 0xDB, (byte) 0xFA, (byte) 0x69, (byte) 0x47, (byte) 0x1C, 1241 (byte) 0x2C, (byte) 0x46, (byte) 0x49, (byte) 0xE6, (byte) 0x37, (byte) 0x5D, 1242 (byte) 0x78, (byte) 0x71, (byte) 0x76, (byte) 0xC1, (byte) 0xB6, (byte) 0x2E, 1243 (byte) 0x4E, (byte) 0x3C, (byte) 0x83, (byte) 0x6F, (byte) 0x82, (byte) 0xC3, 1244 (byte) 0xD8, (byte) 0x50, (byte) 0xD7, (byte) 0x1B, (byte) 0xAF, (byte) 0xF9, 1245 (byte) 0xE3, (byte) 0xF1, (byte) 0x47, (byte) 0xC8, (byte) 0x12, (byte) 0x86, 1246 (byte) 0x82, (byte) 0x9D, (byte) 0x3F, (byte) 0xCE, 1247 }; 1248 private static final PSSParameterSpec SHA1withRSAPSS_MaxSalt_Vector2Signature_ParameterSpec = 1249 new PSSParameterSpec("SHA-1", "MGF1", MGF1ParameterSpec.SHA1, 234, 1); 1250 1251 /* 1252 * echo "This is a signed message from Kenny Root." | openssl sha224 -binary -out digest.bin \ 1253 * && openssl pkeyutl -sign -in digest.bin -inkey privkey.pem \ 1254 * -pkeyopt rsa_padding_mode:pss -pkeyopt digest:sha224 -pkeyopt rsa_pss_saltlen:28 \ 1255 * | recode ../x1 | sed 's/0x/(byte) 0x/g' 1256 */ 1257 private static final byte[] SHA224withRSAPSS_Vector2Signature = new byte[] { 1258 (byte) 0x86, (byte) 0x41, (byte) 0xCC, (byte) 0x4B, (byte) 0x82, (byte) 0x74, 1259 (byte) 0x04, (byte) 0x43, (byte) 0x8C, (byte) 0xAB, (byte) 0xF6, (byte) 0x3B, 1260 (byte) 0xFB, (byte) 0x94, (byte) 0xBC, (byte) 0x4C, (byte) 0x0A, (byte) 0xFE, 1261 (byte) 0x0F, (byte) 0x4F, (byte) 0x0F, (byte) 0x9F, (byte) 0x84, (byte) 0x35, 1262 (byte) 0x57, (byte) 0x8B, (byte) 0x8D, (byte) 0xC3, (byte) 0x58, (byte) 0xA6, 1263 (byte) 0x70, (byte) 0xAC, (byte) 0x40, (byte) 0x6D, (byte) 0xBC, (byte) 0xC1, 1264 (byte) 0x6A, (byte) 0xFA, (byte) 0x31, (byte) 0x3B, (byte) 0x7A, (byte) 0x23, 1265 (byte) 0xCA, (byte) 0x1F, (byte) 0xCD, (byte) 0xA7, (byte) 0xE3, (byte) 0xD6, 1266 (byte) 0x7C, (byte) 0x2C, (byte) 0xF3, (byte) 0x6F, (byte) 0xF5, (byte) 0x82, 1267 (byte) 0x9E, (byte) 0x18, (byte) 0x70, (byte) 0x90, (byte) 0xE6, (byte) 0xA3, 1268 (byte) 0x44, (byte) 0x61, (byte) 0xB6, (byte) 0x46, (byte) 0x9B, (byte) 0x0D, 1269 (byte) 0xE5, (byte) 0x3C, (byte) 0xAE, (byte) 0x22, (byte) 0xF4, (byte) 0x87, 1270 (byte) 0xB7, (byte) 0x03, (byte) 0xD8, (byte) 0x42, (byte) 0x33, (byte) 0x4E, 1271 (byte) 0xCC, (byte) 0x7A, (byte) 0xDF, (byte) 0xD7, (byte) 0x57, (byte) 0xEB, 1272 (byte) 0x51, (byte) 0x6C, (byte) 0xB1, (byte) 0x99, (byte) 0x4D, (byte) 0x94, 1273 (byte) 0x82, (byte) 0xA7, (byte) 0x69, (byte) 0x85, (byte) 0x8D, (byte) 0x82, 1274 (byte) 0x18, (byte) 0xE4, (byte) 0x53, (byte) 0xF5, (byte) 0x9F, (byte) 0x82, 1275 (byte) 0x1C, (byte) 0xE1, (byte) 0x25, (byte) 0x1C, (byte) 0x8E, (byte) 0xE7, 1276 (byte) 0xC1, (byte) 0xEC, (byte) 0xBE, (byte) 0x3F, (byte) 0xC3, (byte) 0xED, 1277 (byte) 0x41, (byte) 0x89, (byte) 0x94, (byte) 0x13, (byte) 0x11, (byte) 0x75, 1278 (byte) 0x3F, (byte) 0x38, (byte) 0x52, (byte) 0x58, (byte) 0xAB, (byte) 0x88, 1279 (byte) 0x01, (byte) 0x30, (byte) 0xB4, (byte) 0xCD, (byte) 0x45, (byte) 0x3E, 1280 (byte) 0x1A, (byte) 0x5F, (byte) 0x36, (byte) 0xF8, (byte) 0x51, (byte) 0x90, 1281 (byte) 0x6E, (byte) 0x6F, (byte) 0x31, (byte) 0x9D, (byte) 0x40, (byte) 0x90, 1282 (byte) 0x1A, (byte) 0xA8, (byte) 0x10, (byte) 0xEF, (byte) 0x9D, (byte) 0xF8, 1283 (byte) 0xB0, (byte) 0x03, (byte) 0x01, (byte) 0xFB, (byte) 0xD8, (byte) 0x3D, 1284 (byte) 0x83, (byte) 0x79, (byte) 0x01, (byte) 0xA7, (byte) 0x82, (byte) 0xC2, 1285 (byte) 0x46, (byte) 0x35, (byte) 0x68, (byte) 0xD2, (byte) 0x08, (byte) 0x81, 1286 (byte) 0x31, (byte) 0x14, (byte) 0xE8, (byte) 0x13, (byte) 0x8C, (byte) 0xD4, 1287 (byte) 0xC4, (byte) 0xCB, (byte) 0xB9, (byte) 0x85, (byte) 0x25, (byte) 0x93, 1288 (byte) 0x40, (byte) 0x88, (byte) 0x34, (byte) 0x11, (byte) 0xDA, (byte) 0xFF, 1289 (byte) 0xEF, (byte) 0x4D, (byte) 0xDC, (byte) 0x31, (byte) 0x74, (byte) 0x7B, 1290 (byte) 0x5E, (byte) 0xA7, (byte) 0x51, (byte) 0x15, (byte) 0x13, (byte) 0xB1, 1291 (byte) 0x9E, (byte) 0x06, (byte) 0x51, (byte) 0xBA, (byte) 0x11, (byte) 0xDA, 1292 (byte) 0x64, (byte) 0x1B, (byte) 0x78, (byte) 0x76, (byte) 0x57, (byte) 0x96, 1293 (byte) 0xF3, (byte) 0x1B, (byte) 0x86, (byte) 0xB2, (byte) 0xF3, (byte) 0x66, 1294 (byte) 0x64, (byte) 0x2B, (byte) 0x04, (byte) 0x81, (byte) 0x8C, (byte) 0xDC, 1295 (byte) 0xE0, (byte) 0xEA, (byte) 0x66, (byte) 0x62, (byte) 0x44, (byte) 0x31, 1296 (byte) 0xA2, (byte) 0x19, (byte) 0xF1, (byte) 0x77, (byte) 0x67, (byte) 0x58, 1297 (byte) 0x18, (byte) 0x5B, (byte) 0xCB, (byte) 0xBA, (byte) 0x28, (byte) 0x91, 1298 (byte) 0x47, (byte) 0x5B, (byte) 0x4F, (byte) 0x17, (byte) 0x23, (byte) 0x2A, 1299 (byte) 0xE4, (byte) 0xB0, (byte) 0xAE, (byte) 0x82, (byte) 0x4E, (byte) 0xCA, 1300 (byte) 0xA6, (byte) 0x12, (byte) 0xCA, (byte) 0x70, 1301 }; 1302 private static final PSSParameterSpec SHA224withRSAPSS_Vector2Signature_ParameterSpec = 1303 new PSSParameterSpec("SHA-224", "MGF1", new MGF1ParameterSpec("SHA-224"), 28, 1); 1304 1305 /* 1306 * echo "This is a signed message from Kenny Root." | openssl sha224 -binary -out digest.bin \ 1307 * && openssl pkeyutl -sign -in digest.bin -inkey privkey.pem \ 1308 * -pkeyopt rsa_padding_mode:pss -pkeyopt digest:sha224 -pkeyopt rsa_pss_saltlen:0 \ 1309 * | recode ../x1 | sed 's/0x/(byte) 0x/g' 1310 */ 1311 private static final byte[] SHA224withRSAPSS_NoSalt_Vector2Signature = new byte[] { 1312 (byte) 0xD8, (byte) 0x38, (byte) 0x48, (byte) 0xCD, (byte) 0xA4, (byte) 0x09, 1313 (byte) 0x36, (byte) 0x35, (byte) 0x47, (byte) 0x55, (byte) 0xDB, (byte) 0x6C, 1314 (byte) 0x2D, (byte) 0x83, (byte) 0x17, (byte) 0x10, (byte) 0x3E, (byte) 0xCE, 1315 (byte) 0x95, (byte) 0x02, (byte) 0x58, (byte) 0xCE, (byte) 0xA8, (byte) 0x02, 1316 (byte) 0x44, (byte) 0xB7, (byte) 0xE4, (byte) 0x32, (byte) 0x3D, (byte) 0x50, 1317 (byte) 0xE1, (byte) 0x8C, (byte) 0xF3, (byte) 0x24, (byte) 0x6F, (byte) 0xA4, 1318 (byte) 0x2D, (byte) 0xD7, (byte) 0xFB, (byte) 0x70, (byte) 0x97, (byte) 0xBE, 1319 (byte) 0xED, (byte) 0x27, (byte) 0x2D, (byte) 0x22, (byte) 0xDC, (byte) 0x62, 1320 (byte) 0x97, (byte) 0x66, (byte) 0x39, (byte) 0xE0, (byte) 0x36, (byte) 0x5F, 1321 (byte) 0x07, (byte) 0x78, (byte) 0xAF, (byte) 0x5E, (byte) 0xDC, (byte) 0xFD, 1322 (byte) 0x21, (byte) 0xA8, (byte) 0xD5, (byte) 0xA7, (byte) 0xD1, (byte) 0xBA, 1323 (byte) 0x1C, (byte) 0xDA, (byte) 0xCA, (byte) 0x80, (byte) 0x72, (byte) 0x8A, 1324 (byte) 0xDD, (byte) 0x5C, (byte) 0x16, (byte) 0x6A, (byte) 0x47, (byte) 0xFC, 1325 (byte) 0x11, (byte) 0x42, (byte) 0x7E, (byte) 0x4E, (byte) 0x3F, (byte) 0x49, 1326 (byte) 0xCF, (byte) 0x2F, (byte) 0x54, (byte) 0xD7, (byte) 0x13, (byte) 0x76, 1327 (byte) 0x5D, (byte) 0xE9, (byte) 0x2A, (byte) 0x29, (byte) 0xCC, (byte) 0x73, 1328 (byte) 0xDB, (byte) 0xE5, (byte) 0xDE, (byte) 0x48, (byte) 0xA2, (byte) 0xE9, 1329 (byte) 0xD1, (byte) 0xD0, (byte) 0x35, (byte) 0xFE, (byte) 0xA1, (byte) 0x1C, 1330 (byte) 0x13, (byte) 0x04, (byte) 0x75, (byte) 0x77, (byte) 0xF4, (byte) 0x55, 1331 (byte) 0x03, (byte) 0xC4, (byte) 0x6D, (byte) 0xAC, (byte) 0x25, (byte) 0x1D, 1332 (byte) 0x57, (byte) 0xFF, (byte) 0x0D, (byte) 0xE0, (byte) 0x91, (byte) 0xEA, 1333 (byte) 0xF6, (byte) 0x1F, (byte) 0x3F, (byte) 0x69, (byte) 0xD6, (byte) 0x00, 1334 (byte) 0xBD, (byte) 0x89, (byte) 0xEA, (byte) 0xD3, (byte) 0x31, (byte) 0x80, 1335 (byte) 0x5E, (byte) 0x04, (byte) 0x4C, (byte) 0x59, (byte) 0xDE, (byte) 0xD0, 1336 (byte) 0x62, (byte) 0x93, (byte) 0x3B, (byte) 0xC9, (byte) 0x9F, (byte) 0xE7, 1337 (byte) 0x69, (byte) 0xC0, (byte) 0xB8, (byte) 0xED, (byte) 0xBF, (byte) 0x0D, 1338 (byte) 0x60, (byte) 0x28, (byte) 0x55, (byte) 0x20, (byte) 0x0C, (byte) 0x9F, 1339 (byte) 0xA2, (byte) 0x42, (byte) 0x34, (byte) 0x95, (byte) 0xAE, (byte) 0xF8, 1340 (byte) 0x67, (byte) 0x7C, (byte) 0xF1, (byte) 0xA0, (byte) 0xC0, (byte) 0x74, 1341 (byte) 0xF2, (byte) 0xDF, (byte) 0x75, (byte) 0x5B, (byte) 0x6E, (byte) 0x2F, 1342 (byte) 0xFB, (byte) 0x1F, (byte) 0xDD, (byte) 0xC3, (byte) 0xD3, (byte) 0x90, 1343 (byte) 0x0A, (byte) 0x33, (byte) 0xF6, (byte) 0x03, (byte) 0x16, (byte) 0xC4, 1344 (byte) 0xF8, (byte) 0xED, (byte) 0xB7, (byte) 0x45, (byte) 0x39, (byte) 0x5D, 1345 (byte) 0x7C, (byte) 0xF8, (byte) 0x82, (byte) 0xCE, (byte) 0x7D, (byte) 0xFB, 1346 (byte) 0x02, (byte) 0x2D, (byte) 0xE0, (byte) 0x96, (byte) 0x35, (byte) 0x60, 1347 (byte) 0x5D, (byte) 0xBC, (byte) 0x35, (byte) 0x80, (byte) 0x4C, (byte) 0x39, 1348 (byte) 0x7C, (byte) 0xE7, (byte) 0xD4, (byte) 0xB4, (byte) 0x19, (byte) 0xD1, 1349 (byte) 0xE5, (byte) 0x8E, (byte) 0x6D, (byte) 0x25, (byte) 0x0C, (byte) 0xB9, 1350 (byte) 0x0C, (byte) 0x8D, (byte) 0x45, (byte) 0xE4, (byte) 0x67, (byte) 0x73, 1351 (byte) 0xCF, (byte) 0x87, (byte) 0x7C, (byte) 0x78, (byte) 0xAA, (byte) 0xB9, 1352 (byte) 0x42, (byte) 0xAE, (byte) 0x7F, (byte) 0xB8, (byte) 0xEC, (byte) 0x4F, 1353 (byte) 0xD2, (byte) 0x85, (byte) 0x01, (byte) 0x80, (byte) 0x00, (byte) 0xBD, 1354 (byte) 0xF5, (byte) 0xEA, (byte) 0x44, (byte) 0x6D, 1355 }; 1356 private static final PSSParameterSpec SHA224withRSAPSS_NoSalt_Vector2Signature_ParameterSpec = 1357 new PSSParameterSpec("SHA-224", "MGF1", new MGF1ParameterSpec("SHA-224"), 0, 1); 1358 1359 /* 1360 * echo "This is a signed message from Kenny Root." | openssl sha224 -binary -out digest.bin \ 1361 * && openssl pkeyutl -sign -in digest.bin -inkey privkey.pem \ 1362 * -pkeyopt rsa_padding_mode:pss -pkeyopt digest:sha224 -pkeyopt rsa_pss_saltlen:226 \ 1363 * | recode ../x1 | sed 's/0x/(byte) 0x/g' 1364 */ 1365 private static final byte[] SHA224withRSAPSS_MaxSalt_Vector2Signature = new byte[] { 1366 (byte) 0x2C, (byte) 0x19, (byte) 0x5E, (byte) 0x63, (byte) 0xC5, (byte) 0x32, 1367 (byte) 0xC3, (byte) 0xC7, (byte) 0x52, (byte) 0xE9, (byte) 0x69, (byte) 0x4C, 1368 (byte) 0x04, (byte) 0xE5, (byte) 0x4A, (byte) 0xF2, (byte) 0x72, (byte) 0x78, 1369 (byte) 0xBF, (byte) 0xC5, (byte) 0x8D, (byte) 0x5A, (byte) 0x71, (byte) 0xEF, 1370 (byte) 0xA9, (byte) 0x58, (byte) 0x77, (byte) 0x94, (byte) 0x49, (byte) 0x71, 1371 (byte) 0xBF, (byte) 0x45, (byte) 0x3E, (byte) 0xA4, (byte) 0x2E, (byte) 0x33, 1372 (byte) 0x9B, (byte) 0x4E, (byte) 0xA4, (byte) 0x95, (byte) 0x07, (byte) 0x9C, 1373 (byte) 0xAA, (byte) 0xC4, (byte) 0xA8, (byte) 0x60, (byte) 0xBC, (byte) 0xCD, 1374 (byte) 0xC3, (byte) 0x45, (byte) 0xE6, (byte) 0xBC, (byte) 0xAD, (byte) 0xB6, 1375 (byte) 0xF3, (byte) 0x0E, (byte) 0xF6, (byte) 0xD5, (byte) 0xCF, (byte) 0x33, 1376 (byte) 0xA3, (byte) 0x82, (byte) 0x62, (byte) 0x52, (byte) 0x95, (byte) 0xA8, 1377 (byte) 0x0E, (byte) 0xD4, (byte) 0xAC, (byte) 0x1F, (byte) 0x9A, (byte) 0xDC, 1378 (byte) 0x00, (byte) 0xD6, (byte) 0x78, (byte) 0xEA, (byte) 0x53, (byte) 0x00, 1379 (byte) 0x19, (byte) 0xE3, (byte) 0x81, (byte) 0x7C, (byte) 0x7A, (byte) 0x8E, 1380 (byte) 0x30, (byte) 0x57, (byte) 0xB7, (byte) 0x81, (byte) 0xD7, (byte) 0x4D, 1381 (byte) 0x1D, (byte) 0xCB, (byte) 0x99, (byte) 0x8D, (byte) 0xE4, (byte) 0xFA, 1382 (byte) 0x6E, (byte) 0x4E, (byte) 0xA6, (byte) 0xDA, (byte) 0x13, (byte) 0x92, 1383 (byte) 0x31, (byte) 0x7C, (byte) 0x2B, (byte) 0x3A, (byte) 0xA0, (byte) 0xF1, 1384 (byte) 0x03, (byte) 0x83, (byte) 0x12, (byte) 0xD1, (byte) 0x23, (byte) 0xED, 1385 (byte) 0xC4, (byte) 0x01, (byte) 0x57, (byte) 0x63, (byte) 0xAF, (byte) 0x40, 1386 (byte) 0x15, (byte) 0xEC, (byte) 0xB8, (byte) 0x5A, (byte) 0xCE, (byte) 0x3D, 1387 (byte) 0x3E, (byte) 0xCD, (byte) 0xD8, (byte) 0xF3, (byte) 0x76, (byte) 0xCA, 1388 (byte) 0x23, (byte) 0x20, (byte) 0x68, (byte) 0x17, (byte) 0x5B, (byte) 0x7F, 1389 (byte) 0xBC, (byte) 0x22, (byte) 0x67, (byte) 0x2A, (byte) 0x91, (byte) 0x05, 1390 (byte) 0xB3, (byte) 0x85, (byte) 0x60, (byte) 0xD8, (byte) 0x76, (byte) 0xD5, 1391 (byte) 0x2B, (byte) 0x9C, (byte) 0x80, (byte) 0xB6, (byte) 0xEA, (byte) 0x1E, 1392 (byte) 0x05, (byte) 0xC7, (byte) 0x95, (byte) 0x2C, (byte) 0x4F, (byte) 0x14, 1393 (byte) 0x5F, (byte) 0xEE, (byte) 0x08, (byte) 0x32, (byte) 0xF7, (byte) 0x12, 1394 (byte) 0x2B, (byte) 0xCD, (byte) 0xF3, (byte) 0x83, (byte) 0x7C, (byte) 0xCE, 1395 (byte) 0x04, (byte) 0x8A, (byte) 0x36, (byte) 0x3D, (byte) 0xB2, (byte) 0x97, 1396 (byte) 0x15, (byte) 0xDB, (byte) 0xD6, (byte) 0xFA, (byte) 0x53, (byte) 0x29, 1397 (byte) 0xD1, (byte) 0x43, (byte) 0x55, (byte) 0xDD, (byte) 0xAE, (byte) 0xA7, 1398 (byte) 0xB4, (byte) 0x2C, (byte) 0xD9, (byte) 0xA7, (byte) 0x74, (byte) 0xA8, 1399 (byte) 0x08, (byte) 0xD6, (byte) 0xC2, (byte) 0x05, (byte) 0xBF, (byte) 0x67, 1400 (byte) 0x3B, (byte) 0xBA, (byte) 0x8D, (byte) 0x99, (byte) 0xC1, (byte) 0x14, 1401 (byte) 0x1A, (byte) 0x32, (byte) 0xCA, (byte) 0xD5, (byte) 0xCC, (byte) 0xF9, 1402 (byte) 0x64, (byte) 0x07, (byte) 0x5B, (byte) 0xB8, (byte) 0xA9, (byte) 0x69, 1403 (byte) 0xED, (byte) 0x01, (byte) 0xCD, (byte) 0xD2, (byte) 0x88, (byte) 0x67, 1404 (byte) 0xFF, (byte) 0x92, (byte) 0xA3, (byte) 0xC6, (byte) 0x97, (byte) 0x97, 1405 (byte) 0xA1, (byte) 0xC5, (byte) 0x15, (byte) 0xC8, (byte) 0xB6, (byte) 0xFE, 1406 (byte) 0x4A, (byte) 0x07, (byte) 0x2E, (byte) 0x46, (byte) 0x3F, (byte) 0x27, 1407 (byte) 0xB8, (byte) 0xEE, (byte) 0x69, (byte) 0xCB, (byte) 0xDC, (byte) 0x30, 1408 (byte) 0x19, (byte) 0x77, (byte) 0xC5, (byte) 0xEF, 1409 }; 1410 private static final PSSParameterSpec SHA224withRSAPSS_MaxSalt_Vector2Signature_ParameterSpec = 1411 new PSSParameterSpec("SHA-224", "MGF1", new MGF1ParameterSpec("SHA-224"), 226, 1); 1412 1413 /* 1414 * echo "This is a signed message from Kenny Root." | openssl sha256 -binary -out digest.bin \ 1415 * && openssl pkeyutl -sign -in digest.bin -inkey privkey.pem \ 1416 * -pkeyopt rsa_padding_mode:pss -pkeyopt digest:sha256 -pkeyopt rsa_pss_saltlen:32 \ 1417 * | recode ../x1 | sed 's/0x/(byte) 0x/g' 1418 */ 1419 private static final byte[] SHA256withRSAPSS_Vector2Signature = new byte[] { 1420 (byte) 0x94, (byte) 0x33, (byte) 0xCB, (byte) 0x9E, (byte) 0x2C, (byte) 0x17, 1421 (byte) 0x46, (byte) 0xB3, (byte) 0x8F, (byte) 0xB7, (byte) 0x93, (byte) 0x98, 1422 (byte) 0xA3, (byte) 0x45, (byte) 0xEA, (byte) 0xD4, (byte) 0x51, (byte) 0x60, 1423 (byte) 0x3E, (byte) 0x00, (byte) 0xA3, (byte) 0x93, (byte) 0x05, (byte) 0x0F, 1424 (byte) 0xCB, (byte) 0x6E, (byte) 0xFF, (byte) 0xA5, (byte) 0x97, (byte) 0x18, 1425 (byte) 0xF6, (byte) 0xED, (byte) 0x6B, (byte) 0x6C, (byte) 0xAD, (byte) 0x9C, 1426 (byte) 0x73, (byte) 0x63, (byte) 0x9C, (byte) 0x5B, (byte) 0xA5, (byte) 0xA1, 1427 (byte) 0x42, (byte) 0xA3, (byte) 0x0E, (byte) 0x32, (byte) 0xF5, (byte) 0xF0, 1428 (byte) 0x55, (byte) 0xEE, (byte) 0x58, (byte) 0xC1, (byte) 0xBD, (byte) 0x99, 1429 (byte) 0x0A, (byte) 0x2B, (byte) 0xFD, (byte) 0xBD, (byte) 0x1E, (byte) 0x23, 1430 (byte) 0xEF, (byte) 0x99, (byte) 0x7D, (byte) 0xC1, (byte) 0xE2, (byte) 0xD5, 1431 (byte) 0x71, (byte) 0x6C, (byte) 0x96, (byte) 0x70, (byte) 0xC3, (byte) 0x75, 1432 (byte) 0x48, (byte) 0x83, (byte) 0x85, (byte) 0x5E, (byte) 0xC6, (byte) 0x3A, 1433 (byte) 0xFF, (byte) 0xE5, (byte) 0xF1, (byte) 0x6B, (byte) 0x85, (byte) 0x7B, 1434 (byte) 0x61, (byte) 0xA6, (byte) 0xB1, (byte) 0xCF, (byte) 0x60, (byte) 0x09, 1435 (byte) 0x32, (byte) 0xAF, (byte) 0xEF, (byte) 0x95, (byte) 0xA4, (byte) 0x1B, 1436 (byte) 0xD6, (byte) 0xFA, (byte) 0xD0, (byte) 0xD7, (byte) 0x17, (byte) 0xCA, 1437 (byte) 0xB0, (byte) 0x19, (byte) 0x21, (byte) 0x7F, (byte) 0x5E, (byte) 0x9B, 1438 (byte) 0xBB, (byte) 0xB8, (byte) 0xE0, (byte) 0xB1, (byte) 0x95, (byte) 0xB3, 1439 (byte) 0xDA, (byte) 0x0B, (byte) 0xB8, (byte) 0xFA, (byte) 0x15, (byte) 0x75, 1440 (byte) 0x73, (byte) 0x88, (byte) 0xC8, (byte) 0x45, (byte) 0x33, (byte) 0xD1, 1441 (byte) 0x5C, (byte) 0xB7, (byte) 0xFB, (byte) 0x38, (byte) 0x05, (byte) 0xA0, 1442 (byte) 0x85, (byte) 0x99, (byte) 0x2C, (byte) 0xB1, (byte) 0xC2, (byte) 0xFE, 1443 (byte) 0xAC, (byte) 0x5D, (byte) 0x2C, (byte) 0x1B, (byte) 0xD3, (byte) 0x42, 1444 (byte) 0x81, (byte) 0xC8, (byte) 0x1C, (byte) 0xB7, (byte) 0x53, (byte) 0x7E, 1445 (byte) 0xC5, (byte) 0x9F, (byte) 0x84, (byte) 0x97, (byte) 0x6F, (byte) 0x00, 1446 (byte) 0xC3, (byte) 0x5E, (byte) 0x8B, (byte) 0x67, (byte) 0x3D, (byte) 0x9A, 1447 (byte) 0xD0, (byte) 0xE2, (byte) 0x9B, (byte) 0x2D, (byte) 0xC6, (byte) 0xD8, 1448 (byte) 0xEF, (byte) 0x19, (byte) 0x14, (byte) 0x49, (byte) 0x88, (byte) 0x52, 1449 (byte) 0xF7, (byte) 0x93, (byte) 0xEB, (byte) 0xDB, (byte) 0xB6, (byte) 0x55, 1450 (byte) 0x05, (byte) 0xB6, (byte) 0xE7, (byte) 0x70, (byte) 0xE4, (byte) 0x5A, 1451 (byte) 0x9E, (byte) 0x80, (byte) 0x78, (byte) 0x48, (byte) 0xA8, (byte) 0xE5, 1452 (byte) 0x59, (byte) 0x8D, (byte) 0x1C, (byte) 0x5D, (byte) 0x95, (byte) 0x38, 1453 (byte) 0x25, (byte) 0xFC, (byte) 0x38, (byte) 0xC3, (byte) 0xFF, (byte) 0xE2, 1454 (byte) 0x6F, (byte) 0xE4, (byte) 0xFC, (byte) 0x64, (byte) 0x8B, (byte) 0xCA, 1455 (byte) 0x91, (byte) 0x5F, (byte) 0x0B, (byte) 0x4E, (byte) 0x9A, (byte) 0xB5, 1456 (byte) 0x22, (byte) 0x5D, (byte) 0xC5, (byte) 0x5A, (byte) 0x77, (byte) 0xED, 1457 (byte) 0x23, (byte) 0xE0, (byte) 0x13, (byte) 0x8F, (byte) 0xAC, (byte) 0x13, 1458 (byte) 0xE5, (byte) 0x81, (byte) 0xEE, (byte) 0xD1, (byte) 0xAD, (byte) 0x8A, 1459 (byte) 0x0F, (byte) 0x2B, (byte) 0x4C, (byte) 0xB2, (byte) 0x13, (byte) 0x54, 1460 (byte) 0x44, (byte) 0x8E, (byte) 0x53, (byte) 0xE2, (byte) 0x33, (byte) 0x14, 1461 (byte) 0x7F, (byte) 0x9B, (byte) 0xA9, (byte) 0xD3, (byte) 0xBB, (byte) 0xFC, 1462 (byte) 0xAC, (byte) 0xC9, (byte) 0x31, (byte) 0xB6, 1463 }; 1464 private static final PSSParameterSpec SHA256withRSAPSS_Vector2Signature_ParameterSpec = 1465 new PSSParameterSpec("SHA-256", "MGF1", MGF1ParameterSpec.SHA256, 32, 1); 1466 1467 /* 1468 * echo "This is a signed message from Kenny Root." | openssl sha256 -binary -out digest.bin \ 1469 * && openssl pkeyutl -sign -in digest.bin -inkey privkey.pem \ 1470 * -pkeyopt rsa_padding_mode:pss -pkeyopt digest:sha256 -pkeyopt rsa_pss_saltlen:0 \ 1471 * | recode ../x1 | sed 's/0x/(byte) 0x/g' 1472 */ 1473 private static final byte[] SHA256withRSAPSS_NoSalt_Vector2Signature = new byte[] { 1474 (byte) 0x4C, (byte) 0xB7, (byte) 0x33, (byte) 0x78, (byte) 0x0A, (byte) 0xA7, 1475 (byte) 0xEB, (byte) 0x35, (byte) 0x5E, (byte) 0x99, (byte) 0x8F, (byte) 0xE9, 1476 (byte) 0x2A, (byte) 0x3D, (byte) 0x8C, (byte) 0x9B, (byte) 0x19, (byte) 0xC7, 1477 (byte) 0xC8, (byte) 0xB8, (byte) 0x10, (byte) 0xC5, (byte) 0x6D, (byte) 0xA4, 1478 (byte) 0x44, (byte) 0x3E, (byte) 0xAB, (byte) 0x90, (byte) 0x82, (byte) 0x70, 1479 (byte) 0xFA, (byte) 0x7B, (byte) 0xE6, (byte) 0x06, (byte) 0x36, (byte) 0x06, 1480 (byte) 0x93, (byte) 0x54, (byte) 0x50, (byte) 0xCD, (byte) 0x5F, (byte) 0xAA, 1481 (byte) 0x01, (byte) 0x42, (byte) 0xAD, (byte) 0xB9, (byte) 0x02, (byte) 0x6E, 1482 (byte) 0xAE, (byte) 0x60, (byte) 0x00, (byte) 0x60, (byte) 0x55, (byte) 0x1B, 1483 (byte) 0xBB, (byte) 0x9E, (byte) 0x03, (byte) 0xB7, (byte) 0x86, (byte) 0x3D, 1484 (byte) 0xCC, (byte) 0xFA, (byte) 0x6E, (byte) 0x20, (byte) 0x07, (byte) 0x61, 1485 (byte) 0x8F, (byte) 0x53, (byte) 0xC6, (byte) 0x2B, (byte) 0xEF, (byte) 0x8F, 1486 (byte) 0x0F, (byte) 0x8B, (byte) 0x80, (byte) 0x22, (byte) 0xDC, (byte) 0x9E, 1487 (byte) 0x20, (byte) 0x4A, (byte) 0x57, (byte) 0xA1, (byte) 0x15, (byte) 0xE0, 1488 (byte) 0x01, (byte) 0x95, (byte) 0xDB, (byte) 0x46, (byte) 0x85, (byte) 0x6D, 1489 (byte) 0x27, (byte) 0x9F, (byte) 0x44, (byte) 0x3B, (byte) 0xB1, (byte) 0x35, 1490 (byte) 0x04, (byte) 0x9D, (byte) 0xF8, (byte) 0xC6, (byte) 0xD7, (byte) 0xD7, 1491 (byte) 0xEF, (byte) 0x9A, (byte) 0x53, (byte) 0x5A, (byte) 0x73, (byte) 0xB3, 1492 (byte) 0xD0, (byte) 0x32, (byte) 0x39, (byte) 0xE1, (byte) 0x28, (byte) 0x3A, 1493 (byte) 0x9D, (byte) 0x69, (byte) 0x4E, (byte) 0x57, (byte) 0xC1, (byte) 0xDF, 1494 (byte) 0xFE, (byte) 0x5F, (byte) 0xA8, (byte) 0xFF, (byte) 0xE8, (byte) 0x75, 1495 (byte) 0x85, (byte) 0x33, (byte) 0x90, (byte) 0x83, (byte) 0x3D, (byte) 0x8F, 1496 (byte) 0x15, (byte) 0x47, (byte) 0x16, (byte) 0xF2, (byte) 0x32, (byte) 0xF9, 1497 (byte) 0x46, (byte) 0x96, (byte) 0xCC, (byte) 0x2E, (byte) 0x8F, (byte) 0x27, 1498 (byte) 0x3F, (byte) 0xCF, (byte) 0x91, (byte) 0xA6, (byte) 0x9E, (byte) 0xBF, 1499 (byte) 0x42, (byte) 0x2F, (byte) 0xD6, (byte) 0x52, (byte) 0xD7, (byte) 0x3B, 1500 (byte) 0xCD, (byte) 0xFE, (byte) 0x0B, (byte) 0x4A, (byte) 0x3B, (byte) 0x19, 1501 (byte) 0x57, (byte) 0x47, (byte) 0x65, (byte) 0x33, (byte) 0xD9, (byte) 0xF7, 1502 (byte) 0xE4, (byte) 0xC3, (byte) 0x05, (byte) 0x49, (byte) 0x3C, (byte) 0xC0, 1503 (byte) 0xDF, (byte) 0xC1, (byte) 0x54, (byte) 0x18, (byte) 0x8D, (byte) 0xDA, 1504 (byte) 0xE4, (byte) 0x59, (byte) 0xE9, (byte) 0x3B, (byte) 0xD6, (byte) 0x89, 1505 (byte) 0x07, (byte) 0x99, (byte) 0xB0, (byte) 0xF4, (byte) 0x09, (byte) 0x0A, 1506 (byte) 0x2C, (byte) 0xBA, (byte) 0x0B, (byte) 0xE4, (byte) 0x79, (byte) 0xB1, 1507 (byte) 0xDB, (byte) 0xAD, (byte) 0xAB, (byte) 0x5D, (byte) 0xA2, (byte) 0x1E, 1508 (byte) 0x76, (byte) 0x7F, (byte) 0x74, (byte) 0x62, (byte) 0x49, (byte) 0x07, 1509 (byte) 0x7A, (byte) 0x5B, (byte) 0xD7, (byte) 0x0F, (byte) 0xA4, (byte) 0x2C, 1510 (byte) 0x36, (byte) 0x13, (byte) 0x42, (byte) 0xBA, (byte) 0xCF, (byte) 0x0A, 1511 (byte) 0xFC, (byte) 0xC3, (byte) 0x31, (byte) 0x5E, (byte) 0x06, (byte) 0x84, 1512 (byte) 0x8A, (byte) 0x8A, (byte) 0x84, (byte) 0x0D, (byte) 0x48, (byte) 0xBD, 1513 (byte) 0x67, (byte) 0xCF, (byte) 0x04, (byte) 0xB4, (byte) 0xFB, (byte) 0xBB, 1514 (byte) 0x04, (byte) 0x91, (byte) 0xB1, (byte) 0x0A, (byte) 0xA4, (byte) 0x70, 1515 (byte) 0x58, (byte) 0x1A, (byte) 0x9B, (byte) 0x02, (byte) 0x86, (byte) 0xBD, 1516 (byte) 0xAE, (byte) 0x77, (byte) 0x97, (byte) 0x1C, 1517 }; 1518 private static final PSSParameterSpec SHA256withRSAPSS_NoSalt_Vector2Signature_ParameterSpec = 1519 new PSSParameterSpec("SHA-256", "MGF1", MGF1ParameterSpec.SHA256, 0, 1); 1520 1521 /* 1522 * echo "This is a signed message from Kenny Root." | openssl sha256 -binary -out digest.bin \ 1523 * && openssl pkeyutl -sign -in digest.bin -inkey privkey.pem \ 1524 * -pkeyopt rsa_padding_mode:pss -pkeyopt digest:sha256 -pkeyopt rsa_pss_saltlen:222 \ 1525 * | recode ../x1 | sed 's/0x/(byte) 0x/g' 1526 */ 1527 private static final byte[] SHA256withRSAPSS_MaxSalt_Vector2Signature = new byte[] { 1528 (byte) 0x3B, (byte) 0x43, (byte) 0xA8, (byte) 0xB5, (byte) 0x34, (byte) 0xD8, 1529 (byte) 0xF9, (byte) 0xAD, (byte) 0xDD, (byte) 0x1F, (byte) 0x7A, (byte) 0x73, 1530 (byte) 0xBF, (byte) 0xFA, (byte) 0xED, (byte) 0x10, (byte) 0xF3, (byte) 0x16, 1531 (byte) 0xCC, (byte) 0xE5, (byte) 0x09, (byte) 0x0F, (byte) 0x68, (byte) 0x02, 1532 (byte) 0xE7, (byte) 0x55, (byte) 0x0D, (byte) 0xCF, (byte) 0x1B, (byte) 0x83, 1533 (byte) 0xCD, (byte) 0xA2, (byte) 0xD6, (byte) 0x02, (byte) 0xDD, (byte) 0x72, 1534 (byte) 0xA6, (byte) 0x5F, (byte) 0x05, (byte) 0x8A, (byte) 0x1E, (byte) 0xA1, 1535 (byte) 0x4F, (byte) 0x92, (byte) 0xD9, (byte) 0x09, (byte) 0x19, (byte) 0x6E, 1536 (byte) 0x80, (byte) 0xA0, (byte) 0x47, (byte) 0x98, (byte) 0x5C, (byte) 0xF7, 1537 (byte) 0x34, (byte) 0x52, (byte) 0x7D, (byte) 0x85, (byte) 0xCF, (byte) 0x9F, 1538 (byte) 0xEB, (byte) 0xAF, (byte) 0xB4, (byte) 0x53, (byte) 0xF0, (byte) 0x5D, 1539 (byte) 0x28, (byte) 0x87, (byte) 0xAC, (byte) 0xA7, (byte) 0xB4, (byte) 0xCF, 1540 (byte) 0xDD, (byte) 0x8B, (byte) 0xA4, (byte) 0xC9, (byte) 0xCA, (byte) 0xAA, 1541 (byte) 0xF4, (byte) 0xA8, (byte) 0x25, (byte) 0x26, (byte) 0x34, (byte) 0x11, 1542 (byte) 0x14, (byte) 0x24, (byte) 0x1C, (byte) 0x1C, (byte) 0x50, (byte) 0xC8, 1543 (byte) 0xFF, (byte) 0x7E, (byte) 0xFF, (byte) 0x6F, (byte) 0x4F, (byte) 0x14, 1544 (byte) 0xB3, (byte) 0x57, (byte) 0x48, (byte) 0x0A, (byte) 0x5A, (byte) 0x95, 1545 (byte) 0x5D, (byte) 0xEB, (byte) 0x71, (byte) 0x4E, (byte) 0x86, (byte) 0xFC, 1546 (byte) 0x38, (byte) 0x1B, (byte) 0x93, (byte) 0x45, (byte) 0x09, (byte) 0x15, 1547 (byte) 0xD3, (byte) 0x06, (byte) 0x6B, (byte) 0x9D, (byte) 0x05, (byte) 0x5C, 1548 (byte) 0x4A, (byte) 0xB3, (byte) 0x93, (byte) 0xD1, (byte) 0x01, (byte) 0x54, 1549 (byte) 0xCC, (byte) 0xED, (byte) 0xBF, (byte) 0x0E, (byte) 0x7E, (byte) 0x33, 1550 (byte) 0x32, (byte) 0xA6, (byte) 0xA5, (byte) 0xF7, (byte) 0x3D, (byte) 0x2E, 1551 (byte) 0xCB, (byte) 0x76, (byte) 0xA7, (byte) 0x22, (byte) 0x64, (byte) 0xB8, 1552 (byte) 0x19, (byte) 0x53, (byte) 0xFE, (byte) 0x8C, (byte) 0xC8, (byte) 0x1E, 1553 (byte) 0x6C, (byte) 0xEE, (byte) 0x08, (byte) 0x07, (byte) 0x7E, (byte) 0x93, 1554 (byte) 0x43, (byte) 0x1B, (byte) 0xCF, (byte) 0x37, (byte) 0xE4, (byte) 0xAB, 1555 (byte) 0xE7, (byte) 0xD7, (byte) 0x83, (byte) 0x8E, (byte) 0x19, (byte) 0xAE, 1556 (byte) 0x05, (byte) 0x51, (byte) 0x91, (byte) 0x10, (byte) 0x7B, (byte) 0x70, 1557 (byte) 0xFC, (byte) 0x73, (byte) 0x12, (byte) 0x96, (byte) 0xFA, (byte) 0xD0, 1558 (byte) 0xCA, (byte) 0xA3, (byte) 0x59, (byte) 0xA7, (byte) 0xDD, (byte) 0xC3, 1559 (byte) 0x1D, (byte) 0x9C, (byte) 0x7B, (byte) 0x50, (byte) 0xBB, (byte) 0x57, 1560 (byte) 0xB8, (byte) 0x86, (byte) 0xF2, (byte) 0xCA, (byte) 0xC4, (byte) 0x86, 1561 (byte) 0x7A, (byte) 0x96, (byte) 0x90, (byte) 0x02, (byte) 0xDF, (byte) 0xA0, 1562 (byte) 0x88, (byte) 0x0E, (byte) 0x89, (byte) 0x45, (byte) 0x27, (byte) 0x52, 1563 (byte) 0xDA, (byte) 0x86, (byte) 0x42, (byte) 0x4B, (byte) 0x90, (byte) 0xC3, 1564 (byte) 0xC1, (byte) 0x41, (byte) 0x60, (byte) 0x5C, (byte) 0x29, (byte) 0x15, 1565 (byte) 0xE5, (byte) 0x5C, (byte) 0x43, (byte) 0x9B, (byte) 0x40, (byte) 0xE5, 1566 (byte) 0x04, (byte) 0x1B, (byte) 0x4A, (byte) 0x93, (byte) 0xDD, (byte) 0x55, 1567 (byte) 0xC4, (byte) 0xFC, (byte) 0xFE, (byte) 0x0C, (byte) 0x65, (byte) 0x96, 1568 (byte) 0x98, (byte) 0xDE, (byte) 0xC5, (byte) 0x05, (byte) 0xC5, (byte) 0x3E, 1569 (byte) 0xB0, (byte) 0x25, (byte) 0x4E, (byte) 0x65, (byte) 0x24, (byte) 0x8D, 1570 (byte) 0x4E, (byte) 0x9D, (byte) 0x94, (byte) 0x01, 1571 }; 1572 private static final PSSParameterSpec SHA256withRSAPSS_MaxSalt_Vector2Signature_ParameterSpec = 1573 new PSSParameterSpec("SHA-256", "MGF1", MGF1ParameterSpec.SHA256, 222, 1); 1574 1575 /* 1576 * echo "This is a signed message from Kenny Root." | openssl sha384 -binary -out digest.bin \ 1577 * && openssl pkeyutl -sign -in digest.bin -inkey privkey.pem \ 1578 * -pkeyopt rsa_padding_mode:pss -pkeyopt digest:sha384 -pkeyopt rsa_pss_saltlen:48 \ 1579 * | recode ../x1 | sed 's/0x/(byte) 0x/g' 1580 */ 1581 private static final byte[] SHA384withRSAPSS_Vector2Signature = new byte[] { 1582 (byte) 0x20, (byte) 0xCB, (byte) 0x97, (byte) 0x9C, (byte) 0x2E, (byte) 0x51, 1583 (byte) 0x59, (byte) 0x56, (byte) 0x9F, (byte) 0x04, (byte) 0x47, (byte) 0x7C, 1584 (byte) 0x5C, (byte) 0x57, (byte) 0x59, (byte) 0xBC, (byte) 0x43, (byte) 0xD9, 1585 (byte) 0x4B, (byte) 0xEC, (byte) 0xAC, (byte) 0xB9, (byte) 0x88, (byte) 0xA2, 1586 (byte) 0x30, (byte) 0x8B, (byte) 0xEE, (byte) 0x2F, (byte) 0xC1, (byte) 0x73, 1587 (byte) 0xF1, (byte) 0x13, (byte) 0xB2, (byte) 0x5E, (byte) 0x1A, (byte) 0xC8, 1588 (byte) 0xD2, (byte) 0xAA, (byte) 0x27, (byte) 0x16, (byte) 0xA1, (byte) 0x14, 1589 (byte) 0xAB, (byte) 0x45, (byte) 0x8A, (byte) 0x7E, (byte) 0x22, (byte) 0x22, 1590 (byte) 0x2A, (byte) 0x2E, (byte) 0xDA, (byte) 0x6A, (byte) 0x7E, (byte) 0x3F, 1591 (byte) 0x66, (byte) 0x99, (byte) 0x55, (byte) 0xAF, (byte) 0x2B, (byte) 0x94, 1592 (byte) 0xD8, (byte) 0x6B, (byte) 0xC2, (byte) 0x60, (byte) 0xB5, (byte) 0x55, 1593 (byte) 0xA9, (byte) 0x26, (byte) 0x29, (byte) 0xFC, (byte) 0x17, (byte) 0x56, 1594 (byte) 0x05, (byte) 0xB7, (byte) 0x48, (byte) 0x2F, (byte) 0xAB, (byte) 0x68, 1595 (byte) 0xCF, (byte) 0x37, (byte) 0x62, (byte) 0x79, (byte) 0x4F, (byte) 0x32, 1596 (byte) 0x04, (byte) 0xF6, (byte) 0xEA, (byte) 0xBE, (byte) 0x79, (byte) 0x84, 1597 (byte) 0x73, (byte) 0xEE, (byte) 0x1C, (byte) 0xEE, (byte) 0x9F, (byte) 0x72, 1598 (byte) 0x7A, (byte) 0xC6, (byte) 0x64, (byte) 0xB4, (byte) 0x4F, (byte) 0xDE, 1599 (byte) 0x0B, (byte) 0x38, (byte) 0x47, (byte) 0x62, (byte) 0xA9, (byte) 0xFD, 1600 (byte) 0x1B, (byte) 0x75, (byte) 0xEC, (byte) 0xFE, (byte) 0x2D, (byte) 0x04, 1601 (byte) 0x2D, (byte) 0x0A, (byte) 0xCE, (byte) 0x13, (byte) 0xFA, (byte) 0xDA, 1602 (byte) 0x3F, (byte) 0x4C, (byte) 0x11, (byte) 0xEA, (byte) 0x02, (byte) 0x00, 1603 (byte) 0x0A, (byte) 0x93, (byte) 0x12, (byte) 0xDC, (byte) 0x60, (byte) 0xE7, 1604 (byte) 0x52, (byte) 0x90, (byte) 0x8A, (byte) 0xA3, (byte) 0xAE, (byte) 0xC5, 1605 (byte) 0x9A, (byte) 0xD7, (byte) 0xD5, (byte) 0x0D, (byte) 0xBC, (byte) 0x7A, 1606 (byte) 0xDB, (byte) 0xF4, (byte) 0x10, (byte) 0xE0, (byte) 0xDB, (byte) 0xC0, 1607 (byte) 0x97, (byte) 0xF1, (byte) 0x84, (byte) 0xCF, (byte) 0x66, (byte) 0xB2, 1608 (byte) 0x04, (byte) 0x58, (byte) 0x81, (byte) 0xB5, (byte) 0x9B, (byte) 0x4A, 1609 (byte) 0xF9, (byte) 0xD7, (byte) 0xCA, (byte) 0x51, (byte) 0x09, (byte) 0x67, 1610 (byte) 0x48, (byte) 0x7B, (byte) 0xE5, (byte) 0xE9, (byte) 0x07, (byte) 0x4E, 1611 (byte) 0x6A, (byte) 0xC1, (byte) 0xA6, (byte) 0x68, (byte) 0x90, (byte) 0x17, 1612 (byte) 0xAB, (byte) 0x0E, (byte) 0xFB, (byte) 0x3E, (byte) 0x39, (byte) 0x74, 1613 (byte) 0x85, (byte) 0x04, (byte) 0x42, (byte) 0x0A, (byte) 0x9E, (byte) 0x02, 1614 (byte) 0xA9, (byte) 0x50, (byte) 0xFF, (byte) 0x23, (byte) 0x2D, (byte) 0x30, 1615 (byte) 0xDD, (byte) 0x17, (byte) 0xC0, (byte) 0x82, (byte) 0xF7, (byte) 0xBB, 1616 (byte) 0x3B, (byte) 0x03, (byte) 0xBD, (byte) 0xB1, (byte) 0x96, (byte) 0xCD, 1617 (byte) 0x71, (byte) 0x3F, (byte) 0x67, (byte) 0x59, (byte) 0x5E, (byte) 0x45, 1618 (byte) 0xE0, (byte) 0x1C, (byte) 0x80, (byte) 0x52, (byte) 0xD7, (byte) 0xF0, 1619 (byte) 0xC1, (byte) 0xE6, (byte) 0xCF, (byte) 0x59, (byte) 0x13, (byte) 0x25, 1620 (byte) 0x6F, (byte) 0x9F, (byte) 0xBB, (byte) 0xB9, (byte) 0x7F, (byte) 0x7E, 1621 (byte) 0x7D, (byte) 0x93, (byte) 0xD9, (byte) 0x3F, (byte) 0x95, (byte) 0xB7, 1622 (byte) 0x9A, (byte) 0xDB, (byte) 0xE2, (byte) 0x2C, (byte) 0x53, (byte) 0x83, 1623 (byte) 0x9A, (byte) 0x06, (byte) 0x6D, (byte) 0x22, (byte) 0x81, (byte) 0xB5, 1624 (byte) 0x63, (byte) 0xAE, (byte) 0x4A, (byte) 0xEE, 1625 }; 1626 private static final PSSParameterSpec SHA384withRSAPSS_Vector2Signature_ParameterSpec = 1627 new PSSParameterSpec("SHA-384", "MGF1", MGF1ParameterSpec.SHA384, 48, 1); 1628 1629 /* 1630 * echo "This is a signed message from Kenny Root." | openssl sha384 -binary -out digest.bin \ 1631 * && openssl pkeyutl -sign -in digest.bin -inkey privkey.pem \ 1632 * -pkeyopt rsa_padding_mode:pss -pkeyopt digest:sha384 -pkeyopt rsa_pss_saltlen:0 \ 1633 * | recode ../x1 | sed 's/0x/(byte) 0x/g' 1634 */ 1635 private static final byte[] SHA384withRSAPSS_NoSalt_Vector2Signature = new byte[] { 1636 (byte) 0x41, (byte) 0x0C, (byte) 0x3A, (byte) 0xEC, (byte) 0xF6, (byte) 0xD9, 1637 (byte) 0x8F, (byte) 0xA3, (byte) 0x61, (byte) 0xBB, (byte) 0x03, (byte) 0xED, 1638 (byte) 0xD9, (byte) 0x69, (byte) 0x7D, (byte) 0xE1, (byte) 0xE1, (byte) 0x4E, 1639 (byte) 0x5E, (byte) 0x71, (byte) 0x4E, (byte) 0x88, (byte) 0x9C, (byte) 0x79, 1640 (byte) 0xD3, (byte) 0x71, (byte) 0x28, (byte) 0x07, (byte) 0x28, (byte) 0x19, 1641 (byte) 0x96, (byte) 0x55, (byte) 0x30, (byte) 0x81, (byte) 0x29, (byte) 0x5C, 1642 (byte) 0x4A, (byte) 0x18, (byte) 0x69, (byte) 0x36, (byte) 0x74, (byte) 0xAC, 1643 (byte) 0x99, (byte) 0xB1, (byte) 0xBC, (byte) 0xA0, (byte) 0xFC, (byte) 0x17, 1644 (byte) 0xA4, (byte) 0xD1, (byte) 0xAE, (byte) 0x84, (byte) 0xA6, (byte) 0x09, 1645 (byte) 0x6B, (byte) 0xB3, (byte) 0x02, (byte) 0xB2, (byte) 0x81, (byte) 0x04, 1646 (byte) 0x59, (byte) 0x8C, (byte) 0xCF, (byte) 0xAD, (byte) 0xFB, (byte) 0x76, 1647 (byte) 0x6F, (byte) 0xE2, (byte) 0x5E, (byte) 0x09, (byte) 0xE5, (byte) 0xBC, 1648 (byte) 0x54, (byte) 0xBD, (byte) 0x08, (byte) 0xA8, (byte) 0x18, (byte) 0x60, 1649 (byte) 0xAF, (byte) 0x09, (byte) 0x67, (byte) 0x15, (byte) 0x03, (byte) 0xA8, 1650 (byte) 0x8B, (byte) 0x3F, (byte) 0x31, (byte) 0xB7, (byte) 0x76, (byte) 0xFD, 1651 (byte) 0xF6, (byte) 0x82, (byte) 0xC7, (byte) 0x89, (byte) 0xC2, (byte) 0x47, 1652 (byte) 0x80, (byte) 0x06, (byte) 0x4F, (byte) 0x8C, (byte) 0x9C, (byte) 0xD7, 1653 (byte) 0x4F, (byte) 0x63, (byte) 0x1E, (byte) 0xF0, (byte) 0x34, (byte) 0xD7, 1654 (byte) 0x91, (byte) 0xD2, (byte) 0x96, (byte) 0x62, (byte) 0xFD, (byte) 0x68, 1655 (byte) 0xE3, (byte) 0xE0, (byte) 0xFB, (byte) 0x7D, (byte) 0x0A, (byte) 0xD7, 1656 (byte) 0x52, (byte) 0xFE, (byte) 0xD1, (byte) 0x95, (byte) 0x9E, (byte) 0xD2, 1657 (byte) 0x84, (byte) 0xBE, (byte) 0x3D, (byte) 0x1F, (byte) 0x8C, (byte) 0xC4, 1658 (byte) 0xD6, (byte) 0xE3, (byte) 0xCF, (byte) 0xE8, (byte) 0xB3, (byte) 0x82, 1659 (byte) 0x2E, (byte) 0xFA, (byte) 0x39, (byte) 0xA3, (byte) 0x20, (byte) 0x3C, 1660 (byte) 0xBE, (byte) 0x6A, (byte) 0xFA, (byte) 0x04, (byte) 0xD2, (byte) 0x74, 1661 (byte) 0x41, (byte) 0xDC, (byte) 0xE8, (byte) 0x0E, (byte) 0xE7, (byte) 0xF2, 1662 (byte) 0x36, (byte) 0xD4, (byte) 0x2E, (byte) 0x6A, (byte) 0xCF, (byte) 0xDF, 1663 (byte) 0x8B, (byte) 0x4B, (byte) 0x77, (byte) 0xE8, (byte) 0x0A, (byte) 0x64, 1664 (byte) 0x86, (byte) 0x2C, (byte) 0xCA, (byte) 0x92, (byte) 0x01, (byte) 0xB2, 1665 (byte) 0x8A, (byte) 0xB8, (byte) 0xB2, (byte) 0x6C, (byte) 0x0B, (byte) 0x18, 1666 (byte) 0x90, (byte) 0x31, (byte) 0x93, (byte) 0x29, (byte) 0xBA, (byte) 0xB1, 1667 (byte) 0x88, (byte) 0x94, (byte) 0x44, (byte) 0x0B, (byte) 0x38, (byte) 0x64, 1668 (byte) 0xC1, (byte) 0xDE, (byte) 0x0B, (byte) 0xD8, (byte) 0xE4, (byte) 0xBA, 1669 (byte) 0x0A, (byte) 0x41, (byte) 0x24, (byte) 0x35, (byte) 0xAA, (byte) 0xE3, 1670 (byte) 0x59, (byte) 0x8E, (byte) 0x57, (byte) 0x51, (byte) 0x43, (byte) 0xE1, 1671 (byte) 0x9C, (byte) 0xF6, (byte) 0xF8, (byte) 0x16, (byte) 0x68, (byte) 0x83, 1672 (byte) 0x08, (byte) 0x8C, (byte) 0x2D, (byte) 0x40, (byte) 0xD2, (byte) 0xEF, 1673 (byte) 0xD6, (byte) 0xAE, (byte) 0x98, (byte) 0x77, (byte) 0xE8, (byte) 0xF2, 1674 (byte) 0xC7, (byte) 0x19, (byte) 0x61, (byte) 0xD6, (byte) 0x43, (byte) 0xCD, 1675 (byte) 0x76, (byte) 0x2E, (byte) 0x7A, (byte) 0xCB, (byte) 0x1A, (byte) 0x5D, 1676 (byte) 0x73, (byte) 0x45, (byte) 0xF2, (byte) 0x7C, (byte) 0xD0, (byte) 0x88, 1677 (byte) 0x83, (byte) 0x51, (byte) 0xF3, (byte) 0x19, (byte) 0x0F, (byte) 0xD5, 1678 (byte) 0x40, (byte) 0x3F, (byte) 0xD9, (byte) 0xBF, 1679 }; 1680 private static final PSSParameterSpec SHA384withRSAPSS_NoSalt_Vector2Signature_ParameterSpec = 1681 new PSSParameterSpec("SHA-384", "MGF1", MGF1ParameterSpec.SHA384, 0, 1); 1682 1683 /* 1684 * echo "This is a signed message from Kenny Root." | openssl sha384 -binary -out digest.bin \ 1685 * && openssl pkeyutl -sign -in digest.bin -inkey privkey.pem \ 1686 * -pkeyopt rsa_padding_mode:pss -pkeyopt digest:sha384 -pkeyopt rsa_pss_saltlen:206 \ 1687 * | recode ../x1 | sed 's/0x/(byte) 0x/g' 1688 */ 1689 private static final byte[] SHA384withRSAPSS_MaxSalt_Vector2Signature = new byte[] { 1690 (byte) 0xDE, (byte) 0xF7, (byte) 0xC3, (byte) 0x21, (byte) 0x79, (byte) 0x0F, 1691 (byte) 0x55, (byte) 0xD1, (byte) 0x56, (byte) 0x9A, (byte) 0xB0, (byte) 0x08, 1692 (byte) 0xA1, (byte) 0x27, (byte) 0xC9, (byte) 0x5E, (byte) 0x64, (byte) 0xF4, 1693 (byte) 0xC7, (byte) 0x83, (byte) 0x94, (byte) 0xCA, (byte) 0xBD, (byte) 0x50, 1694 (byte) 0xD6, (byte) 0xC5, (byte) 0x56, (byte) 0x94, (byte) 0xBD, (byte) 0x0B, 1695 (byte) 0x55, (byte) 0xE6, (byte) 0x04, (byte) 0xAD, (byte) 0xAF, (byte) 0xAF, 1696 (byte) 0x4F, (byte) 0x2D, (byte) 0x91, (byte) 0x7F, (byte) 0xF1, (byte) 0x60, 1697 (byte) 0x0C, (byte) 0xEE, (byte) 0xE8, (byte) 0x44, (byte) 0xFC, (byte) 0x69, 1698 (byte) 0x80, (byte) 0x43, (byte) 0xBC, (byte) 0xAB, (byte) 0x83, (byte) 0x35, 1699 (byte) 0xB0, (byte) 0xC6, (byte) 0xCB, (byte) 0xE6, (byte) 0x92, (byte) 0x29, 1700 (byte) 0x09, (byte) 0xCF, (byte) 0xDB, (byte) 0xAD, (byte) 0x16, (byte) 0x93, 1701 (byte) 0xC7, (byte) 0xBE, (byte) 0x81, (byte) 0x68, (byte) 0x0F, (byte) 0x7B, 1702 (byte) 0xC1, (byte) 0xC2, (byte) 0x8C, (byte) 0xBA, (byte) 0x59, (byte) 0x80, 1703 (byte) 0xAE, (byte) 0xFB, (byte) 0x60, (byte) 0x22, (byte) 0x28, (byte) 0x36, 1704 (byte) 0xBE, (byte) 0x37, (byte) 0x72, (byte) 0x86, (byte) 0x02, (byte) 0x4B, 1705 (byte) 0xF9, (byte) 0x14, (byte) 0x5A, (byte) 0x6B, (byte) 0x32, (byte) 0x44, 1706 (byte) 0x72, (byte) 0x33, (byte) 0x2E, (byte) 0x7F, (byte) 0xA1, (byte) 0xFD, 1707 (byte) 0x07, (byte) 0xF2, (byte) 0xD9, (byte) 0x9D, (byte) 0x03, (byte) 0x77, 1708 (byte) 0x17, (byte) 0xFB, (byte) 0x0E, (byte) 0xFF, (byte) 0xF7, (byte) 0x37, 1709 (byte) 0x68, (byte) 0xF6, (byte) 0x8F, (byte) 0x9B, (byte) 0x2C, (byte) 0xEB, 1710 (byte) 0xAF, (byte) 0x6C, (byte) 0x50, (byte) 0x9F, (byte) 0x34, (byte) 0xB2, 1711 (byte) 0x52, (byte) 0x3B, (byte) 0x94, (byte) 0x6F, (byte) 0x60, (byte) 0x16, 1712 (byte) 0x52, (byte) 0x0A, (byte) 0xBF, (byte) 0x95, (byte) 0x41, (byte) 0x44, 1713 (byte) 0x83, (byte) 0x91, (byte) 0x85, (byte) 0xA1, (byte) 0xF7, (byte) 0xF9, 1714 (byte) 0x17, (byte) 0x4A, (byte) 0xF7, (byte) 0xF1, (byte) 0xE8, (byte) 0x9C, 1715 (byte) 0x75, (byte) 0x86, (byte) 0x12, (byte) 0x44, (byte) 0x19, (byte) 0x5C, 1716 (byte) 0x65, (byte) 0x31, (byte) 0x89, (byte) 0x2A, (byte) 0xFC, (byte) 0xBE, 1717 (byte) 0xE8, (byte) 0xEC, (byte) 0xC9, (byte) 0xD7, (byte) 0x41, (byte) 0xDA, 1718 (byte) 0xD9, (byte) 0xC9, (byte) 0x8B, (byte) 0x90, (byte) 0x60, (byte) 0xCC, 1719 (byte) 0xB2, (byte) 0x7A, (byte) 0xBA, (byte) 0xA0, (byte) 0xEE, (byte) 0xBE, 1720 (byte) 0x9C, (byte) 0xE7, (byte) 0xF2, (byte) 0x27, (byte) 0x92, (byte) 0x9C, 1721 (byte) 0x3C, (byte) 0x0F, (byte) 0x5C, (byte) 0xEE, (byte) 0x38, (byte) 0x48, 1722 (byte) 0xCF, (byte) 0xFF, (byte) 0x33, (byte) 0x35, (byte) 0x80, (byte) 0x99, 1723 (byte) 0x5D, (byte) 0xA7, (byte) 0x5A, (byte) 0x7A, (byte) 0xEA, (byte) 0x96, 1724 (byte) 0x74, (byte) 0x28, (byte) 0x36, (byte) 0x7B, (byte) 0xE1, (byte) 0x33, 1725 (byte) 0x7C, (byte) 0x78, (byte) 0xEC, (byte) 0x05, (byte) 0x72, (byte) 0x0E, 1726 (byte) 0x5D, (byte) 0x16, (byte) 0x5C, (byte) 0x77, (byte) 0x58, (byte) 0xA7, 1727 (byte) 0x31, (byte) 0x3F, (byte) 0xBA, (byte) 0x91, (byte) 0xA7, (byte) 0x16, 1728 (byte) 0xFC, (byte) 0x31, (byte) 0xCA, (byte) 0x30, (byte) 0xE0, (byte) 0xF4, 1729 (byte) 0x5D, (byte) 0x07, (byte) 0x4A, (byte) 0x9C, (byte) 0x1D, (byte) 0x2B, 1730 (byte) 0x4E, (byte) 0xB8, (byte) 0x7C, (byte) 0x67, (byte) 0xCB, (byte) 0x34, 1731 (byte) 0x69, (byte) 0x85, (byte) 0x4E, (byte) 0x99, (byte) 0x41, (byte) 0x8A, 1732 (byte) 0x35, (byte) 0x85, (byte) 0xF2, (byte) 0x1A, 1733 }; 1734 private static final PSSParameterSpec SHA384withRSAPSS_MaxSalt_Vector2Signature_ParameterSpec = 1735 new PSSParameterSpec("SHA-384", "MGF1", MGF1ParameterSpec.SHA384, 206, 1); 1736 1737 /* 1738 * echo "This is a signed message from Kenny Root." | openssl sha512 -binary -out digest.bin \ 1739 * && openssl pkeyutl -sign -in digest.bin -inkey privkey.pem \ 1740 * -pkeyopt rsa_padding_mode:pss -pkeyopt digest:sha512 -pkeyopt rsa_pss_saltlen:64 \ 1741 * | recode ../x1 | sed 's/0x/(byte) 0x/g' 1742 */ 1743 private static final byte[] SHA512withRSAPSS_Vector2Signature = new byte[] { 1744 (byte) 0x9F, (byte) 0xED, (byte) 0xF8, (byte) 0xEE, (byte) 0x30, (byte) 0x5F, 1745 (byte) 0x30, (byte) 0x63, (byte) 0x1D, (byte) 0x86, (byte) 0xD3, (byte) 0xAD, 1746 (byte) 0x1D, (byte) 0xD8, (byte) 0xD2, (byte) 0x67, (byte) 0xE2, (byte) 0x43, 1747 (byte) 0x64, (byte) 0x71, (byte) 0x98, (byte) 0x82, (byte) 0x00, (byte) 0x84, 1748 (byte) 0x2C, (byte) 0x88, (byte) 0x1A, (byte) 0x28, (byte) 0xCD, (byte) 0xA2, 1749 (byte) 0x34, (byte) 0x17, (byte) 0x0F, (byte) 0x34, (byte) 0x8A, (byte) 0x10, 1750 (byte) 0x79, (byte) 0x6C, (byte) 0xCB, (byte) 0xDA, (byte) 0x2F, (byte) 0xDF, 1751 (byte) 0x4D, (byte) 0x98, (byte) 0x01, (byte) 0xE8, (byte) 0xB3, (byte) 0xF5, 1752 (byte) 0xCD, (byte) 0x60, (byte) 0xEA, (byte) 0xDE, (byte) 0xA5, (byte) 0x0C, 1753 (byte) 0x09, (byte) 0xA1, (byte) 0x4A, (byte) 0xC4, (byte) 0x6B, (byte) 0x09, 1754 (byte) 0xB3, (byte) 0x37, (byte) 0x1F, (byte) 0x8A, (byte) 0x64, (byte) 0x81, 1755 (byte) 0x2E, (byte) 0x22, (byte) 0x75, (byte) 0x24, (byte) 0x3B, (byte) 0xC0, 1756 (byte) 0x0E, (byte) 0x1F, (byte) 0x37, (byte) 0xC9, (byte) 0x1E, (byte) 0x6F, 1757 (byte) 0xAF, (byte) 0x3E, (byte) 0x9B, (byte) 0x3F, (byte) 0xA3, (byte) 0xC3, 1758 (byte) 0x0B, (byte) 0xB9, (byte) 0x83, (byte) 0x60, (byte) 0x02, (byte) 0xC6, 1759 (byte) 0x29, (byte) 0x83, (byte) 0x09, (byte) 0x16, (byte) 0xD9, (byte) 0x3D, 1760 (byte) 0x84, (byte) 0x02, (byte) 0x81, (byte) 0x20, (byte) 0xE9, (byte) 0x01, 1761 (byte) 0x5B, (byte) 0x85, (byte) 0xC8, (byte) 0x81, (byte) 0x25, (byte) 0x6B, 1762 (byte) 0xCB, (byte) 0x78, (byte) 0x48, (byte) 0x65, (byte) 0x3A, (byte) 0xD6, 1763 (byte) 0x95, (byte) 0x9B, (byte) 0x62, (byte) 0x2D, (byte) 0x84, (byte) 0x54, 1764 (byte) 0x12, (byte) 0x94, (byte) 0xB7, (byte) 0xF0, (byte) 0x1C, (byte) 0xB6, 1765 (byte) 0x59, (byte) 0xCD, (byte) 0xC3, (byte) 0x86, (byte) 0xE6, (byte) 0x63, 1766 (byte) 0xD7, (byte) 0x99, (byte) 0x9A, (byte) 0xC4, (byte) 0xBF, (byte) 0x8E, 1767 (byte) 0xDD, (byte) 0x46, (byte) 0x10, (byte) 0xBE, (byte) 0xAB, (byte) 0x78, 1768 (byte) 0xC6, (byte) 0x30, (byte) 0x47, (byte) 0x23, (byte) 0xB6, (byte) 0x2C, 1769 (byte) 0x02, (byte) 0x5E, (byte) 0x1F, (byte) 0x07, (byte) 0x96, (byte) 0x54, 1770 (byte) 0xEE, (byte) 0x28, (byte) 0xC7, (byte) 0xEC, (byte) 0x57, (byte) 0xDB, 1771 (byte) 0x9E, (byte) 0xEF, (byte) 0xE4, (byte) 0x11, (byte) 0xF8, (byte) 0x04, 1772 (byte) 0xA9, (byte) 0x26, (byte) 0xC2, (byte) 0x61, (byte) 0xF1, (byte) 0x84, 1773 (byte) 0xEB, (byte) 0x94, (byte) 0xBD, (byte) 0x48, (byte) 0xCA, (byte) 0xD1, 1774 (byte) 0x84, (byte) 0xCE, (byte) 0x82, (byte) 0x2E, (byte) 0xF6, (byte) 0x4E, 1775 (byte) 0x17, (byte) 0x6F, (byte) 0x78, (byte) 0xB9, (byte) 0x0B, (byte) 0xA9, 1776 (byte) 0x7D, (byte) 0xBC, (byte) 0xE5, (byte) 0xF8, (byte) 0x7D, (byte) 0xA8, 1777 (byte) 0x76, (byte) 0x7A, (byte) 0x8B, (byte) 0xB5, (byte) 0x05, (byte) 0x42, 1778 (byte) 0x37, (byte) 0xDA, (byte) 0x15, (byte) 0xE2, (byte) 0xC4, (byte) 0x70, 1779 (byte) 0x6E, (byte) 0x95, (byte) 0x60, (byte) 0x47, (byte) 0xF9, (byte) 0x0F, 1780 (byte) 0xF4, (byte) 0xA2, (byte) 0x73, (byte) 0xF1, (byte) 0x73, (byte) 0xBD, 1781 (byte) 0x0B, (byte) 0x9B, (byte) 0x44, (byte) 0xB6, (byte) 0xA9, (byte) 0xAF, 1782 (byte) 0x50, (byte) 0x2D, (byte) 0x5C, (byte) 0xA3, (byte) 0x72, (byte) 0x6F, 1783 (byte) 0x85, (byte) 0xE8, (byte) 0x0C, (byte) 0xF9, (byte) 0xE1, (byte) 0xE8, 1784 (byte) 0xF7, (byte) 0xC0, (byte) 0x85, (byte) 0x14, (byte) 0x53, (byte) 0x95, 1785 (byte) 0xF9, (byte) 0x9E, (byte) 0x65, (byte) 0x05, (byte) 0xF0, (byte) 0x22, 1786 (byte) 0x7F, (byte) 0x4F, (byte) 0x40, (byte) 0x45, 1787 }; 1788 private static final PSSParameterSpec SHA512withRSAPSS_Vector2Signature_ParameterSpec = 1789 new PSSParameterSpec("SHA-512", "MGF1", MGF1ParameterSpec.SHA512, 64, 1); 1790 1791 /* 1792 * echo "This is a signed message from Kenny Root." | openssl sha512 -binary -out digest.bin \ 1793 * && openssl pkeyutl -sign -in digest.bin -inkey privkey.pem \ 1794 * -pkeyopt rsa_padding_mode:pss -pkeyopt digest:sha512 -pkeyopt rsa_pss_saltlen:64 \ 1795 * | recode ../x1 | sed 's/0x/(byte) 0x/g' 1796 */ 1797 private static final byte[] SHA512withRSAPSS_NoSalt_Vector2Signature = new byte[] { 1798 (byte) 0x49, (byte) 0xA3, (byte) 0xBC, (byte) 0x2E, (byte) 0x67, (byte) 0x96, 1799 (byte) 0xA5, (byte) 0x3E, (byte) 0x39, (byte) 0x46, (byte) 0xD6, (byte) 0xA1, 1800 (byte) 0xA0, (byte) 0x4F, (byte) 0x3A, (byte) 0x03, (byte) 0x8F, (byte) 0x62, 1801 (byte) 0xF2, (byte) 0xD8, (byte) 0x90, (byte) 0xAD, (byte) 0xE2, (byte) 0x3B, 1802 (byte) 0x4F, (byte) 0x98, (byte) 0x88, (byte) 0x51, (byte) 0x41, (byte) 0x09, 1803 (byte) 0x23, (byte) 0xEB, (byte) 0xF4, (byte) 0x5D, (byte) 0x6A, (byte) 0x22, 1804 (byte) 0x12, (byte) 0x12, (byte) 0xDC, (byte) 0x27, (byte) 0xE9, (byte) 0xF7, 1805 (byte) 0x64, (byte) 0xA3, (byte) 0xDE, (byte) 0x3A, (byte) 0xB0, (byte) 0xD6, 1806 (byte) 0xF2, (byte) 0xC6, (byte) 0xBC, (byte) 0x0B, (byte) 0xA2, (byte) 0xA1, 1807 (byte) 0xAA, (byte) 0xB0, (byte) 0x51, (byte) 0xDA, (byte) 0x4F, (byte) 0x28, 1808 (byte) 0xA8, (byte) 0xEB, (byte) 0x34, (byte) 0x60, (byte) 0x37, (byte) 0xF7, 1809 (byte) 0x50, (byte) 0x7D, (byte) 0xB8, (byte) 0xE7, (byte) 0x24, (byte) 0x8E, 1810 (byte) 0xAC, (byte) 0x03, (byte) 0x31, (byte) 0xB8, (byte) 0xE0, (byte) 0xDB, 1811 (byte) 0x97, (byte) 0xE9, (byte) 0x1B, (byte) 0x7E, (byte) 0x27, (byte) 0x99, 1812 (byte) 0x93, (byte) 0x4D, (byte) 0x46, (byte) 0xB3, (byte) 0xFE, (byte) 0xD6, 1813 (byte) 0x23, (byte) 0xB3, (byte) 0xAB, (byte) 0x3E, (byte) 0x33, (byte) 0xA1, 1814 (byte) 0x10, (byte) 0x4E, (byte) 0x34, (byte) 0x27, (byte) 0x58, (byte) 0x25, 1815 (byte) 0xB7, (byte) 0xBA, (byte) 0xEE, (byte) 0xBE, (byte) 0xE0, (byte) 0x6E, 1816 (byte) 0x54, (byte) 0xF7, (byte) 0x73, (byte) 0x7B, (byte) 0x5A, (byte) 0x9C, 1817 (byte) 0x74, (byte) 0xEA, (byte) 0xC7, (byte) 0x7E, (byte) 0xC6, (byte) 0xF7, 1818 (byte) 0xD5, (byte) 0x32, (byte) 0x0E, (byte) 0x28, (byte) 0x99, (byte) 0xD8, 1819 (byte) 0xEF, (byte) 0x97, (byte) 0x62, (byte) 0x8A, (byte) 0xE3, (byte) 0x16, 1820 (byte) 0xAD, (byte) 0xE2, (byte) 0xF4, (byte) 0x11, (byte) 0x91, (byte) 0x17, 1821 (byte) 0xF3, (byte) 0x32, (byte) 0x90, (byte) 0xCB, (byte) 0x3C, (byte) 0x89, 1822 (byte) 0xF4, (byte) 0x20, (byte) 0xF1, (byte) 0x2D, (byte) 0x74, (byte) 0x22, 1823 (byte) 0x50, (byte) 0x64, (byte) 0xC2, (byte) 0xF4, (byte) 0xC4, (byte) 0x0D, 1824 (byte) 0x18, (byte) 0x6A, (byte) 0x02, (byte) 0x52, (byte) 0x14, (byte) 0x85, 1825 (byte) 0x67, (byte) 0xA4, (byte) 0x08, (byte) 0xE5, (byte) 0xBF, (byte) 0x65, 1826 (byte) 0x15, (byte) 0xB3, (byte) 0x5A, (byte) 0x88, (byte) 0xEB, (byte) 0xD4, 1827 (byte) 0x75, (byte) 0xF9, (byte) 0x52, (byte) 0x73, (byte) 0xA0, (byte) 0x5E, 1828 (byte) 0xBA, (byte) 0x37, (byte) 0x6A, (byte) 0x61, (byte) 0x2B, (byte) 0x16, 1829 (byte) 0x8A, (byte) 0xA8, (byte) 0x00, (byte) 0xBB, (byte) 0x4D, (byte) 0xFA, 1830 (byte) 0x04, (byte) 0xB8, (byte) 0xAB, (byte) 0x4D, (byte) 0xA4, (byte) 0xFC, 1831 (byte) 0x9D, (byte) 0xCF, (byte) 0x63, (byte) 0x83, (byte) 0x34, (byte) 0xAE, 1832 (byte) 0xAE, (byte) 0xA6, (byte) 0x77, (byte) 0x73, (byte) 0xA2, (byte) 0xB5, 1833 (byte) 0x77, (byte) 0xAC, (byte) 0x00, (byte) 0x03, (byte) 0x06, (byte) 0xD4, 1834 (byte) 0xDF, (byte) 0x81, (byte) 0x61, (byte) 0xCE, (byte) 0x8E, (byte) 0xC1, 1835 (byte) 0xD5, (byte) 0x99, (byte) 0xD5, (byte) 0x2F, (byte) 0xE8, (byte) 0x27, 1836 (byte) 0xFA, (byte) 0x84, (byte) 0x7E, (byte) 0x57, (byte) 0xF1, (byte) 0xC9, 1837 (byte) 0xEB, (byte) 0x4F, (byte) 0xF9, (byte) 0x92, (byte) 0xC6, (byte) 0xD0, 1838 (byte) 0x25, (byte) 0x8A, (byte) 0x16, (byte) 0xD0, (byte) 0xEC, (byte) 0xE5, 1839 (byte) 0x33, (byte) 0xA6, (byte) 0xF9, (byte) 0xD5, (byte) 0x0C, (byte) 0x7B, 1840 (byte) 0xEC, (byte) 0xC6, (byte) 0x58, (byte) 0x45, 1841 }; 1842 private static final PSSParameterSpec SHA512withRSAPSS_NoSalt_Vector2Signature_ParameterSpec = 1843 new PSSParameterSpec("SHA-512", "MGF1", MGF1ParameterSpec.SHA512, 0, 1); 1844 1845 /* 1846 * echo "This is a signed message from Kenny Root." | openssl sha512 -binary -out digest.bin \ 1847 * && openssl pkeyutl -sign -in digest.bin -inkey privkey.pem \ 1848 * -pkeyopt rsa_padding_mode:pss -pkeyopt digest:sha512 -pkeyopt rsa_pss_saltlen:190 \ 1849 * | recode ../x1 | sed 's/0x/(byte) 0x/g' 1850 */ 1851 private static final byte[] SHA512withRSAPSS_MaxSalt_Vector2Signature = new byte[] { 1852 (byte) 0x90, (byte) 0x92, (byte) 0x45, (byte) 0xA1, (byte) 0x1E, (byte) 0x0F, 1853 (byte) 0x5F, (byte) 0xF6, (byte) 0x8F, (byte) 0xA0, (byte) 0xBE, (byte) 0x34, 1854 (byte) 0x29, (byte) 0x62, (byte) 0xBE, (byte) 0x41, (byte) 0x80, (byte) 0xF0, 1855 (byte) 0xB8, (byte) 0x9F, (byte) 0x29, (byte) 0x63, (byte) 0x89, (byte) 0x26, 1856 (byte) 0xC2, (byte) 0x22, (byte) 0x1F, (byte) 0x60, (byte) 0xB6, (byte) 0xFC, 1857 (byte) 0x5A, (byte) 0x3E, (byte) 0x99, (byte) 0xB8, (byte) 0xC6, (byte) 0x3B, 1858 (byte) 0x67, (byte) 0x33, (byte) 0x97, (byte) 0x19, (byte) 0xC6, (byte) 0xFF, 1859 (byte) 0x0C, (byte) 0xA9, (byte) 0x04, (byte) 0x5A, (byte) 0xF0, (byte) 0x02, 1860 (byte) 0x9A, (byte) 0x19, (byte) 0x0F, (byte) 0xEA, (byte) 0x77, (byte) 0x0D, 1861 (byte) 0x56, (byte) 0x38, (byte) 0x0A, (byte) 0xED, (byte) 0x4E, (byte) 0xB7, 1862 (byte) 0x57, (byte) 0xBD, (byte) 0xC9, (byte) 0xA3, (byte) 0xE8, (byte) 0xC0, 1863 (byte) 0x7D, (byte) 0xF6, (byte) 0xA3, (byte) 0x4B, (byte) 0x61, (byte) 0x45, 1864 (byte) 0x06, (byte) 0x5E, (byte) 0x56, (byte) 0xF5, (byte) 0xEF, (byte) 0x76, 1865 (byte) 0x6B, (byte) 0xB7, (byte) 0xD4, (byte) 0xBB, (byte) 0xA4, (byte) 0x3C, 1866 (byte) 0x52, (byte) 0xF8, (byte) 0x06, (byte) 0x67, (byte) 0xF7, (byte) 0xC3, 1867 (byte) 0x8C, (byte) 0x5E, (byte) 0xDF, (byte) 0xFE, (byte) 0x30, (byte) 0x2E, 1868 (byte) 0xF8, (byte) 0x59, (byte) 0x3C, (byte) 0x3B, (byte) 0xEA, (byte) 0xA0, 1869 (byte) 0x5D, (byte) 0x8F, (byte) 0x18, (byte) 0x73, (byte) 0x1A, (byte) 0x2D, 1870 (byte) 0xB1, (byte) 0x55, (byte) 0x07, (byte) 0xC8, (byte) 0x33, (byte) 0xED, 1871 (byte) 0x8A, (byte) 0x5E, (byte) 0xC3, (byte) 0xAE, (byte) 0x51, (byte) 0x31, 1872 (byte) 0xC4, (byte) 0xFA, (byte) 0xE8, (byte) 0xE9, (byte) 0xBE, (byte) 0x2E, 1873 (byte) 0x28, (byte) 0xAA, (byte) 0xED, (byte) 0xA8, (byte) 0x4B, (byte) 0xA3, 1874 (byte) 0x13, (byte) 0xB9, (byte) 0x82, (byte) 0x57, (byte) 0xD1, (byte) 0x72, 1875 (byte) 0x0D, (byte) 0xA7, (byte) 0xF8, (byte) 0x67, (byte) 0xB8, (byte) 0x55, 1876 (byte) 0xF3, (byte) 0x06, (byte) 0xAE, (byte) 0xA7, (byte) 0x69, (byte) 0x66, 1877 (byte) 0x0B, (byte) 0x80, (byte) 0x56, (byte) 0x65, (byte) 0xC7, (byte) 0xE9, 1878 (byte) 0x60, (byte) 0xDC, (byte) 0x2D, (byte) 0x4B, (byte) 0x26, (byte) 0xA9, 1879 (byte) 0xED, (byte) 0x54, (byte) 0x79, (byte) 0x9E, (byte) 0x55, (byte) 0x1D, 1880 (byte) 0xEE, (byte) 0x78, (byte) 0x49, (byte) 0xA1, (byte) 0x1F, (byte) 0x9B, 1881 (byte) 0x37, (byte) 0xC0, (byte) 0xBA, (byte) 0xE6, (byte) 0x4B, (byte) 0x3B, 1882 (byte) 0xAF, (byte) 0x12, (byte) 0x99, (byte) 0x32, (byte) 0x14, (byte) 0x8C, 1883 (byte) 0x4D, (byte) 0xEB, (byte) 0x08, (byte) 0xA4, (byte) 0xE3, (byte) 0xC6, 1884 (byte) 0x37, (byte) 0x8B, (byte) 0x6E, (byte) 0x7C, (byte) 0xEC, (byte) 0xA3, 1885 (byte) 0x78, (byte) 0xED, (byte) 0x4E, (byte) 0x36, (byte) 0xBC, (byte) 0xA2, 1886 (byte) 0x7D, (byte) 0x11, (byte) 0x0E, (byte) 0xD0, (byte) 0x53, (byte) 0x14, 1887 (byte) 0x93, (byte) 0x16, (byte) 0x54, (byte) 0x45, (byte) 0x79, (byte) 0x7A, 1888 (byte) 0x1A, (byte) 0xA1, (byte) 0xEC, (byte) 0xF3, (byte) 0x12, (byte) 0x3F, 1889 (byte) 0xFE, (byte) 0x68, (byte) 0xFF, (byte) 0x5A, (byte) 0x3F, (byte) 0xE7, 1890 (byte) 0x13, (byte) 0x37, (byte) 0xEB, (byte) 0x60, (byte) 0x0A, (byte) 0x8E, 1891 (byte) 0x4F, (byte) 0x54, (byte) 0x46, (byte) 0x19, (byte) 0x82, (byte) 0xBF, 1892 (byte) 0xB7, (byte) 0xD2, (byte) 0x19, (byte) 0x71, (byte) 0x78, (byte) 0x38, 1893 (byte) 0x4C, (byte) 0xE3, (byte) 0xC4, (byte) 0xEA, (byte) 0x8F, (byte) 0x9B, 1894 (byte) 0xE5, (byte) 0xBA, (byte) 0x06, (byte) 0xFC, 1895 }; 1896 private static final PSSParameterSpec SHA512withRSAPSS_MaxSalt_Vector2Signature_ParameterSpec = 1897 new PSSParameterSpec("SHA-512", "MGF1", MGF1ParameterSpec.SHA512, 190, 1); 1898 1899 public void testGetCommonInstances_Success() throws Exception { 1900 assertNotNull(Signature.getInstance("SHA1withRSA")); 1901 assertNotNull(Signature.getInstance("SHA256withRSA")); 1902 assertNotNull(Signature.getInstance("SHA384withRSA")); 1903 assertNotNull(Signature.getInstance("SHA512withRSA")); 1904 assertNotNull(Signature.getInstance("NONEwithRSA")); 1905 assertNotNull(Signature.getInstance("MD5withRSA")); 1906 assertNotNull(Signature.getInstance("SHA1withDSA")); 1907 } 1908 1909 public void testVerify_SHA1withRSA_Key_Success() throws Exception { 1910 KeyFactory kf = KeyFactory.getInstance("RSA"); 1911 RSAPublicKeySpec keySpec = new RSAPublicKeySpec(RSA_2048_modulus, RSA_2048_publicExponent); 1912 PublicKey pubKey = kf.generatePublic(keySpec); 1913 1914 Signature sig = Signature.getInstance("SHA1withRSA"); 1915 sig.initVerify(pubKey); 1916 sig.update(Vector1Data); 1917 1918 assertTrue("Signature must match expected signature", 1919 sig.verify(SHA1withRSA_Vector1Signature)); 1920 } 1921 1922 public void testVerify_SHA256withRSA_Key_Success() throws Exception { 1923 KeyFactory kf = KeyFactory.getInstance("RSA"); 1924 RSAPublicKeySpec keySpec = new RSAPublicKeySpec(RSA_2048_modulus, RSA_2048_publicExponent); 1925 PublicKey pubKey = kf.generatePublic(keySpec); 1926 1927 Signature sig = Signature.getInstance("SHA256withRSA"); 1928 sig.initVerify(pubKey); 1929 sig.update(Vector2Data); 1930 1931 assertTrue("Signature must match expected signature", 1932 sig.verify(SHA256withRSA_Vector2Signature)); 1933 } 1934 1935 public void testVerify_SHA384withRSA_Key_Success() throws Exception { 1936 KeyFactory kf = KeyFactory.getInstance("RSA"); 1937 RSAPublicKeySpec keySpec = new RSAPublicKeySpec(RSA_2048_modulus, RSA_2048_publicExponent); 1938 PublicKey pubKey = kf.generatePublic(keySpec); 1939 1940 Signature sig = Signature.getInstance("SHA384withRSA"); 1941 sig.initVerify(pubKey); 1942 sig.update(Vector2Data); 1943 1944 assertTrue("Signature must match expected signature", 1945 sig.verify(SHA384withRSA_Vector2Signature)); 1946 } 1947 1948 public void testVerify_SHA512withRSA_Key_Success() throws Exception { 1949 KeyFactory kf = KeyFactory.getInstance("RSA"); 1950 RSAPublicKeySpec keySpec = new RSAPublicKeySpec(RSA_2048_modulus, RSA_2048_publicExponent); 1951 PublicKey pubKey = kf.generatePublic(keySpec); 1952 1953 Signature sig = Signature.getInstance("SHA512withRSA"); 1954 sig.initVerify(pubKey); 1955 sig.update(Vector2Data); 1956 1957 assertTrue("Signature must match expected signature", 1958 sig.verify(SHA512withRSA_Vector2Signature)); 1959 } 1960 1961 public void testVerify_MD5withRSA_Key_Success() throws Exception { 1962 KeyFactory kf = KeyFactory.getInstance("RSA"); 1963 RSAPublicKeySpec keySpec = new RSAPublicKeySpec(RSA_2048_modulus, RSA_2048_publicExponent); 1964 PublicKey pubKey = kf.generatePublic(keySpec); 1965 1966 Signature sig = Signature.getInstance("MD5withRSA"); 1967 sig.initVerify(pubKey); 1968 sig.update(Vector2Data); 1969 1970 assertTrue("Signature must match expected signature", 1971 sig.verify(MD5withRSA_Vector2Signature)); 1972 } 1973 1974 public void testVerify_SHA1withRSAPSS_Key_Success() throws Exception { 1975 KeyFactory kf = KeyFactory.getInstance("RSA"); 1976 RSAPublicKeySpec keySpec = new RSAPublicKeySpec(RSA_2048_modulus, RSA_2048_publicExponent); 1977 PublicKey pubKey = kf.generatePublic(keySpec); 1978 1979 Signature sig = Signature.getInstance("SHA1withRSA/PSS"); 1980 sig.initVerify(pubKey); 1981 assertPSSAlgorithmParametersEquals( 1982 SHA1withRSAPSS_Vector2Signature_ParameterSpec, sig.getParameters()); 1983 sig.update(Vector2Data); 1984 1985 assertTrue("Signature must verify", 1986 sig.verify(SHA1withRSAPSS_Vector2Signature)); 1987 } 1988 1989 public void testVerify_SHA1withRSAPSS_NoSalt_Key_Success() throws Exception { 1990 KeyFactory kf = KeyFactory.getInstance("RSA"); 1991 RSAPublicKeySpec keySpec = new RSAPublicKeySpec(RSA_2048_modulus, RSA_2048_publicExponent); 1992 PublicKey pubKey = kf.generatePublic(keySpec); 1993 1994 Signature sig = Signature.getInstance("SHA1withRSA/PSS"); 1995 sig.initVerify(pubKey); 1996 sig.setParameter(SHA1withRSAPSS_NoSalt_Vector2Signature_ParameterSpec); 1997 sig.update(Vector2Data); 1998 1999 assertTrue("Signature must verify", 2000 sig.verify(SHA1withRSAPSS_NoSalt_Vector2Signature)); 2001 } 2002 2003 public void testVerify_SHA1withRSAPSS_MaxSalt_Key_Success() throws Exception { 2004 KeyFactory kf = KeyFactory.getInstance("RSA"); 2005 RSAPublicKeySpec keySpec = new RSAPublicKeySpec(RSA_2048_modulus, RSA_2048_publicExponent); 2006 PublicKey pubKey = kf.generatePublic(keySpec); 2007 2008 Signature sig = Signature.getInstance("SHA1withRSA/PSS"); 2009 sig.initVerify(pubKey); 2010 sig.setParameter(SHA1withRSAPSS_MaxSalt_Vector2Signature_ParameterSpec); 2011 sig.update(Vector2Data); 2012 2013 assertTrue("Signature must verify", 2014 sig.verify(SHA1withRSAPSS_MaxSalt_Vector2Signature)); 2015 } 2016 2017 public void testVerify_SHA224withRSAPSS_Key_Success() throws Exception { 2018 KeyFactory kf = KeyFactory.getInstance("RSA"); 2019 RSAPublicKeySpec keySpec = new RSAPublicKeySpec(RSA_2048_modulus, RSA_2048_publicExponent); 2020 PublicKey pubKey = kf.generatePublic(keySpec); 2021 2022 Signature sig = Signature.getInstance("SHA224withRSA/PSS"); 2023 sig.initVerify(pubKey); 2024 assertPSSAlgorithmParametersEquals( 2025 SHA224withRSAPSS_Vector2Signature_ParameterSpec, sig.getParameters()); 2026 sig.update(Vector2Data); 2027 2028 assertTrue("Signature must verify", 2029 sig.verify(SHA224withRSAPSS_Vector2Signature)); 2030 } 2031 2032 public void testVerify_SHA224withRSAPSS_NoSalt_Key_Success() throws Exception { 2033 KeyFactory kf = KeyFactory.getInstance("RSA"); 2034 RSAPublicKeySpec keySpec = new RSAPublicKeySpec(RSA_2048_modulus, RSA_2048_publicExponent); 2035 PublicKey pubKey = kf.generatePublic(keySpec); 2036 2037 Signature sig = Signature.getInstance("SHA224withRSA/PSS"); 2038 sig.initVerify(pubKey); 2039 sig.setParameter(SHA224withRSAPSS_NoSalt_Vector2Signature_ParameterSpec); 2040 sig.update(Vector2Data); 2041 2042 assertTrue("Signature must verify", 2043 sig.verify(SHA224withRSAPSS_NoSalt_Vector2Signature)); 2044 } 2045 2046 public void testVerify_SHA224withRSAPSS_MaxSalt_Key_Success() throws Exception { 2047 KeyFactory kf = KeyFactory.getInstance("RSA"); 2048 RSAPublicKeySpec keySpec = new RSAPublicKeySpec(RSA_2048_modulus, RSA_2048_publicExponent); 2049 PublicKey pubKey = kf.generatePublic(keySpec); 2050 2051 Signature sig = Signature.getInstance("SHA224withRSA/PSS"); 2052 sig.initVerify(pubKey); 2053 sig.setParameter(SHA224withRSAPSS_MaxSalt_Vector2Signature_ParameterSpec); 2054 sig.update(Vector2Data); 2055 2056 assertTrue("Signature must verify", 2057 sig.verify(SHA224withRSAPSS_MaxSalt_Vector2Signature)); 2058 } 2059 2060 public void testVerify_SHA256withRSAPSS_Key_Success() throws Exception { 2061 KeyFactory kf = KeyFactory.getInstance("RSA"); 2062 RSAPublicKeySpec keySpec = new RSAPublicKeySpec(RSA_2048_modulus, RSA_2048_publicExponent); 2063 PublicKey pubKey = kf.generatePublic(keySpec); 2064 2065 Signature sig = Signature.getInstance("SHA256withRSA/PSS"); 2066 sig.initVerify(pubKey); 2067 assertPSSAlgorithmParametersEquals( 2068 SHA256withRSAPSS_Vector2Signature_ParameterSpec, sig.getParameters()); 2069 sig.update(Vector2Data); 2070 2071 assertTrue("Signature must verify", 2072 sig.verify(SHA256withRSAPSS_Vector2Signature)); 2073 } 2074 2075 public void testVerify_SHA256withRSAPSS_NoSalt_Key_Success() throws Exception { 2076 KeyFactory kf = KeyFactory.getInstance("RSA"); 2077 RSAPublicKeySpec keySpec = new RSAPublicKeySpec(RSA_2048_modulus, RSA_2048_publicExponent); 2078 PublicKey pubKey = kf.generatePublic(keySpec); 2079 2080 Signature sig = Signature.getInstance("SHA256withRSA/PSS"); 2081 sig.initVerify(pubKey); 2082 sig.setParameter(SHA256withRSAPSS_NoSalt_Vector2Signature_ParameterSpec); 2083 sig.update(Vector2Data); 2084 2085 assertTrue("Signature must verify", 2086 sig.verify(SHA256withRSAPSS_NoSalt_Vector2Signature)); 2087 } 2088 2089 public void testVerify_SHA256withRSAPSS_MaxSalt_Key_Success() throws Exception { 2090 KeyFactory kf = KeyFactory.getInstance("RSA"); 2091 RSAPublicKeySpec keySpec = new RSAPublicKeySpec(RSA_2048_modulus, RSA_2048_publicExponent); 2092 PublicKey pubKey = kf.generatePublic(keySpec); 2093 2094 Signature sig = Signature.getInstance("SHA256withRSA/PSS"); 2095 sig.initVerify(pubKey); 2096 sig.setParameter(SHA256withRSAPSS_MaxSalt_Vector2Signature_ParameterSpec); 2097 sig.update(Vector2Data); 2098 2099 assertTrue("Signature must verify", 2100 sig.verify(SHA256withRSAPSS_MaxSalt_Vector2Signature)); 2101 } 2102 2103 public void testVerify_SHA384withRSAPSS_Key_Success() throws Exception { 2104 KeyFactory kf = KeyFactory.getInstance("RSA"); 2105 RSAPublicKeySpec keySpec = new RSAPublicKeySpec(RSA_2048_modulus, RSA_2048_publicExponent); 2106 PublicKey pubKey = kf.generatePublic(keySpec); 2107 2108 Signature sig = Signature.getInstance("SHA384withRSA/PSS"); 2109 sig.initVerify(pubKey); 2110 assertPSSAlgorithmParametersEquals( 2111 SHA384withRSAPSS_Vector2Signature_ParameterSpec, sig.getParameters()); 2112 sig.update(Vector2Data); 2113 2114 assertTrue("Signature must verify", 2115 sig.verify(SHA384withRSAPSS_Vector2Signature)); 2116 } 2117 2118 public void testVerify_SHA384withRSAPSS_NoSalt_Key_Success() throws Exception { 2119 KeyFactory kf = KeyFactory.getInstance("RSA"); 2120 RSAPublicKeySpec keySpec = new RSAPublicKeySpec(RSA_2048_modulus, RSA_2048_publicExponent); 2121 PublicKey pubKey = kf.generatePublic(keySpec); 2122 2123 Signature sig = Signature.getInstance("SHA384withRSA/PSS"); 2124 sig.initVerify(pubKey); 2125 sig.setParameter(SHA384withRSAPSS_NoSalt_Vector2Signature_ParameterSpec); 2126 sig.update(Vector2Data); 2127 2128 assertTrue("Signature must verify", 2129 sig.verify(SHA384withRSAPSS_NoSalt_Vector2Signature)); 2130 } 2131 2132 public void testVerify_SHA384withRSAPSS_MaxSalt_Key_Success() throws Exception { 2133 KeyFactory kf = KeyFactory.getInstance("RSA"); 2134 RSAPublicKeySpec keySpec = new RSAPublicKeySpec(RSA_2048_modulus, RSA_2048_publicExponent); 2135 PublicKey pubKey = kf.generatePublic(keySpec); 2136 2137 Signature sig = Signature.getInstance("SHA384withRSA/PSS"); 2138 sig.initVerify(pubKey); 2139 sig.setParameter(SHA384withRSAPSS_MaxSalt_Vector2Signature_ParameterSpec); 2140 sig.update(Vector2Data); 2141 2142 assertTrue("Signature must verify", 2143 sig.verify(SHA384withRSAPSS_MaxSalt_Vector2Signature)); 2144 } 2145 2146 public void testVerify_SHA512withRSAPSS_Key_Success() throws Exception { 2147 KeyFactory kf = KeyFactory.getInstance("RSA"); 2148 RSAPublicKeySpec keySpec = new RSAPublicKeySpec(RSA_2048_modulus, RSA_2048_publicExponent); 2149 PublicKey pubKey = kf.generatePublic(keySpec); 2150 2151 Signature sig = Signature.getInstance("SHA512withRSA/PSS"); 2152 sig.initVerify(pubKey); 2153 assertPSSAlgorithmParametersEquals( 2154 SHA512withRSAPSS_Vector2Signature_ParameterSpec, sig.getParameters()); 2155 sig.update(Vector2Data); 2156 2157 assertTrue("Signature must verify", 2158 sig.verify(SHA512withRSAPSS_Vector2Signature)); 2159 } 2160 2161 public void testVerify_SHA512withRSAPSS_NoSalt_Key_Success() throws Exception { 2162 KeyFactory kf = KeyFactory.getInstance("RSA"); 2163 RSAPublicKeySpec keySpec = new RSAPublicKeySpec(RSA_2048_modulus, RSA_2048_publicExponent); 2164 PublicKey pubKey = kf.generatePublic(keySpec); 2165 2166 Signature sig = Signature.getInstance("SHA512withRSA/PSS"); 2167 sig.initVerify(pubKey); 2168 sig.setParameter(SHA512withRSAPSS_NoSalt_Vector2Signature_ParameterSpec); 2169 sig.update(Vector2Data); 2170 2171 assertTrue("Signature must verify", 2172 sig.verify(SHA512withRSAPSS_NoSalt_Vector2Signature)); 2173 } 2174 2175 public void testVerify_SHA512withRSAPSS_MaxSalt_Key_Success() throws Exception { 2176 KeyFactory kf = KeyFactory.getInstance("RSA"); 2177 RSAPublicKeySpec keySpec = new RSAPublicKeySpec(RSA_2048_modulus, RSA_2048_publicExponent); 2178 PublicKey pubKey = kf.generatePublic(keySpec); 2179 2180 Signature sig = Signature.getInstance("SHA512withRSA/PSS"); 2181 sig.initVerify(pubKey); 2182 sig.setParameter(SHA512withRSAPSS_MaxSalt_Vector2Signature_ParameterSpec); 2183 sig.update(Vector2Data); 2184 2185 assertTrue("Signature must verify", 2186 sig.verify(SHA512withRSAPSS_MaxSalt_Vector2Signature)); 2187 } 2188 2189 public void testVerify_SHA1withRSA_Key_InitSignThenInitVerify_Success() throws Exception { 2190 KeyFactory kf = KeyFactory.getInstance("RSA"); 2191 RSAPublicKeySpec pubKeySpec = new RSAPublicKeySpec(RSA_2048_modulus, 2192 RSA_2048_publicExponent); 2193 PublicKey pubKey = kf.generatePublic(pubKeySpec); 2194 2195 RSAPrivateKeySpec privKeySpec = new RSAPrivateKeySpec(RSA_2048_modulus, 2196 RSA_2048_privateExponent); 2197 PrivateKey privKey = kf.generatePrivate(privKeySpec); 2198 2199 Signature sig = Signature.getInstance("SHA1withRSA"); 2200 2201 // Start a signing operation 2202 sig.initSign(privKey); 2203 sig.update(Vector2Data); 2204 2205 // Switch to verify 2206 sig.initVerify(pubKey); 2207 sig.update(Vector1Data); 2208 2209 assertTrue("Signature must match expected signature", 2210 sig.verify(SHA1withRSA_Vector1Signature)); 2211 } 2212 2213 public void testVerify_SHA1withRSA_Key_TwoMessages_Success() throws Exception { 2214 KeyFactory kf = KeyFactory.getInstance("RSA"); 2215 RSAPublicKeySpec keySpec = new RSAPublicKeySpec(RSA_2048_modulus, RSA_2048_publicExponent); 2216 PublicKey pubKey = kf.generatePublic(keySpec); 2217 2218 Signature sig = Signature.getInstance("SHA1withRSA"); 2219 sig.initVerify(pubKey); 2220 2221 sig.update(Vector1Data); 2222 assertTrue("First signature must match expected signature", 2223 sig.verify(SHA1withRSA_Vector1Signature)); 2224 2225 sig.update(Vector2Data); 2226 assertTrue("Second signature must match expected signature", 2227 sig.verify(SHA1withRSA_Vector2Signature)); 2228 } 2229 2230 public void testVerify_SHA1withRSA_Key_WrongExpectedSignature_Failure() throws Exception { 2231 KeyFactory kf = KeyFactory.getInstance("RSA"); 2232 RSAPublicKeySpec keySpec = new RSAPublicKeySpec(RSA_2048_modulus, RSA_2048_publicExponent); 2233 PublicKey pubKey = kf.generatePublic(keySpec); 2234 2235 Signature sig = Signature.getInstance("SHA1withRSA"); 2236 sig.initVerify(pubKey); 2237 sig.update(Vector1Data); 2238 2239 assertFalse("Signature should fail to verify", sig.verify(SHA1withRSA_Vector2Signature)); 2240 } 2241 2242 public void testSign_SHA1withRSA_CrtKeyWithPublicExponent_Success() throws Exception { 2243 KeyFactory kf = KeyFactory.getInstance("RSA"); 2244 RSAPrivateCrtKeySpec keySpec = new RSAPrivateCrtKeySpec(RSA_2048_modulus, 2245 RSA_2048_publicExponent, RSA_2048_privateExponent, null, null, null, null, null); 2246 2247 // The RI fails on this key which is totally unreasonable. 2248 final PrivateKey privKey; 2249 try { 2250 privKey = kf.generatePrivate(keySpec); 2251 } catch (NullPointerException e) { 2252 if (StandardNames.IS_RI) { 2253 return; 2254 } else { 2255 fail("Private key should be created"); 2256 return; 2257 } 2258 } 2259 2260 Signature sig = Signature.getInstance("SHA1withRSA"); 2261 sig.initSign(privKey); 2262 sig.update(Vector1Data); 2263 2264 byte[] signature = sig.sign(); 2265 assertNotNull("Signature must not be null", signature); 2266 assertTrue("Signature should match expected", 2267 Arrays.equals(signature, SHA1withRSA_Vector1Signature)); 2268 2269 RSAPublicKeySpec pubKeySpec = new RSAPublicKeySpec(RSA_2048_modulus, 2270 RSA_2048_publicExponent); 2271 PublicKey pubKey = kf.generatePublic(pubKeySpec); 2272 sig.initVerify(pubKey); 2273 sig.update(Vector1Data); 2274 assertTrue("Signature must verify correctly", sig.verify(signature)); 2275 } 2276 2277 public void testSign_SHA1withRSA_CrtKey_NoPrivateExponent_Failure() throws Exception { 2278 KeyFactory kf = KeyFactory.getInstance("RSA"); 2279 RSAPrivateCrtKeySpec keySpec = new RSAPrivateCrtKeySpec(RSA_2048_modulus, 2280 RSA_2048_publicExponent, null, RSA_2048_primeP, RSA_2048_primeQ, null, null, null); 2281 2282 // Failing on this key early is okay. 2283 final PrivateKey privKey; 2284 try { 2285 privKey = kf.generatePrivate(keySpec); 2286 } catch (NullPointerException e) { 2287 return; 2288 } catch (InvalidKeySpecException e) { 2289 return; 2290 } 2291 2292 Signature sig = Signature.getInstance("SHA1withRSA"); 2293 2294 try { 2295 sig.initSign(privKey); 2296 fail("Should throw error when private exponent is not available"); 2297 } catch (InvalidKeyException expected) { 2298 } 2299 } 2300 2301 public void testSign_SHA1withRSA_CrtKey_NoModulus_Failure() throws Exception { 2302 KeyFactory kf = KeyFactory.getInstance("RSA"); 2303 RSAPrivateCrtKeySpec keySpec = new RSAPrivateCrtKeySpec(null, RSA_2048_publicExponent, 2304 RSA_2048_privateExponent, RSA_2048_primeP, RSA_2048_primeQ, null, null, null); 2305 2306 // Failing on this key early is okay. 2307 final PrivateKey privKey; 2308 try { 2309 privKey = kf.generatePrivate(keySpec); 2310 } catch (NullPointerException e) { 2311 return; 2312 } catch (InvalidKeySpecException e) { 2313 return; 2314 } 2315 2316 Signature sig = Signature.getInstance("SHA1withRSA"); 2317 2318 try { 2319 sig.initSign(privKey); 2320 fail("Should throw error when modulus is not available"); 2321 } catch (InvalidKeyException expected) { 2322 } 2323 } 2324 2325 public void testSign_SHA1withRSA_Key_EmptyKey_Failure() throws Exception { 2326 KeyFactory kf = KeyFactory.getInstance("RSA"); 2327 RSAPrivateKeySpec keySpec = new RSAPrivateKeySpec(null, null); 2328 2329 // Failing on this key early is okay. 2330 final PrivateKey privKey; 2331 try { 2332 privKey = kf.generatePrivate(keySpec); 2333 } catch (NullPointerException e) { 2334 return; 2335 } catch (InvalidKeySpecException e) { 2336 return; 2337 } 2338 2339 Signature sig = Signature.getInstance("SHA1withRSA"); 2340 2341 try { 2342 sig.initSign(privKey); 2343 fail("Should throw error when key is empty"); 2344 } catch (InvalidKeyException expected) { 2345 } 2346 } 2347 2348 public void testSign_SHA1withRSA_Key_Success() throws Exception { 2349 KeyFactory kf = KeyFactory.getInstance("RSA"); 2350 RSAPrivateKeySpec keySpec = new RSAPrivateKeySpec(RSA_2048_modulus, 2351 RSA_2048_privateExponent); 2352 PrivateKey privKey = kf.generatePrivate(keySpec); 2353 2354 Signature sig = Signature.getInstance("SHA1withRSA"); 2355 sig.initSign(privKey); 2356 sig.update(Vector1Data); 2357 2358 byte[] signature = sig.sign(); 2359 assertNotNull("Signature must not be null", signature); 2360 assertTrue("Signature should match expected", 2361 Arrays.equals(signature, SHA1withRSA_Vector1Signature)); 2362 2363 RSAPublicKeySpec pubKeySpec = new RSAPublicKeySpec(RSA_2048_modulus, 2364 RSA_2048_publicExponent); 2365 PublicKey pubKey = kf.generatePublic(pubKeySpec); 2366 sig.initVerify(pubKey); 2367 sig.update(Vector1Data); 2368 assertTrue("Signature must verify correctly", sig.verify(signature)); 2369 } 2370 2371 public void testSign_SHA224withRSA_Key_Success() throws Exception { 2372 KeyFactory kf = KeyFactory.getInstance("RSA"); 2373 RSAPrivateKeySpec keySpec = new RSAPrivateKeySpec(RSA_2048_modulus, 2374 RSA_2048_privateExponent); 2375 2376 final PrivateKey privKey = kf.generatePrivate(keySpec); 2377 2378 Signature sig = Signature.getInstance("SHA224withRSA"); 2379 sig.initSign(privKey); 2380 sig.update(Vector2Data); 2381 2382 byte[] signature = sig.sign(); 2383 assertNotNull("Signature must not be null", signature); 2384 assertTrue("Signature should match expected", 2385 Arrays.equals(signature, SHA224withRSA_Vector2Signature)); 2386 2387 RSAPublicKeySpec pubKeySpec = new RSAPublicKeySpec(RSA_2048_modulus, 2388 RSA_2048_publicExponent); 2389 PublicKey pubKey = kf.generatePublic(pubKeySpec); 2390 sig.initVerify(pubKey); 2391 sig.update(Vector2Data); 2392 assertTrue("Signature must verify correctly", sig.verify(signature)); 2393 } 2394 2395 public void testSign_SHA256withRSA_Key_Success() throws Exception { 2396 KeyFactory kf = KeyFactory.getInstance("RSA"); 2397 RSAPrivateKeySpec keySpec = new RSAPrivateKeySpec(RSA_2048_modulus, 2398 RSA_2048_privateExponent); 2399 2400 final PrivateKey privKey = kf.generatePrivate(keySpec); 2401 2402 Signature sig = Signature.getInstance("SHA256withRSA"); 2403 sig.initSign(privKey); 2404 sig.update(Vector2Data); 2405 2406 byte[] signature = sig.sign(); 2407 assertNotNull("Signature must not be null", signature); 2408 assertTrue("Signature should match expected", 2409 Arrays.equals(signature, SHA256withRSA_Vector2Signature)); 2410 2411 RSAPublicKeySpec pubKeySpec = new RSAPublicKeySpec(RSA_2048_modulus, 2412 RSA_2048_publicExponent); 2413 PublicKey pubKey = kf.generatePublic(pubKeySpec); 2414 sig.initVerify(pubKey); 2415 sig.update(Vector2Data); 2416 assertTrue("Signature must verify correctly", sig.verify(signature)); 2417 } 2418 2419 public void testSign_SHA384withRSA_Key_Success() throws Exception { 2420 KeyFactory kf = KeyFactory.getInstance("RSA"); 2421 RSAPrivateKeySpec keySpec = new RSAPrivateKeySpec(RSA_2048_modulus, 2422 RSA_2048_privateExponent); 2423 PrivateKey privKey = kf.generatePrivate(keySpec); 2424 2425 Signature sig = Signature.getInstance("SHA384withRSA"); 2426 sig.initSign(privKey); 2427 sig.update(Vector2Data); 2428 2429 byte[] signature = sig.sign(); 2430 assertNotNull("Signature must not be null", signature); 2431 assertTrue("Signature should match expected", 2432 Arrays.equals(signature, SHA384withRSA_Vector2Signature)); 2433 2434 RSAPublicKeySpec pubKeySpec = new RSAPublicKeySpec(RSA_2048_modulus, 2435 RSA_2048_publicExponent); 2436 PublicKey pubKey = kf.generatePublic(pubKeySpec); 2437 sig.initVerify(pubKey); 2438 sig.update(Vector2Data); 2439 assertTrue("Signature must verify correctly", sig.verify(signature)); 2440 } 2441 2442 public void testSign_SHA512withRSA_Key_Success() throws Exception { 2443 KeyFactory kf = KeyFactory.getInstance("RSA"); 2444 RSAPrivateKeySpec keySpec = new RSAPrivateKeySpec(RSA_2048_modulus, 2445 RSA_2048_privateExponent); 2446 PrivateKey privKey = kf.generatePrivate(keySpec); 2447 2448 Signature sig = Signature.getInstance("SHA512withRSA"); 2449 sig.initSign(privKey); 2450 sig.update(Vector2Data); 2451 2452 byte[] signature = sig.sign(); 2453 assertNotNull("Signature must not be null", signature); 2454 assertTrue("Signature should match expected", 2455 Arrays.equals(signature, SHA512withRSA_Vector2Signature)); 2456 2457 RSAPublicKeySpec pubKeySpec = new RSAPublicKeySpec(RSA_2048_modulus, 2458 RSA_2048_publicExponent); 2459 PublicKey pubKey = kf.generatePublic(pubKeySpec); 2460 sig.initVerify(pubKey); 2461 sig.update(Vector2Data); 2462 assertTrue("Signature must verify correctly", sig.verify(signature)); 2463 } 2464 2465 public void testSign_MD5withRSA_Key_Success() throws Exception { 2466 KeyFactory kf = KeyFactory.getInstance("RSA"); 2467 RSAPrivateKeySpec keySpec = new RSAPrivateKeySpec(RSA_2048_modulus, 2468 RSA_2048_privateExponent); 2469 PrivateKey privKey = kf.generatePrivate(keySpec); 2470 2471 Signature sig = Signature.getInstance("MD5withRSA"); 2472 sig.initSign(privKey); 2473 sig.update(Vector2Data); 2474 2475 byte[] signature = sig.sign(); 2476 assertNotNull("Signature must not be null", signature); 2477 assertTrue("Signature should match expected", 2478 Arrays.equals(signature, MD5withRSA_Vector2Signature)); 2479 2480 RSAPublicKeySpec pubKeySpec = new RSAPublicKeySpec(RSA_2048_modulus, 2481 RSA_2048_publicExponent); 2482 PublicKey pubKey = kf.generatePublic(pubKeySpec); 2483 sig.initVerify(pubKey); 2484 sig.update(Vector2Data); 2485 assertTrue("Signature must verify correctly", sig.verify(signature)); 2486 } 2487 2488 public void testSign_SHA1withRSAPSS_Key_Success() throws Exception { 2489 KeyFactory kf = KeyFactory.getInstance("RSA"); 2490 RSAPrivateKeySpec keySpec = new RSAPrivateKeySpec(RSA_2048_modulus, 2491 RSA_2048_privateExponent); 2492 PrivateKey privKey = kf.generatePrivate(keySpec); 2493 2494 Signature sig = Signature.getInstance("SHA1withRSA/PSS"); 2495 sig.initSign(privKey); 2496 sig.update(Vector2Data); 2497 2498 byte[] signature = sig.sign(); 2499 assertNotNull("Signature must not be null", signature); 2500 assertPSSAlgorithmParametersEquals( 2501 SHA1withRSAPSS_Vector2Signature_ParameterSpec, sig.getParameters()); 2502 2503 RSAPublicKeySpec pubKeySpec = new RSAPublicKeySpec(RSA_2048_modulus, 2504 RSA_2048_publicExponent); 2505 PublicKey pubKey = kf.generatePublic(pubKeySpec); 2506 sig.initVerify(pubKey); 2507 sig.update(Vector2Data); 2508 assertTrue("Signature must verify correctly", sig.verify(signature)); 2509 } 2510 2511 public void testSign_SHA1withRSAPSS_NoSalt_Key_Success() throws Exception { 2512 KeyFactory kf = KeyFactory.getInstance("RSA"); 2513 RSAPrivateKeySpec keySpec = new RSAPrivateKeySpec(RSA_2048_modulus, 2514 RSA_2048_privateExponent); 2515 PrivateKey privKey = kf.generatePrivate(keySpec); 2516 2517 Signature sig = Signature.getInstance("SHA1withRSA/PSS"); 2518 sig.initSign(privKey); 2519 sig.setParameter(SHA1withRSAPSS_NoSalt_Vector2Signature_ParameterSpec); 2520 sig.update(Vector2Data); 2521 2522 byte[] signature = sig.sign(); 2523 assertNotNull("Signature must not be null", signature); 2524 assertPSSAlgorithmParametersEquals( 2525 SHA1withRSAPSS_NoSalt_Vector2Signature_ParameterSpec, sig.getParameters()); 2526 assertTrue("Signature should match expected", 2527 Arrays.equals(signature, SHA1withRSAPSS_NoSalt_Vector2Signature)); 2528 2529 RSAPublicKeySpec pubKeySpec = new RSAPublicKeySpec(RSA_2048_modulus, 2530 RSA_2048_publicExponent); 2531 PublicKey pubKey = kf.generatePublic(pubKeySpec); 2532 sig.initVerify(pubKey); 2533 sig.setParameter(SHA1withRSAPSS_NoSalt_Vector2Signature_ParameterSpec); 2534 sig.update(Vector2Data); 2535 assertTrue("Signature must verify correctly", sig.verify(signature)); 2536 } 2537 2538 public void testSign_SHA1withRSAPSS_MaxSalt_Key_Success() throws Exception { 2539 KeyFactory kf = KeyFactory.getInstance("RSA"); 2540 RSAPrivateKeySpec keySpec = new RSAPrivateKeySpec(RSA_2048_modulus, 2541 RSA_2048_privateExponent); 2542 PrivateKey privKey = kf.generatePrivate(keySpec); 2543 2544 Signature sig = Signature.getInstance("SHA1withRSA/PSS"); 2545 sig.initSign(privKey); 2546 sig.setParameter(SHA1withRSAPSS_MaxSalt_Vector2Signature_ParameterSpec); 2547 sig.update(Vector2Data); 2548 2549 byte[] signature = sig.sign(); 2550 assertNotNull("Signature must not be null", signature); 2551 assertPSSAlgorithmParametersEquals( 2552 SHA1withRSAPSS_MaxSalt_Vector2Signature_ParameterSpec, sig.getParameters()); 2553 2554 RSAPublicKeySpec pubKeySpec = new RSAPublicKeySpec(RSA_2048_modulus, 2555 RSA_2048_publicExponent); 2556 PublicKey pubKey = kf.generatePublic(pubKeySpec); 2557 sig = Signature.getInstance("SHA1withRSA/PSS"); 2558 sig.initVerify(pubKey); 2559 sig.setParameter(SHA1withRSAPSS_MaxSalt_Vector2Signature_ParameterSpec); 2560 sig.update(Vector2Data); 2561 assertTrue("Signature must verify correctly", sig.verify(signature)); 2562 } 2563 2564 public void testSign_SHA224withRSAPSS_Key_Success() throws Exception { 2565 KeyFactory kf = KeyFactory.getInstance("RSA"); 2566 RSAPrivateKeySpec keySpec = new RSAPrivateKeySpec(RSA_2048_modulus, 2567 RSA_2048_privateExponent); 2568 PrivateKey privKey = kf.generatePrivate(keySpec); 2569 2570 Signature sig = Signature.getInstance("SHA224withRSA/PSS"); 2571 sig.initSign(privKey); 2572 sig.update(Vector2Data); 2573 2574 byte[] signature = sig.sign(); 2575 assertNotNull("Signature must not be null", signature); 2576 assertPSSAlgorithmParametersEquals( 2577 SHA224withRSAPSS_Vector2Signature_ParameterSpec, sig.getParameters()); 2578 2579 RSAPublicKeySpec pubKeySpec = new RSAPublicKeySpec(RSA_2048_modulus, 2580 RSA_2048_publicExponent); 2581 PublicKey pubKey = kf.generatePublic(pubKeySpec); 2582 sig.initVerify(pubKey); 2583 sig.update(Vector2Data); 2584 assertTrue("Signature must verify correctly", sig.verify(signature)); 2585 } 2586 2587 public void testSign_SHA224withRSAPSS_NoSalt_Key_Success() throws Exception { 2588 KeyFactory kf = KeyFactory.getInstance("RSA"); 2589 RSAPrivateKeySpec keySpec = new RSAPrivateKeySpec(RSA_2048_modulus, 2590 RSA_2048_privateExponent); 2591 PrivateKey privKey = kf.generatePrivate(keySpec); 2592 2593 Signature sig = Signature.getInstance("SHA224withRSA/PSS"); 2594 sig.initSign(privKey); 2595 sig.setParameter(SHA224withRSAPSS_NoSalt_Vector2Signature_ParameterSpec); 2596 sig.update(Vector2Data); 2597 2598 byte[] signature = sig.sign(); 2599 assertNotNull("Signature must not be null", signature); 2600 assertPSSAlgorithmParametersEquals( 2601 SHA224withRSAPSS_NoSalt_Vector2Signature_ParameterSpec, sig.getParameters()); 2602 assertTrue("Signature should match expected", 2603 Arrays.equals(signature, SHA224withRSAPSS_NoSalt_Vector2Signature)); 2604 2605 RSAPublicKeySpec pubKeySpec = new RSAPublicKeySpec(RSA_2048_modulus, 2606 RSA_2048_publicExponent); 2607 PublicKey pubKey = kf.generatePublic(pubKeySpec); 2608 sig.initVerify(pubKey); 2609 sig.setParameter(SHA224withRSAPSS_NoSalt_Vector2Signature_ParameterSpec); 2610 sig.update(Vector2Data); 2611 assertTrue("Signature must verify correctly", sig.verify(signature)); 2612 } 2613 2614 public void testSign_SHA224withRSAPSS_MaxSalt_Key_Success() throws Exception { 2615 KeyFactory kf = KeyFactory.getInstance("RSA"); 2616 RSAPrivateKeySpec keySpec = new RSAPrivateKeySpec(RSA_2048_modulus, 2617 RSA_2048_privateExponent); 2618 PrivateKey privKey = kf.generatePrivate(keySpec); 2619 2620 Signature sig = Signature.getInstance("SHA224withRSA/PSS"); 2621 sig.initSign(privKey); 2622 sig.setParameter(SHA224withRSAPSS_MaxSalt_Vector2Signature_ParameterSpec); 2623 sig.update(Vector2Data); 2624 2625 byte[] signature = sig.sign(); 2626 assertNotNull("Signature must not be null", signature); 2627 assertPSSAlgorithmParametersEquals( 2628 SHA224withRSAPSS_MaxSalt_Vector2Signature_ParameterSpec, sig.getParameters()); 2629 2630 RSAPublicKeySpec pubKeySpec = new RSAPublicKeySpec(RSA_2048_modulus, 2631 RSA_2048_publicExponent); 2632 PublicKey pubKey = kf.generatePublic(pubKeySpec); 2633 sig = Signature.getInstance("SHA224withRSA/PSS"); 2634 sig.initVerify(pubKey); 2635 sig.setParameter(SHA224withRSAPSS_MaxSalt_Vector2Signature_ParameterSpec); 2636 sig.update(Vector2Data); 2637 assertTrue("Signature must verify correctly", sig.verify(signature)); 2638 } 2639 2640 public void testSign_SHA256withRSAPSS_Key_Success() throws Exception { 2641 KeyFactory kf = KeyFactory.getInstance("RSA"); 2642 RSAPrivateKeySpec keySpec = new RSAPrivateKeySpec(RSA_2048_modulus, 2643 RSA_2048_privateExponent); 2644 PrivateKey privKey = kf.generatePrivate(keySpec); 2645 2646 Signature sig = Signature.getInstance("SHA256withRSA/PSS"); 2647 sig.initSign(privKey); 2648 sig.update(Vector2Data); 2649 2650 byte[] signature = sig.sign(); 2651 assertNotNull("Signature must not be null", signature); 2652 assertPSSAlgorithmParametersEquals( 2653 SHA256withRSAPSS_Vector2Signature_ParameterSpec, sig.getParameters()); 2654 2655 RSAPublicKeySpec pubKeySpec = new RSAPublicKeySpec(RSA_2048_modulus, 2656 RSA_2048_publicExponent); 2657 PublicKey pubKey = kf.generatePublic(pubKeySpec); 2658 sig.initVerify(pubKey); 2659 sig.update(Vector2Data); 2660 assertTrue("Signature must verify correctly", sig.verify(signature)); 2661 } 2662 2663 public void testSign_SHA256withRSAPSS_NoSalt_Key_Success() throws Exception { 2664 KeyFactory kf = KeyFactory.getInstance("RSA"); 2665 RSAPrivateKeySpec keySpec = new RSAPrivateKeySpec(RSA_2048_modulus, 2666 RSA_2048_privateExponent); 2667 PrivateKey privKey = kf.generatePrivate(keySpec); 2668 2669 Signature sig = Signature.getInstance("SHA256withRSA/PSS"); 2670 sig.initSign(privKey); 2671 sig.setParameter(SHA256withRSAPSS_NoSalt_Vector2Signature_ParameterSpec); 2672 sig.update(Vector2Data); 2673 2674 byte[] signature = sig.sign(); 2675 assertNotNull("Signature must not be null", signature); 2676 assertPSSAlgorithmParametersEquals( 2677 SHA256withRSAPSS_NoSalt_Vector2Signature_ParameterSpec, sig.getParameters()); 2678 assertTrue("Signature should match expected", 2679 Arrays.equals(signature, SHA256withRSAPSS_NoSalt_Vector2Signature)); 2680 2681 RSAPublicKeySpec pubKeySpec = new RSAPublicKeySpec(RSA_2048_modulus, 2682 RSA_2048_publicExponent); 2683 PublicKey pubKey = kf.generatePublic(pubKeySpec); 2684 sig.initVerify(pubKey); 2685 sig.setParameter(SHA256withRSAPSS_NoSalt_Vector2Signature_ParameterSpec); 2686 sig.update(Vector2Data); 2687 assertTrue("Signature must verify correctly", sig.verify(signature)); 2688 } 2689 2690 public void testSign_SHA256withRSAPSS_MaxSalt_Key_Success() throws Exception { 2691 KeyFactory kf = KeyFactory.getInstance("RSA"); 2692 RSAPrivateKeySpec keySpec = new RSAPrivateKeySpec(RSA_2048_modulus, 2693 RSA_2048_privateExponent); 2694 PrivateKey privKey = kf.generatePrivate(keySpec); 2695 2696 Signature sig = Signature.getInstance("SHA256withRSA/PSS"); 2697 sig.initSign(privKey); 2698 sig.setParameter(SHA256withRSAPSS_MaxSalt_Vector2Signature_ParameterSpec); 2699 sig.update(Vector2Data); 2700 2701 byte[] signature = sig.sign(); 2702 assertNotNull("Signature must not be null", signature); 2703 assertPSSAlgorithmParametersEquals( 2704 SHA256withRSAPSS_MaxSalt_Vector2Signature_ParameterSpec, sig.getParameters()); 2705 2706 RSAPublicKeySpec pubKeySpec = new RSAPublicKeySpec(RSA_2048_modulus, 2707 RSA_2048_publicExponent); 2708 PublicKey pubKey = kf.generatePublic(pubKeySpec); 2709 sig = Signature.getInstance("SHA256withRSA/PSS"); 2710 sig.initVerify(pubKey); 2711 sig.setParameter(SHA256withRSAPSS_MaxSalt_Vector2Signature_ParameterSpec); 2712 sig.update(Vector2Data); 2713 assertTrue("Signature must verify correctly", sig.verify(signature)); 2714 } 2715 2716 public void testSign_SHA384withRSAPSS_Key_Success() throws Exception { 2717 KeyFactory kf = KeyFactory.getInstance("RSA"); 2718 RSAPrivateKeySpec keySpec = new RSAPrivateKeySpec(RSA_2048_modulus, 2719 RSA_2048_privateExponent); 2720 PrivateKey privKey = kf.generatePrivate(keySpec); 2721 2722 Signature sig = Signature.getInstance("SHA384withRSA/PSS"); 2723 sig.initSign(privKey); 2724 sig.update(Vector2Data); 2725 2726 byte[] signature = sig.sign(); 2727 assertNotNull("Signature must not be null", signature); 2728 assertPSSAlgorithmParametersEquals( 2729 SHA384withRSAPSS_Vector2Signature_ParameterSpec, sig.getParameters()); 2730 2731 RSAPublicKeySpec pubKeySpec = new RSAPublicKeySpec(RSA_2048_modulus, 2732 RSA_2048_publicExponent); 2733 PublicKey pubKey = kf.generatePublic(pubKeySpec); 2734 sig.initVerify(pubKey); 2735 sig.update(Vector2Data); 2736 assertTrue("Signature must verify correctly", sig.verify(signature)); 2737 } 2738 2739 public void testSign_SHA384withRSAPSS_NoSalt_Key_Success() throws Exception { 2740 KeyFactory kf = KeyFactory.getInstance("RSA"); 2741 RSAPrivateKeySpec keySpec = new RSAPrivateKeySpec(RSA_2048_modulus, 2742 RSA_2048_privateExponent); 2743 PrivateKey privKey = kf.generatePrivate(keySpec); 2744 2745 Signature sig = Signature.getInstance("SHA384withRSA/PSS"); 2746 sig.initSign(privKey); 2747 sig.setParameter(SHA384withRSAPSS_NoSalt_Vector2Signature_ParameterSpec); 2748 sig.update(Vector2Data); 2749 2750 byte[] signature = sig.sign(); 2751 assertNotNull("Signature must not be null", signature); 2752 assertPSSAlgorithmParametersEquals( 2753 SHA384withRSAPSS_NoSalt_Vector2Signature_ParameterSpec, sig.getParameters()); 2754 assertTrue("Signature should match expected", 2755 Arrays.equals(signature, SHA384withRSAPSS_NoSalt_Vector2Signature)); 2756 2757 RSAPublicKeySpec pubKeySpec = new RSAPublicKeySpec(RSA_2048_modulus, 2758 RSA_2048_publicExponent); 2759 PublicKey pubKey = kf.generatePublic(pubKeySpec); 2760 sig.initVerify(pubKey); 2761 sig.setParameter(SHA384withRSAPSS_NoSalt_Vector2Signature_ParameterSpec); 2762 sig.update(Vector2Data); 2763 assertTrue("Signature must verify correctly", sig.verify(signature)); 2764 } 2765 2766 public void testSign_SHA384withRSAPSS_MaxSalt_Key_Success() throws Exception { 2767 KeyFactory kf = KeyFactory.getInstance("RSA"); 2768 RSAPrivateKeySpec keySpec = new RSAPrivateKeySpec(RSA_2048_modulus, 2769 RSA_2048_privateExponent); 2770 PrivateKey privKey = kf.generatePrivate(keySpec); 2771 2772 Signature sig = Signature.getInstance("SHA384withRSA/PSS"); 2773 sig.initSign(privKey); 2774 sig.setParameter(SHA384withRSAPSS_MaxSalt_Vector2Signature_ParameterSpec); 2775 sig.update(Vector2Data); 2776 2777 byte[] signature = sig.sign(); 2778 assertNotNull("Signature must not be null", signature); 2779 assertPSSAlgorithmParametersEquals( 2780 SHA384withRSAPSS_MaxSalt_Vector2Signature_ParameterSpec, sig.getParameters()); 2781 2782 RSAPublicKeySpec pubKeySpec = new RSAPublicKeySpec(RSA_2048_modulus, 2783 RSA_2048_publicExponent); 2784 PublicKey pubKey = kf.generatePublic(pubKeySpec); 2785 sig = Signature.getInstance("SHA384withRSA/PSS"); 2786 sig.initVerify(pubKey); 2787 sig.setParameter(SHA384withRSAPSS_MaxSalt_Vector2Signature_ParameterSpec); 2788 sig.update(Vector2Data); 2789 assertTrue("Signature must verify correctly", sig.verify(signature)); 2790 } 2791 2792 public void testSign_SHA512withRSAPSS_Key_Success() throws Exception { 2793 KeyFactory kf = KeyFactory.getInstance("RSA"); 2794 RSAPrivateKeySpec keySpec = new RSAPrivateKeySpec(RSA_2048_modulus, 2795 RSA_2048_privateExponent); 2796 PrivateKey privKey = kf.generatePrivate(keySpec); 2797 2798 Signature sig = Signature.getInstance("SHA512withRSA/PSS"); 2799 sig.initSign(privKey); 2800 sig.update(Vector2Data); 2801 2802 byte[] signature = sig.sign(); 2803 assertNotNull("Signature must not be null", signature); 2804 assertPSSAlgorithmParametersEquals( 2805 SHA512withRSAPSS_Vector2Signature_ParameterSpec, sig.getParameters()); 2806 2807 RSAPublicKeySpec pubKeySpec = new RSAPublicKeySpec(RSA_2048_modulus, 2808 RSA_2048_publicExponent); 2809 PublicKey pubKey = kf.generatePublic(pubKeySpec); 2810 sig.initVerify(pubKey); 2811 sig.update(Vector2Data); 2812 assertTrue("Signature must verify correctly", sig.verify(signature)); 2813 } 2814 2815 public void testSign_SHA512withRSAPSS_NoSalt_Key_Success() throws Exception { 2816 KeyFactory kf = KeyFactory.getInstance("RSA"); 2817 RSAPrivateKeySpec keySpec = new RSAPrivateKeySpec(RSA_2048_modulus, 2818 RSA_2048_privateExponent); 2819 PrivateKey privKey = kf.generatePrivate(keySpec); 2820 2821 Signature sig = Signature.getInstance("SHA512withRSA/PSS"); 2822 sig.initSign(privKey); 2823 sig.setParameter(SHA512withRSAPSS_NoSalt_Vector2Signature_ParameterSpec); 2824 sig.update(Vector2Data); 2825 2826 byte[] signature = sig.sign(); 2827 assertNotNull("Signature must not be null", signature); 2828 assertPSSAlgorithmParametersEquals( 2829 SHA512withRSAPSS_NoSalt_Vector2Signature_ParameterSpec, sig.getParameters()); 2830 assertTrue("Signature should match expected", 2831 Arrays.equals(signature, SHA512withRSAPSS_NoSalt_Vector2Signature)); 2832 2833 RSAPublicKeySpec pubKeySpec = new RSAPublicKeySpec(RSA_2048_modulus, 2834 RSA_2048_publicExponent); 2835 PublicKey pubKey = kf.generatePublic(pubKeySpec); 2836 sig.initVerify(pubKey); 2837 sig.setParameter(SHA512withRSAPSS_NoSalt_Vector2Signature_ParameterSpec); 2838 sig.update(Vector2Data); 2839 assertTrue("Signature must verify correctly", sig.verify(signature)); 2840 } 2841 2842 public void testSign_SHA512withRSAPSS_MaxSalt_Key_Success() throws Exception { 2843 KeyFactory kf = KeyFactory.getInstance("RSA"); 2844 RSAPrivateKeySpec keySpec = new RSAPrivateKeySpec(RSA_2048_modulus, 2845 RSA_2048_privateExponent); 2846 PrivateKey privKey = kf.generatePrivate(keySpec); 2847 2848 Signature sig = Signature.getInstance("SHA512withRSA/PSS"); 2849 sig.initSign(privKey); 2850 sig.setParameter(SHA512withRSAPSS_MaxSalt_Vector2Signature_ParameterSpec); 2851 sig.update(Vector2Data); 2852 2853 byte[] signature = sig.sign(); 2854 assertNotNull("Signature must not be null", signature); 2855 assertPSSAlgorithmParametersEquals( 2856 SHA512withRSAPSS_MaxSalt_Vector2Signature_ParameterSpec, sig.getParameters()); 2857 2858 RSAPublicKeySpec pubKeySpec = new RSAPublicKeySpec(RSA_2048_modulus, 2859 RSA_2048_publicExponent); 2860 PublicKey pubKey = kf.generatePublic(pubKeySpec); 2861 sig = Signature.getInstance("SHA512withRSA/PSS"); 2862 sig.initVerify(pubKey); 2863 sig.setParameter(SHA512withRSAPSS_MaxSalt_Vector2Signature_ParameterSpec); 2864 sig.update(Vector2Data); 2865 assertTrue("Signature must verify correctly", sig.verify(signature)); 2866 } 2867 2868 public void testSign_NONEwithRSA_Key_Success() throws Exception { 2869 KeyFactory kf = KeyFactory.getInstance("RSA"); 2870 RSAPrivateKeySpec keySpec = new RSAPrivateKeySpec(RSA_2048_modulus, 2871 RSA_2048_privateExponent); 2872 PrivateKey privKey = kf.generatePrivate(keySpec); 2873 2874 Signature sig = Signature.getInstance("NONEwithRSA"); 2875 sig.initSign(privKey); 2876 sig.update(Vector1Data); 2877 2878 byte[] signature = sig.sign(); 2879 assertNotNull("Signature must not be null", signature); 2880 assertTrue("Signature should match expected", 2881 Arrays.equals(signature, NONEwithRSA_Vector1Signature)); 2882 2883 RSAPublicKeySpec pubKeySpec = new RSAPublicKeySpec(RSA_2048_modulus, 2884 RSA_2048_publicExponent); 2885 PublicKey pubKey = kf.generatePublic(pubKeySpec); 2886 sig.initVerify(pubKey); 2887 sig.update(Vector1Data); 2888 assertTrue("Signature must verify correctly", sig.verify(signature)); 2889 } 2890 2891 public void testVerify_NONEwithRSA_Key_WrongSignature_Failure() throws Exception { 2892 KeyFactory kf = KeyFactory.getInstance("RSA"); 2893 2894 RSAPublicKeySpec pubKeySpec = new RSAPublicKeySpec(RSA_2048_modulus, 2895 RSA_2048_publicExponent); 2896 PublicKey pubKey = kf.generatePublic(pubKeySpec); 2897 2898 Signature sig = Signature.getInstance("NONEwithRSA"); 2899 sig.initVerify(pubKey); 2900 sig.update(Vector1Data); 2901 assertFalse("Invalid signature must not verify", 2902 sig.verify("Invalid".getBytes(UTF_8))); 2903 } 2904 2905 public void testSign_NONEwithRSA_Key_DataTooLarge_Failure() throws Exception { 2906 KeyFactory kf = KeyFactory.getInstance("RSA"); 2907 RSAPrivateKeySpec keySpec = new RSAPrivateKeySpec(RSA_2048_modulus, 2908 RSA_2048_privateExponent); 2909 PrivateKey privKey = kf.generatePrivate(keySpec); 2910 2911 Signature sig = Signature.getInstance("NONEwithRSA"); 2912 sig.initSign(privKey); 2913 2914 final int oneTooBig = RSA_2048_modulus.bitLength() - 10; 2915 for (int i = 0; i < oneTooBig; i++) { 2916 sig.update((byte) i); 2917 } 2918 2919 try { 2920 sig.sign(); 2921 fail("Should throw exception when data is too large"); 2922 } catch (SignatureException expected) { 2923 } 2924 } 2925 2926 public void testSign_NONEwithRSA_Key_DataTooLarge_SingleByte_Failure() throws Exception { 2927 KeyFactory kf = KeyFactory.getInstance("RSA"); 2928 RSAPrivateKeySpec keySpec = new RSAPrivateKeySpec(RSA_2048_modulus, 2929 RSA_2048_privateExponent); 2930 PrivateKey privKey = kf.generatePrivate(keySpec); 2931 2932 Signature sig = Signature.getInstance("NONEwithRSA"); 2933 sig.initSign(privKey); 2934 2935 // This should make it two bytes too big. 2936 final int oneTooBig = RSA_2048_modulus.bitLength() - 10; 2937 for (int i = 0; i < oneTooBig; i++) { 2938 sig.update((byte) i); 2939 } 2940 2941 try { 2942 sig.sign(); 2943 fail("Should throw exception when data is too large"); 2944 } catch (SignatureException expected) { 2945 } 2946 } 2947 2948 public void testVerify_NONEwithRSA_Key_DataTooLarge_Failure() throws Exception { 2949 KeyFactory kf = KeyFactory.getInstance("RSA"); 2950 2951 RSAPublicKeySpec pubKeySpec = new RSAPublicKeySpec(RSA_2048_modulus, 2952 RSA_2048_publicExponent); 2953 PublicKey pubKey = kf.generatePublic(pubKeySpec); 2954 2955 Signature sig = Signature.getInstance("NONEwithRSA"); 2956 sig.initVerify(pubKey); 2957 2958 // This should make it one bytes too big. 2959 final int oneTooBig = RSA_2048_modulus.bitLength() + 1; 2960 final byte[] vector = new byte[oneTooBig]; 2961 for (int i = 0; i < oneTooBig; i++) { 2962 vector[i] = (byte) Vector1Data[i % Vector1Data.length]; 2963 } 2964 sig.update(vector); 2965 2966 assertFalse("Should not verify when signature is too large", 2967 sig.verify(NONEwithRSA_Vector1Signature)); 2968 } 2969 2970 public void testVerify_NONEwithRSA_Key_DataTooLarge_SingleByte_Failure() throws Exception { 2971 KeyFactory kf = KeyFactory.getInstance("RSA"); 2972 2973 RSAPublicKeySpec pubKeySpec = new RSAPublicKeySpec(RSA_2048_modulus, 2974 RSA_2048_publicExponent); 2975 PublicKey pubKey = kf.generatePublic(pubKeySpec); 2976 2977 Signature sig = Signature.getInstance("NONEwithRSA"); 2978 sig.initVerify(pubKey); 2979 2980 // This should make it twice as big as it should be. 2981 final int tooBig = RSA_2048_modulus.bitLength() * 2; 2982 for (int i = 0; i < tooBig; i++) { 2983 sig.update((byte) Vector1Data[i % Vector1Data.length]); 2984 } 2985 2986 assertFalse("Should not verify when signature is too large", 2987 sig.verify(NONEwithRSA_Vector1Signature)); 2988 } 2989 2990 public void testVerify_NONEwithRSA_Key_SignatureTooSmall_Failure() throws Exception { 2991 KeyFactory kf = KeyFactory.getInstance("RSA"); 2992 2993 RSAPublicKeySpec pubKeySpec = new RSAPublicKeySpec(RSA_2048_modulus, 2994 RSA_2048_publicExponent); 2995 PublicKey pubKey = kf.generatePublic(pubKeySpec); 2996 2997 Signature sig = Signature.getInstance("NONEwithRSA"); 2998 sig.initVerify(pubKey); 2999 sig.update(Vector1Data); 3000 3001 assertFalse("Invalid signature should not verify", 3002 sig.verify("Invalid sig".getBytes(UTF_8))); 3003 } 3004 3005 public void testVerify_NONEwithRSA_Key_SignatureTooLarge_Failure() throws Exception { 3006 KeyFactory kf = KeyFactory.getInstance("RSA"); 3007 3008 RSAPublicKeySpec pubKeySpec = new RSAPublicKeySpec(RSA_2048_modulus, 3009 RSA_2048_publicExponent); 3010 PublicKey pubKey = kf.generatePublic(pubKeySpec); 3011 3012 Signature sig = Signature.getInstance("NONEwithRSA"); 3013 sig.initVerify(pubKey); 3014 sig.update(Vector1Data); 3015 3016 byte[] invalidSignature = new byte[NONEwithRSA_Vector1Signature.length * 2]; 3017 System.arraycopy(NONEwithRSA_Vector1Signature, 0, invalidSignature, 0, 3018 NONEwithRSA_Vector1Signature.length); 3019 System.arraycopy(NONEwithRSA_Vector1Signature, 0, invalidSignature, 3020 NONEwithRSA_Vector1Signature.length, NONEwithRSA_Vector1Signature.length); 3021 3022 try { 3023 sig.verify(invalidSignature); 3024 fail("Should throw exception when signature is too large"); 3025 } catch (SignatureException expected) { 3026 } 3027 } 3028 3029 public void testSign_NONEwithECDSA_Key_Success() throws Exception { 3030 KeyPair keys = keyPair("NONEwithECDSA", null); 3031 Signature sig = Signature.getInstance("NONEwithECDSA"); 3032 3033 sig.initSign(keys.getPrivate()); 3034 sig.update(Vector1Data); 3035 byte[] signature = sig.sign(); 3036 assertNotNull("Signature must not be null", signature); 3037 assertTrue("Signature must not be empty", signature.length > 0); 3038 3039 sig.initVerify(keys.getPublic()); 3040 sig.update(Vector1Data); 3041 assertTrue("Signature must verify correctly", sig.verify(signature)); 3042 } 3043 3044 public void testVerify_NONEwithECDSA_Key_Success() throws Exception { 3045 PublicKey pub = getNamedCurveEcPublicKey(); 3046 MessageDigest sha1 = MessageDigest.getInstance("SHA1"); 3047 Signature sig = Signature.getInstance("NONEwithECDSA"); 3048 3049 // NAMED_CURVE_SIGNATURE was signed using SHA1withECDSA, so NONEwithECDSA should 3050 // verify the digest 3051 sig.initVerify(pub); 3052 sig.update(sha1.digest(NAMED_CURVE_VECTOR)); 3053 assertTrue(sig.verify(NAMED_CURVE_SIGNATURE)); 3054 } 3055 3056 public void testVerify_NONEwithECDSA_Key_WrongData_Failure() throws Exception { 3057 PublicKey pub = getNamedCurveEcPublicKey(); 3058 Signature sig = Signature.getInstance("NONEwithECDSA"); 3059 3060 sig.initVerify(pub); 3061 sig.update(NAMED_CURVE_VECTOR); 3062 assertFalse(sig.verify(NAMED_CURVE_SIGNATURE)); 3063 } 3064 3065 public void testVerify_NONEwithECDSA_Key_SingleByte_Failure() throws Exception { 3066 PublicKey pub = getNamedCurveEcPublicKey(); 3067 MessageDigest sha1 = MessageDigest.getInstance("SHA1"); 3068 Signature sig = Signature.getInstance("NONEwithECDSA"); 3069 3070 byte[] corrupted = new byte[NAMED_CURVE_SIGNATURE.length]; 3071 corrupted[0] ^= 1; 3072 3073 sig.initVerify(pub); 3074 sig.update(sha1.digest(NAMED_CURVE_VECTOR)); 3075 try { 3076 assertFalse(sig.verify(corrupted)); 3077 } catch (SignatureException expected) { 3078 // It's valid to either return false or throw an exception, accept either 3079 } 3080 } 3081 3082 /* 3083 * These tests were generated with this DSA private key: 3084 * 3085 * -----BEGIN DSA PRIVATE KEY----- 3086 * MIIBugIBAAKBgQCeYcKJ73epThNnZB8JAf4kE1Pgt5CoTnb+iYJ/esU8TgwgVTCV 3087 * QoXhQH0njwcN6NyZ77MHlDTWfP+cvmnT60Q3UO9J+OJb2NEQhJfq46UcwE5pynA9 3088 * eLkW5f5hXYpasyxhtgE70AF8Mo3h82kOi1jGzwCU+EkqS+raAP9L0L5AIwIVAL/u 3089 * qg8SNFBy+GAT2PFBARClL1dfAoGAd9R6EsyBfn7rOvvmhm1aEB2tqU+5A10hGuQw 3090 * lXWOzV7RvQpF7uf3a2UCYNAurz28B90rjjPAk4DZK6dxV3a8jrng1/QjjUEal08s 3091 * G9VLZuj60lANF6s0MT2kiNiOqKduFwO3D2h8ZHuSuGPkmmcYgSfUCxNI031O9qiP 3092 * VhctCFECgYAz7i1DhjRGUkCdYQd5tVaI42lhXOV71MTYPbuFOIxTL/hny7Z0PZWR 3093 * A1blmYE6vrArDEhzpmRvDJZSIMzMfJjUIGu1KO73zpo9siK0xY0/sw5r3QC9txP2 3094 * 2Mv3BUIl5TLrs9outQJ0VMwldY2fElgCLWcSVkH44qZwWir1cq+cIwIUEGPDardb 3095 * pNvWlWgTDD6a6ZTby+M= 3096 * -----END DSA PRIVATE KEY----- 3097 * 3098 */ 3099 3100 private static final BigInteger DSA_priv = new BigInteger(new byte[] { 3101 (byte) 0x10, (byte) 0x63, (byte) 0xc3, (byte) 0x6a, (byte) 0xb7, (byte) 0x5b, (byte) 0xa4, (byte) 0xdb, 3102 (byte) 0xd6, (byte) 0x95, (byte) 0x68, (byte) 0x13, (byte) 0x0c, (byte) 0x3e, (byte) 0x9a, (byte) 0xe9, 3103 (byte) 0x94, (byte) 0xdb, (byte) 0xcb, (byte) 0xe3, 3104 }); 3105 3106 private static final BigInteger DSA_pub = new BigInteger(new byte[] { 3107 (byte) 0x33, (byte) 0xee, (byte) 0x2d, (byte) 0x43, (byte) 0x86, (byte) 0x34, (byte) 0x46, (byte) 0x52, 3108 (byte) 0x40, (byte) 0x9d, (byte) 0x61, (byte) 0x07, (byte) 0x79, (byte) 0xb5, (byte) 0x56, (byte) 0x88, 3109 (byte) 0xe3, (byte) 0x69, (byte) 0x61, (byte) 0x5c, (byte) 0xe5, (byte) 0x7b, (byte) 0xd4, (byte) 0xc4, 3110 (byte) 0xd8, (byte) 0x3d, (byte) 0xbb, (byte) 0x85, (byte) 0x38, (byte) 0x8c, (byte) 0x53, (byte) 0x2f, 3111 (byte) 0xf8, (byte) 0x67, (byte) 0xcb, (byte) 0xb6, (byte) 0x74, (byte) 0x3d, (byte) 0x95, (byte) 0x91, 3112 (byte) 0x03, (byte) 0x56, (byte) 0xe5, (byte) 0x99, (byte) 0x81, (byte) 0x3a, (byte) 0xbe, (byte) 0xb0, 3113 (byte) 0x2b, (byte) 0x0c, (byte) 0x48, (byte) 0x73, (byte) 0xa6, (byte) 0x64, (byte) 0x6f, (byte) 0x0c, 3114 (byte) 0x96, (byte) 0x52, (byte) 0x20, (byte) 0xcc, (byte) 0xcc, (byte) 0x7c, (byte) 0x98, (byte) 0xd4, 3115 (byte) 0x20, (byte) 0x6b, (byte) 0xb5, (byte) 0x28, (byte) 0xee, (byte) 0xf7, (byte) 0xce, (byte) 0x9a, 3116 (byte) 0x3d, (byte) 0xb2, (byte) 0x22, (byte) 0xb4, (byte) 0xc5, (byte) 0x8d, (byte) 0x3f, (byte) 0xb3, 3117 (byte) 0x0e, (byte) 0x6b, (byte) 0xdd, (byte) 0x00, (byte) 0xbd, (byte) 0xb7, (byte) 0x13, (byte) 0xf6, 3118 (byte) 0xd8, (byte) 0xcb, (byte) 0xf7, (byte) 0x05, (byte) 0x42, (byte) 0x25, (byte) 0xe5, (byte) 0x32, 3119 (byte) 0xeb, (byte) 0xb3, (byte) 0xda, (byte) 0x2e, (byte) 0xb5, (byte) 0x02, (byte) 0x74, (byte) 0x54, 3120 (byte) 0xcc, (byte) 0x25, (byte) 0x75, (byte) 0x8d, (byte) 0x9f, (byte) 0x12, (byte) 0x58, (byte) 0x02, 3121 (byte) 0x2d, (byte) 0x67, (byte) 0x12, (byte) 0x56, (byte) 0x41, (byte) 0xf8, (byte) 0xe2, (byte) 0xa6, 3122 (byte) 0x70, (byte) 0x5a, (byte) 0x2a, (byte) 0xf5, (byte) 0x72, (byte) 0xaf, (byte) 0x9c, (byte) 0x23, 3123 }); 3124 3125 private static final BigInteger DSA_P = new BigInteger(new byte[] { 3126 (byte) 0x00, (byte) 0x9e, (byte) 0x61, (byte) 0xc2, (byte) 0x89, (byte) 0xef, (byte) 0x77, (byte) 0xa9, 3127 (byte) 0x4e, (byte) 0x13, (byte) 0x67, (byte) 0x64, (byte) 0x1f, (byte) 0x09, (byte) 0x01, (byte) 0xfe, 3128 (byte) 0x24, (byte) 0x13, (byte) 0x53, (byte) 0xe0, (byte) 0xb7, (byte) 0x90, (byte) 0xa8, (byte) 0x4e, 3129 (byte) 0x76, (byte) 0xfe, (byte) 0x89, (byte) 0x82, (byte) 0x7f, (byte) 0x7a, (byte) 0xc5, (byte) 0x3c, 3130 (byte) 0x4e, (byte) 0x0c, (byte) 0x20, (byte) 0x55, (byte) 0x30, (byte) 0x95, (byte) 0x42, (byte) 0x85, 3131 (byte) 0xe1, (byte) 0x40, (byte) 0x7d, (byte) 0x27, (byte) 0x8f, (byte) 0x07, (byte) 0x0d, (byte) 0xe8, 3132 (byte) 0xdc, (byte) 0x99, (byte) 0xef, (byte) 0xb3, (byte) 0x07, (byte) 0x94, (byte) 0x34, (byte) 0xd6, 3133 (byte) 0x7c, (byte) 0xff, (byte) 0x9c, (byte) 0xbe, (byte) 0x69, (byte) 0xd3, (byte) 0xeb, (byte) 0x44, 3134 (byte) 0x37, (byte) 0x50, (byte) 0xef, (byte) 0x49, (byte) 0xf8, (byte) 0xe2, (byte) 0x5b, (byte) 0xd8, 3135 (byte) 0xd1, (byte) 0x10, (byte) 0x84, (byte) 0x97, (byte) 0xea, (byte) 0xe3, (byte) 0xa5, (byte) 0x1c, 3136 (byte) 0xc0, (byte) 0x4e, (byte) 0x69, (byte) 0xca, (byte) 0x70, (byte) 0x3d, (byte) 0x78, (byte) 0xb9, 3137 (byte) 0x16, (byte) 0xe5, (byte) 0xfe, (byte) 0x61, (byte) 0x5d, (byte) 0x8a, (byte) 0x5a, (byte) 0xb3, 3138 (byte) 0x2c, (byte) 0x61, (byte) 0xb6, (byte) 0x01, (byte) 0x3b, (byte) 0xd0, (byte) 0x01, (byte) 0x7c, 3139 (byte) 0x32, (byte) 0x8d, (byte) 0xe1, (byte) 0xf3, (byte) 0x69, (byte) 0x0e, (byte) 0x8b, (byte) 0x58, 3140 (byte) 0xc6, (byte) 0xcf, (byte) 0x00, (byte) 0x94, (byte) 0xf8, (byte) 0x49, (byte) 0x2a, (byte) 0x4b, 3141 (byte) 0xea, (byte) 0xda, (byte) 0x00, (byte) 0xff, (byte) 0x4b, (byte) 0xd0, (byte) 0xbe, (byte) 0x40, 3142 (byte) 0x23, 3143 }); 3144 3145 private static final BigInteger DSA_Q = new BigInteger(new byte[] { 3146 (byte) 0x00, (byte) 0xbf, (byte) 0xee, (byte) 0xaa, (byte) 0x0f, (byte) 0x12, (byte) 0x34, (byte) 0x50, 3147 (byte) 0x72, (byte) 0xf8, (byte) 0x60, (byte) 0x13, (byte) 0xd8, (byte) 0xf1, (byte) 0x41, (byte) 0x01, 3148 (byte) 0x10, (byte) 0xa5, (byte) 0x2f, (byte) 0x57, (byte) 0x5f, 3149 }); 3150 3151 private static final BigInteger DSA_G = new BigInteger(new byte[] { 3152 (byte) 0x77, (byte) 0xd4, (byte) 0x7a, (byte) 0x12, (byte) 0xcc, (byte) 0x81, (byte) 0x7e, (byte) 0x7e, 3153 (byte) 0xeb, (byte) 0x3a, (byte) 0xfb, (byte) 0xe6, (byte) 0x86, (byte) 0x6d, (byte) 0x5a, (byte) 0x10, 3154 (byte) 0x1d, (byte) 0xad, (byte) 0xa9, (byte) 0x4f, (byte) 0xb9, (byte) 0x03, (byte) 0x5d, (byte) 0x21, 3155 (byte) 0x1a, (byte) 0xe4, (byte) 0x30, (byte) 0x95, (byte) 0x75, (byte) 0x8e, (byte) 0xcd, (byte) 0x5e, 3156 (byte) 0xd1, (byte) 0xbd, (byte) 0x0a, (byte) 0x45, (byte) 0xee, (byte) 0xe7, (byte) 0xf7, (byte) 0x6b, 3157 (byte) 0x65, (byte) 0x02, (byte) 0x60, (byte) 0xd0, (byte) 0x2e, (byte) 0xaf, (byte) 0x3d, (byte) 0xbc, 3158 (byte) 0x07, (byte) 0xdd, (byte) 0x2b, (byte) 0x8e, (byte) 0x33, (byte) 0xc0, (byte) 0x93, (byte) 0x80, 3159 (byte) 0xd9, (byte) 0x2b, (byte) 0xa7, (byte) 0x71, (byte) 0x57, (byte) 0x76, (byte) 0xbc, (byte) 0x8e, 3160 (byte) 0xb9, (byte) 0xe0, (byte) 0xd7, (byte) 0xf4, (byte) 0x23, (byte) 0x8d, (byte) 0x41, (byte) 0x1a, 3161 (byte) 0x97, (byte) 0x4f, (byte) 0x2c, (byte) 0x1b, (byte) 0xd5, (byte) 0x4b, (byte) 0x66, (byte) 0xe8, 3162 (byte) 0xfa, (byte) 0xd2, (byte) 0x50, (byte) 0x0d, (byte) 0x17, (byte) 0xab, (byte) 0x34, (byte) 0x31, 3163 (byte) 0x3d, (byte) 0xa4, (byte) 0x88, (byte) 0xd8, (byte) 0x8e, (byte) 0xa8, (byte) 0xa7, (byte) 0x6e, 3164 (byte) 0x17, (byte) 0x03, (byte) 0xb7, (byte) 0x0f, (byte) 0x68, (byte) 0x7c, (byte) 0x64, (byte) 0x7b, 3165 (byte) 0x92, (byte) 0xb8, (byte) 0x63, (byte) 0xe4, (byte) 0x9a, (byte) 0x67, (byte) 0x18, (byte) 0x81, 3166 (byte) 0x27, (byte) 0xd4, (byte) 0x0b, (byte) 0x13, (byte) 0x48, (byte) 0xd3, (byte) 0x7d, (byte) 0x4e, 3167 (byte) 0xf6, (byte) 0xa8, (byte) 0x8f, (byte) 0x56, (byte) 0x17, (byte) 0x2d, (byte) 0x08, (byte) 0x51, 3168 }); 3169 3170 /** 3171 * A possible signature using SHA1withDSA of Vector2Data. Note that DSS is 3172 * randomized, so this won't be the exact signature you'll get out of 3173 * another signing operation unless you use a fixed RNG. 3174 */ 3175 public static final byte[] SHA1withDSA_Vector2Signature = new byte[] { 3176 (byte) 0x30, (byte) 0x2d, (byte) 0x02, (byte) 0x15, (byte) 0x00, (byte) 0x88, (byte) 0xef, (byte) 0xac, 3177 (byte) 0x2b, (byte) 0x8b, (byte) 0xe2, (byte) 0x61, (byte) 0xc6, (byte) 0x2b, (byte) 0xea, (byte) 0xd5, 3178 (byte) 0x96, (byte) 0xbc, (byte) 0xb0, (byte) 0xa1, (byte) 0x30, (byte) 0x0c, (byte) 0x1f, (byte) 0xed, 3179 (byte) 0x11, (byte) 0x02, (byte) 0x14, (byte) 0x15, (byte) 0xc4, (byte) 0xfc, (byte) 0x82, (byte) 0x6f, 3180 (byte) 0x17, (byte) 0xdc, (byte) 0x87, (byte) 0x82, (byte) 0x75, (byte) 0x23, (byte) 0xd4, (byte) 0x58, 3181 (byte) 0xdc, (byte) 0x73, (byte) 0x3d, (byte) 0xf3, (byte) 0x51, (byte) 0xc0, (byte) 0x57, 3182 }; 3183 3184 /** 3185 * A possible signature using SHA224withDSA of Vector2Data. Note that DSS is 3186 * randomized, so this won't be the exact signature you'll get out of 3187 * another signing operation unless you use a fixed RNG. 3188 */ 3189 public static final byte[] SHA224withDSA_Vector2Signature = new byte[] { 3190 (byte) 0x30, (byte) 0x2D, (byte) 0x02, (byte) 0x15, (byte) 0x00, (byte) 0xAD, (byte) 0xE5, (byte) 0x6D, 3191 (byte) 0xF5, (byte) 0x11, (byte) 0x8D, (byte) 0x2E, (byte) 0x62, (byte) 0x5D, (byte) 0x98, (byte) 0x8A, 3192 (byte) 0xC4, (byte) 0x88, (byte) 0x7E, (byte) 0xE6, (byte) 0xA3, (byte) 0x44, (byte) 0x99, (byte) 0xEF, 3193 (byte) 0x49, (byte) 0x02, (byte) 0x14, (byte) 0x15, (byte) 0x3E, (byte) 0x32, (byte) 0xD6, (byte) 0xF9, 3194 (byte) 0x79, (byte) 0x2C, (byte) 0x60, (byte) 0x6E, (byte) 0xF9, (byte) 0xA9, (byte) 0x78, (byte) 0xE7, 3195 (byte) 0x4B, (byte) 0x87, (byte) 0x08, (byte) 0x96, (byte) 0x60, (byte) 0xDE, (byte) 0xB5 3196 }; 3197 3198 /** 3199 * A possible signature using SHA256withDSA of Vector2Data. Note that DSS is 3200 * randomized, so this won't be the exact signature you'll get out of 3201 * another signing operation unless you use a fixed RNG. 3202 */ 3203 public static final byte[] SHA256withDSA_Vector2Signature = new byte[] { 3204 (byte) 0x30, (byte) 0x2D, (byte) 0x02, (byte) 0x14, (byte) 0x0A, (byte) 0xB1, (byte) 0x74, (byte) 0x45, 3205 (byte) 0xE1, (byte) 0x63, (byte) 0x43, (byte) 0x68, (byte) 0x65, (byte) 0xBC, (byte) 0xCA, (byte) 0x45, 3206 (byte) 0x27, (byte) 0x11, (byte) 0x4D, (byte) 0x52, (byte) 0xFB, (byte) 0x22, (byte) 0x93, (byte) 0xDD, 3207 (byte) 0x02, (byte) 0x15, (byte) 0x00, (byte) 0x98, (byte) 0x32, (byte) 0x1A, (byte) 0x16, (byte) 0x77, 3208 (byte) 0x49, (byte) 0xA7, (byte) 0x78, (byte) 0xFD, (byte) 0xE0, (byte) 0xF7, (byte) 0x71, (byte) 0xD4, 3209 (byte) 0x80, (byte) 0x50, (byte) 0xA7, (byte) 0xDD, (byte) 0x94, (byte) 0xD1, (byte) 0x6C 3210 }; 3211 3212 public void testSign_SHA1withDSA_Key_Success() throws Exception { 3213 KeyFactory kf = KeyFactory.getInstance("DSA"); 3214 DSAPrivateKeySpec keySpec = new DSAPrivateKeySpec(DSA_priv, DSA_P, DSA_Q, DSA_G); 3215 PrivateKey privKey = kf.generatePrivate(keySpec); 3216 3217 Signature sig = Signature.getInstance("SHA1withDSA"); 3218 sig.initSign(privKey); 3219 sig.update(Vector2Data); 3220 3221 byte[] signature = sig.sign(); 3222 assertNotNull("Signature must not be null", signature); 3223 3224 DSAPublicKeySpec pubKeySpec = new DSAPublicKeySpec(DSA_pub, DSA_P, DSA_Q, DSA_G); 3225 PublicKey pubKey = kf.generatePublic(pubKeySpec); 3226 sig.initVerify(pubKey); 3227 sig.update(Vector2Data); 3228 assertTrue("Signature must verify correctly", sig.verify(signature)); 3229 } 3230 3231 public void testVerify_SHA1withDSA_Key_Success() throws Exception { 3232 KeyFactory kf = KeyFactory.getInstance("DSA"); 3233 DSAPublicKeySpec pubKeySpec = new DSAPublicKeySpec(DSA_pub, DSA_P, DSA_Q, DSA_G); 3234 PublicKey pubKey = kf.generatePublic(pubKeySpec); 3235 3236 Signature sig = Signature.getInstance("SHA1withDSA"); 3237 sig.initVerify(pubKey); 3238 sig.update(Vector2Data); 3239 assertTrue("Signature must verify correctly", sig.verify(SHA1withDSA_Vector2Signature)); 3240 } 3241 3242 public void testSign_SHA224withDSA_Key_Success() throws Exception { 3243 KeyFactory kf = KeyFactory.getInstance("DSA"); 3244 DSAPrivateKeySpec keySpec = new DSAPrivateKeySpec(DSA_priv, DSA_P, DSA_Q, DSA_G); 3245 PrivateKey privKey = kf.generatePrivate(keySpec); 3246 3247 Signature sig = Signature.getInstance("SHA224withDSA"); 3248 sig.initSign(privKey); 3249 sig.update(Vector2Data); 3250 3251 byte[] signature = sig.sign(); 3252 assertNotNull("Signature must not be null", signature); 3253 3254 DSAPublicKeySpec pubKeySpec = new DSAPublicKeySpec(DSA_pub, DSA_P, DSA_Q, DSA_G); 3255 PublicKey pubKey = kf.generatePublic(pubKeySpec); 3256 sig.initVerify(pubKey); 3257 sig.update(Vector2Data); 3258 assertTrue("Signature must verify correctly", sig.verify(signature)); 3259 } 3260 3261 public void testVerify_SHA224withDSA_Key_Success() throws Exception { 3262 KeyFactory kf = KeyFactory.getInstance("DSA"); 3263 DSAPublicKeySpec pubKeySpec = new DSAPublicKeySpec(DSA_pub, DSA_P, DSA_Q, DSA_G); 3264 PublicKey pubKey = kf.generatePublic(pubKeySpec); 3265 3266 Signature sig = Signature.getInstance("SHA224withDSA"); 3267 sig.initVerify(pubKey); 3268 sig.update(Vector2Data); 3269 assertTrue("Signature must verify correctly", sig.verify(SHA224withDSA_Vector2Signature)); 3270 } 3271 3272 public void testSign_SHA256withDSA_Key_Success() throws Exception { 3273 KeyFactory kf = KeyFactory.getInstance("DSA"); 3274 DSAPrivateKeySpec keySpec = new DSAPrivateKeySpec(DSA_priv, DSA_P, DSA_Q, DSA_G); 3275 PrivateKey privKey = kf.generatePrivate(keySpec); 3276 3277 Signature sig = Signature.getInstance("SHA256withDSA"); 3278 sig.initSign(privKey); 3279 sig.update(Vector2Data); 3280 3281 byte[] signature = sig.sign(); 3282 assertNotNull("Signature must not be null", signature); 3283 3284 DSAPublicKeySpec pubKeySpec = new DSAPublicKeySpec(DSA_pub, DSA_P, DSA_Q, DSA_G); 3285 PublicKey pubKey = kf.generatePublic(pubKeySpec); 3286 sig.initVerify(pubKey); 3287 sig.update(Vector2Data); 3288 assertTrue("Signature must verify correctly", sig.verify(signature)); 3289 } 3290 3291 public void testVerify_SHA256withDSA_Key_Success() throws Exception { 3292 KeyFactory kf = KeyFactory.getInstance("DSA"); 3293 DSAPublicKeySpec pubKeySpec = new DSAPublicKeySpec(DSA_pub, DSA_P, DSA_Q, DSA_G); 3294 PublicKey pubKey = kf.generatePublic(pubKeySpec); 3295 3296 Signature sig = Signature.getInstance("SHA256withDSA"); 3297 sig.initVerify(pubKey); 3298 sig.update(Vector2Data); 3299 assertTrue("Signature must verify correctly", sig.verify(SHA256withDSA_Vector2Signature)); 3300 } 3301 3302 // NetscapeCertRequest looks up Signature algorithms by OID from 3303 // BC but BC version 1.47 had registration bugs and MD5withRSA was 3304 // overlooked. http://b/7453821 3305 public void testGetInstanceFromOID() throws Exception { 3306 if (StandardNames.IS_RI) { 3307 return; 3308 } 3309 assertBouncyCastleSignatureFromOID("1.2.840.113549.1.1.4"); // MD5withRSA 3310 assertBouncyCastleSignatureFromOID("1.2.840.113549.1.1.5"); // SHA1withRSA 3311 assertBouncyCastleSignatureFromOID("1.3.14.3.2.29"); // SHA1withRSA 3312 assertBouncyCastleSignatureFromOID("1.2.840.113549.1.1.11"); // SHA256withRSA 3313 assertBouncyCastleSignatureFromOID("1.2.840.113549.1.1.12"); // SHA384withRSA 3314 assertBouncyCastleSignatureFromOID("1.2.840.113549.1.1.13"); // SHA512withRSA 3315 assertBouncyCastleSignatureFromOID("1.2.840.10040.4.3"); // SHA1withDSA 3316 } 3317 3318 private void assertBouncyCastleSignatureFromOID(String oid) throws Exception { 3319 Signature signature = Signature.getInstance(oid, "BC"); 3320 assertNotNull(oid, signature); 3321 assertEquals(oid, signature.getAlgorithm()); 3322 } 3323 3324 private final int THREAD_COUNT = 10; 3325 3326 private void testSignature_MultipleThreads_Misuse(final Signature s) throws Exception { 3327 ExecutorService es = Executors.newFixedThreadPool(THREAD_COUNT); 3328 3329 final CountDownLatch latch = new CountDownLatch(THREAD_COUNT); 3330 final byte[] message = new byte[64]; 3331 3332 for (int i = 0; i < THREAD_COUNT; i++) { 3333 es.submit(new Callable<Void>() { 3334 @Override 3335 public Void call() throws Exception { 3336 // Try to make sure all the threads are ready first. 3337 latch.countDown(); 3338 latch.await(); 3339 3340 for (int j = 0; j < 100; j++) { 3341 s.update(message); 3342 s.sign(); 3343 } 3344 3345 return null; 3346 } 3347 }); 3348 } 3349 es.shutdown(); 3350 assertTrue("Test should not timeout", es.awaitTermination(1, TimeUnit.MINUTES)); 3351 } 3352 3353 private static final byte[] NAMED_CURVE_VECTOR = "Satoshi Nakamoto".getBytes(UTF_8); 3354 // $ echo -n "Satoshi Nakamoto" > signed 3355 // $ openssl dgst -ecdsa-with-SHA1 -sign key.pem -out sig signed 3356 private static final byte[] NAMED_CURVE_SIGNATURE = HexEncoding.decode("304402205b41ece6dcc1c5bfcfdae74658d99c08c5e783f3926c11ecc1a8bea5d95cdf27022061a7d5fc687287e2e02dd7c6723e2e27fe0555f789590a37e96b1bb0355b4df0"); 3357 3358 private static PublicKey getNamedCurveEcPublicKey() throws Exception { 3359 // These are the parameters for the BitCoin curve (secp256k1). See 3360 // https://en.bitcoin.it/wiki/Secp256k1. 3361 final BigInteger p = new BigInteger("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F", 16); 3362 final BigInteger a = BigInteger.valueOf(0); 3363 final BigInteger b = BigInteger.valueOf(7); 3364 final BigInteger x = new BigInteger("79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798", 16); 3365 final BigInteger y = new BigInteger("483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8", 16); 3366 final BigInteger order = new BigInteger("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141", 16); 3367 final int cofactor = 1; 3368 3369 final ECParameterSpec spec = new ECParameterSpec(new EllipticCurve(new ECFieldFp(p), a, b), new ECPoint(x, y), order, cofactor); 3370 3371 // $ openssl ecparam -name secp256k1 -genkey > key.pem 3372 // $ openssl ec -text -noout < key.pem 3373 final BigInteger Px = new BigInteger("2d45572747a625db5fd23b30f97044a682f2d42d31959295043c1fa0034c8ed3", 16); 3374 final BigInteger Py = new BigInteger("4d330f52e4bba00145a331041c8bbcf300c4fbfdf3d63d8de7608155b2793808", 16); 3375 3376 final KeyFactory factory = KeyFactory.getInstance("EC"); 3377 ECPublicKeySpec keySpec = new ECPublicKeySpec(new ECPoint(Px, Py), spec); 3378 return factory.generatePublic(keySpec); 3379 } 3380 3381 public void testArbitraryCurve() throws Exception { 3382 final PublicKey pub = getNamedCurveEcPublicKey(); 3383 3384 Signature ecdsaVerify = Signature.getInstance("SHA1withECDSA"); 3385 ecdsaVerify.initVerify(pub); 3386 ecdsaVerify.update(NAMED_CURVE_VECTOR); 3387 boolean result = ecdsaVerify.verify(NAMED_CURVE_SIGNATURE); 3388 assertEquals(true, result); 3389 3390 ecdsaVerify = Signature.getInstance("SHA1withECDSA"); 3391 ecdsaVerify.initVerify(pub); 3392 ecdsaVerify.update("Not Satoshi Nakamoto".getBytes(UTF_8)); 3393 result = ecdsaVerify.verify(NAMED_CURVE_SIGNATURE); 3394 assertEquals(false, result); 3395 } 3396 3397 /** 3398 * When an instance of a Signature is obtained, it's actually wrapped in an 3399 * implementation that makes sure the correct SPI is selected and then calls 3400 * through to the underlying SPI. We need to make sure that all methods on 3401 * the delegate are wrapped and don't call directly into 3402 * {@link SignatureSpi}. 3403 */ 3404 public void testSignatureDelegateOverridesAllMethods() throws Exception { 3405 Signature sig = Signature.getInstance("SHA1withRSA"); 3406 3407 /* 3408 * Make sure we're dealing with a delegate and not an actual instance of 3409 * Signature. 3410 */ 3411 Class<?> sigClass = sig.getClass(); 3412 assertFalse(sigClass.equals(SignatureSpi.class)); 3413 assertFalse(sigClass.equals(Signature.class)); 3414 3415 List<String> methodsNotOverridden = new ArrayList<String>(); 3416 3417 for (Method spiMethod : SignatureSpi.class.getDeclaredMethods()) { 3418 try { 3419 sigClass.getDeclaredMethod(spiMethod.getName(), spiMethod.getParameterTypes()); 3420 } catch (NoSuchMethodException e) { 3421 methodsNotOverridden.add(spiMethod.toString()); 3422 } 3423 } 3424 3425 assertEquals(Collections.EMPTY_LIST, methodsNotOverridden); 3426 } 3427 3428 public void testGetParameters_IsCalled() throws Exception { 3429 Provider provider = spy(new MockableProvider()); 3430 Provider.Service service = spy(new Provider.Service(provider, "Signature", 3431 "FAKEFORGETPARAMETERS", "fake", null, null)); 3432 MockableSignatureSpi signatureSpi = mock(MockableSignatureSpi.class); 3433 3434 // Since these are spies, we want to use the doReturn(...) syntax to 3435 // avoid calling the real methods. 3436 doReturn(service).when(provider).getService(service.getType(), service.getAlgorithm()); 3437 doReturn(signatureSpi).when(service).newInstance(null); 3438 3439 Signature sig = Signature.getInstance(service.getAlgorithm(), provider); 3440 sig.getParameters(); 3441 verify(signatureSpi).engineGetParameters(); 3442 } 3443 3444 private static void assertPSSAlgorithmParametersEquals( 3445 PSSParameterSpec expectedSpec, AlgorithmParameters actual) 3446 throws InvalidParameterSpecException { 3447 assertNotNull(actual); 3448 assertEqualsIgnoreCase("PSS", actual.getAlgorithm()); 3449 PSSParameterSpec actualSpec = actual.getParameterSpec(PSSParameterSpec.class); 3450 assertPSSParameterSpecEquals(expectedSpec, actualSpec); 3451 } 3452 3453 private static void assertPSSParameterSpecEquals( 3454 PSSParameterSpec expected, PSSParameterSpec actual) { 3455 assertEqualsIgnoreCase(expected.getDigestAlgorithm(), actual.getDigestAlgorithm()); 3456 assertEqualsIgnoreCase(expected.getMGFAlgorithm(), actual.getMGFAlgorithm()); 3457 if (!"MGF1".equalsIgnoreCase(expected.getMGFAlgorithm())) { 3458 fail("Unsupported MGF algorithm: " + expected.getMGFAlgorithm()); 3459 } 3460 MGF1ParameterSpec expectedMgfParams = (MGF1ParameterSpec) expected.getMGFParameters(); 3461 MGF1ParameterSpec actualMgfParams = (MGF1ParameterSpec) actual.getMGFParameters(); 3462 assertEqualsIgnoreCase( 3463 expectedMgfParams.getDigestAlgorithm(), actualMgfParams.getDigestAlgorithm()); 3464 assertEquals(expected.getSaltLength(), actual.getSaltLength()); 3465 assertEquals(expected.getTrailerField(), actual.getTrailerField()); 3466 } 3467 3468 private static void assertEqualsIgnoreCase(String expected, String actual) { 3469 if (expected == null) { 3470 if (actual == null) { 3471 return; 3472 } 3473 fail("Expected null, actual: <" + actual + ">"); 3474 } else if (actual == null) { 3475 fail("Expected: <" + expected + ">, actual: null"); 3476 } else { 3477 if (!expected.equalsIgnoreCase(actual)) { 3478 fail("Expected: <" + expected + ">, actual: <" + actual + ">"); 3479 } 3480 } 3481 } 3482 3483 public static class MockableProvider extends Provider { 3484 protected MockableProvider() { 3485 super("MockableProvider", 1.0, "Used by Mockito"); 3486 } 3487 } 3488 3489 public static class MockableSignatureSpi extends SignatureSpi { 3490 @Override 3491 public void engineInitVerify(PublicKey publicKey) throws InvalidKeyException { 3492 throw new UnsupportedOperationException(); 3493 } 3494 3495 @Override 3496 public void engineInitSign(PrivateKey privateKey) throws InvalidKeyException { 3497 throw new UnsupportedOperationException(); 3498 } 3499 3500 @Override 3501 public void engineUpdate(byte b) throws SignatureException { 3502 throw new UnsupportedOperationException(); 3503 } 3504 3505 @Override 3506 public void engineUpdate(byte[] b, int off, int len) throws SignatureException { 3507 throw new UnsupportedOperationException(); 3508 } 3509 3510 @Override 3511 public byte[] engineSign() throws SignatureException { 3512 throw new UnsupportedOperationException(); 3513 } 3514 3515 @Override 3516 public boolean engineVerify(byte[] sigBytes) throws SignatureException { 3517 throw new UnsupportedOperationException(); 3518 } 3519 3520 @Override 3521 public void engineSetParameter(String param, Object value) throws InvalidParameterException { 3522 throw new UnsupportedOperationException(); 3523 } 3524 3525 @Override 3526 public Object engineGetParameter(String param) throws InvalidParameterException { 3527 throw new UnsupportedOperationException(); 3528 } 3529 3530 @Override 3531 public AlgorithmParameters engineGetParameters() { 3532 throw new UnsupportedOperationException(); 3533 } 3534 } 3535} 3536