本文整理了Java中org.apache.kerby.kerberos.kerb.keytab.Keytab.getKeytabEntries()
方法的一些代码示例,展示了Keytab.getKeytabEntries()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Keytab.getKeytabEntries()
方法的具体详情如下:
包路径:org.apache.kerby.kerberos.kerb.keytab.Keytab
类名称:Keytab
方法名:getKeytabEntries
暂无
代码示例来源:origin: org.apache.hadoop/hadoop-common
/**
* Dump a keytab: list all principals.
*
* @param keytabFile the keytab file
* @throws IOException IO problems
*/
private void dumpKeytab(File keytabFile) throws IOException {
title("Examining keytab %s", keytabFile);
File kt = keytabFile.getCanonicalFile();
verifyFileIsValid(kt, CAT_KERBEROS, "keytab");
Keytab loadKeytab = Keytab.loadKeytab(kt);
List<PrincipalName> principals = loadKeytab.getPrincipals();
println("keytab principal count: %d", principals.size());
int entrySize = 0;
for (PrincipalName princ : principals) {
List<KeytabEntry> entries = loadKeytab.getKeytabEntries(princ);
entrySize = entrySize + entries.size();
for (KeytabEntry entry : entries) {
EncryptionKey key = entry.getKey();
println(" %s: version=%d expires=%s encryption=%s",
entry.getPrincipal(),
entry.getKvno(),
entry.getTimestamp(),
key.getKeyType());
}
}
println("keytab entry count: %d", entrySize);
endln();
}
代码示例来源:origin: org.apache.kerby/kerb-util
@Override
public void removeKeytabEntries(PrincipalName principal, int kvno) {
List<KeytabEntry> entries = getKeytabEntries(principal);
for (KeytabEntry entry : entries) {
if (entry.getKvno() == kvno) {
removeKeytabEntry(entry);
}
}
}
代码示例来源:origin: apache/directory-kerby
@Override
public void removeKeytabEntries(PrincipalName principal, int kvno) {
List<KeytabEntry> entries = getKeytabEntries(principal);
for (KeytabEntry entry : entries) {
if (entry.getKvno() == kvno) {
removeKeytabEntry(entry);
}
}
}
代码示例来源:origin: org.apache.kerby/client-tool
List<PrincipalName> principals = keytab.getPrincipals();
for (PrincipalName principal : principals) {
List<KeytabEntry> keytabEntries = keytab.getKeytabEntries(principal);
for (KeytabEntry entry : keytabEntries) {
StringBuilder sb = new StringBuilder();
代码示例来源:origin: apache/directory-kerby
List<PrincipalName> principals = keytab.getPrincipals();
for (PrincipalName principal : principals) {
List<KeytabEntry> keytabEntries = keytab.getKeytabEntries(principal);
for (KeytabEntry entry : keytabEntries) {
StringBuilder sb = new StringBuilder();
代码示例来源:origin: apache/directory-kerby
@Override
public EncryptionKey getKey(PrincipalName principal, EncryptionType keyType) {
List<KeytabEntry> entries = getKeytabEntries(principal);
for (KeytabEntry ke : entries) {
if (ke.getKey().getKeyType() == keyType) {
return ke.getKey();
}
}
// Maybe we have a key stored under a different name for the same type
int keyTypeValue = keyType.getValue();
for (KeytabEntry ke : entries) {
if (keyTypeValue == ke.getKey().getKeyType().getValue()) {
return ke.getKey();
}
}
return null;
}
代码示例来源:origin: org.apache.kerby/kerb-util
@Override
public EncryptionKey getKey(PrincipalName principal, EncryptionType keyType) {
List<KeytabEntry> entries = getKeytabEntries(principal);
for (KeytabEntry ke : entries) {
if (ke.getKey().getKeyType() == keyType) {
return ke.getKey();
}
}
// Maybe we have a key stored under a different name for the same type
int keyTypeValue = keyType.getValue();
for (KeytabEntry ke : entries) {
if (keyTypeValue == ke.getKey().getKeyType().getValue()) {
return ke.getKey();
}
}
return null;
}
代码示例来源:origin: apache/directory-kerby
/**
* Remove all the old keys of the specified principal
* in the specified keytab file.
*
* @param keytabFile The keytab file
* @param principalName The principal name
* @throws KrbException If there is a problem in removing the old keys of the specified principal
*/
public static void removeOldKeytabEntriesOf(File keytabFile,
String principalName) throws KrbException {
Keytab keytab = loadKeytab(keytabFile);
List<KeytabEntry> entries = keytab.getKeytabEntries(
new PrincipalName(principalName));
int maxKvno = 0;
for (KeytabEntry entry : entries) {
if (maxKvno < entry.getKvno()) {
maxKvno = entry.getKvno();
}
}
for (KeytabEntry entry : entries) {
if (entry.getKvno() < maxKvno) {
keytab.removeKeytabEntry(entry);
}
}
storeKeytab(keytab, keytabFile);
}
代码示例来源:origin: org.apache.kerby/kerb-admin
/**
* Remove all the old keys of the specified principal
* in the specified keytab file.
*
* @param keytabFile The keytab file
* @param principalName The principal name
* @throws KrbException If there is a problem in removing the old keys of the specified principal
*/
public static void removeOldKeytabEntriesOf(File keytabFile,
String principalName) throws KrbException {
Keytab keytab = loadKeytab(keytabFile);
List<KeytabEntry> entries = keytab.getKeytabEntries(
new PrincipalName(principalName));
int maxKvno = 0;
for (KeytabEntry entry : entries) {
if (maxKvno < entry.getKvno()) {
maxKvno = entry.getKvno();
}
}
for (KeytabEntry entry : entries) {
if (entry.getKvno() < maxKvno) {
keytab.removeKeytabEntry(entry);
}
}
storeKeytab(keytab, keytabFile);
}
内容来源于网络,如有侵权,请联系作者删除!