You are viewing a plain text version of this content. The canonical link for it is here.
Posted to kerby@directory.apache.org by Marc Boorshtein <mb...@gmail.com> on 2018/06/08 18:40:46 UTC
Create keytab through Java
Hello, I'm trying to build a keytab using a user's principal and password.
I've got the following sample code:
https://stackoverflow.com/questions/23269894/can-i-generate-my-own-keytab-programmatically-in-java
which
is pretty old. I'm integrating it with kerby 1.1.1 and it doesn't look
like KerberosKeyFactory exists anymore. Is there an example of how to do
this with kerby 1.1.1?
Thanks
Marc
RE: Create keytab through Java
Posted by "Li, Jiajia" <ji...@intel.com>.
The example of creating keytab with principal and password:
List<EncryptionKey> keys = EncryptionUtil.generateKeys(principal, password, encryptionTypes);
List<KeytabEntry> lstEntries = new ArrayList<KeytabEntry>();
for (EncryptionKey key : keys) {
KeytabEntry keytabEntry = new KeytabEntry(
principal, 1, new KerberosTime(), (byte) 1, key);
lstEntries.add(keytabEntry);
}
Keytab keytab = new Keytab();
keytab.addKeytabEntries(lstEntries);
keytab.store(new File(keytabFileName));
Regards,
Jiajia
-----Original Message-----
From: Marc Boorshtein [mailto:mboorshtein@gmail.com]
Sent: Saturday, June 9, 2018 2:41 AM
To: kerby@directory.apache.org
Subject: Create keytab through Java
Hello, I'm trying to build a keytab using a user's principal and password.
I've got the following sample code:
https://stackoverflow.com/questions/23269894/can-i-generate-my-own-keytab-programmatically-in-java
which
is pretty old. I'm integrating it with kerby 1.1.1 and it doesn't look like KerberosKeyFactory exists anymore. Is there an example of how to do this with kerby 1.1.1?
Thanks
Marc