(PrivateKey key, int alg)
| 990 | return signature; |
| 991 | } |
| 992 | static void |
| 993 | checkAlgorithm(PrivateKey key, int alg) throws UnsupportedAlgorithmException |
| 994 | { |
| 995 | switch (alg) { |
| 996 | case Algorithm.RSAMD5: |
| 997 | case Algorithm.RSASHA1: |
| 998 | case Algorithm.RSA_NSEC3_SHA1: |
| 999 | case Algorithm.RSASHA256: |
| 1000 | case Algorithm.RSASHA512: |
| 1001 | if (! (key instanceof RSAPrivateKey)) |
| 1002 | throw new IncompatibleKeyException(); |
| 1003 | break; |
| 1004 | case Algorithm.DSA: |
| 1005 | case Algorithm.DSA_NSEC3_SHA1: |
| 1006 | if (! (key instanceof DSAPrivateKey)) |
| 1007 | throw new IncompatibleKeyException(); |
| 1008 | break; |
| 1009 | case Algorithm.ECC_GOST: |
| 1010 | case Algorithm.ECDSAP256SHA256: |
| 1011 | case Algorithm.ECDSAP384SHA384: |
| 1012 | if (! (key instanceof ECPrivateKey)) |
| 1013 | throw new IncompatibleKeyException(); |
| 1014 | break; |
| 1015 | default: |
| 1016 | throw new UnsupportedAlgorithmException(alg); |
| 1017 | } |
| 1018 | } |
| 1019 | |
| 1020 | /** |
| 1021 | * Generate a DNSSEC signature. key and privateKey must refer to the |
no outgoing calls
no test coverage detected