(KEYBase r)
| 426 | } |
| 427 | |
| 428 | private static PublicKey |
| 429 | toDSAPublicKey(KEYBase r) throws IOException, GeneralSecurityException, |
| 430 | MalformedKeyException |
| 431 | { |
| 432 | DNSInput in = new DNSInput(r.getKey()); |
| 433 | |
| 434 | int t = in.readU8(); |
| 435 | if (t > 8) |
| 436 | throw new MalformedKeyException(r); |
| 437 | |
| 438 | BigInteger q = readBigInteger(in, 20); |
| 439 | BigInteger p = readBigInteger(in, 64 + t*8); |
| 440 | BigInteger g = readBigInteger(in, 64 + t*8); |
| 441 | BigInteger y = readBigInteger(in, 64 + t*8); |
| 442 | |
| 443 | KeyFactory factory = KeyFactory.getInstance("DSA"); |
| 444 | return factory.generatePublic(new DSAPublicKeySpec(y, p, q, g)); |
| 445 | } |
| 446 | |
| 447 | private static class ECKeyInfo { |
| 448 | int length; |
no test coverage detected