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 8C23118528 for ; Thu, 23 Apr 2015 08:22:38 +0000 (UTC) Received: (qmail 42237 invoked by uid 500); 23 Apr 2015 08:22:38 -0000 Delivered-To: apmail-directory-dev-archive@directory.apache.org Received: (qmail 42182 invoked by uid 500); 23 Apr 2015 08:22:38 -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 42170 invoked by uid 99); 23 Apr 2015 08:22:38 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Apr 2015 08:22:38 +0000 Date: Thu, 23 Apr 2015 08:22:38 +0000 (UTC) From: "Xu Yaning (JIRA)" To: dev@directory.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (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 [ https://issues.apache.org/jira/browse/DIRKRB-220?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Xu Yaning updated DIRKRB-220: ----------------------------- Attachment: DIRKRB-220-v2.patch > 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 > Attachments: DIRKRB-220-v1.patch, DIRKRB-220-v2.patch > > > 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)