Convert an algorithm number to the corresponding JCA string. @param alg The algorithm number. @throws UnsupportedAlgorithmException The algorithm is unknown.
(int alg)
| 658 | * @throws UnsupportedAlgorithmException The algorithm is unknown. |
| 659 | */ |
| 660 | public static String |
| 661 | algString(int alg) throws UnsupportedAlgorithmException { |
| 662 | switch (alg) { |
| 663 | case Algorithm.RSAMD5: |
| 664 | return "MD5withRSA"; |
| 665 | case Algorithm.DSA: |
| 666 | case Algorithm.DSA_NSEC3_SHA1: |
| 667 | return "SHA1withDSA"; |
| 668 | case Algorithm.RSASHA1: |
| 669 | case Algorithm.RSA_NSEC3_SHA1: |
| 670 | return "SHA1withRSA"; |
| 671 | case Algorithm.RSASHA256: |
| 672 | return "SHA256withRSA"; |
| 673 | case Algorithm.RSASHA512: |
| 674 | return "SHA512withRSA"; |
| 675 | case Algorithm.ECC_GOST: |
| 676 | return "GOST3411withECGOST3410"; |
| 677 | case Algorithm.ECDSAP256SHA256: |
| 678 | return "SHA256withECDSA"; |
| 679 | case Algorithm.ECDSAP384SHA384: |
| 680 | return "SHA384withECDSA"; |
| 681 | default: |
| 682 | throw new UnsupportedAlgorithmException(alg); |
| 683 | } |
| 684 | } |
| 685 | |
| 686 | private static final int ASN1_SEQ = 0x30; |
| 687 | private static final int ASN1_INT = 0x2; |