Wrap the new exceptions to mimic prior behavior.

This commit is contained in:
David Blacka 2012-05-26 15:48:25 -04:00
parent ca7f10bd07
commit 69d965cc0f

View File

@ -44,6 +44,7 @@ import javax.crypto.spec.DHParameterSpec;
import javax.crypto.spec.DHPrivateKeySpec; import javax.crypto.spec.DHPrivateKeySpec;
import org.xbill.DNS.DNSKEYRecord; import org.xbill.DNS.DNSKEYRecord;
import org.xbill.DNS.DNSSEC.DNSSECException;
import org.xbill.DNS.Name; import org.xbill.DNS.Name;
import org.xbill.DNS.utils.base64; import org.xbill.DNS.utils.base64;
@ -95,18 +96,33 @@ public class DnsKeyConverter
pKeyRecord.getKey()); pKeyRecord.getKey());
} }
try
{
return pKeyRecord.getPublicKey(); return pKeyRecord.getPublicKey();
} }
catch (DNSSECException e)
{
throw new NoSuchAlgorithmException(e);
}
}
/** /**
* Given a JCA public key and the ancillary data, generate a DNSKEY record. * Given a JCA public key and the ancillary data, generate a DNSKEY record.
*/ */
public DNSKEYRecord generateDNSKEYRecord(Name name, int dclass, long ttl, public DNSKEYRecord generateDNSKEYRecord(Name name, int dclass, long ttl,
int flags, int alg, PublicKey key) int flags, int alg, PublicKey key)
{
try
{ {
return new DNSKEYRecord(name, dclass, ttl, flags, DNSKEYRecord.Protocol.DNSSEC, alg, return new DNSKEYRecord(name, dclass, ttl, flags, DNSKEYRecord.Protocol.DNSSEC, alg,
key); key);
} }
catch (DNSSECException e)
{
// FIXME: this mimics the behavior of KEYConverter.buildRecord(), which would return null if the algorithm was unknown.
return null;
}
}
// Private Key Specific Parsing routines // Private Key Specific Parsing routines