use of org.apache.kerby.kerberos.kerb.type.KerberosTime in project hadoop by apache.
the class TestKerberosUtil method createKeyTab.
private void createKeyTab(String fileName, String[] principalNames) throws IOException {
//create a test keytab file
List<KeytabEntry> lstEntries = new ArrayList<KeytabEntry>();
for (String principal : principalNames) {
// duplicate principals
for (int kvno = 1; kvno <= 3; kvno++) {
EncryptionKey key = new EncryptionKey(EncryptionType.NONE, "samplekey1".getBytes(), kvno);
KeytabEntry keytabEntry = new KeytabEntry(new PrincipalName(principal), new KerberosTime(), (byte) 1, key);
lstEntries.add(keytabEntry);
}
}
Keytab keytab = new Keytab();
keytab.addKeytabEntries(lstEntries);
keytab.store(new File(testKeytab));
}
Aggregations