public byte[] evaluateChallenge(byte[] challengeData) throws SaslException {
  if (completed) {
    throw new IllegalStateException("PLAIN authentication already completed");
  }
  completed=true;
  try {
    byte[] authz=(authorizationID != null) ? authorizationID.getBytes("UTF8") : null;
    byte[] auth=authenticationID.getBytes("UTF8");
    byte[] answer=new byte[pw.length + auth.length + 2+ (authz == null ? 0 : authz.length)];
    int pos=0;
    if (authz != null) {
      System.arraycopy(authz,0,answer,0,authz.length);
      pos=authz.length;
    }
    answer[pos++]=SEP;
    System.arraycopy(auth,0,answer,pos,auth.length);
    pos+=auth.length;
    answer[pos++]=SEP;
    System.arraycopy(pw,0,answer,pos,pw.length);
    clearPassword();
    return answer;
  }
 catch (  java.io.UnsupportedEncodingException e) {
    throw new SaslException("Cannot get UTF-8 encoding of ids",e);
  }
}

public byte [ ] evaluateChallenge ( byte [ ] challengeData ) throws SaslException { if ( completed ) { throw new IllegalStateException ( "PLAIN authentication already completed" ) ; } completed = true ; try { byte [ ] authz = ( authorizationID != null ) ? authorizationID . getBytes ( "UTF8" ) : null ; byte [ ] auth = authenticationID . getBytes ( "UTF8" ) ; byte [ ] answer = new byte [ pw . length + auth . length + 2 + ( authz == null ? 0 : authz . length ) ] ; int pos = 0 ; if ( authz != null ) { System . arraycopy ( authz , 0 , answer , 0 , authz . length ) ; pos = authz . length ; } answer [ pos ++ ] = SEP ; System . arraycopy ( auth , 0 , answer , pos , auth . length ) ; pos += auth . length ; answer [ pos ++ ] = SEP ; System . arraycopy ( pw , 0 , answer , pos , pw . length ) ; clearPassword ( ) ; return answer ; } catch ( java . io . UnsupportedEncodingException e ) { throw new SaslException ( "Cannot get UTF-8 encoding of ids" , e ) ; } }
retrieves the initial response for the sasl command , which for plain is the concatenation of authorization id , authentication id and password , with each component separated by the us - ascii < nul > byte .
