Return-Path: X-Original-To: apmail-directory-dev-archive@www.apache.org Delivered-To: apmail-directory-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E9646105D4 for ; Fri, 17 Apr 2015 08:14:08 +0000 (UTC) Received: (qmail 87887 invoked by uid 500); 17 Apr 2015 08:13:58 -0000 Delivered-To: apmail-directory-dev-archive@directory.apache.org Received: (qmail 87845 invoked by uid 500); 17 Apr 2015 08:13:58 -0000 Mailing-List: contact dev-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Apache Directory Developers List" Delivered-To: mailing list dev@directory.apache.org Received: (qmail 87816 invoked by uid 99); 17 Apr 2015 08:13:58 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Apr 2015 08:13:58 +0000 Date: Fri, 17 Apr 2015 08:13:58 +0000 (UTC) From: "Xu Yaning (JIRA)" To: dev@directory.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (DIRKRB-220) Fix random2Key function in Des3KeyMaker.java MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Xu Yaning created DIRKRB-220: -------------------------------- Summary: Fix random2Key function in Des3KeyMaker.java Key: DIRKRB-220 URL: https://issues.apache.org/jira/browse/DIRKRB-220 Project: Directory Kerberos Issue Type: Bug Reporter: Xu Yaning There is a problem in random2Key function that it dosen't calculate the 8th byte for every 7 bytes. {code} byte[] key = new byte[encProvider().keySize()]; byte[] tmp1 = new byte[7]; byte[] tmp2; for (int i = 0; i < 3; i++) { System.arraycopy(randomBits, i * 7, key, i * 8, 7); System.arraycopy(randomBits, i * 7, tmp1, 0, 7); tmp2 = getEightBits(tmp1); key[8 * (i + 1) - 1] = tmp2[7]; int nthByte = i * 8; key[nthByte + 7] = (byte) (((key[nthByte + 0] & 1) << 1) | ((key[nthByte + 1] & 1) << 2) | ((key[nthByte + 2] & 1) << 3) | ((key[nthByte + 3] & 1) << 4) | ((key[nthByte + 4] & 1) << 5) | ((key[nthByte + 5] & 1) << 6) | ((key[nthByte + 6] & 1) << 7)); for (int j = 0; j < 8; j++) { int tmp = key[nthByte + j] & 0xfe; tmp |= (Integer.bitCount(tmp) & 1) ^ 1; key[nthByte + j] = (byte) tmp; } } {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)