MCPcopy Create free account
hub / github.com/DeNA/PacketProxy / toPublicKey

Method toPublicKey

src/main/java/core/org/xbill/DNS/DNSSEC.java:525–555  ·  view source on GitHub ↗

Converts a KEY/DNSKEY record into a PublicKey

(KEYBase r)

Source from the content-addressed store, hash-verified

523
524/** Converts a KEY/DNSKEY record into a PublicKey */
525static PublicKey
526toPublicKey(KEYBase r) throws DNSSECException {
527 int alg = r.getAlgorithm();
528 try {
529 switch (alg) {
530 case Algorithm.RSAMD5:
531 case Algorithm.RSASHA1:
532 case Algorithm.RSA_NSEC3_SHA1:
533 case Algorithm.RSASHA256:
534 case Algorithm.RSASHA512:
535 return toRSAPublicKey(r);
536 case Algorithm.DSA:
537 case Algorithm.DSA_NSEC3_SHA1:
538 return toDSAPublicKey(r);
539 case Algorithm.ECC_GOST:
540 return toECGOSTPublicKey(r, GOST);
541 case Algorithm.ECDSAP256SHA256:
542 return toECDSAPublicKey(r, ECDSA_P256);
543 case Algorithm.ECDSAP384SHA384:
544 return toECDSAPublicKey(r, ECDSA_P384);
545 default:
546 throw new UnsupportedAlgorithmException(alg);
547 }
548 }
549 catch (IOException e) {
550 throw new MalformedKeyException(r);
551 }
552 catch (GeneralSecurityException e) {
553 throw new DNSSECException(e.toString());
554 }
555}
556
557private static byte []
558fromRSAPublicKey(RSAPublicKey key) {

Callers 1

getPublicKeyMethod · 0.95

Calls 6

toRSAPublicKeyMethod · 0.95
toDSAPublicKeyMethod · 0.95
toECGOSTPublicKeyMethod · 0.95
toECDSAPublicKeyMethod · 0.95
getAlgorithmMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected