directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kai Zheng (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (DIRKRB-220) Fix random2Key function in Des3KeyMaker
Date Thu, 23 Apr 2015 09:08:38 GMT

     [ https://issues.apache.org/jira/browse/DIRKRB-220?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Kai Zheng updated DIRKRB-220:
-----------------------------
    Assignee: Xu Yaning

> Fix random2Key function in Des3KeyMaker
> ---------------------------------------
>
>                 Key: DIRKRB-220
>                 URL: https://issues.apache.org/jira/browse/DIRKRB-220
>             Project: Directory Kerberos
>          Issue Type: Bug
>            Reporter: Xu Yaning
>            Assignee: 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)

Mime
View raw message