code: public static KEYRecord
  buildRecord(Name name, int dclass, long ttl, int flags, int proto,
  	    PublicKey key)
  {
  	byte alg;
  
  	if (key instanceof RSAPublicKey) {
  		alg = DNSSEC.RSAMD5;
  	}
  	else if (key instanceof DHPublicKey) {
  		alg = DNSSEC.DH;
  	}
  	else if (key instanceof DSAPublicKey) {
  		alg = DNSSEC.DSA;
  	}
  	else
  		return null;
  
  	return (KEYRecord) buildRecord(name, Type.KEY, dclass, ttl, flags,
  				       proto, alg, key);
  }
docs: Builds a KEY record from a PublicKey