/** * Copyright (c) 2000-present Liferay, Inc. All rights reserved. * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. */ package com.liferay.portal.security.sso.ntlm.internal; import jcifs.util.DES; /** * @author Michael C. Han */ public class NetlogonCredentialUtil { public static byte[] computeNetlogonCredential( byte[] input, byte[] sessionKey) { byte[] k1 = new byte[7]; byte[] k2 = new byte[7]; System.arraycopy(sessionKey, 0, k1, 0, 7); System.arraycopy(sessionKey, 7, k2, 0, 7); DES k3 = new DES(k1); DES k4 = new DES(k2); byte[] output1 = new byte[8]; byte[] output2 = new byte[8]; k3.encrypt(input, output1); k4.encrypt(output1, output2); return output2; } }