这里是我的代码我仍然是这个协议缓冲区的新手如何将协议缓冲区转换为byte []以便我可以加密
for (ClientRequest req : check.getClientRequestGroup().getClientRequests()) {
ClientRequestProtos.GetUnixDormantUsers.Builder guduBuilder = ClientRequestProtos.GetUnixDormantUsers.newBuilder();
guduBuilder.setCheckFiles(true);
guduBuilder.setCheckProcesses(true);
guduBuilder.setThreshold(30);
guduBuilder.addExcludeUser("root");
guduBuilder.addExcludeUser("bin");
ClientRequestProtos.GetUnixDormantUsers guduMessage = guduBuilder.build();
ClientRequestProtos.ClientRequest.Builder clientBuilder = ClientRequestProtos.ClientRequest.newBuilder();
clientBuilder.setId(req.getId());
clientBuilder.setSentAt(req.getSentAt().getTime());
clientBuilder.setType(ClientRequestType.GET_UNIX_DORMANT_USERS);
clientBuilder.setGetUnixDormantUsers(guduMessage);
ClientRequestProtos.ClientRequest clientMessage = clientBuilder.build();
String ipAddress = mapHostIp.get(req.getHost());
GenericUrl url = new GenericUrl("http://"+ ipAddress+":5736/request");
byte[] content; // convert protocol buffers to byte[]
byte[] encrypted = Encrypt.encrypt(content);
HttpRequest request = requestFactory.buildPostRequest(url, new ByteArrayContent(null, encrypted));
request.execute();
}