directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From plusplusjia...@apache.org
Subject [4/6] directory-kerby git commit: [DIRKRB-326]-Fix CheckStyle Problems. Contributed by Yaning.
Date Thu, 09 Jul 2015 02:50:29 GMT
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/cksum/HmacMd5Rc4CheckSum.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/cksum/HmacMd5Rc4CheckSum.java b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/cksum/HmacMd5Rc4CheckSum.java
index 85e227b..529487a 100644
--- a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/cksum/HmacMd5Rc4CheckSum.java
+++ b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/cksum/HmacMd5Rc4CheckSum.java
@@ -58,7 +58,7 @@ public class HmacMd5Rc4CheckSum extends AbstractKeyedCheckSumTypeHandler {
         byte[] signKey = "signaturekey".getBytes();
         byte[] newSignKey = new byte[signKey.length + 1];
         System.arraycopy(signKey, 0, newSignKey, 0, signKey.length);
-        byte[] Ksign = Hmac.hmac(hashProvider(), key, newSignKey);
+        byte[] ksign = Hmac.hmac(hashProvider(), key, newSignKey);
 
         byte[] salt = Rc4.getSalt(usage, false);
 
@@ -66,6 +66,6 @@ public class HmacMd5Rc4CheckSum extends AbstractKeyedCheckSumTypeHandler {
         hashProvider().hash(data, start, len);
         byte[] hashTmp = hashProvider().output();
 
-        return Hmac.hmac(hashProvider(), Ksign, hashTmp);
+        return Hmac.hmac(hashProvider(), ksign, hashTmp);
     }
 }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/cksum/KcCheckSum.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/cksum/KcCheckSum.java b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/cksum/KcCheckSum.java
index 9550c08..eec6439 100644
--- a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/cksum/KcCheckSum.java
+++ b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/cksum/KcCheckSum.java
@@ -37,11 +37,11 @@ public abstract class KcCheckSum extends AbstractKeyedCheckSumTypeHandler {
         byte[] constant = new byte[5];
         BytesUtil.int2bytes(usage, constant, 0, true);
         constant[4] = (byte) 0x99;
-        byte[] Kc = ((DkKeyMaker) keyMaker()).dk(key, constant);
+        byte[] kc = ((DkKeyMaker) keyMaker()).dk(key, constant);
 
-        return mac(Kc, data, start, len);
+        return mac(kc, data, start, len);
     }
 
-    protected abstract byte[] mac(byte[] Kc, byte[] data, int start,
+    protected abstract byte[] mac(byte[] kc, byte[] data, int start,
                                   int len) throws KrbException;
 }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/cksum/Md5HmacRc4CheckSum.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/cksum/Md5HmacRc4CheckSum.java b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/cksum/Md5HmacRc4CheckSum.java
index 4b62fea..7b9e0e8 100644
--- a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/cksum/Md5HmacRc4CheckSum.java
+++ b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/cksum/Md5HmacRc4CheckSum.java
@@ -55,7 +55,7 @@ public class Md5HmacRc4CheckSum extends AbstractKeyedCheckSumTypeHandler {
     @Override
     protected byte[] doChecksumWithKey(byte[] data, int start, int len,
                                        byte[] key, int usage) throws KrbException {
-        byte[] Ksign = key;
+        byte[] ksign = key;
 
         byte[] salt = Rc4.getSalt(usage, false);
 
@@ -63,6 +63,6 @@ public class Md5HmacRc4CheckSum extends AbstractKeyedCheckSumTypeHandler {
         hashProvider().hash(data, start, len);
         byte[] hashTmp = hashProvider().output();
 
-        return Hmac.hmac(hashProvider(), Ksign, hashTmp);
+        return Hmac.hmac(hashProvider(), ksign, hashTmp);
     }
 }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/enc/Camellia256CtsCmacEnc.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/enc/Camellia256CtsCmacEnc.java b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/enc/Camellia256CtsCmacEnc.java
index 1352d6c..a3e4924 100644
--- a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/enc/Camellia256CtsCmacEnc.java
+++ b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/enc/Camellia256CtsCmacEnc.java
@@ -27,7 +27,8 @@ import org.apache.kerby.kerberos.kerb.spec.base.EncryptionType;
 public class Camellia256CtsCmacEnc extends KeKiCmacEnc {
 
     public Camellia256CtsCmacEnc() {
-        super(new Camellia256Provider(), EncryptionType.CAMELLIA256_CTS_CMAC, new CamelliaKeyMaker(new Camellia256Provider()));
+        super(new Camellia256Provider(), EncryptionType.CAMELLIA256_CTS_CMAC,
+                new CamelliaKeyMaker(new Camellia256Provider()));
         keyMaker(new CamelliaKeyMaker((Camellia256Provider) encProvider()));
     }
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/enc/DesCbcEnc.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/enc/DesCbcEnc.java b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/enc/DesCbcEnc.java
index 1af1976..666621a 100644
--- a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/enc/DesCbcEnc.java
+++ b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/enc/DesCbcEnc.java
@@ -98,7 +98,7 @@ abstract class DesCbcEnc extends AbstractEncTypeHandler {
 
         hashProvider().hash(workBuffer);
         byte[] newChecksum = hashProvider().output();
-        if (! checksumEqual(checksum, newChecksum)) {
+        if (!checksumEqual(checksum, newChecksum)) {
             throw new KrbException(KrbErrorCode.KRB_AP_ERR_BAD_INTEGRITY);
         }
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/enc/KeKiCmacEnc.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/enc/KeKiCmacEnc.java b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/enc/KeKiCmacEnc.java
index c59b1ed..03c5339 100644
--- a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/enc/KeKiCmacEnc.java
+++ b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/enc/KeKiCmacEnc.java
@@ -48,8 +48,9 @@ public abstract class KeKiCmacEnc extends KeKiEnc {
     public byte[] prf(byte[] key, byte[] seed) throws KrbException {
         byte[] prfConst = "prf".getBytes();
         byte[] kp;
-        if (EncryptionHandler.getEncHandler(this.eType()).prfSize() != encProvider().blockSize())
+        if (EncryptionHandler.getEncHandler(this.eType()).prfSize() != encProvider().blockSize()) {
             return null;
+        }
         kp = km.dk(key, prfConst);
         return Cmac.cmac(encProvider(), kp, seed);
     }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/enc/KeKiEnc.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/enc/KeKiEnc.java b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/enc/KeKiEnc.java
index c97b762..23e7a6c 100644
--- a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/enc/KeKiEnc.java
+++ b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/enc/KeKiEnc.java
@@ -59,15 +59,15 @@ public abstract class KeKiEnc extends AbstractEncTypeHandler {
         int paddingLen = workLens[3];
 
         byte[] constant = new byte[5];
-        constant[0] = (byte) ((usage>>24)&0xff);
-        constant[1] = (byte) ((usage>>16)&0xff);
-        constant[2] = (byte) ((usage>>8)&0xff);
-        constant[3] = (byte) (usage&0xff);
+        constant[0] = (byte) ((usage >> 24) & 0xff);
+        constant[1] = (byte) ((usage >> 16) & 0xff);
+        constant[2] = (byte) ((usage >> 8) & 0xff);
+        constant[3] = (byte) (usage & 0xff);
         constant[4] = (byte) 0xaa;
         
-        byte[] Ke = ((DkKeyMaker) keyMaker()).dk(key, constant);
+        byte[] ke = ((DkKeyMaker) keyMaker()).dk(key, constant);
         constant[4] = (byte) 0x55;
-        byte[] Ki = ((DkKeyMaker) keyMaker()).dk(key, constant);
+        byte[] ki = ((DkKeyMaker) keyMaker()).dk(key, constant);
 
         /**
          * Instead of E(Confounder | Checksum | Plaintext | Padding),
@@ -90,8 +90,8 @@ public abstract class KeKiEnc extends AbstractEncTypeHandler {
         }
 
         // checksum & encrypt
-        byte[] checksum = makeChecksum(Ki, tmpEnc, checksumLen);
-        encProvider().encrypt(Ke, iv, tmpEnc);
+        byte[] checksum = makeChecksum(ki, tmpEnc, checksumLen);
+        encProvider().encrypt(ke, iv, tmpEnc);
 
         System.arraycopy(tmpEnc, 0, workBuffer, 0, tmpEnc.length);
         System.arraycopy(checksum, 0, workBuffer, tmpEnc.length, checksum.length);
@@ -107,9 +107,9 @@ public abstract class KeKiEnc extends AbstractEncTypeHandler {
         byte[] constant = new byte[5];
         BytesUtil.int2bytes(usage, constant, 0, true);
         constant[4] = (byte) 0xaa;
-        byte[] Ke = ((DkKeyMaker) keyMaker()).dk(key, constant);
+        byte[] ke = ((DkKeyMaker) keyMaker()).dk(key, constant);
         constant[4] = (byte) 0x55;
-        byte[] Ki = ((DkKeyMaker) keyMaker()).dk(key, constant);
+        byte[] ki = ((DkKeyMaker) keyMaker()).dk(key, constant);
 
         // decrypt and verify checksum
 
@@ -120,10 +120,10 @@ public abstract class KeKiEnc extends AbstractEncTypeHandler {
         System.arraycopy(workBuffer, confounderLen + dataLen,
                 checksum, 0, checksumLen);
 
-        encProvider().decrypt(Ke, iv, tmpEnc);
-        byte[] newChecksum = makeChecksum(Ki, tmpEnc, checksumLen);
+        encProvider().decrypt(ke, iv, tmpEnc);
+        byte[] newChecksum = makeChecksum(ki, tmpEnc, checksumLen);
 
-        if (! checksumEqual(checksum, newChecksum)) {
+        if (!checksumEqual(checksum, newChecksum)) {
             throw new KrbException(KrbErrorCode.KRB_AP_ERR_BAD_INTEGRITY);
         }
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/enc/Rc4HmacEnc.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/enc/Rc4HmacEnc.java b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/enc/Rc4HmacEnc.java
index 5bf8752..d7115e5 100644
--- a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/enc/Rc4HmacEnc.java
+++ b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/enc/Rc4HmacEnc.java
@@ -152,7 +152,7 @@ public class Rc4HmacEnc extends AbstractEncTypeHandler {
         encProvider().decrypt(encKey, iv, tmpEnc);
 
         byte[] newChecksum = Hmac.hmac(hashProvider(), usageKey, tmpEnc);
-        if (! checksumEqual(checksum, newChecksum)) {
+        if (!checksumEqual(checksum, newChecksum)) {
             throw new KrbException(KrbErrorCode.KRB_AP_ERR_BAD_INTEGRITY);
         }
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/enc/provider/AesProvider.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/enc/provider/AesProvider.java b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/enc/provider/AesProvider.java
index 004c30e..50c74c2 100644
--- a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/enc/provider/AesProvider.java
+++ b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/enc/provider/AesProvider.java
@@ -49,8 +49,8 @@ public abstract class AesProvider extends AbstractEncryptProvider {
             SecretKeySpec secretKey = new SecretKeySpec(key, "AES");
             IvParameterSpec param = new IvParameterSpec(cipherState);
 
-            cipher.init(encrypt ?
-                    Cipher.ENCRYPT_MODE : Cipher.DECRYPT_MODE, secretKey, param);
+            cipher.init(encrypt
+                    ? Cipher.ENCRYPT_MODE : Cipher.DECRYPT_MODE, secretKey, param);
             byte[] output = cipher.doFinal(data);
             System.arraycopy(output, 0, data, 0, output.length);
         } catch (GeneralSecurityException e) {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/enc/provider/DesProvider.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/enc/provider/DesProvider.java b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/enc/provider/DesProvider.java
index 223810d..9021573 100644
--- a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/enc/provider/DesProvider.java
+++ b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/enc/provider/DesProvider.java
@@ -74,8 +74,7 @@ public class DesProvider extends AbstractEncryptProvider {
                 output = cipher.doFinal(data, i * 8, 8);
                 cipher.init(Cipher.ENCRYPT_MODE, skSpec, new IvParameterSpec(output));
             }
-        }
-        catch (GeneralSecurityException e) {
+        } catch (GeneralSecurityException e) {
             KrbException ke = new KrbException(e.getMessage());
             ke.initCause(e);
             throw ke;

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/fast/FastUtil.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/fast/FastUtil.java b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/fast/FastUtil.java
index 90c79e8..48a0823 100644
--- a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/fast/FastUtil.java
+++ b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/fast/FastUtil.java
@@ -43,12 +43,13 @@ public class FastUtil {
         int iterations = keyBytesLen / prfSize;
         prfInbuf[0] = 1;
         System.arraycopy(pepper.getBytes(), 0, prfInbuf, 1, pepper.length());
-        if (keyBytesLen % prfSize !=0) {
+        if (keyBytesLen % prfSize != 0) {
             iterations++;
         }
         byte[] buffer = new byte[prfSize * iterations];
         for (int i = 0; i < iterations; i++) {
-            System.arraycopy(EncryptionHandler.getEncHandler(key.getKeyType()).prf(key.getKeyData(), prfInbuf), 0, buffer, i * prfSize, prfSize);
+            System.arraycopy(EncryptionHandler.getEncHandler(key.getKeyType())
+                    .prf(key.getKeyData(), prfInbuf), 0, buffer, i * prfSize, prfSize);
             prfInbuf[0]++;
         }
         System.arraycopy(buffer, 0, tmpbuf, 0, keyBytesLen);

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/AbstractKeyMaker.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/AbstractKeyMaker.java b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/AbstractKeyMaker.java
index f31aeb3..69ba1f8 100644
--- a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/AbstractKeyMaker.java
+++ b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/AbstractKeyMaker.java
@@ -75,7 +75,7 @@ public abstract class AbstractKeyMaker implements KeyMaker {
     protected static byte[] getSaltBytes(String salt, String pepper)
             throws UnsupportedEncodingException {
         byte[] saltBytes = salt.getBytes("UTF-8");
-        if (pepper != null && ! pepper.isEmpty()) {
+        if (pepper != null && !pepper.isEmpty()) {
             byte[] pepperBytes = pepper.getBytes("UTF-8");
             int len = saltBytes.length;
             len += 1 + pepperBytes.length;

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/AesKeyMaker.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/AesKeyMaker.java b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/AesKeyMaker.java
index 7f1ac1f..c3a72a3 100644
--- a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/AesKeyMaker.java
+++ b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/AesKeyMaker.java
@@ -51,9 +51,9 @@ public class AesKeyMaker extends DkKeyMaker {
         int keySize = encProvider().keySize();
         byte[] random;
         try {
-            random = Pbkdf.PBKDF2(string.toCharArray(), saltBytes, iterCount, keySize);
+            random = Pbkdf.pbkdf2(string.toCharArray(), saltBytes, iterCount, keySize);
         } catch (GeneralSecurityException e) {
-            throw new KrbException("PBKDF2 failed", e);
+            throw new KrbException("pbkdf2 failed", e);
         }
 
         byte[] tmpKey = random2Key(random);

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/CamelliaKeyMaker.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/CamelliaKeyMaker.java b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/CamelliaKeyMaker.java
index 83f6f59..dbdb7f7 100644
--- a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/CamelliaKeyMaker.java
+++ b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/CamelliaKeyMaker.java
@@ -53,9 +53,9 @@ public class CamelliaKeyMaker extends DkKeyMaker {
         int keySize = encProvider().keySize();
         byte[] random;
         try {
-            random = Pbkdf.PBKDF2(string.toCharArray(), saltBytes, iterCount, keySize);
+            random = Pbkdf.pbkdf2(string.toCharArray(), saltBytes, iterCount, keySize);
         } catch (GeneralSecurityException e) {
-            throw new KrbException("PBKDF2 failed", e);
+            throw new KrbException("pbkdf2 failed", e);
         }
 
         byte[] tmpKey = random2Key(random);
@@ -89,24 +89,24 @@ public class CamelliaKeyMaker extends DkKeyMaker {
         // four-byte big-endian binary string giving the output length
         len += 4;
 
-        byte[] Ki = new byte[len];
-        System.arraycopy(constant, 0, Ki, blocksize + 4, constant.length);
-        BytesUtil.int2bytes(keyInuptSize * 8, Ki, len - 4, true);
+        byte[] ki = new byte[len];
+        System.arraycopy(constant, 0, ki, blocksize + 4, constant.length);
+        BytesUtil.int2bytes(keyInuptSize * 8, ki, len - 4, true);
 
         for (int i = 1, n = 0; n < keyInuptSize; i++) {
             // Update the block counter
-            BytesUtil.int2bytes(i, Ki, blocksize, true);
+            BytesUtil.int2bytes(i, ki, blocksize, true);
 
             // Compute a CMAC checksum, update Ki with the result
-            byte[] tmp = Cmac.cmac(encProvider(), key, Ki);
-            System.arraycopy(tmp, 0, Ki, 0, blocksize);
+            byte[] tmp = Cmac.cmac(encProvider(), key, ki);
+            System.arraycopy(tmp, 0, ki, 0, blocksize);
 
             if (n + blocksize >= keyInuptSize) {
-                System.arraycopy(Ki, 0, keyBytes, n, keyInuptSize - n);
+                System.arraycopy(ki, 0, keyBytes, n, keyInuptSize - n);
                 break;
             }
 
-            System.arraycopy(Ki, 0, keyBytes, n, blocksize);
+            System.arraycopy(ki, 0, keyBytes, n, blocksize);
             n += blocksize;
         }
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/Des3KeyMaker.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/Des3KeyMaker.java b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/Des3KeyMaker.java
index 9c1ef68..df424a5 100644
--- a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/Des3KeyMaker.java
+++ b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/Des3KeyMaker.java
@@ -44,12 +44,12 @@ public class Des3KeyMaker extends DkKeyMaker {
      * @param bits56
      * @return
      */
-    private static byte[] getEightBits(byte[] bits56){
+    private static byte[] getEightBits(byte[] bits56) {
         byte[] bits64 = new byte[8];
         System.arraycopy(bits56, 0, bits64, 0, 7);
-        bits64[7] = (byte) (((bits56[0] & 1) << 1) | ((bits56[1] & 1) << 2) | ((bits56[2] & 1) << 3) |
-                ((bits56[3] & 1) << 4) | ((bits56[4] & 1) << 5) | ((bits56[5] & 1) << 6) |
-                ((bits56[6] & 1) << 7));
+        bits64[7] = (byte) (((bits56[0] & 1) << 1) | ((bits56[1] & 1) << 2) | ((bits56[2] & 1) << 3)
+                | ((bits56[3] & 1) << 4) | ((bits56[4] & 1) << 5) | ((bits56[5] & 1) << 6)
+                | ((bits56[6] & 1) << 7));
         return bits64;
     }
 
@@ -72,13 +72,13 @@ public class Des3KeyMaker extends DkKeyMaker {
             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));
+            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;

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/DesKeyMaker.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/DesKeyMaker.java b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/DesKeyMaker.java
index 8ae57d4..b71cf69 100644
--- a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/DesKeyMaker.java
+++ b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/DesKeyMaker.java
@@ -145,12 +145,12 @@ public class DesKeyMaker extends AbstractKeyMaker {
      * @param bits56
      * @return
      */
-    private static byte[] getEightBits(byte[] bits56){
+    private static byte[] getEightBits(byte[] bits56) {
         byte[] bits64 = new byte[8];
         System.arraycopy(bits56, 0, bits64, 0, 7);
-        bits64[7] = (byte) (((bits56[0] & 1) << 1) | ((bits56[1] & 1) << 2) | ((bits56[2] & 1) << 3) |
-                ((bits56[3] & 1) << 4) | ((bits56[4] & 1) << 5) | ((bits56[5] & 1) << 6) |
-                ((bits56[6] & 1) << 7));
+        bits64[7] = (byte) (((bits56[0] & 1) << 1) | ((bits56[1] & 1) << 2) | ((bits56[2] & 1) << 3)
+                | ((bits56[3] & 1) << 4) | ((bits56[4] & 1) << 5) | ((bits56[5] & 1) << 6)
+                | ((bits56[6] & 1) << 7));
         return bits64;
     }
 
@@ -209,15 +209,21 @@ public class DesKeyMaker extends AbstractKeyMaker {
 
             t1 = (bt >> 6) & 1;
             t2 = (bt >> 0) & 1;
-            if (t1 != t2) bt ^= (1 << 6 | 1 << 0);
+            if (t1 != t2) {
+                bt ^= (1 << 6 | 1 << 0);
+            }
 
             t1 = (bt >> 5) & 1;
             t2 = (bt >> 1) & 1;
-            if (t1 != t2) bt ^= (1 << 5 | 1 << 1);
+            if (t1 != t2) {
+                bt ^= (1 << 5 | 1 << 1);
+            }
 
             t1 = (bt >> 4) & 1;
             t2 = (bt >> 2) & 1;
-            if (t1 != t2) bt ^= (1 << 4 | 1 << 2);
+            if (t1 != t2) {
+                bt ^= (1 << 4 | 1 << 2);
+            }
 
             bits56[i] = bt;
         }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/DkKeyMaker.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/DkKeyMaker.java b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/DkKeyMaker.java
index c279d7a..148bb6f 100644
--- a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/DkKeyMaker.java
+++ b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/DkKeyMaker.java
@@ -46,25 +46,25 @@ public abstract class DkKeyMaker extends AbstractKeyMaker {
         int blocksize = encProvider().blockSize();
         int keyInuptSize = encProvider().keyInputSize();
         byte[] keyBytes = new byte[keyInuptSize];
-        byte[] Ki;
+        byte[] ki;
 
         if (constant.length != blocksize) {
-            Ki = Nfold.nfold(constant, blocksize);
+            ki = Nfold.nfold(constant, blocksize);
         } else {
-            Ki = new byte[constant.length];
-            System.arraycopy(constant, 0, Ki, 0, constant.length);
+            ki = new byte[constant.length];
+            System.arraycopy(constant, 0, ki, 0, constant.length);
         }
 
         int n = 0;
         while (n < keyInuptSize) {
-            encProvider().encrypt(key, Ki);
+            encProvider().encrypt(key, ki);
 
             if (n + blocksize >= keyInuptSize) {
-                System.arraycopy(Ki, 0, keyBytes, n, keyInuptSize - n);
+                System.arraycopy(ki, 0, keyBytes, n, keyInuptSize - n);
                 break;
             }
 
-            System.arraycopy(Ki, 0, keyBytes, n, blocksize);
+            System.arraycopy(ki, 0, keyBytes, n, blocksize);
             n += blocksize;
         }
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/Rc4KeyMaker.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/Rc4KeyMaker.java b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/Rc4KeyMaker.java
index 237b510..8322bde 100644
--- a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/Rc4KeyMaker.java
+++ b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/Rc4KeyMaker.java
@@ -19,9 +19,9 @@
  */
 package org.apache.kerby.kerberos.kerb.crypto.key;
 
-import org.apache.kerby.kerberos.kerb.crypto.enc.EncryptProvider;
 import org.apache.kerby.kerberos.kerb.KrbException;
-import sun.security.provider.MD4;
+import org.apache.kerby.kerberos.kerb.crypto.enc.EncryptProvider;
+import org.apache.kerby.kerberos.kerb.crypto.util.Md4;
 
 import java.io.UnsupportedEncodingException;
 import java.security.MessageDigest;
@@ -41,7 +41,7 @@ public class Rc4KeyMaker extends AbstractKeyMaker {
 
         try {
             byte[] passwd = string.getBytes("UTF-16LE"); // to unicode
-            MessageDigest md = MD4.getInstance();
+            MessageDigest md = new Md4();
             md.update(passwd);
             return md.digest();
         } catch (UnsupportedEncodingException e) {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/random/NativeRandom.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/random/NativeRandom.java b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/random/NativeRandom.java
index dd14cdd..872874d 100644
--- a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/random/NativeRandom.java
+++ b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/random/NativeRandom.java
@@ -19,7 +19,13 @@
  */
 package org.apache.kerby.kerberos.kerb.crypto.random;
 
-import java.io.*;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
 
 /**
  * use "/dev/urandom", which is on linux, to implement RandomProvider, so it should be used on linux.

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/util/BytesUtil.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/util/BytesUtil.java b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/util/BytesUtil.java
index 14ef9bb..1ccef4d 100644
--- a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/util/BytesUtil.java
+++ b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/util/BytesUtil.java
@@ -54,7 +54,7 @@ public class BytesUtil {
             bytes[offset + 1] = (byte) ((val) & 0xff);
         } else {
             bytes[offset + 1] = (byte) ((val >>  8) & 0xff);
-            bytes[offset + 0] = (byte) ((val      ) & 0xff);
+            bytes[offset + 0] = (byte) ((val) & 0xff);
         }
     }
 
@@ -147,7 +147,7 @@ public class BytesUtil {
             return data;
         }
 
-        byte[] result = new byte[len + + paddingLen];
+        byte[] result = new byte[len + paddingLen];
         System.arraycopy(data, 0, result, 0, len);
         return result;
     }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/util/CamelliaKey.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/util/CamelliaKey.java b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/util/CamelliaKey.java
index 43adfeb..d641f9e 100644
--- a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/util/CamelliaKey.java
+++ b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/util/CamelliaKey.java
@@ -44,70 +44,70 @@ public class CamelliaKey {
 
     // S-box data
     protected static final byte[] SBOX1 = {
-            (byte)112, (byte)130, (byte)44, (byte)236,
-            (byte)179, (byte)39, (byte)192, (byte)229,
-            (byte)228, (byte)133, (byte)87, (byte)53,
-            (byte)234, (byte)12, (byte)174, (byte)65,
-            (byte)35, (byte)239, (byte)107, (byte)147,
-            (byte)69, (byte)25, (byte)165, (byte)33,
-            (byte)237, (byte)14, (byte)79, (byte)78,
-            (byte)29, (byte)101, (byte)146, (byte)189,
-            (byte)134, (byte)184, (byte)175, (byte)143,
-            (byte)124, (byte)235, (byte)31, (byte)206,
-            (byte)62, (byte)48, (byte)220, (byte)95,
-            (byte)94, (byte)197, (byte)11, (byte)26,
-            (byte)166, (byte)225, (byte)57, (byte)202,
-            (byte)213, (byte)71, (byte)93, (byte)61,
-            (byte)217, (byte)1, (byte)90, (byte)214,
-            (byte)81, (byte)86, (byte)108, (byte)77,
-            (byte)139, (byte)13, (byte)154, (byte)102,
-            (byte)251, (byte)204, (byte)176, (byte)45,
-            (byte)116, (byte)18, (byte)43, (byte)32,
-            (byte)240, (byte)177, (byte)132, (byte)153,
-            (byte)223, (byte)76, (byte)203, (byte)194,
-            (byte)52, (byte)126, (byte)118, (byte)5,
-            (byte)109, (byte)183, (byte)169, (byte)49,
-            (byte)209, (byte)23, (byte)4, (byte)215,
-            (byte)20, (byte)88, (byte)58, (byte)97,
-            (byte)222, (byte)27, (byte)17, (byte)28,
-            (byte)50, (byte)15, (byte)156, (byte)22,
-            (byte)83, (byte)24, (byte)242, (byte)34,
-            (byte)254, (byte)68, (byte)207, (byte)178,
-            (byte)195, (byte)181, (byte)122, (byte)145,
-            (byte)36, (byte)8, (byte)232, (byte)168,
-            (byte)96, (byte)252, (byte)105, (byte)80,
-            (byte)170, (byte)208, (byte)160, (byte)125,
-            (byte)161, (byte)137, (byte)98, (byte)151,
-            (byte)84, (byte)91, (byte)30, (byte)149,
-            (byte)224, (byte)255, (byte)100, (byte)210,
-            (byte)16, (byte)196, (byte)0, (byte)72,
-            (byte)163, (byte)247, (byte)117, (byte)219,
-            (byte)138, (byte)3, (byte)230, (byte)218,
-            (byte)9, (byte)63, (byte)221, (byte)148,
-            (byte)135, (byte)92, (byte)131, (byte)2,
-            (byte)205, (byte)74, (byte)144, (byte)51,
-            (byte)115, (byte)103, (byte)246, (byte)243,
-            (byte)157, (byte)127, (byte)191, (byte)226,
-            (byte)82, (byte)155, (byte)216, (byte)38,
-            (byte)200, (byte)55, (byte)198, (byte)59,
-            (byte)129, (byte)150, (byte)111, (byte)75,
-            (byte)19, (byte)190, (byte)99, (byte)46,
-            (byte)233, (byte)121, (byte)167, (byte)140,
-            (byte)159, (byte)110, (byte)188, (byte)142,
-            (byte)41, (byte)245, (byte)249, (byte)182,
-            (byte)47, (byte)253, (byte)180, (byte)89,
-            (byte)120, (byte)152, (byte)6, (byte)106,
-            (byte)231, (byte)70, (byte)113, (byte)186,
-            (byte)212, (byte)37, (byte)171, (byte)66,
-            (byte)136, (byte)162, (byte)141, (byte)250,
-            (byte)114, (byte)7, (byte)185, (byte)85,
-            (byte)248, (byte)238, (byte)172, (byte)10,
-            (byte)54, (byte)73, (byte)42, (byte)104,
-            (byte)60, (byte)56, (byte)241, (byte)164,
-            (byte)64, (byte)40, (byte)211, (byte)123,
-            (byte)187, (byte)201, (byte)67, (byte)193,
-            (byte)21, (byte)227, (byte)173, (byte)244,
-            (byte)119, (byte)199, (byte)128, (byte)158
+            (byte) 112, (byte) 130, (byte) 44, (byte) 236,
+            (byte) 179, (byte) 39, (byte) 192, (byte) 229,
+            (byte) 228, (byte) 133, (byte) 87, (byte) 53,
+            (byte) 234, (byte) 12, (byte) 174, (byte) 65,
+            (byte) 35, (byte) 239, (byte) 107, (byte) 147,
+            (byte) 69, (byte) 25, (byte) 165, (byte) 33,
+            (byte) 237, (byte) 14, (byte) 79, (byte) 78,
+            (byte) 29, (byte) 101, (byte) 146, (byte) 189,
+            (byte) 134, (byte) 184, (byte) 175, (byte) 143,
+            (byte) 124, (byte) 235, (byte) 31, (byte) 206,
+            (byte) 62, (byte) 48, (byte) 220, (byte) 95,
+            (byte) 94, (byte) 197, (byte) 11, (byte) 26,
+            (byte) 166, (byte) 225, (byte) 57, (byte) 202,
+            (byte) 213, (byte) 71, (byte) 93, (byte) 61,
+            (byte) 217, (byte) 1, (byte) 90, (byte) 214,
+            (byte) 81, (byte) 86, (byte) 108, (byte) 77,
+            (byte) 139, (byte) 13, (byte) 154, (byte) 102,
+            (byte) 251, (byte) 204, (byte) 176, (byte) 45,
+            (byte) 116, (byte) 18, (byte) 43, (byte) 32,
+            (byte) 240, (byte) 177, (byte) 132, (byte) 153,
+            (byte) 223, (byte) 76, (byte) 203, (byte) 194,
+            (byte) 52, (byte) 126, (byte) 118, (byte) 5,
+            (byte) 109, (byte) 183, (byte) 169, (byte) 49,
+            (byte) 209, (byte) 23, (byte) 4, (byte) 215,
+            (byte) 20, (byte) 88, (byte) 58, (byte) 97,
+            (byte) 222, (byte) 27, (byte) 17, (byte) 28,
+            (byte) 50, (byte) 15, (byte) 156, (byte) 22,
+            (byte) 83, (byte) 24, (byte) 242, (byte) 34,
+            (byte) 254, (byte) 68, (byte) 207, (byte) 178,
+            (byte) 195, (byte) 181, (byte) 122, (byte) 145,
+            (byte) 36, (byte) 8, (byte) 232, (byte) 168,
+            (byte) 96, (byte) 252, (byte) 105, (byte) 80,
+            (byte) 170, (byte) 208, (byte) 160, (byte) 125,
+            (byte) 161, (byte) 137, (byte) 98, (byte) 151,
+            (byte) 84, (byte) 91, (byte) 30, (byte) 149,
+            (byte) 224, (byte) 255, (byte) 100, (byte) 210,
+            (byte) 16, (byte) 196, (byte) 0, (byte) 72,
+            (byte) 163, (byte) 247, (byte) 117, (byte) 219,
+            (byte) 138, (byte) 3, (byte) 230, (byte) 218,
+            (byte) 9, (byte) 63, (byte) 221, (byte) 148,
+            (byte) 135, (byte) 92, (byte) 131, (byte) 2,
+            (byte) 205, (byte) 74, (byte) 144, (byte) 51,
+            (byte) 115, (byte) 103, (byte) 246, (byte) 243,
+            (byte) 157, (byte) 127, (byte) 191, (byte) 226,
+            (byte) 82, (byte) 155, (byte) 216, (byte) 38,
+            (byte) 200, (byte) 55, (byte) 198, (byte) 59,
+            (byte) 129, (byte) 150, (byte) 111, (byte) 75,
+            (byte) 19, (byte) 190, (byte) 99, (byte) 46,
+            (byte) 233, (byte) 121, (byte) 167, (byte) 140,
+            (byte) 159, (byte) 110, (byte) 188, (byte) 142,
+            (byte) 41, (byte) 245, (byte) 249, (byte) 182,
+            (byte) 47, (byte) 253, (byte) 180, (byte) 89,
+            (byte) 120, (byte) 152, (byte) 6, (byte) 106,
+            (byte) 231, (byte) 70, (byte) 113, (byte) 186,
+            (byte) 212, (byte) 37, (byte) 171, (byte) 66,
+            (byte) 136, (byte) 162, (byte) 141, (byte) 250,
+            (byte) 114, (byte) 7, (byte) 185, (byte) 85,
+            (byte) 248, (byte) 238, (byte) 172, (byte) 10,
+            (byte) 54, (byte) 73, (byte) 42, (byte) 104,
+            (byte) 60, (byte) 56, (byte) 241, (byte) 164,
+            (byte) 64, (byte) 40, (byte) 211, (byte) 123,
+            (byte) 187, (byte) 201, (byte) 67, (byte) 193,
+            (byte) 21, (byte) 227, (byte) 173, (byte) 244,
+            (byte) 119, (byte) 199, (byte) 128, (byte) 158
     };
 
     public CamelliaKey(byte[] key, boolean isEncrypt) {
@@ -151,8 +151,7 @@ public class CamelliaKey {
     }
 
     private static void roldqo32(int rot, int[] ki, int ioff,
-                                 int[] ko, int ooff)
-    {
+                                 int[] ko, int ooff) {
         ko[0 + ooff] = (ki[1 + ioff] << (rot - 32)) | (ki[2 + ioff] >>> (64 - rot));
         ko[1 + ooff] = (ki[2 + ioff] << (rot - 32)) | (ki[3 + ioff] >>> (64 - rot));
         ko[2 + ooff] = (ki[3 + ioff] << (rot - 32)) | (ki[0 + ioff] >>> (64 - rot));
@@ -175,24 +174,20 @@ public class CamelliaKey {
         ki[3 + ioff] = ko[1 + ooff];
     }
 
-    private byte lRot8(byte v, int rot)
-    {
-        return (byte)((v << rot) | ((v & 0xff) >>> (8 - rot)));
+    private byte lRot8(byte v, int rot) {
+        return (byte) ((v << rot) | ((v & 0xff) >>> (8 - rot)));
     }
 
-    private int sbox2(int x)
-    {
+    private int sbox2(int x) {
         return (lRot8(SBOX1[x], 1) & 0xff);
     }
 
-    private int sbox3(int x)
-    {
+    private int sbox3(int x) {
         return (lRot8(SBOX1[x], 7) & 0xff);
     }
 
-    private int sbox4(int x)
-    {
-        return (SBOX1[((int)lRot8((byte)x, 1) & 0xff)] & 0xff);
+    private int sbox4(int x) {
+        return (SBOX1[((int) lRot8((byte) x, 1) & 0xff)] & 0xff);
     }
 
     protected void fls(int[] s, int[] fkey, int keyoff) {
@@ -210,10 +205,10 @@ public class CamelliaKey {
         u = sbox4((t1 & 0xff));
         u |= (sbox3(((t1 >>> 8) & 0xff)) << 8);
         u |= (sbox2(((t1 >>> 16) & 0xff)) << 16);
-        u |= ((int)(SBOX1[((t1 >>> 24) & 0xff)] & 0xff) << 24);
+        u |= ((int) (SBOX1[((t1 >>> 24) & 0xff)] & 0xff) << 24);
 
         t2 = s[1] ^ skey[1 + keyoff];
-        v = (int)SBOX1[(t2 & 0xff)] & 0xff;
+        v = (int) SBOX1[(t2 & 0xff)] & 0xff;
         v |= (sbox4(((t2 >>> 8) & 0xff)) << 8);
         v |= (sbox3(((t2 >>> 16) & 0xff)) << 16);
         v |= (sbox2(((t2 >>> 24) & 0xff)) << 24);
@@ -229,10 +224,10 @@ public class CamelliaKey {
         u = sbox4((t1 & 0xff));
         u |= sbox3(((t1 >>> 8) & 0xff)) << 8;
         u |= sbox2(((t1 >>> 16) & 0xff)) << 16;
-        u |= ((int)SBOX1[((t1 >>> 24) & 0xff)] & 0xff) << 24;
+        u |= ((int) SBOX1[((t1 >>> 24) & 0xff)] & 0xff) << 24;
 
         t2 = s[3] ^ skey[3 + keyoff];
-        v = ((int)SBOX1[(t2 & 0xff)] & 0xff);
+        v = ((int) SBOX1[(t2 & 0xff)] & 0xff);
         v |= sbox4(((t2 >>> 8) & 0xff)) << 8;
         v |= sbox3(((t2 >>> 16) & 0xff)) << 16;
         v |= sbox2(((t2 >>> 24) & 0xff)) << 24;

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/util/Cmac.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/util/Cmac.java b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/util/Cmac.java
index 290c63c..f39c6fa 100644
--- a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/util/Cmac.java
+++ b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/util/Cmac.java
@@ -62,14 +62,14 @@ public class Cmac {
 
         int blockSize = encProvider.blockSize();
 
-        byte[] Y = new byte[blockSize];
+        byte[] y = new byte[blockSize];
         byte[] mLast = new byte[blockSize];
         byte[] padded = new byte[blockSize];
-        byte[] K1 = new byte[blockSize];
-        byte[] K2 = new byte[blockSize];
+        byte[] k1 = new byte[blockSize];
+        byte[] k2 = new byte[blockSize];
 
         // step 1
-        makeSubkey(encProvider, key, K1, K2);
+        makeSubkey(encProvider, key, k1, k2);
 
         // step 2
         int n = (len + blockSize - 1) / blockSize;
@@ -93,7 +93,7 @@ public class Cmac {
         }
 
         // step 5
-        System.arraycopy(cipher, 0, Y, 0, blockSize);
+        System.arraycopy(cipher, 0, y, 0, blockSize);
 
         // step 4
         int lastPos = (n - 1) * blockSize;
@@ -101,10 +101,10 @@ public class Cmac {
         byte[] lastBlock = new byte[lastLen];
         System.arraycopy(data, lastPos, lastBlock, 0, lastLen);
         if (lastIsComplete) {
-            BytesUtil.xor(lastBlock, K1, mLast);
+            BytesUtil.xor(lastBlock, k1, mLast);
         } else {
             padding(lastBlock, padded);
-            BytesUtil.xor(padded, K2, mLast);
+            BytesUtil.xor(padded, k2, mLast);
         }
 
         // Step 6 (last block)
@@ -115,29 +115,29 @@ public class Cmac {
 
     // Generate subkeys K1 and K2 as described in RFC 4493 figure 2.2.
     private static void makeSubkey(EncryptProvider encProvider,
-                              byte[] key, byte[] K1, byte[] K2) throws KrbException {
+                              byte[] key, byte[] k1, byte[] k2) throws KrbException {
 
         // L := encrypt(K, const_Zero)
-        byte[] L = new byte[K1.length];
-        Arrays.fill(L, (byte) 0);
-        encryptBlock(encProvider, key, null, L);
+        byte[] l = new byte[k1.length];
+        Arrays.fill(l, (byte) 0);
+        encryptBlock(encProvider, key, null, l);
 
         // K1 := (MSB(L) == 0) ? L << 1 : (L << 1) XOR const_Rb
-        if ((L[0] & 0x80) == 0) {
-            leftShiftByOne(L, K1);
+        if ((l[0] & 0x80) == 0) {
+            leftShiftByOne(l, k1);
         } else {
-            byte[] tmp = new byte[K1.length];
-            leftShiftByOne(L, tmp);
-            BytesUtil.xor(tmp, constRb, K1);
+            byte[] tmp = new byte[k1.length];
+            leftShiftByOne(l, tmp);
+            BytesUtil.xor(tmp, constRb, k1);
         }
 
         // K2 := (MSB(K1) == 0) ? K1 << 1 : (K1 << 1) XOR const_Rb
-        if ((K1[0] & 0x80) == 0) {
-            leftShiftByOne(K1, K2);
+        if ((k1[0] & 0x80) == 0) {
+            leftShiftByOne(k1, k2);
         } else {
-            byte[] tmp = new byte[K1.length];
-            leftShiftByOne(K1, tmp);
-            BytesUtil.xor(tmp, constRb, K2);
+            byte[] tmp = new byte[k1.length];
+            leftShiftByOne(k1, tmp);
+            BytesUtil.xor(tmp, constRb, k2);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/util/Des.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/util/Des.java b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/util/Des.java
index 1d9394a..7b8570e 100644
--- a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/util/Des.java
+++ b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/util/Des.java
@@ -29,29 +29,29 @@ public class Des {
      */
     static final byte[][] WEAK_KEYS = {
     /* weak keys */
-            {(byte) 0x01,(byte) 0x01,(byte) 0x01,(byte) 0x01,(byte) 0x01,(byte) 0x01,(byte) 0x01,(byte) 0x01},
-            {(byte) 0xfe,(byte) 0xfe,(byte) 0xfe,(byte) 0xfe,(byte) 0xfe,(byte) 0xfe,(byte) 0xfe,(byte) 0xfe},
-            {(byte) 0x1f,(byte) 0x1f,(byte) 0x1f,(byte) 0x1f,(byte) 0x0e,(byte) 0x0e,(byte) 0x0e,(byte) 0x0e},
-            {(byte) 0xe0,(byte) 0xe0,(byte) 0xe0,(byte) 0xe0,(byte) 0xf1,(byte) 0xf1,(byte) 0xf1,(byte) 0xf1},
+            {(byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x01},
+            {(byte) 0xfe, (byte) 0xfe, (byte) 0xfe, (byte) 0xfe, (byte) 0xfe, (byte) 0xfe, (byte) 0xfe, (byte) 0xfe},
+            {(byte) 0x1f, (byte) 0x1f, (byte) 0x1f, (byte) 0x1f, (byte) 0x0e, (byte) 0x0e, (byte) 0x0e, (byte) 0x0e},
+            {(byte) 0xe0, (byte) 0xe0, (byte) 0xe0, (byte) 0xe0, (byte) 0xf1, (byte) 0xf1, (byte) 0xf1, (byte) 0xf1},
 
     /* semi-weak */
-            {(byte) 0x01,(byte) 0xfe,(byte) 0x01,(byte) 0xfe,(byte) 0x01,(byte) 0xfe,(byte) 0x01,(byte) 0xfe},
-            {(byte) 0xfe,(byte) 0x01,(byte) 0xfe,(byte) 0x01,(byte) 0xfe,(byte) 0x01,(byte) 0xfe,(byte) 0x01},
+            {(byte) 0x01, (byte) 0xfe, (byte) 0x01, (byte) 0xfe, (byte) 0x01, (byte) 0xfe, (byte) 0x01, (byte) 0xfe},
+            {(byte) 0xfe, (byte) 0x01, (byte) 0xfe, (byte) 0x01, (byte) 0xfe, (byte) 0x01, (byte) 0xfe, (byte) 0x01},
 
-            {(byte) 0x1f,(byte) 0xe0,(byte) 0x1f,(byte) 0xe0,(byte) 0x0e,(byte) 0xf1,(byte) 0x0e,(byte) 0xf1},
-            {(byte) 0xe0,(byte) 0x1f,(byte) 0xe0,(byte) 0x1f,(byte) 0xf1,(byte) 0x0e,(byte) 0xf1,(byte) 0x0e},
+            {(byte) 0x1f, (byte) 0xe0, (byte) 0x1f, (byte) 0xe0, (byte) 0x0e, (byte) 0xf1, (byte) 0x0e, (byte) 0xf1},
+            {(byte) 0xe0, (byte) 0x1f, (byte) 0xe0, (byte) 0x1f, (byte) 0xf1, (byte) 0x0e, (byte) 0xf1, (byte) 0x0e},
 
-            {(byte) 0x01,(byte) 0xe0,(byte) 0x01,(byte) 0xe0,(byte) 0x01,(byte) 0xf1,(byte) 0x01,(byte) 0xf1},
-            {(byte) 0xe0,(byte) 0x01,(byte) 0xe0,(byte) 0x01,(byte) 0xf1,(byte) 0x01,(byte) 0xf1,(byte) 0x01},
+            {(byte) 0x01, (byte) 0xe0, (byte) 0x01, (byte) 0xe0, (byte) 0x01, (byte) 0xf1, (byte) 0x01, (byte) 0xf1},
+            {(byte) 0xe0, (byte) 0x01, (byte) 0xe0, (byte) 0x01, (byte) 0xf1, (byte) 0x01, (byte) 0xf1, (byte) 0x01},
 
-            {(byte) 0x1f,(byte) 0xfe,(byte) 0x1f,(byte) 0xfe,(byte) 0x0e,(byte) 0xfe,(byte) 0x0e,(byte) 0xfe},
-            {(byte) 0xfe,(byte) 0x1f,(byte) 0xfe,(byte) 0x1f,(byte) 0xfe,(byte) 0x0e,(byte) 0xfe,(byte) 0x0e},
+            {(byte) 0x1f, (byte) 0xfe, (byte) 0x1f, (byte) 0xfe, (byte) 0x0e, (byte) 0xfe, (byte) 0x0e, (byte) 0xfe},
+            {(byte) 0xfe, (byte) 0x1f, (byte) 0xfe, (byte) 0x1f, (byte) 0xfe, (byte) 0x0e, (byte) 0xfe, (byte) 0x0e},
 
-            {(byte) 0x01,(byte) 0x1f,(byte) 0x01,(byte) 0x1f,(byte) 0x01,(byte) 0x0e,(byte) 0x01,(byte) 0x0e},
-            {(byte) 0x1f,(byte) 0x01,(byte) 0x1f,(byte) 0x01,(byte) 0x0e,(byte) 0x01,(byte) 0x0e,(byte) 0x01},
+            {(byte) 0x01, (byte) 0x1f, (byte) 0x01, (byte) 0x1f, (byte) 0x01, (byte) 0x0e, (byte) 0x01, (byte) 0x0e},
+            {(byte) 0x1f, (byte) 0x01, (byte) 0x1f, (byte) 0x01, (byte) 0x0e, (byte) 0x01, (byte) 0x0e, (byte) 0x01},
 
-            {(byte) 0xe0,(byte) 0xfe,(byte) 0xe0,(byte) 0xfe,(byte) 0xf1,(byte) 0xfe,(byte) 0xf1,(byte) 0xfe},
-            {(byte) 0xfe,(byte) 0xe0,(byte) 0xfe,(byte) 0xe0,(byte) 0xfe,(byte) 0xf1,(byte) 0xfe,(byte) 0xf1}
+            {(byte) 0xe0, (byte) 0xfe, (byte) 0xe0, (byte) 0xfe, (byte) 0xf1, (byte) 0xfe, (byte) 0xf1, (byte) 0xfe},
+            {(byte) 0xfe, (byte) 0xe0, (byte) 0xfe, (byte) 0xe0, (byte) 0xfe, (byte) 0xf1, (byte) 0xfe, (byte) 0xf1}
     };
 
     public static boolean isWeakKey(byte[] key, int offset, int len) {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/util/Hmac.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/util/Hmac.java b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/util/Hmac.java
index 45f8951..c9fafa1 100644
--- a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/util/Hmac.java
+++ b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/util/Hmac.java
@@ -56,13 +56,13 @@ public class Hmac {
         byte[] outerPaddedKey = new byte[blockLen];
 
         // Create the inner padded key
-        Arrays.fill(innerPaddedKey, (byte)0x36);
+        Arrays.fill(innerPaddedKey, (byte) 0x36);
         for (int i = 0; i < key.length; i++) {
             innerPaddedKey[i] ^= key[i];
         }
 
         // Create the outer padded key
-        Arrays.fill(outerPaddedKey, (byte)0x5c);
+        Arrays.fill(outerPaddedKey, (byte) 0x5c);
         for (int i = 0; i < key.length; i++) {
             outerPaddedKey[i] ^= key[i];
         }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/util/Md4.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/util/Md4.java b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/util/Md4.java
index dca0117..fe28a6e 100644
--- a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/util/Md4.java
+++ b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/util/Md4.java
@@ -147,9 +147,9 @@ public class Md4 extends MessageDigest {
     protected byte[] engineDigest() {
         byte[] p = pad();
         engineUpdate(p, 0, p.length);
-        byte[] digest = { (byte) a, (byte) (a >>> 8), (byte) (a >>> 16), (byte) (a >>> 24), (byte) b, (byte) (b >>> 8),
+        byte[] digest = {(byte) a, (byte) (a >>> 8), (byte) (a >>> 16), (byte) (a >>> 24), (byte) b, (byte) (b >>> 8),
                 (byte) (b >>> 16), (byte) (b >>> 24), (byte) c, (byte) (c >>> 8), (byte) (c >>> 16), (byte) (c >>> 24),
-                (byte) d, (byte) (d >>> 8), (byte) (d >>> 16), (byte) (d >>> 24) };
+                (byte) d, (byte) (d >>> 8), (byte) (d >>> 16), (byte) (d >>> 24)};
 
         engineReset();
 
@@ -222,112 +222,112 @@ public class Md4 extends MessageDigest {
         int dd = d;
 
         // Copy the block to process into X array
-        int[] X = new int[16];
+        int[] x = new int[16];
         for (int i = 0; i < 16; i++) {
-            X[i] = (in[offset++] & 0xff) | (in[offset++] & 0xff) << 8 | (in[offset++] & 0xff) << 16
+            x[i] = (in[offset++] & 0xff) | (in[offset++] & 0xff) << 8 | (in[offset++] & 0xff) << 16
                     | (in[offset++] & 0xff) << 24;
         }
 
         // Round 1
-        a += ((b & c) | (~b & d)) + X[0];
+        a += ((b & c) | (~b & d)) + x[0];
         a = a << 3 | a >>> (32 - 3);
-        d += ((a & b) | (~a & c)) + X[1];
+        d += ((a & b) | (~a & c)) + x[1];
         d = d << 7 | d >>> (32 - 7);
-        c += ((d & a) | (~d & b)) + X[2];
+        c += ((d & a) | (~d & b)) + x[2];
         c = c << 11 | c >>> (32 - 11);
-        b += ((c & d) | (~c & a)) + X[3];
+        b += ((c & d) | (~c & a)) + x[3];
         b = b << 19 | b >>> (32 - 19);
-        a += ((b & c) | (~b & d)) + X[4];
+        a += ((b & c) | (~b & d)) + x[4];
         a = a << 3 | a >>> (32 - 3);
-        d += ((a & b) | (~a & c)) + X[5];
+        d += ((a & b) | (~a & c)) + x[5];
         d = d << 7 | d >>> (32 - 7);
-        c += ((d & a) | (~d & b)) + X[6];
+        c += ((d & a) | (~d & b)) + x[6];
         c = c << 11 | c >>> (32 - 11);
-        b += ((c & d) | (~c & a)) + X[7];
+        b += ((c & d) | (~c & a)) + x[7];
         b = b << 19 | b >>> (32 - 19);
-        a += ((b & c) | (~b & d)) + X[8];
+        a += ((b & c) | (~b & d)) + x[8];
         a = a << 3 | a >>> (32 - 3);
-        d += ((a & b) | (~a & c)) + X[9];
+        d += ((a & b) | (~a & c)) + x[9];
         d = d << 7 | d >>> (32 - 7);
-        c += ((d & a) | (~d & b)) + X[10];
+        c += ((d & a) | (~d & b)) + x[10];
         c = c << 11 | c >>> (32 - 11);
-        b += ((c & d) | (~c & a)) + X[11];
+        b += ((c & d) | (~c & a)) + x[11];
         b = b << 19 | b >>> (32 - 19);
-        a += ((b & c) | (~b & d)) + X[12];
+        a += ((b & c) | (~b & d)) + x[12];
         a = a << 3 | a >>> (32 - 3);
-        d += ((a & b) | (~a & c)) + X[13];
+        d += ((a & b) | (~a & c)) + x[13];
         d = d << 7 | d >>> (32 - 7);
-        c += ((d & a) | (~d & b)) + X[14];
+        c += ((d & a) | (~d & b)) + x[14];
         c = c << 11 | c >>> (32 - 11);
-        b += ((c & d) | (~c & a)) + X[15];
+        b += ((c & d) | (~c & a)) + x[15];
         b = b << 19 | b >>> (32 - 19);
 
         // Round 2
-        a += ((b & (c | d)) | (c & d)) + X[0] + 0x5a827999;
+        a += ((b & (c | d)) | (c & d)) + x[0] + 0x5a827999;
         a = a << 3 | a >>> (32 - 3);
-        d += ((a & (b | c)) | (b & c)) + X[4] + 0x5a827999;
+        d += ((a & (b | c)) | (b & c)) + x[4] + 0x5a827999;
         d = d << 5 | d >>> (32 - 5);
-        c += ((d & (a | b)) | (a & b)) + X[8] + 0x5a827999;
+        c += ((d & (a | b)) | (a & b)) + x[8] + 0x5a827999;
         c = c << 9 | c >>> (32 - 9);
-        b += ((c & (d | a)) | (d & a)) + X[12] + 0x5a827999;
+        b += ((c & (d | a)) | (d & a)) + x[12] + 0x5a827999;
         b = b << 13 | b >>> (32 - 13);
-        a += ((b & (c | d)) | (c & d)) + X[1] + 0x5a827999;
+        a += ((b & (c | d)) | (c & d)) + x[1] + 0x5a827999;
         a = a << 3 | a >>> (32 - 3);
-        d += ((a & (b | c)) | (b & c)) + X[5] + 0x5a827999;
+        d += ((a & (b | c)) | (b & c)) + x[5] + 0x5a827999;
         d = d << 5 | d >>> (32 - 5);
-        c += ((d & (a | b)) | (a & b)) + X[9] + 0x5a827999;
+        c += ((d & (a | b)) | (a & b)) + x[9] + 0x5a827999;
         c = c << 9 | c >>> (32 - 9);
-        b += ((c & (d | a)) | (d & a)) + X[13] + 0x5a827999;
+        b += ((c & (d | a)) | (d & a)) + x[13] + 0x5a827999;
         b = b << 13 | b >>> (32 - 13);
-        a += ((b & (c | d)) | (c & d)) + X[2] + 0x5a827999;
+        a += ((b & (c | d)) | (c & d)) + x[2] + 0x5a827999;
         a = a << 3 | a >>> (32 - 3);
-        d += ((a & (b | c)) | (b & c)) + X[6] + 0x5a827999;
+        d += ((a & (b | c)) | (b & c)) + x[6] + 0x5a827999;
         d = d << 5 | d >>> (32 - 5);
-        c += ((d & (a | b)) | (a & b)) + X[10] + 0x5a827999;
+        c += ((d & (a | b)) | (a & b)) + x[10] + 0x5a827999;
         c = c << 9 | c >>> (32 - 9);
-        b += ((c & (d | a)) | (d & a)) + X[14] + 0x5a827999;
+        b += ((c & (d | a)) | (d & a)) + x[14] + 0x5a827999;
         b = b << 13 | b >>> (32 - 13);
-        a += ((b & (c | d)) | (c & d)) + X[3] + 0x5a827999;
+        a += ((b & (c | d)) | (c & d)) + x[3] + 0x5a827999;
         a = a << 3 | a >>> (32 - 3);
-        d += ((a & (b | c)) | (b & c)) + X[7] + 0x5a827999;
+        d += ((a & (b | c)) | (b & c)) + x[7] + 0x5a827999;
         d = d << 5 | d >>> (32 - 5);
-        c += ((d & (a | b)) | (a & b)) + X[11] + 0x5a827999;
+        c += ((d & (a | b)) | (a & b)) + x[11] + 0x5a827999;
         c = c << 9 | c >>> (32 - 9);
-        b += ((c & (d | a)) | (d & a)) + X[15] + 0x5a827999;
+        b += ((c & (d | a)) | (d & a)) + x[15] + 0x5a827999;
         b = b << 13 | b >>> (32 - 13);
 
         // Round 3
-        a += (b ^ c ^ d) + X[0] + 0x6ed9eba1;
+        a += (b ^ c ^ d) + x[0] + 0x6ed9eba1;
         a = a << 3 | a >>> (32 - 3);
-        d += (a ^ b ^ c) + X[8] + 0x6ed9eba1;
+        d += (a ^ b ^ c) + x[8] + 0x6ed9eba1;
         d = d << 9 | d >>> (32 - 9);
-        c += (d ^ a ^ b) + X[4] + 0x6ed9eba1;
+        c += (d ^ a ^ b) + x[4] + 0x6ed9eba1;
         c = c << 11 | c >>> (32 - 11);
-        b += (c ^ d ^ a) + X[12] + 0x6ed9eba1;
+        b += (c ^ d ^ a) + x[12] + 0x6ed9eba1;
         b = b << 15 | b >>> (32 - 15);
-        a += (b ^ c ^ d) + X[2] + 0x6ed9eba1;
+        a += (b ^ c ^ d) + x[2] + 0x6ed9eba1;
         a = a << 3 | a >>> (32 - 3);
-        d += (a ^ b ^ c) + X[10] + 0x6ed9eba1;
+        d += (a ^ b ^ c) + x[10] + 0x6ed9eba1;
         d = d << 9 | d >>> (32 - 9);
-        c += (d ^ a ^ b) + X[6] + 0x6ed9eba1;
+        c += (d ^ a ^ b) + x[6] + 0x6ed9eba1;
         c = c << 11 | c >>> (32 - 11);
-        b += (c ^ d ^ a) + X[14] + 0x6ed9eba1;
+        b += (c ^ d ^ a) + x[14] + 0x6ed9eba1;
         b = b << 15 | b >>> (32 - 15);
-        a += (b ^ c ^ d) + X[1] + 0x6ed9eba1;
+        a += (b ^ c ^ d) + x[1] + 0x6ed9eba1;
         a = a << 3 | a >>> (32 - 3);
-        d += (a ^ b ^ c) + X[9] + 0x6ed9eba1;
+        d += (a ^ b ^ c) + x[9] + 0x6ed9eba1;
         d = d << 9 | d >>> (32 - 9);
-        c += (d ^ a ^ b) + X[5] + 0x6ed9eba1;
+        c += (d ^ a ^ b) + x[5] + 0x6ed9eba1;
         c = c << 11 | c >>> (32 - 11);
-        b += (c ^ d ^ a) + X[13] + 0x6ed9eba1;
+        b += (c ^ d ^ a) + x[13] + 0x6ed9eba1;
         b = b << 15 | b >>> (32 - 15);
-        a += (b ^ c ^ d) + X[3] + 0x6ed9eba1;
+        a += (b ^ c ^ d) + x[3] + 0x6ed9eba1;
         a = a << 3 | a >>> (32 - 3);
-        d += (a ^ b ^ c) + X[11] + 0x6ed9eba1;
+        d += (a ^ b ^ c) + x[11] + 0x6ed9eba1;
         d = d << 9 | d >>> (32 - 9);
-        c += (d ^ a ^ b) + X[7] + 0x6ed9eba1;
+        c += (d ^ a ^ b) + x[7] + 0x6ed9eba1;
         c = c << 11 | c >>> (32 - 11);
-        b += (c ^ d ^ a) + X[15] + 0x6ed9eba1;
+        b += (c ^ d ^ a) + x[15] + 0x6ed9eba1;
         b = b << 15 | b >>> (32 - 15);
 
         //Update state.

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/util/Nfold.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/util/Nfold.java b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/util/Nfold.java
index 9f878bf..ec8489f 100644
--- a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/util/Nfold.java
+++ b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/util/Nfold.java
@@ -57,23 +57,23 @@ public class Nfold {
         int lcm = (outBytesNum * inBytesNum) / a;
 
         byte[] outBytes = new byte[outBytesNum];
-        Arrays.fill(outBytes, (byte)0);
+        Arrays.fill(outBytes, (byte) 0);
 
         int tmpByte = 0;
         for (int i = lcm - 1; i >= 0; i--) {
             // first, start with the msbit inBytes the first, unrotated byte
-            int tmp = ((inBytesNum<<3)-1);
+            int tmp = ((inBytesNum << 3) - 1);
             // then, for each byte, shift to the right for each repetition
-            tmp += (((inBytesNum<<3)+13)*(i/inBytesNum));
+            tmp += (((inBytesNum << 3) + 13) * (i / inBytesNum));
             // last, pick outBytes the correct byte within that shifted repetition
-            tmp += ((inBytesNum-(i%inBytesNum)) << 3);
+            tmp += ((inBytesNum - (i % inBytesNum)) << 3);
 
             int msbit = tmp % (inBytesNum << 3);
 
             // pull outBytes the byte value itself
-            tmp =  ((((inBytes[((inBytesNum - 1)-(msbit >>> 3)) % inBytesNum] & 0xff) << 8) |
-                (inBytes[((inBytesNum) - (msbit >>> 3)) % inBytesNum] & 0xff))
-                >>>((msbit & 7)+1)) & 0xff;
+            tmp =  ((((inBytes[((inBytesNum - 1) - (msbit >>> 3)) % inBytesNum] & 0xff) << 8)
+                    | (inBytes[((inBytesNum) - (msbit >>> 3)) % inBytesNum] & 0xff))
+                >>> ((msbit & 7) + 1)) & 0xff;
 
             tmpByte += tmp;
             tmp = (outBytes[i % outBytesNum] & 0xff);
@@ -86,7 +86,7 @@ public class Nfold {
 
         // if there's a carry bit left over, add it back inBytes
         if (tmpByte != 0) {
-            for (int i = outBytesNum-1; i >= 0; i--) {
+            for (int i = outBytesNum - 1; i >= 0; i--) {
                 // do the addition
                 tmpByte += (outBytes[i] & 0xff);
                 outBytes[i] = (byte) (tmpByte & 0xff);

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/util/Pbkdf.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/util/Pbkdf.java b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/util/Pbkdf.java
index 646fc79..3ce6830 100644
--- a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/util/Pbkdf.java
+++ b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/util/Pbkdf.java
@@ -26,8 +26,8 @@ import java.security.GeneralSecurityException;
 
 public class Pbkdf {
 
-    public static byte[] PBKDF2(char[] secret, byte[] salt,
-                                   int count, int keySize) throws GeneralSecurityException {
+    public static byte[] pbkdf2(char[] secret, byte[] salt,
+                                int count, int keySize) throws GeneralSecurityException {
 
         PBEKeySpec ks = new PBEKeySpec(secret, salt, count, keySize * 8);
         SecretKeyFactory skf =

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-kerb/kerb-crypto/src/test/java/org/apache/kerby/kerberos/kerb/crypto/CamelliaEncTest.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-crypto/src/test/java/org/apache/kerby/kerberos/kerb/crypto/CamelliaEncTest.java b/kerby-kerb/kerb-crypto/src/test/java/org/apache/kerby/kerberos/kerb/crypto/CamelliaEncTest.java
index 7ebdb05..c13be9d 100644
--- a/kerby-kerb/kerb-crypto/src/test/java/org/apache/kerby/kerberos/kerb/crypto/CamelliaEncTest.java
+++ b/kerby-kerb/kerb-crypto/src/test/java/org/apache/kerby/kerberos/kerb/crypto/CamelliaEncTest.java
@@ -53,7 +53,7 @@ public class CamelliaEncTest {
         String line;
         while ((line = br.readLine()) != null) {
             line = line.trim();
-            if (! line.isEmpty()) {
+            if (!line.isEmpty()) {
                 results.add(line);
             }
         }
@@ -77,8 +77,7 @@ public class CamelliaEncTest {
         this.keySize = keySize;
         outputs.add("KEYSIZE=" + (keySize * 8));
 
-        encProvider = keySize == 16 ?
-                new Camellia128Provider() : new Camellia256Provider();
+        encProvider = keySize == 16 ? new Camellia128Provider() : new Camellia256Provider();
 
         byte[] key = new byte[keySize];
         Arrays.fill(key, (byte) 0);

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-kerb/kerb-crypto/src/test/java/org/apache/kerby/kerberos/kerb/crypto/CheckSumTest.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-crypto/src/test/java/org/apache/kerby/kerberos/kerb/crypto/CheckSumTest.java b/kerby-kerb/kerb-crypto/src/test/java/org/apache/kerby/kerberos/kerb/crypto/CheckSumTest.java
index e7b0b10..157cb5c 100644
--- a/kerby-kerb/kerb-crypto/src/test/java/org/apache/kerby/kerberos/kerb/crypto/CheckSumTest.java
+++ b/kerby-kerb/kerb-crypto/src/test/java/org/apache/kerby/kerberos/kerb/crypto/CheckSumTest.java
@@ -19,7 +19,11 @@
  */
 package org.apache.kerby.kerberos.kerb.crypto;
 
-import org.apache.kerby.kerberos.kerb.spec.base.*;
+import org.apache.kerby.kerberos.kerb.spec.base.CheckSum;
+import org.apache.kerby.kerberos.kerb.spec.base.CheckSumType;
+import org.apache.kerby.kerberos.kerb.spec.base.EncryptionKey;
+import org.apache.kerby.kerberos.kerb.spec.base.EncryptionType;
+import org.apache.kerby.kerberos.kerb.spec.base.KeyUsage;
 import org.apache.kerby.util.HexUtil;
 import org.junit.Test;
 
@@ -55,8 +59,8 @@ public class CheckSumTest {
             )
     };
 
-    static final byte[] TESTKEY = { (byte)0x45, (byte)0x01, (byte)0x49, (byte)0x61, (byte)0x58,
-            (byte)0x19, (byte)0x1a, (byte)0x3d };
+    static final byte[] TESTKEY = {(byte) 0x45, (byte) 0x01, (byte) 0x49, (byte) 0x61, (byte) 0x58,
+            (byte) 0x19, (byte) 0x1a, (byte) 0x3d};
 
     @Test
     public void testCheckSums() {
@@ -73,7 +77,7 @@ public class CheckSumTest {
         byte[] knownChecksum = HexUtil.hex2bytes(testCase.knownChecksum);
         byte[] plainData = testCase.plainText.getBytes();
 
-        if (! CheckSumHandler.isImplemented(testCase.cksumType)) {
+        if (!CheckSumHandler.isImplemented(testCase.cksumType)) {
             fail("Checksum type not supported yet: "
                     + testCase.cksumType.getName());
             return;
@@ -81,7 +85,8 @@ public class CheckSumTest {
 
         EncryptionKey key = new EncryptionKey(EncryptionType.DES_CBC_CRC, TESTKEY);
 
-        CheckSum newCksum = CheckSumHandler.checksumWithKey(testCase.cksumType, plainData, key.getKeyData(), KeyUsage.NONE);
+        CheckSum newCksum = CheckSumHandler.checksumWithKey(testCase.cksumType,
+                plainData, key.getKeyData(), KeyUsage.NONE);
 
         if (!CheckSumHandler.verifyWithKey(newCksum, plainData, key.getKeyData(), KeyUsage.NONE)) {
             fail("Checksum verifying failed for " + testCase.cksumType.getName());

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-kerb/kerb-crypto/src/test/java/org/apache/kerby/kerberos/kerb/crypto/CheckSumsTest.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-crypto/src/test/java/org/apache/kerby/kerberos/kerb/crypto/CheckSumsTest.java b/kerby-kerb/kerb-crypto/src/test/java/org/apache/kerby/kerberos/kerb/crypto/CheckSumsTest.java
index 871f05b..9aa50c4 100644
--- a/kerby-kerb/kerb-crypto/src/test/java/org/apache/kerby/kerberos/kerb/crypto/CheckSumsTest.java
+++ b/kerby-kerb/kerb-crypto/src/test/java/org/apache/kerby/kerberos/kerb/crypto/CheckSumsTest.java
@@ -192,7 +192,7 @@ public class CheckSumsTest {
         byte[] plainData = testCase.plainText.getBytes();
         CheckSum newCksum;
 
-        if (! CheckSumHandler.isImplemented(testCase.cksumType)) {
+        if (!CheckSumHandler.isImplemented(testCase.cksumType)) {
             fail("Checksum type not supported yet: "
                 + testCase.cksumType.getName());
             return;
@@ -202,7 +202,7 @@ public class CheckSumsTest {
             /**
              * For keyed checksum types
              */
-            if (! EncryptionHandler.isImplemented(testCase.encType)) {
+            if (!EncryptionHandler.isImplemented(testCase.encType)) {
                 fail("Key type not supported yet: " + testCase.encType.getName());
                 return;
             }
@@ -223,7 +223,7 @@ public class CheckSumsTest {
             }
         }
 
-        if (! newCksum.isEqual(answer)) {
+        if (!newCksum.isEqual(answer)) {
             fail("Checksum test failed for " + testCase.cksumType.getName());
         }
     }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-kerb/kerb-crypto/src/test/java/org/apache/kerby/kerberos/kerb/crypto/CmacTest.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-crypto/src/test/java/org/apache/kerby/kerberos/kerb/crypto/CmacTest.java b/kerby-kerb/kerb-crypto/src/test/java/org/apache/kerby/kerberos/kerb/crypto/CmacTest.java
index f8f7a39..8d0d01d 100644
--- a/kerby-kerb/kerb-crypto/src/test/java/org/apache/kerby/kerberos/kerb/crypto/CmacTest.java
+++ b/kerby-kerb/kerb-crypto/src/test/java/org/apache/kerby/kerberos/kerb/crypto/CmacTest.java
@@ -31,34 +31,29 @@ import static org.assertj.core.api.Assertions.assertThat;
 public class CmacTest {
 
     /* All examples use the following Camellia-128 key. */
-    static String keyBytes = "2b7e151628aed2a6" +
-            "abf7158809cf4f3c";
+    static String keyBytes = "2b7e151628aed2a6" + "abf7158809cf4f3c";
 
     /* Example inputs are this message truncated to 0, 16, 40, and 64 bytes. */
-    static String inputBytes = "6bc1bee22e409f96" +
-            "e93d7e117393172a" +
-            "ae2d8a571e03ac9c" +
-            "9eb76fac45af8e51" +
-            "30c81c46a35ce411" +
-            "e5fbc1191a0a52ef" +
-            "f69f2445df4f9b17" +
-            "ad2b417be66c3710";
+    static String inputBytes = "6bc1bee22e409f96"
+            + "e93d7e117393172a"
+            + "ae2d8a571e03ac9c"
+            + "9eb76fac45af8e51"
+            + "30c81c46a35ce411"
+            + "e5fbc1191a0a52ef"
+            + "f69f2445df4f9b17"
+            + "ad2b417be66c3710";
 
     /* Expected result of CMAC on empty inputBytes. */
-    static String cmac1 = "ba925782aaa1f5d9" +
-            "a00f89648094fc71";
+    static String cmac1 = "ba925782aaa1f5d9" + "a00f89648094fc71";
 
     /* Expected result of CMAC on first 16 bytes of inputBytes. */
-    static String cmac2 = "6d962854a3b9fda5" +
-            "6d7d45a95ee17993";
+    static String cmac2 = "6d962854a3b9fda5" + "6d7d45a95ee17993";
 
     /* Expected result of CMAC on first 40 bytes of inputBytes. */
-    static String cmac3 = "5c18d119ccd67661" +
-            "44ac1866131d9f22";
+    static String cmac3 = "5c18d119ccd67661" + "44ac1866131d9f22";
 
     /* Expected result of CMAC on all 64 bytes of inputBytes. */
-    static String cmac4 = "c2699a6eba55ce9d" +
-            "939a8a4e19466ee9";
+    static String cmac4 = "c2699a6eba55ce9d" + "939a8a4e19466ee9";
 
 
     @Test

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1d312c9f/kerby-kerb/kerb-crypto/src/test/java/org/apache/kerby/kerberos/kerb/crypto/Crc32Test.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-crypto/src/test/java/org/apache/kerby/kerberos/kerb/crypto/Crc32Test.java b/kerby-kerb/kerb-crypto/src/test/java/org/apache/kerby/kerberos/kerb/crypto/Crc32Test.java
index 2b42f54..7ac5f25 100644
--- a/kerby-kerb/kerb-crypto/src/test/java/org/apache/kerby/kerberos/kerb/crypto/Crc32Test.java
+++ b/kerby-kerb/kerb-crypto/src/test/java/org/apache/kerby/kerberos/kerb/crypto/Crc32Test.java
@@ -96,15 +96,15 @@ public class Crc32Test {
             new TestCase("00000080", 0xedb88320),
             new TestCase("666F6F", 0x7332bc33),
             new TestCase("7465737430313233343536373839", 0xb83e88d6),
-            new TestCase("4D4153534143485653455454532049" +
-                    "4E53544954565445204F4620544543484E4F4C4F4759", 0xe34180f7)
+            new TestCase("4D4153534143485653455454532049"
+                    + "4E53544954565445204F4620544543484E4F4C4F4759", 0xe34180f7)
     };
 
     @Test
     public void testCrc32() {
         boolean isOk = true;
         for (TestCase tc : testCases) {
-            if (! testWith(tc)) {
+            if (!testWith(tc)) {
                 isOk = false;
                 System.err.println("Test with data " + tc.data + " failed");
             }


Mime
View raw message