public byte[] wrap(byte[] outgoing,int start,int len) throws SaslException {
  if (len == 0) {
    return EMPTY_BYTE_ARRAY;
  }
  byte[] wrapped=new byte[len + 10 + 2+ 4];
  System.arraycopy(outgoing,start,wrapped,0,len);
  incrementSeqNum();
  byte[] mac=getHMAC(myKi,sequenceNum,outgoing,start,len);
  if (logger.isLoggable(Level.FINEST)) {
    traceOutput(DI_CLASS_NAME,"wrap","DIGEST14:outgoing: ",outgoing,start,len);
    traceOutput(DI_CLASS_NAME,"wrap","DIGEST15:seqNum: ",sequenceNum);
    traceOutput(DI_CLASS_NAME,"wrap","DIGEST16:MAC: ",mac);
  }
  System.arraycopy(mac,0,wrapped,len,10);
  System.arraycopy(messageType,0,wrapped,len + 10,2);
  System.arraycopy(sequenceNum,0,wrapped,len + 12,4);
  if (logger.isLoggable(Level.FINEST)) {
    traceOutput(DI_CLASS_NAME,"wrap","DIGEST17:wrapped: ",wrapped);
  }
  return wrapped;
}

public byte [ ] wrap ( byte [ ] outgoing , int start , int len ) throws SaslException { if ( len == 0 ) { return EMPTY_BYTE_ARRAY ; } byte [ ] wrapped = new byte [ len + 10 + 2 + 4 ] ; System . arraycopy ( outgoing , start , wrapped , 0 , len ) ; incrementSeqNum ( ) ; byte [ ] mac = getHMAC ( myKi , sequenceNum , outgoing , start , len ) ; if ( logger . isLoggable ( Level . FINEST ) ) { traceOutput ( DI_CLASS_NAME , "wrap" , "DIGEST14:outgoing: " , outgoing , start , len ) ; traceOutput ( DI_CLASS_NAME , "wrap" , "DIGEST15:seqNum: " , sequenceNum ) ; traceOutput ( DI_CLASS_NAME , "wrap" , "DIGEST16:MAC: " , mac ) ; } System . arraycopy ( mac , 0 , wrapped , len , 10 ) ; System . arraycopy ( messageType , 0 , wrapped , len + 10 , 2 ) ; System . arraycopy ( sequenceNum , 0 , wrapped , len + 12 , 4 ) ; if ( logger . isLoggable ( Level . FINEST ) ) { traceOutput ( DI_CLASS_NAME , "wrap" , "DIGEST17:wrapped: " , wrapped ) ; } return wrapped ; }
append mac onto outgoing message .
