You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by dr...@apache.org on 2015/01/22 22:48:08 UTC
[29/45] directory-kerberos git commit: DIRKRB-149 New layout
structure with the new name "Apache Kerby"
http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/HmacMd5Rc4CheckSum.java
----------------------------------------------------------------------
diff --git a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/HmacMd5Rc4CheckSum.java b/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/HmacMd5Rc4CheckSum.java
deleted file mode 100644
index f03aae1..0000000
--- a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/HmacMd5Rc4CheckSum.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.kerberos.kerb.crypto.cksum;
-
-import org.apache.kerberos.kerb.crypto.Hmac;
-import org.apache.kerberos.kerb.crypto.Rc4;
-import org.apache.kerberos.kerb.crypto.cksum.provider.Md5Provider;
-import org.apache.kerberos.kerb.KrbException;
-import org.apache.kerberos.kerb.spec.common.CheckSumType;
-
-public class HmacMd5Rc4CheckSum extends AbstractKeyedCheckSumTypeHandler {
-
- public HmacMd5Rc4CheckSum() {
- super(null, new Md5Provider(), 16, 16);
- }
-
- public int confounderSize() {
- return 8;
- }
-
- public CheckSumType cksumType() {
- return CheckSumType.HMAC_MD5_ARCFOUR;
- }
-
- public boolean isSafe() {
- return true;
- }
-
- public int cksumSize() {
- return 16; // bytes
- }
-
- public int keySize() {
- return 16; // bytes
- }
-
- @Override
- protected byte[] doChecksumWithKey(byte[] data, int start, int len,
- byte[] key, int usage) throws KrbException {
-
- byte[] Ksign = null;
- byte[] signKey = "signaturekey".getBytes();
- byte[] newSignKey = new byte[signKey.length + 1];
- System.arraycopy(signKey, 0, newSignKey, 0, signKey.length);
- Ksign = Hmac.hmac(hashProvider(), key, newSignKey);
-
- byte[] salt = Rc4.getSalt(usage, false);
-
- hashProvider().hash(salt);
- hashProvider().hash(data, start, len);
- byte[] hashTmp = hashProvider().output();
-
- byte[] hmac = Hmac.hmac(hashProvider(), Ksign, hashTmp);
- return hmac;
- }
-}
http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/HmacSha1Aes128CheckSum.java
----------------------------------------------------------------------
diff --git a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/HmacSha1Aes128CheckSum.java b/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/HmacSha1Aes128CheckSum.java
deleted file mode 100644
index e3595c6..0000000
--- a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/HmacSha1Aes128CheckSum.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.kerberos.kerb.crypto.cksum;
-
-import org.apache.kerberos.kerb.crypto.enc.provider.Aes128Provider;
-import org.apache.kerberos.kerb.crypto.key.AesKeyMaker;
-import org.apache.kerberos.kerb.spec.common.CheckSumType;
-
-public class HmacSha1Aes128CheckSum extends HmacKcCheckSum {
-
- public HmacSha1Aes128CheckSum() {
- super(new Aes128Provider(), 20, 12);
-
- keyMaker(new AesKeyMaker((Aes128Provider) encProvider()));
- }
-
- public int confounderSize() {
- return 16;
- }
-
- public CheckSumType cksumType() {
- return CheckSumType.HMAC_SHA1_96_AES128;
- }
-
- public boolean isSafe() {
- return true;
- }
-
- public int cksumSize() {
- return 12; // bytes
- }
-
- public int keySize() {
- return 16; // bytes
- }
-}
http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/HmacSha1Aes256CheckSum.java
----------------------------------------------------------------------
diff --git a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/HmacSha1Aes256CheckSum.java b/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/HmacSha1Aes256CheckSum.java
deleted file mode 100644
index 83fbb28..0000000
--- a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/HmacSha1Aes256CheckSum.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.kerberos.kerb.crypto.cksum;
-
-import org.apache.kerberos.kerb.crypto.enc.provider.Aes256Provider;
-import org.apache.kerberos.kerb.crypto.key.AesKeyMaker;
-import org.apache.kerberos.kerb.spec.common.CheckSumType;
-
-public class HmacSha1Aes256CheckSum extends HmacKcCheckSum {
-
- public HmacSha1Aes256CheckSum() {
- super(new Aes256Provider(), 20, 12);
-
- keyMaker(new AesKeyMaker((Aes256Provider) encProvider()));
- }
-
- public int confounderSize() {
- return 16;
- }
-
- public CheckSumType cksumType() {
- return CheckSumType.HMAC_SHA1_96_AES256;
- }
-
- public boolean isSafe() {
- return true;
- }
-
- public int cksumSize() {
- return 12; // bytes
- }
-
- public int keySize() {
- return 32; // bytes
- }
-}
http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/HmacSha1Des3CheckSum.java
----------------------------------------------------------------------
diff --git a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/HmacSha1Des3CheckSum.java b/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/HmacSha1Des3CheckSum.java
deleted file mode 100644
index f51ca45..0000000
--- a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/HmacSha1Des3CheckSum.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.kerberos.kerb.crypto.cksum;
-
-import org.apache.kerberos.kerb.crypto.enc.provider.Des3Provider;
-import org.apache.kerberos.kerb.crypto.key.Des3KeyMaker;
-import org.apache.kerberos.kerb.spec.common.CheckSumType;
-
-public class HmacSha1Des3CheckSum extends HmacKcCheckSum {
-
- public HmacSha1Des3CheckSum() {
- super(new Des3Provider(), 20, 20);
-
- keyMaker(new Des3KeyMaker(encProvider()));
- }
-
- public int confounderSize() {
- return 8;
- }
-
- public CheckSumType cksumType() {
- return CheckSumType.HMAC_SHA1_DES3;
- }
-
- public boolean isSafe() {
- return true;
- }
-
- public int cksumSize() {
- return 20; // bytes
- }
-
- public int keySize() {
- return 24; // bytes
- }
-}
http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/KcCheckSum.java
----------------------------------------------------------------------
diff --git a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/KcCheckSum.java b/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/KcCheckSum.java
deleted file mode 100644
index 695f432..0000000
--- a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/KcCheckSum.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.kerberos.kerb.crypto.cksum;
-
-import org.apache.kerberos.kerb.crypto.BytesUtil;
-import org.apache.kerberos.kerb.crypto.enc.EncryptProvider;
-import org.apache.kerberos.kerb.crypto.key.DkKeyMaker;
-import org.apache.kerberos.kerb.KrbException;
-
-public abstract class KcCheckSum extends AbstractKeyedCheckSumTypeHandler {
-
- public KcCheckSum(EncryptProvider encProvider, HashProvider hashProvider,
- int computeSize, int outputSize) {
- super(encProvider, hashProvider, computeSize, outputSize);
- }
-
- @Override
- protected byte[] doChecksumWithKey(byte[] data, int start, int len,
- byte[] key, int usage) throws KrbException {
- byte[] Kc;
- byte[] constant = new byte[5];
- BytesUtil.int2bytes(usage, constant, 0, true);
- constant[4] = (byte) 0x99;
- Kc = ((DkKeyMaker) keyMaker()).dk(key, constant);
-
- byte[] mac = mac(Kc, data, start, len);
- return mac;
- }
-
- protected abstract byte[] mac(byte[] Kc, byte[] data, int start, int len) throws KrbException;
-}
http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/Md5HmacRc4CheckSum.java
----------------------------------------------------------------------
diff --git a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/Md5HmacRc4CheckSum.java b/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/Md5HmacRc4CheckSum.java
deleted file mode 100644
index 453791b..0000000
--- a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/Md5HmacRc4CheckSum.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.kerberos.kerb.crypto.cksum;
-
-import org.apache.kerberos.kerb.crypto.Hmac;
-import org.apache.kerberos.kerb.crypto.Rc4;
-import org.apache.kerberos.kerb.crypto.cksum.provider.Md5Provider;
-import org.apache.kerberos.kerb.crypto.enc.provider.Rc4Provider;
-import org.apache.kerberos.kerb.KrbException;
-import org.apache.kerberos.kerb.spec.common.CheckSumType;
-
-public class Md5HmacRc4CheckSum extends AbstractKeyedCheckSumTypeHandler {
-
- public Md5HmacRc4CheckSum() {
- super(new Rc4Provider(), new Md5Provider(), 16, 16);
- }
-
- public int confounderSize() {
- return 8;
- }
-
- public CheckSumType cksumType() {
- return CheckSumType.MD5_HMAC_ARCFOUR;
- }
-
- public boolean isSafe() {
- return true;
- }
-
- public int cksumSize() {
- return 16; // bytes
- }
-
- public int keySize() {
- return 16; // bytes
- }
-
- @Override
- protected byte[] doChecksumWithKey(byte[] data, int start, int len,
- byte[] key, int usage) throws KrbException {
-
- byte[] Ksign = key;
-
- byte[] salt = Rc4.getSalt(usage, false);
-
- hashProvider().hash(salt);
- hashProvider().hash(data, start, len);
- byte[] hashTmp = hashProvider().output();
-
- byte[] hmac = Hmac.hmac(hashProvider(), Ksign, hashTmp);
- return hmac;
- }
-}
http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/RsaMd4CheckSum.java
----------------------------------------------------------------------
diff --git a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/RsaMd4CheckSum.java b/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/RsaMd4CheckSum.java
deleted file mode 100644
index c7890e7..0000000
--- a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/RsaMd4CheckSum.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.kerberos.kerb.crypto.cksum;
-
-import org.apache.kerberos.kerb.crypto.cksum.provider.AbstractUnkeyedCheckSumTypeHandler;
-import org.apache.kerberos.kerb.crypto.cksum.provider.Md4Provider;
-import org.apache.kerberos.kerb.spec.common.CheckSumType;
-
-public class RsaMd4CheckSum extends AbstractUnkeyedCheckSumTypeHandler {
-
- public RsaMd4CheckSum() {
- super(new Md4Provider(), 16, 16);
- }
-
- public CheckSumType cksumType() {
- return CheckSumType.RSA_MD4;
- }
-}
http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/RsaMd4DesCheckSum.java
----------------------------------------------------------------------
diff --git a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/RsaMd4DesCheckSum.java b/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/RsaMd4DesCheckSum.java
deleted file mode 100644
index 0fee59b..0000000
--- a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/RsaMd4DesCheckSum.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.kerberos.kerb.crypto.cksum;
-
-import org.apache.kerberos.kerb.crypto.cksum.provider.Md4Provider;
-import org.apache.kerberos.kerb.spec.common.CheckSumType;
-
-public class RsaMd4DesCheckSum extends ConfounderedDesCheckSum {
-
- public RsaMd4DesCheckSum() {
- super(new Md4Provider(), 24, 24);
- }
-
- public CheckSumType cksumType() {
- return CheckSumType.RSA_MD4_DES;
- }
-}
http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/RsaMd5CheckSum.java
----------------------------------------------------------------------
diff --git a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/RsaMd5CheckSum.java b/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/RsaMd5CheckSum.java
deleted file mode 100644
index b92b174..0000000
--- a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/RsaMd5CheckSum.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.kerberos.kerb.crypto.cksum;
-
-import org.apache.kerberos.kerb.crypto.cksum.provider.AbstractUnkeyedCheckSumTypeHandler;
-import org.apache.kerberos.kerb.crypto.cksum.provider.Md5Provider;
-import org.apache.kerberos.kerb.spec.common.CheckSumType;
-
-public class RsaMd5CheckSum extends AbstractUnkeyedCheckSumTypeHandler {
-
- public RsaMd5CheckSum() {
- super(new Md5Provider(), 16, 16);
- }
-
- public CheckSumType cksumType() {
- return CheckSumType.RSA_MD5;
- }
-}
http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/RsaMd5DesCheckSum.java
----------------------------------------------------------------------
diff --git a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/RsaMd5DesCheckSum.java b/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/RsaMd5DesCheckSum.java
deleted file mode 100644
index 8673d4b..0000000
--- a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/RsaMd5DesCheckSum.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.kerberos.kerb.crypto.cksum;
-
-import org.apache.kerberos.kerb.crypto.cksum.provider.Md5Provider;
-import org.apache.kerberos.kerb.spec.common.CheckSumType;
-
-public final class RsaMd5DesCheckSum extends ConfounderedDesCheckSum {
-
- public RsaMd5DesCheckSum() {
- super(new Md5Provider(), 24, 24);
- }
-
- public CheckSumType cksumType() {
- return CheckSumType.RSA_MD5_DES;
- }
-}
http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/Sha1CheckSum.java
----------------------------------------------------------------------
diff --git a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/Sha1CheckSum.java b/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/Sha1CheckSum.java
deleted file mode 100644
index c95a5ff..0000000
--- a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/Sha1CheckSum.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.kerberos.kerb.crypto.cksum;
-
-import org.apache.kerberos.kerb.crypto.cksum.provider.AbstractUnkeyedCheckSumTypeHandler;
-import org.apache.kerberos.kerb.crypto.cksum.provider.Sha1Provider;
-import org.apache.kerberos.kerb.spec.common.CheckSumType;
-
-public class Sha1CheckSum extends AbstractUnkeyedCheckSumTypeHandler {
-
- public Sha1CheckSum() {
- super(new Sha1Provider(), 20, 20);
- }
-
- public CheckSumType cksumType() {
- return CheckSumType.NIST_SHA;
- }
-}
http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/provider/AbstractHashProvider.java
----------------------------------------------------------------------
diff --git a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/provider/AbstractHashProvider.java b/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/provider/AbstractHashProvider.java
deleted file mode 100644
index c3797cf..0000000
--- a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/provider/AbstractHashProvider.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.kerberos.kerb.crypto.cksum.provider;
-
-import org.apache.kerberos.kerb.crypto.cksum.HashProvider;
-import org.apache.kerberos.kerb.KrbException;
-
-public abstract class AbstractHashProvider implements HashProvider {
- private int blockSize;
- private int hashSize;
-
- public AbstractHashProvider(int hashSize, int blockSize) {
- this.hashSize = hashSize;
- this.blockSize = blockSize;
- }
-
- protected void init() {
-
- }
-
- @Override
- public int hashSize() {
- return hashSize;
- }
-
- @Override
- public int blockSize() {
- return blockSize;
- }
-
- @Override
- public void hash(byte[] data) throws KrbException {
- hash(data, 0, data.length);
- }
-}
http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/provider/AbstractUnkeyedCheckSumTypeHandler.java
----------------------------------------------------------------------
diff --git a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/provider/AbstractUnkeyedCheckSumTypeHandler.java b/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/provider/AbstractUnkeyedCheckSumTypeHandler.java
deleted file mode 100644
index 2984e0e..0000000
--- a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/provider/AbstractUnkeyedCheckSumTypeHandler.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.kerberos.kerb.crypto.cksum.provider;
-
-import org.apache.kerberos.kerb.crypto.cksum.AbstractCheckSumTypeHandler;
-import org.apache.kerberos.kerb.crypto.cksum.HashProvider;
-import org.apache.kerberos.kerb.KrbException;
-
-public abstract class AbstractUnkeyedCheckSumTypeHandler extends AbstractCheckSumTypeHandler {
-
- public AbstractUnkeyedCheckSumTypeHandler(HashProvider hashProvider,
- int computeSize, int outputSize) {
- super(null, hashProvider, computeSize, outputSize);
- }
-
- @Override
- public byte[] checksum(byte[] data, int start, int len) throws KrbException {
- int outputSize = outputSize();
-
- HashProvider hp = hashProvider();
- hp.hash(data, start, len);
- byte[] workBuffer = hp.output();
-
- if (outputSize < workBuffer.length) {
- byte[] output = new byte[outputSize];
- System.arraycopy(workBuffer, 0, output, 0, outputSize);
- return output;
- }
- return workBuffer;
- }
-
- @Override
- public boolean verify(byte[] data, int start, int len, byte[] checksum) throws KrbException {
- byte[] newCksum = checksum(data, start, len);
- return checksumEqual(newCksum, checksum);
- }
-}
http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/provider/Crc32Provider.java
----------------------------------------------------------------------
diff --git a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/provider/Crc32Provider.java b/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/provider/Crc32Provider.java
deleted file mode 100644
index ab419da..0000000
--- a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/provider/Crc32Provider.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.kerberos.kerb.crypto.cksum.provider;
-
-import org.apache.kerberos.kerb.crypto.Crc32;
-
-public class Crc32Provider extends AbstractHashProvider {
- private byte[] output;
-
- public Crc32Provider() {
- super(4, 1);
- }
-
- @Override
- public void hash(byte[] data, int start, int size) {
- output = Crc32.crc(data, start, size);
- }
-
- @Override
- public byte[] output() {
- return output;
- }
-}
http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/provider/Md4Provider.java
----------------------------------------------------------------------
diff --git a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/provider/Md4Provider.java b/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/provider/Md4Provider.java
deleted file mode 100644
index 02e84f3..0000000
--- a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/provider/Md4Provider.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.kerberos.kerb.crypto.cksum.provider;
-
-import org.apache.kerberos.kerb.crypto.Md4;
-
-public class Md4Provider extends MessageDigestHashProvider {
-
- public Md4Provider() {
- super(16, 64, "MD4");
- }
-
- @Override
- protected void init() {
- messageDigest = new Md4();
- }
-}
http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/provider/Md5Provider.java
----------------------------------------------------------------------
diff --git a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/provider/Md5Provider.java b/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/provider/Md5Provider.java
deleted file mode 100644
index 6484015..0000000
--- a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/provider/Md5Provider.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.kerberos.kerb.crypto.cksum.provider;
-
-public class Md5Provider extends MessageDigestHashProvider {
-
- public Md5Provider() {
- super(16, 64, "MD5");
- }
-}
http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/provider/MessageDigestHashProvider.java
----------------------------------------------------------------------
diff --git a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/provider/MessageDigestHashProvider.java b/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/provider/MessageDigestHashProvider.java
deleted file mode 100644
index bbd8ddf..0000000
--- a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/provider/MessageDigestHashProvider.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.kerberos.kerb.crypto.cksum.provider;
-
-import org.apache.kerberos.kerb.KrbException;
-
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-
-public class MessageDigestHashProvider extends AbstractHashProvider {
- private String algorithm;
- protected MessageDigest messageDigest;
-
- public MessageDigestHashProvider(int hashSize, int blockSize, String algorithm) {
- super(hashSize, blockSize);
- this.algorithm = algorithm;
-
- init();
- }
-
- @Override
- protected void init() {
- try {
- messageDigest = MessageDigest.getInstance(algorithm);
- } catch (NoSuchAlgorithmException e) {
- throw new RuntimeException("Failed to init JCE provider", e);
- }
- }
-
- @Override
- public void hash(byte[] data, int start, int len) throws KrbException {
- messageDigest.update(data, start, len);
- }
-
- @Override
- public byte[] output() {
- return messageDigest.digest();
- }
-}
http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/provider/Sha1Provider.java
----------------------------------------------------------------------
diff --git a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/provider/Sha1Provider.java b/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/provider/Sha1Provider.java
deleted file mode 100644
index b547501..0000000
--- a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/cksum/provider/Sha1Provider.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.kerberos.kerb.crypto.cksum.provider;
-
-public class Sha1Provider extends MessageDigestHashProvider {
-
- public Sha1Provider() {
- super(20, 64, "SHA1");
- }
-}
http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/AbstractEncTypeHandler.java
----------------------------------------------------------------------
diff --git a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/AbstractEncTypeHandler.java b/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/AbstractEncTypeHandler.java
deleted file mode 100644
index 3aab860..0000000
--- a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/AbstractEncTypeHandler.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.kerberos.kerb.crypto.enc;
-
-import org.apache.kerberos.kerb.crypto.AbstractCryptoTypeHandler;
-import org.apache.kerberos.kerb.crypto.EncTypeHandler;
-import org.apache.kerberos.kerb.crypto.cksum.HashProvider;
-import org.apache.kerberos.kerb.crypto.key.KeyMaker;
-import org.apache.kerberos.kerb.KrbException;
-
-public abstract class AbstractEncTypeHandler
- extends AbstractCryptoTypeHandler implements EncTypeHandler {
-
- private KeyMaker keyMaker;
-
- public AbstractEncTypeHandler(EncryptProvider encProvider,
- HashProvider hashProvider) {
- super(encProvider, hashProvider);
- }
-
- protected void keyMaker(KeyMaker keyMaker) {
- this.keyMaker = keyMaker;
- }
-
- protected KeyMaker keyMaker() {
- return keyMaker;
- }
-
- @Override
- public String name() {
- return eType().getName();
- }
-
- @Override
- public String displayName() {
- return eType().getDisplayName();
- }
-
- protected int paddingLength(int inputLen) {
- int payloadLen = confounderSize() + checksumSize() + inputLen;
- int padding = paddingSize();
-
- if (padding == 0 || (payloadLen % padding) == 0) {
- return 0;
- }
-
- return padding - (payloadLen % padding);
- }
-
- @Override
- public int keyInputSize() {
- return encProvider().keyInputSize();
- }
-
- @Override
- public int keySize() {
- return encProvider().keySize();
- }
-
- @Override
- public int confounderSize() {
- return encProvider().blockSize();
- }
-
- @Override
- public int checksumSize() {
- return hashProvider().hashSize();
- }
-
- @Override
- public int paddingSize() {
- return encProvider().blockSize();
- }
-
- @Override
- public byte[] str2key(String string, String salt, byte[] param) throws KrbException {
- return keyMaker.str2key(string, salt, param);
- }
-
- @Override
- public byte[] random2Key(byte[] randomBits) throws KrbException {
- return keyMaker.random2Key(randomBits);
- }
-
- @Override
- public byte[] encrypt(byte[] data, byte[] key, int usage) throws KrbException {
- byte[] iv = new byte[encProvider().blockSize()];
- return encrypt(data, key, iv, usage);
- }
-
- @Override
- public byte[] encrypt(byte[] data, byte[] key, byte[] iv, int usage) throws KrbException {
- int confounderLen = confounderSize();
- int checksumLen = checksumSize();
- int headerLen = confounderLen + checksumLen;
- int inputLen = data.length;
- int paddingLen = paddingLength(inputLen);
-
- /**
- * E(Confounder | Checksum | Plaintext | Padding), or
- * header | data | padding | trailer, where trailer may be absent
- */
-
- int workLength = headerLen + inputLen + paddingLen;
-
- byte[] workBuffer = new byte[workLength];
- System.arraycopy(data, 0, workBuffer, headerLen, data.length);
-
- int [] workLens = new int[] {confounderLen, checksumLen,
- inputLen, paddingLen};
-
- encryptWith(workBuffer, workLens, key, iv, usage);
- return workBuffer;
- }
-
- protected void encryptWith(byte[] workBuffer, int[] workLens,
- byte[] key, byte[] iv, int usage) throws KrbException {
-
- }
-
- public byte[] decrypt(byte[] cipher, byte[] key, int usage)
- throws KrbException {
- byte[] iv = new byte[encProvider().blockSize()];
- return decrypt(cipher, key, iv, usage);
- }
-
- public byte[] decrypt(byte[] cipher, byte[] key, byte[] iv, int usage)
- throws KrbException {
-
- int totalLen = cipher.length;
- int confounderLen = confounderSize();
- int checksumLen = checksumSize();
- int dataLen = totalLen - (confounderLen + checksumLen);
-
- int[] workLens = new int[] {confounderLen, checksumLen, dataLen};
- return decryptWith(cipher, workLens, key, iv, usage);
- }
-
- protected byte[] decryptWith(byte[] workBuffer, int[] workLens,
- byte[] key, byte[] iv, int usage) throws KrbException {
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/Aes128CtsHmacSha1Enc.java
----------------------------------------------------------------------
diff --git a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/Aes128CtsHmacSha1Enc.java b/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/Aes128CtsHmacSha1Enc.java
deleted file mode 100644
index f435d0f..0000000
--- a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/Aes128CtsHmacSha1Enc.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.kerberos.kerb.crypto.enc;
-
-import org.apache.kerberos.kerb.crypto.cksum.provider.Sha1Provider;
-import org.apache.kerberos.kerb.crypto.enc.provider.Aes128Provider;
-import org.apache.kerberos.kerb.crypto.enc.provider.AesProvider;
-import org.apache.kerberos.kerb.crypto.key.AesKeyMaker;
-import org.apache.kerberos.kerb.spec.common.CheckSumType;
-import org.apache.kerberos.kerb.spec.common.EncryptionType;
-
-public class Aes128CtsHmacSha1Enc extends KeKiHmacSha1Enc {
-
- public Aes128CtsHmacSha1Enc() {
- super(new Aes128Provider(), new Sha1Provider());
- keyMaker(new AesKeyMaker((AesProvider) encProvider()));
- }
-
- @Override
- public int checksumSize() {
- return 96 / 8;
- }
-
- public EncryptionType eType() {
- return EncryptionType.AES128_CTS_HMAC_SHA1_96;
- }
-
- public CheckSumType checksumType() {
- return CheckSumType.HMAC_SHA1_96_AES128;
- }
-}
http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/Aes256CtsHmacSha1Enc.java
----------------------------------------------------------------------
diff --git a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/Aes256CtsHmacSha1Enc.java b/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/Aes256CtsHmacSha1Enc.java
deleted file mode 100644
index 31b5efd..0000000
--- a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/Aes256CtsHmacSha1Enc.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.kerberos.kerb.crypto.enc;
-
-import org.apache.kerberos.kerb.crypto.cksum.provider.Sha1Provider;
-import org.apache.kerberos.kerb.crypto.enc.provider.Aes256Provider;
-import org.apache.kerberos.kerb.crypto.enc.provider.AesProvider;
-import org.apache.kerberos.kerb.crypto.key.AesKeyMaker;
-import org.apache.kerberos.kerb.spec.common.CheckSumType;
-import org.apache.kerberos.kerb.spec.common.EncryptionType;
-
-public class Aes256CtsHmacSha1Enc extends KeKiHmacSha1Enc {
-
- public Aes256CtsHmacSha1Enc() {
- super(new Aes256Provider(), new Sha1Provider());
- keyMaker(new AesKeyMaker((AesProvider) encProvider()));
- }
-
- public EncryptionType eType() {
- return EncryptionType.AES256_CTS_HMAC_SHA1_96;
- }
-
- public CheckSumType checksumType() {
- return CheckSumType.HMAC_SHA1_96_AES256;
- }
-
- @Override
- public int checksumSize() {
- return 96 / 8;
- }
-}
http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/Camellia128CtsCmacEnc.java
----------------------------------------------------------------------
diff --git a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/Camellia128CtsCmacEnc.java b/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/Camellia128CtsCmacEnc.java
deleted file mode 100644
index d726391..0000000
--- a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/Camellia128CtsCmacEnc.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.kerberos.kerb.crypto.enc;
-
-import org.apache.kerberos.kerb.crypto.enc.provider.Camellia128Provider;
-import org.apache.kerberos.kerb.crypto.key.CamelliaKeyMaker;
-import org.apache.kerberos.kerb.spec.common.CheckSumType;
-import org.apache.kerberos.kerb.spec.common.EncryptionType;
-
-public class Camellia128CtsCmacEnc extends KeKiCmacEnc {
-
- public Camellia128CtsCmacEnc() {
- super(new Camellia128Provider());
- keyMaker(new CamelliaKeyMaker((Camellia128Provider) encProvider()));
- }
-
- public EncryptionType eType() {
- return EncryptionType.CAMELLIA128_CTS_CMAC;
- }
-
- public CheckSumType checksumType() {
- return CheckSumType.CMAC_CAMELLIA128;
- }
-}
http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/Camellia256CtsCmacEnc.java
----------------------------------------------------------------------
diff --git a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/Camellia256CtsCmacEnc.java b/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/Camellia256CtsCmacEnc.java
deleted file mode 100644
index 41afe1b..0000000
--- a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/Camellia256CtsCmacEnc.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.kerberos.kerb.crypto.enc;
-
-import org.apache.kerberos.kerb.crypto.enc.provider.Camellia256Provider;
-import org.apache.kerberos.kerb.crypto.key.CamelliaKeyMaker;
-import org.apache.kerberos.kerb.spec.common.CheckSumType;
-import org.apache.kerberos.kerb.spec.common.EncryptionType;
-
-public class Camellia256CtsCmacEnc extends KeKiCmacEnc {
-
- public Camellia256CtsCmacEnc() {
- super(new Camellia256Provider());
- keyMaker(new CamelliaKeyMaker((Camellia256Provider) encProvider()));
- }
-
- public EncryptionType eType() {
- return EncryptionType.CAMELLIA256_CTS_CMAC;
- }
-
- public CheckSumType checksumType() {
- return CheckSumType.CMAC_CAMELLIA256;
- }
-}
http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/Des3CbcSha1Enc.java
----------------------------------------------------------------------
diff --git a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/Des3CbcSha1Enc.java b/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/Des3CbcSha1Enc.java
deleted file mode 100644
index d461047..0000000
--- a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/Des3CbcSha1Enc.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.kerberos.kerb.crypto.enc;
-
-import org.apache.kerberos.kerb.crypto.cksum.provider.Sha1Provider;
-import org.apache.kerberos.kerb.crypto.enc.provider.Des3Provider;
-import org.apache.kerberos.kerb.crypto.key.Des3KeyMaker;
-import org.apache.kerberos.kerb.spec.common.CheckSumType;
-import org.apache.kerberos.kerb.spec.common.EncryptionType;
-
-public class Des3CbcSha1Enc extends KeKiHmacSha1Enc {
-
- public Des3CbcSha1Enc() {
- super(new Des3Provider(), new Sha1Provider());
- keyMaker(new Des3KeyMaker(this.encProvider()));
- }
-
- public EncryptionType eType() {
- return EncryptionType.DES3_CBC_SHA1;
- }
-
- public CheckSumType checksumType() {
- return CheckSumType.HMAC_SHA1_DES3;
- }
-}
http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/DesCbcCrcEnc.java
----------------------------------------------------------------------
diff --git a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/DesCbcCrcEnc.java b/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/DesCbcCrcEnc.java
deleted file mode 100644
index 5fdfd9b..0000000
--- a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/DesCbcCrcEnc.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.kerberos.kerb.crypto.enc;
-
-import org.apache.kerberos.kerb.crypto.cksum.provider.Crc32Provider;
-import org.apache.kerberos.kerb.KrbException;
-import org.apache.kerberos.kerb.spec.common.CheckSumType;
-import org.apache.kerberos.kerb.spec.common.EncryptionType;
-
-public class DesCbcCrcEnc extends DesCbcEnc {
-
- public DesCbcCrcEnc() {
- super(new Crc32Provider());
- }
-
- public EncryptionType eType() {
- return EncryptionType.DES_CBC_CRC;
- }
-
- public CheckSumType checksumType() {
- return CheckSumType.CRC32;
- }
-
- @Override
- public byte[] encrypt(byte[] data, byte[] key, int usage) throws KrbException {
- byte[] iv = new byte[encProvider().blockSize()];
- System.arraycopy(key, 0, iv, 0, key.length);
- return encrypt(data, key, iv, usage);
- }
-
- @Override
- public byte[] decrypt(byte[] cipher, byte[] key, int usage)
- throws KrbException {
- byte[] iv = new byte[encProvider().blockSize()];
- System.arraycopy(key, 0, iv, 0, key.length);
- return decrypt(cipher, key, iv, usage);
- }
-}
http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/DesCbcEnc.java
----------------------------------------------------------------------
diff --git a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/DesCbcEnc.java b/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/DesCbcEnc.java
deleted file mode 100644
index cbca17f..0000000
--- a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/DesCbcEnc.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.kerberos.kerb.crypto.enc;
-
-import org.apache.kerberos.kerb.KrbErrorCode;
-import org.apache.kerberos.kerb.crypto.Confounder;
-import org.apache.kerberos.kerb.crypto.cksum.HashProvider;
-import org.apache.kerberos.kerb.crypto.enc.provider.DesProvider;
-import org.apache.kerberos.kerb.crypto.key.DesKeyMaker;
-import org.apache.kerberos.kerb.KrbException;
-
-abstract class DesCbcEnc extends AbstractEncTypeHandler {
-
- public DesCbcEnc(HashProvider hashProvider) {
- super(new DesProvider(), hashProvider);
- keyMaker(new DesKeyMaker(this.encProvider()));
- }
-
- @Override
- protected void encryptWith(byte[] workBuffer, int[] workLens,
- byte[] key, byte[] iv, int usage) throws KrbException {
- int confounderLen = workLens[0];
- int checksumLen = workLens[1];
- int dataLen = workLens[2];
- int paddingLen = workLens[3];
-
- // confounder
- byte[] confounder = Confounder.makeBytes(confounderLen);
- System.arraycopy(confounder, 0, workBuffer, 0, confounderLen);
-
- // padding
- for (int i = confounderLen + checksumLen + dataLen; i < paddingLen; ++i) {
- workBuffer[i] = 0;
- }
-
- // checksum
- hashProvider().hash(workBuffer);
- byte[] cksum = hashProvider().output();
- System.arraycopy(cksum, 0, workBuffer, confounderLen, checksumLen);
-
- encProvider().encrypt(key, iv, workBuffer);
- }
-
- @Override
- protected byte[] decryptWith(byte[] workBuffer, int[] workLens,
- byte[] key, byte[] iv, int usage) throws KrbException {
- int confounderLen = workLens[0];
- int checksumLen = workLens[1];
- int dataLen = workLens[2];
-
- encProvider().decrypt(key, iv, workBuffer);
-
- byte[] checksum = new byte[checksumLen];
- for (int i = 0; i < checksumLen; i++) {
- checksum[i] = workBuffer[confounderLen + i];
- workBuffer[confounderLen + i] = 0;
- }
-
- hashProvider().hash(workBuffer);
- byte[] newChecksum = hashProvider().output();
- if (! checksumEqual(checksum, newChecksum)) {
- throw new KrbException(KrbErrorCode.KRB_AP_ERR_BAD_INTEGRITY);
- }
-
- byte[] data = new byte[dataLen];
- System.arraycopy(workBuffer, confounderLen + checksumLen,
- data, 0, dataLen);
-
- return data;
- }
-}
http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/DesCbcMd4Enc.java
----------------------------------------------------------------------
diff --git a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/DesCbcMd4Enc.java b/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/DesCbcMd4Enc.java
deleted file mode 100644
index 494091e..0000000
--- a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/DesCbcMd4Enc.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.kerberos.kerb.crypto.enc;
-
-import org.apache.kerberos.kerb.crypto.cksum.provider.Md4Provider;
-import org.apache.kerberos.kerb.spec.common.CheckSumType;
-import org.apache.kerberos.kerb.spec.common.EncryptionType;
-
-public class DesCbcMd4Enc extends DesCbcEnc {
-
- public DesCbcMd4Enc() {
- super(new Md4Provider());
- }
-
- public EncryptionType eType() {
- return EncryptionType.DES_CBC_MD4;
- }
-
- public CheckSumType checksumType() {
- return CheckSumType.RSA_MD4_DES;
- }
-}
http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/DesCbcMd5Enc.java
----------------------------------------------------------------------
diff --git a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/DesCbcMd5Enc.java b/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/DesCbcMd5Enc.java
deleted file mode 100644
index fb5ec2b..0000000
--- a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/DesCbcMd5Enc.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.kerberos.kerb.crypto.enc;
-
-import org.apache.kerberos.kerb.crypto.cksum.provider.Md5Provider;
-import org.apache.kerberos.kerb.spec.common.CheckSumType;
-import org.apache.kerberos.kerb.spec.common.EncryptionType;
-
-public class DesCbcMd5Enc extends DesCbcEnc {
-
- public DesCbcMd5Enc() {
- super(new Md5Provider());
- }
-
- public EncryptionType eType() {
- return EncryptionType.DES_CBC_MD5;
- }
-
- public CheckSumType checksumType() {
- return CheckSumType.RSA_MD5_DES;
- }
-}
http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/EncryptProvider.java
----------------------------------------------------------------------
diff --git a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/EncryptProvider.java b/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/EncryptProvider.java
deleted file mode 100644
index 5dc1f18..0000000
--- a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/EncryptProvider.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.kerberos.kerb.crypto.enc;
-
-import org.apache.kerberos.kerb.KrbException;
-
-/**
- * krb5_enc_provider
- */
-public interface EncryptProvider {
-
- public int keyInputSize(); //input size to make key
- public int keySize(); //output key size
- public int blockSize(); //crypto block size
-
- public void encrypt(byte[] key, byte[] cipherState, byte[] data) throws KrbException;
- public void decrypt(byte[] key, byte[] cipherState, byte[] data) throws KrbException;
- public void encrypt(byte[] key, byte[] data) throws KrbException;
- public void decrypt(byte[] key, byte[] data) throws KrbException;
- public byte[] cbcMac(byte[] key, byte[] iv, byte[] data) throws KrbException;
- public boolean supportCbcMac();
-
- public byte[] initState(byte[] key, int keyUsage);
- public void cleanState();
- public void cleanKey();
-}
http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/KeKiCmacEnc.java
----------------------------------------------------------------------
diff --git a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/KeKiCmacEnc.java b/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/KeKiCmacEnc.java
deleted file mode 100644
index f4ad9be..0000000
--- a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/KeKiCmacEnc.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.kerberos.kerb.crypto.enc;
-
-import org.apache.kerberos.kerb.crypto.Cmac;
-import org.apache.kerberos.kerb.KrbException;
-
-public abstract class KeKiCmacEnc extends KeKiEnc {
-
- public KeKiCmacEnc(EncryptProvider encProvider) {
- super(encProvider, null);
- }
-
- @Override
- public int paddingSize() {
- return 0;
- }
-
- @Override
- public int checksumSize() {
- return encProvider().blockSize();
- }
-
- @Override
- protected byte[] makeChecksum(byte[] key, byte[] data, int hashSize)
- throws KrbException {
-
- // generate hash
- byte[] hash = Cmac.cmac(encProvider(), key, data);
-
- // truncate hash
- byte[] output = new byte[hashSize];
- System.arraycopy(hash, 0, output, 0, hashSize);
- return output;
- }
-}
http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/KeKiEnc.java
----------------------------------------------------------------------
diff --git a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/KeKiEnc.java b/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/KeKiEnc.java
deleted file mode 100644
index faaeb38..0000000
--- a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/KeKiEnc.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.kerberos.kerb.crypto.enc;
-
-import org.apache.kerberos.kerb.KrbErrorCode;
-import org.apache.kerberos.kerb.crypto.BytesUtil;
-import org.apache.kerberos.kerb.crypto.Confounder;
-import org.apache.kerberos.kerb.crypto.cksum.HashProvider;
-import org.apache.kerberos.kerb.crypto.key.DkKeyMaker;
-import org.apache.kerberos.kerb.KrbException;
-
-public abstract class KeKiEnc extends AbstractEncTypeHandler {
-
- public KeKiEnc(EncryptProvider encProvider,
- HashProvider hashProvider) {
- super(encProvider, hashProvider);
- }
-
- @Override
- public int paddingSize() {
- return 0;
- }
-
-
- @Override
- protected void encryptWith(byte[] workBuffer, int[] workLens,
- byte[] key, byte[] iv, int usage) throws KrbException {
- int confounderLen = workLens[0];
- int checksumLen = workLens[1];
- int inputLen = workLens[2];
- int paddingLen = workLens[3];
-
- byte[] Ke, Ki;
- 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[4] = (byte) 0xaa;
- Ke = ((DkKeyMaker) keyMaker()).dk(key, constant);
- constant[4] = (byte) 0x55;
- Ki = ((DkKeyMaker) keyMaker()).dk(key, constant);
-
- /**
- * Instead of E(Confounder | Checksum | Plaintext | Padding),
- * E(Confounder | Plaintext | Padding) | Checksum,
- * so need to adjust the workBuffer arrangement
- */
-
- byte[] tmpEnc = new byte[confounderLen + inputLen + paddingLen];
- // confounder
- byte[] confounder = Confounder.makeBytes(confounderLen);
- System.arraycopy(confounder, 0, tmpEnc, 0, confounderLen);
-
- // data
- System.arraycopy(workBuffer, confounderLen + checksumLen,
- tmpEnc, confounderLen, inputLen);
-
- // padding
- for (int i = confounderLen + inputLen; i < paddingLen; ++i) {
- tmpEnc[i] = 0;
- }
-
- // checksum & encrypt
- byte[] checksum;
- 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);
- }
-
- @Override
- protected byte[] decryptWith(byte[] workBuffer, int[] workLens,
- byte[] key, byte[] iv, int usage) throws KrbException {
- int confounderLen = workLens[0];
- int checksumLen = workLens[1];
- int dataLen = workLens[2];
-
- byte[] Ke, Ki;
- byte[] constant = new byte[5];
- BytesUtil.int2bytes(usage, constant, 0, true);
- constant[4] = (byte) 0xaa;
- Ke = ((DkKeyMaker) keyMaker()).dk(key, constant);
- constant[4] = (byte) 0x55;
- Ki = ((DkKeyMaker) keyMaker()).dk(key, constant);
-
- // decrypt and verify checksum
-
- byte[] tmpEnc = new byte[confounderLen + dataLen];
- System.arraycopy(workBuffer, 0,
- tmpEnc, 0, confounderLen + dataLen);
- byte[] checksum = new byte[checksumLen];
- System.arraycopy(workBuffer, confounderLen + dataLen,
- checksum, 0, checksumLen);
-
- byte[] newChecksum;
- encProvider().decrypt(Ke, iv, tmpEnc);
- newChecksum = makeChecksum(Ki, tmpEnc, checksumLen);
-
- if (! checksumEqual(checksum, newChecksum)) {
- throw new KrbException(KrbErrorCode.KRB_AP_ERR_BAD_INTEGRITY);
- }
-
- byte[] data = new byte[dataLen];
- System.arraycopy(tmpEnc, confounderLen, data, 0, dataLen);
- return data;
- }
-
- protected abstract byte[] makeChecksum(byte[] key, byte[] data, int hashSize)
- throws KrbException;
-}
http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/KeKiHmacSha1Enc.java
----------------------------------------------------------------------
diff --git a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/KeKiHmacSha1Enc.java b/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/KeKiHmacSha1Enc.java
deleted file mode 100644
index c731248..0000000
--- a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/KeKiHmacSha1Enc.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.kerberos.kerb.crypto.enc;
-
-import org.apache.kerberos.kerb.crypto.Hmac;
-import org.apache.kerberos.kerb.crypto.cksum.HashProvider;
-import org.apache.kerberos.kerb.KrbException;
-
-public abstract class KeKiHmacSha1Enc extends KeKiEnc {
-
- public KeKiHmacSha1Enc(EncryptProvider encProvider,
- HashProvider hashProvider) {
- super(encProvider, hashProvider);
- }
-
- @Override
- public int paddingSize() {
- return 0;
- }
-
- @Override
- protected byte[] makeChecksum(byte[] key, byte[] data, int hashSize)
- throws KrbException {
-
- // generate hash
- byte[] hash = Hmac.hmac(hashProvider(), key, data);
-
- // truncate hash
- byte[] output = new byte[hashSize];
- System.arraycopy(hash, 0, output, 0, hashSize);
- return output;
- }
-}
http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/Rc4HmacEnc.java
----------------------------------------------------------------------
diff --git a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/Rc4HmacEnc.java b/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/Rc4HmacEnc.java
deleted file mode 100644
index 27d660c..0000000
--- a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/Rc4HmacEnc.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.kerberos.kerb.crypto.enc;
-
-import org.apache.kerberos.kerb.KrbErrorCode;
-import org.apache.kerberos.kerb.crypto.BytesUtil;
-import org.apache.kerberos.kerb.crypto.Confounder;
-import org.apache.kerberos.kerb.crypto.Rc4;
-import org.apache.kerberos.kerb.crypto.Hmac;
-import org.apache.kerberos.kerb.crypto.cksum.provider.Md5Provider;
-import org.apache.kerberos.kerb.crypto.enc.provider.Rc4Provider;
-import org.apache.kerberos.kerb.crypto.key.Rc4KeyMaker;
-import org.apache.kerberos.kerb.KrbException;
-import org.apache.kerberos.kerb.spec.common.CheckSumType;
-import org.apache.kerberos.kerb.spec.common.EncryptionType;
-
-public class Rc4HmacEnc extends AbstractEncTypeHandler {
- private boolean exportable;
-
- public Rc4HmacEnc() {
- this(false);
- }
-
- public Rc4HmacEnc(boolean exportable) {
- super(new Rc4Provider(), new Md5Provider());
- keyMaker(new Rc4KeyMaker(this.encProvider()));
- this.exportable = exportable;
- }
-
- public EncryptionType eType() {
- return EncryptionType.ARCFOUR_HMAC;
- }
-
- @Override
- public int confounderSize() {
- return 8;
- }
-
- @Override
- public int paddingSize() {
- return 0;
- }
-
- public CheckSumType checksumType() {
- return CheckSumType.HMAC_MD5_ARCFOUR;
- }
-
- protected void encryptWith(byte[] workBuffer, int[] workLens,
- byte[] key, byte[] iv, int usage) throws KrbException {
- int confounderLen = workLens[0];
- int checksumLen = workLens[1];
- int dataLen = workLens[2];
-
- /**
- * Instead of E(Confounder | Checksum | Plaintext | Padding),
- * Checksum | E(Confounder | Plaintext)
- */
-
- // confounder
- byte[] confounder = Confounder.makeBytes(confounderLen);
- System.arraycopy(confounder, 0, workBuffer, checksumLen, confounderLen);
-
- // no padding
-
- /* checksum and encryption */
- byte[] usageKey = makeUsageKey(key, usage);
-
- byte[] checksum = Hmac.hmac(hashProvider(), usageKey, workBuffer,
- checksumLen, confounderLen + dataLen);
-
- byte[] encKey = makeEncKey(usageKey, checksum);
-
- byte[] tmpEnc = new byte[confounderLen + dataLen];
- System.arraycopy(workBuffer, checksumLen,
- tmpEnc, 0, confounderLen + dataLen);
- encProvider().encrypt(encKey, iv, tmpEnc);
- System.arraycopy(checksum, 0, workBuffer, 0, checksumLen);
- System.arraycopy(tmpEnc, 0, workBuffer, checksumLen, tmpEnc.length);
- }
-
- protected byte[] makeUsageKey(byte[] key, int usage) throws KrbException {
- byte[] salt = Rc4.getSalt(usage, exportable);
- byte[] usageKey = Hmac.hmac(hashProvider(), key, salt);
- return usageKey;
- }
-
- protected byte[] makeEncKey(byte[] usageKey, byte[] checksum) throws KrbException {
- byte[] tmpKey = usageKey;
-
- if (exportable) {
- tmpKey = BytesUtil.duplicate(usageKey);
- for (int i = 0; i < 9; ++i) {
- tmpKey[i + 7] = (byte) 0xab;
- }
- }
-
- byte[] encKey = Hmac.hmac(hashProvider(), tmpKey, checksum);
- return encKey;
- }
-
- @Override
- protected byte[] decryptWith(byte[] workBuffer, int[] workLens,
- byte[] key, byte[] iv, int usage) throws KrbException {
- int confounderLen = workLens[0];
- int checksumLen = workLens[1];
- int dataLen = workLens[2];
-
- /* checksum and decryption */
- byte[] usageKey = makeUsageKey(key, usage);
-
- byte[] checksum = new byte[checksumLen];
- System.arraycopy(workBuffer, 0, checksum, 0, checksumLen);
-
- byte[] encKey = makeEncKey(usageKey, checksum);
-
- byte[] tmpEnc = new byte[confounderLen + dataLen];
- System.arraycopy(workBuffer, checksumLen,
- tmpEnc, 0, confounderLen + dataLen);
- encProvider().decrypt(encKey, iv, tmpEnc);
-
- byte[] newChecksum = Hmac.hmac(hashProvider(), usageKey, tmpEnc);
- if (! checksumEqual(checksum, newChecksum)) {
- throw new KrbException(KrbErrorCode.KRB_AP_ERR_BAD_INTEGRITY);
- }
-
- byte[] data = new byte[dataLen];
- System.arraycopy(tmpEnc, confounderLen,
- data, 0, dataLen);
-
- return data;
- }
-}
http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/ceacb982/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/Rc4HmacExpEnc.java
----------------------------------------------------------------------
diff --git a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/Rc4HmacExpEnc.java b/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/Rc4HmacExpEnc.java
deleted file mode 100644
index 63ea752..0000000
--- a/haox-kerb/kerb-crypto/src/main/java/org/apache/kerberos/kerb/crypto/enc/Rc4HmacExpEnc.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.kerberos.kerb.crypto.enc;
-
-import org.apache.kerberos.kerb.spec.common.EncryptionType;
-
-public class Rc4HmacExpEnc extends Rc4HmacEnc {
-
- public Rc4HmacExpEnc() {
- super(true);
- }
-
- public EncryptionType eType() {
- return EncryptionType.ARCFOUR_HMAC_EXP;
- }
-}