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:[email protected]]
Sent: Saturday, June 9, 2018 2:41 AM
To: [email protected]
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