byte subtype = (byte)(keyType & 0xFF);
if(type == NodeCHK.BASE_TYPE) {
// For CHKs, the subtype is the crypto algorithm.
return CHKBlock.construct(dataBytes, headersBytes, subtype);
} else if(type == NodeSSK.BASE_TYPE) {
DSAPublicKey pubKey;
try {
pubKey = new DSAPublicKey(pubkeyBytes);
} catch (IOException e) {
throw new KeyVerifyException("Failed to construct pubkey: "+e, e);
} catch (CryptFormatException e) {
throw new KeyVerifyException("Failed to construct pubkey: "+e, e);
}
NodeSSK key = new NodeSSK(pubKey.asBytesHash(), keyBytes, pubKey, subtype);
return new SSKBlock(dataBytes, headersBytes, key, false);
} else {
throw new KeyVerifyException("No such key type "+Integer.toHexString(type));
}
}