MCPcopy Create free account
hub / github.com/OpenTSDB/asynchbase / wrap

Method wrap

src/SecureRpcHelper.java:228–249  ·  view source on GitHub ↗

When QOP of auth-int or auth-conf is selected This is used to wrap the contents into the proper payload (ie encryption, signature, etc) and should be called just before sending the buffer to Netty. @param content The content to be wrapped. @return The wrapped payload. @throws IllegalStateException i

(final ChannelBuffer content)

Source from the content-addressed store, hash-verified

226 * the payload
227 */
228 public ChannelBuffer wrap(final ChannelBuffer content) {
229 if (!use_wrap) {
230 return content;
231 }
232
233 try {
234 final byte[] payload = new byte[content.readableBytes()];
235 content.readBytes(payload);
236 final byte[] wrapped = sasl_client.wrap(payload, 0, payload.length);
237 final ChannelBuffer ret = ChannelBuffers.wrappedBuffer(
238 new byte[4 + wrapped.length]);
239 ret.clear();
240 ret.writeInt(wrapped.length);
241 ret.writeBytes(wrapped);
242 //if (LOG.isDebugEnabled()) {
243 // LOG.debug("Wrapped payload: " + Bytes.pretty(ret));
244 //}
245 return ret;
246 } catch (SaslException e) {
247 throw new IllegalStateException("Failed to wrap payload", e);
248 }
249 }
250
251 /**
252 * Sends the initial handshake and/or SASL challenge to the region server

Callers

nothing calls this directly

Calls 1

clearMethod · 0.80

Tested by

no test coverage detected