directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dran...@apache.org
Subject [3/3] directory-kerby git commit: DIRKRB-222 Implement a new random2Key function in EncryptionHandler. Contributed by Yaning
Date Thu, 23 Apr 2015 09:13:25 GMT
DIRKRB-222 Implement a new random2Key function in EncryptionHandler. Contributed by Yaning


Project: http://git-wip-us.apache.org/repos/asf/directory-kerby/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-kerby/commit/7a1670bf
Tree: http://git-wip-us.apache.org/repos/asf/directory-kerby/tree/7a1670bf
Diff: http://git-wip-us.apache.org/repos/asf/directory-kerby/diff/7a1670bf

Branch: refs/heads/master
Commit: 7a1670bfdc0b7b4e6e21063e7ea806d96699e496
Parents: d633b46
Author: Drankye <drankye@gmail.com>
Authored: Fri Apr 24 01:10:04 2015 +0800
Committer: Drankye <drankye@gmail.com>
Committed: Fri Apr 24 01:10:04 2015 +0800

----------------------------------------------------------------------
 .../kerby/kerberos/kerb/crypto/EncryptionHandler.java       | 9 +++++++++
 1 file changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/7a1670bf/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/EncryptionHandler.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/EncryptionHandler.java
b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/EncryptionHandler.java
index 4c95ea5..408ae0f 100644
--- a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/EncryptionHandler.java
+++ b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/EncryptionHandler.java
@@ -200,6 +200,15 @@ public class EncryptionHandler {
         return encKey;
     }
 
+    public static EncryptionKey random2Key(EncryptionType eType, byte[] randomBytes) throws
KrbException {
+        EncTypeHandler handler = getEncHandler(eType);
+
+        byte[] randomBytes1 = randomBytes;
+        byte[] keyBytes = handler.random2Key(randomBytes1);
+        EncryptionKey encKey = new EncryptionKey(eType, keyBytes);
+        return encKey;
+    }
+
     /**
      * Generate a secure and random key seeded with an existing encryption key.
      * @param encKey


Mime
View raw message