protected void calcPrivacyInfo(MessageProp prop, byte[] confounder, byte[] data, int dataOffset, int dataLength, int paddingLen) throws GSSException { prop.setQOP(0); if (!confState) { prop.setPrivacy(false); } checkSum = calcCheckSum(confounder, commHeader, data, dataOffset, dataLength, paddingLen); encryptSequenceNumber(); }
private void initTokenHeader(byte[] tokenBytes, MessageProp prop) throws GSSException { int tokenIDRecv = (((int) tokenBytes[0]) << 8) + tokenBytes[1]; if (tokenType != tokenIDRecv) { throw new GSSException(GSSException.DEFECTIVE_TOKEN, -1, "Token ID should be " + tokenType + " instead of " + tokenIDRecv); } sgnAlg = (((int) tokenBytes[2]) << 8) + tokenBytes[3]; sealAlg = (((int) tokenBytes[4]) << 8) + tokenBytes[5]; if (tokenBytes[6] != (byte) 0xFF || tokenBytes[7] != (byte) 0xFF) { throw new GSSException(GSSException.DEFECTIVE_TOKEN, -1, "Invalid token head filler"); } prop.setQOP(0); prop.setPrivacy(sealAlg != SEAL_ALG_NONE); }
prop.setPrivacy(this.encryption); prop.setQOP(0);
prop.setPrivacy(this.encryption); prop.setQOP(0);
private void reconstructInitializaion(int tokenType, GssContext context, MessageProp prop, InputStream is) throws GSSException { initialize(tokenType, context, true); if (!confState) { prop.setPrivacy(false); } try { gssHeader = new GSSHeader(is); } catch (IOException e) { throw new GSSException(GSSException.DEFECTIVE_TOKEN, -1, "Invalid token:" + e.getMessage()); } if (!gssHeader.getOid().equals((Object) objId)) { throw new GSSException(GSSException.DEFECTIVE_TOKEN, -1, "Invalid token OID"); } reconstructTokenHeader(is, prop); }
public WrapTokenV1(GssContext context, byte[] inMsg, int msgOffset, int msgLength, MessageProp prop) throws GSSException { super(TOKEN_WRAP_V1, context); paddingLen = getPaddingLength(msgLength); confounder = Random.makeBytes(CONFOUNDER_SIZE); tokenBodyLen = CONFOUNDER_SIZE + msgLength + paddingLen; calcPrivacyInfo(prop, confounder, inMsg, msgOffset, msgLength, paddingLen); if (!context.getConfState()) { prop.setPrivacy(false); } privacy = prop.getPrivacy(); inData = inMsg; inOffset = msgOffset; inLen = msgLength; }
prop.setPrivacy(true); } else { prop.setPrivacy(false);
prop.setPrivacy(false);
prop.setPrivacy(this.encryption); prop.setQOP(0);
WrapTokenV2(GssContext context, byte[] data, int dataOffset, int dataLength, MessageProp messageProp) throws GSSException { super(TOKEN_WRAP_V2, context); prop = messageProp; if (prop.getQOP() != 0) { prop.setQOP(0); } if (!context.getConfState()) { prop.setPrivacy(false); } generateCheckSum(prop, data, dataOffset, dataLength); if (prop.getPrivacy()) { byte[] toProcess = new byte[dataLength + TOKEN_HEADER_SIZE]; System.arraycopy(data, dataOffset, toProcess, 0, dataLength); encodeHeader(toProcess, dataLength); tokenData = encryptor.encryptData(toProcess, getKeyUsage()); } else { tokenData = data; // keep it for now } }
prop.setPrivacy(this.encryption); prop.setQOP(0);