use of org.apache.directory.server.kerberos.shared.keytab.KeytabEntry in project karaf by apache.
the class Krb5LoginModuleTest method createKeytab.
private String createKeytab() throws Exception {
File file = folder.newFile("test.keytab");
List<KeytabEntry> entries = new ArrayList<>();
entries.add(createKeytabEntry());
Keytab writer = Keytab.getInstance();
writer.setEntries(entries);
writer.write(file);
return file.getAbsolutePath();
}
use of org.apache.directory.server.kerberos.shared.keytab.KeytabEntry in project karaf by apache.
the class Krb5LoginModuleTest method createKeytabEntry.
private KeytabEntry createKeytabEntry() throws ParseException {
String principalName = "hnelson@EXAMPLE.COM";
int principalType = 1;
String zuluTime = "20070217235745Z";
Date date = null;
synchronized (KerberosUtils.UTC_DATE_FORMAT) {
date = KerberosUtils.UTC_DATE_FORMAT.parse(zuluTime);
}
KerberosTime timeStamp = new KerberosTime(date.getTime());
byte keyVersion = 1;
String passPhrase = "secret";
Map<EncryptionType, EncryptionKey> keys = KerberosKeyFactory.getKerberosKeys(principalName, passPhrase);
EncryptionKey key = keys.get(EncryptionType.AES128_CTS_HMAC_SHA1_96);
return new KeytabEntry(principalName, principalType, timeStamp, keyVersion, key);
}
Aggregations