|
1 | 1 | /*
|
2 |
| - * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
4 | 4 | *
|
5 | 5 | * This code is free software; you can redistribute it and/or modify it
|
|
47 | 47 | * Standards and Technology (NIST), using SHA digest algorithms
|
48 | 48 | * from FIPS180-3.
|
49 | 49 | *
|
50 |
| - * This file contains both the signature implementation for the |
51 |
| - * commonly used SHA1withDSA (DSS), SHA224withDSA, SHA256withDSA, |
52 |
| - * as well as RawDSA, used by TLS among others. RawDSA expects |
53 |
| - * the 20 byte SHA-1 digest as input via update rather than the |
54 |
| - * original data like other signature implementations. |
| 50 | + * This file contains the signature implementation for the |
| 51 | + * SHA1withDSA (DSS), SHA224withDSA, SHA256withDSA, SHA384withDSA, |
| 52 | + * SHA512withDSA, SHA3-224withDSA, SHA3-256withDSA, SHA3-384withDSA, |
| 53 | + * SHA3-512withDSA, as well as RawDSA, used by TLS among others. |
| 54 | + * RawDSA expects the 20 byte SHA-1 digest as input via update rather |
| 55 | + * than the original data like other signature implementations. |
| 56 | + * |
| 57 | + * In addition, IEEE P1363 signature format is supported. The |
| 58 | + * corresponding implementation is registered under <sig>inP1363Format, |
| 59 | + * e.g. SHA256withDSAinP1363Format. |
55 | 60 | *
|
56 | 61 | * @author Benjamin Renaud
|
57 | 62 | *
|
@@ -504,6 +509,78 @@ public String toString() {
|
504 | 509 | return printable;
|
505 | 510 | }
|
506 | 511 |
|
| 512 | + /** |
| 513 | + * SHA3-224withDSA implementation. |
| 514 | + */ |
| 515 | + public static final class SHA3_224withDSA extends DSA { |
| 516 | + public SHA3_224withDSA() throws NoSuchAlgorithmException { |
| 517 | + super(MessageDigest.getInstance("SHA3-224")); |
| 518 | + } |
| 519 | + } |
| 520 | + |
| 521 | + /** |
| 522 | + * SHA3-224withDSA implementation that uses the IEEE P1363 format. |
| 523 | + */ |
| 524 | + public static final class SHA3_224withDSAinP1363Format extends DSA { |
| 525 | + public SHA3_224withDSAinP1363Format() throws NoSuchAlgorithmException { |
| 526 | + super(MessageDigest.getInstance("SHA3-224"), true); |
| 527 | + } |
| 528 | + } |
| 529 | + |
| 530 | + /** |
| 531 | + * Standard SHA3-256withDSA implementation. |
| 532 | + */ |
| 533 | + public static final class SHA3_256withDSA extends DSA { |
| 534 | + public SHA3_256withDSA() throws NoSuchAlgorithmException { |
| 535 | + super(MessageDigest.getInstance("SHA3-256")); |
| 536 | + } |
| 537 | + } |
| 538 | + |
| 539 | + /** |
| 540 | + * Standard SHA3-256withDSA implementation that uses the IEEE P1363 format. |
| 541 | + */ |
| 542 | + public static final class SHA3_256withDSAinP1363Format extends DSA { |
| 543 | + public SHA3_256withDSAinP1363Format() throws NoSuchAlgorithmException { |
| 544 | + super(MessageDigest.getInstance("SHA3-256"), true); |
| 545 | + } |
| 546 | + } |
| 547 | + |
| 548 | + /** |
| 549 | + * Standard SHA3-384withDSA implementation. |
| 550 | + */ |
| 551 | + public static final class SHA3_384withDSA extends DSA { |
| 552 | + public SHA3_384withDSA() throws NoSuchAlgorithmException { |
| 553 | + super(MessageDigest.getInstance("SHA3-384")); |
| 554 | + } |
| 555 | + } |
| 556 | + |
| 557 | + /** |
| 558 | + * Standard SHA3-384withDSA implementation that uses the IEEE P1363 format. |
| 559 | + */ |
| 560 | + public static final class SHA3_384withDSAinP1363Format extends DSA { |
| 561 | + public SHA3_384withDSAinP1363Format() throws NoSuchAlgorithmException { |
| 562 | + super(MessageDigest.getInstance("SHA3-384"), true); |
| 563 | + } |
| 564 | + } |
| 565 | + |
| 566 | + /** |
| 567 | + * Standard SHA3-512withDSA implementation. |
| 568 | + */ |
| 569 | + public static final class SHA3_512withDSA extends DSA { |
| 570 | + public SHA3_512withDSA() throws NoSuchAlgorithmException { |
| 571 | + super(MessageDigest.getInstance("SHA3-512")); |
| 572 | + } |
| 573 | + } |
| 574 | + |
| 575 | + /** |
| 576 | + * Standard SHA3-512withDSA implementation that uses the IEEE P1363 format. |
| 577 | + */ |
| 578 | + public static final class SHA3_512withDSAinP1363Format extends DSA { |
| 579 | + public SHA3_512withDSAinP1363Format() throws NoSuchAlgorithmException { |
| 580 | + super(MessageDigest.getInstance("SHA3-512"), true); |
| 581 | + } |
| 582 | + } |
| 583 | + |
507 | 584 | /**
|
508 | 585 | * Standard SHA224withDSA implementation as defined in FIPS186-3.
|
509 | 586 | */
|
@@ -540,6 +617,42 @@ public SHA256withDSAinP1363Format() throws NoSuchAlgorithmException {
|
540 | 617 | }
|
541 | 618 | }
|
542 | 619 |
|
| 620 | + /** |
| 621 | + * Standard SHA384withDSA implementation as defined in FIPS186-3. |
| 622 | + */ |
| 623 | + public static final class SHA384withDSA extends DSA { |
| 624 | + public SHA384withDSA() throws NoSuchAlgorithmException { |
| 625 | + super(MessageDigest.getInstance("SHA-384")); |
| 626 | + } |
| 627 | + } |
| 628 | + |
| 629 | + /** |
| 630 | + * SHA384withDSA implementation that uses the IEEE P1363 format. |
| 631 | + */ |
| 632 | + public static final class SHA384withDSAinP1363Format extends DSA { |
| 633 | + public SHA384withDSAinP1363Format() throws NoSuchAlgorithmException { |
| 634 | + super(MessageDigest.getInstance("SHA-384"), true); |
| 635 | + } |
| 636 | + } |
| 637 | + |
| 638 | + /** |
| 639 | + * Standard SHA512withDSA implementation as defined in FIPS186-3. |
| 640 | + */ |
| 641 | + public static final class SHA512withDSA extends DSA { |
| 642 | + public SHA512withDSA() throws NoSuchAlgorithmException { |
| 643 | + super(MessageDigest.getInstance("SHA-512")); |
| 644 | + } |
| 645 | + } |
| 646 | + |
| 647 | + /** |
| 648 | + * SHA512withDSA implementation that uses the IEEE P1363 format. |
| 649 | + */ |
| 650 | + public static final class SHA512withDSAinP1363Format extends DSA { |
| 651 | + public SHA512withDSAinP1363Format() throws NoSuchAlgorithmException { |
| 652 | + super(MessageDigest.getInstance("SHA-512"), true); |
| 653 | + } |
| 654 | + } |
| 655 | + |
543 | 656 | /**
|
544 | 657 | * Standard SHA1withDSA implementation.
|
545 | 658 | */
|
|
0 commit comments