(KEYBase r)
| 413 | } |
| 414 | |
| 415 | private static PublicKey |
| 416 | toRSAPublicKey(KEYBase r) throws IOException, GeneralSecurityException { |
| 417 | DNSInput in = new DNSInput(r.getKey()); |
| 418 | int exponentLength = in.readU8(); |
| 419 | if (exponentLength == 0) |
| 420 | exponentLength = in.readU16(); |
| 421 | BigInteger exponent = readBigInteger(in, exponentLength); |
| 422 | BigInteger modulus = readBigInteger(in); |
| 423 | |
| 424 | KeyFactory factory = KeyFactory.getInstance("RSA"); |
| 425 | return factory.generatePublic(new RSAPublicKeySpec(modulus, exponent)); |
| 426 | } |
| 427 | |
| 428 | private static PublicKey |
| 429 | toDSAPublicKey(KEYBase r) throws IOException, GeneralSecurityException, |
no test coverage detected