log.info("received a key request from peer");
if (log.isInfoEnabled()) { log.info("received a key request from peer"); }
	private void handleUpMessage(Event evt) throws Exception	{		if (log.isDebugEnabled())			log.debug("Handling up message " + evt);		Message msg = (Message) evt.getArg();		if (msg == null)		{			if (log.isDebugEnabled())				log.debug("Null message - passing straight up");			passUp(evt);			return;		}		Object obj = msg.getHeader(EncryptHeader.KEY);		// try and get the encryption header		if (obj == null || !(obj instanceof EncryptHeader))		{			if (log.isDebugEnabled())				log.info("Dropping message as ENCRYPT header is null  or has not been recognized, msg will not be passed up");			return;		}		EncryptHeader hdr = (EncryptHeader) obj;				if (log.isDebugEnabled())			log.debug("Header received " + hdr);		// if a normal message try and decrypt it		if (hdr.getType() == EncryptHeader.ENCRYPT)		{			// if queueing then pass into queue to be dealt with later			if (queue_up){				if (log.isDebugEnabled())					log.debug("queueing up message as no session key established");				up_queue.add(evt);			}else{				// make sure we pass up any queued messages first				// could be more optimised but this can wait				// we only need this if not using supplied key				if (!suppliedKey) {					drainUpQueue();				}				// try and decrypt the message				if (decryptMessage(symDecodingCipher, msg) != null){				    passUp(evt);				} else {				    log.warn("Unrecognised cipher discarding message");				}			}		} else		{			// check if we had some sort of encrypt control 			// header if using supplied key we should not 			// process it			if (suppliedKey)			{				if (log.isWarnEnabled())				{					log.warn("We received an encrypt header of "							+ hdr.getType() + " while in configured mode");				}			} else{				// see what sort of encrypt control message we				// have received				switch (hdr.getType()){					// if a key request					case EncryptHeader.KEY_REQUEST:						log.info("received a key request from peer");												//if a key request send response key back						try {							// extract peer's public key							PublicKey tmpKey = generatePubKey(msg.getBuffer());							// send back the secret key we have							sendSecretKey(getSecretKey(), tmpKey, msg.getSrc());						} catch (Exception e){							log.warn("unable to reconstitute peer's public key");						}						break;					case EncryptHeader.SECRETKEY:						log.info("received a secretkey response from keyserver");												try {							SecretKey tmp = decodeKey(msg.getBuffer());							if (tmp == null) {								// unable to understand response								// lets try again								sendKeyRequest();							}else{								// otherwise lets set the reurned key								// as the shared key								setKeys(tmp, hdr.getVersion());								log.info("Decoded secretkey response");							}						} catch (Exception e){							log.warn("unable to process received public key");							log.fatal(e);						}						break;					default:						log.warn("Received ignored encrypt header of "+hdr.getType());						break;				}			}		}	}