use of org.apache.kerby.kerberos.kerb.type.base.EncryptionType in project dcos-commons by mesosphere.
the class KrbInputStream method readKey.
public EncryptionKey readKey() throws IOException {
int eType = readShort();
EncryptionType encType = EncryptionType.fromValue(eType);
byte[] keyData = readCountedOctets();
if (encType == EncryptionType.NONE || keyData == null) {
return null;
}
EncryptionKey key = new EncryptionKey(encType, keyData);
return key;
}
use of org.apache.kerby.kerberos.kerb.type.base.EncryptionType in project cloudbreak by hortonworks.
the class UserKeytabGenerator method toKeytabEntry.
private KeytabEntry toKeytabEntry(String user, String realm, ActorKerberosKey actorKerberosKey) {
requireNonNull(user, "user must not be null");
requireNonNull(realm, "realm must not be null");
requireNonNull(actorKerberosKey, "actorKerberosKey must not be null");
PrincipalName principalName = new PrincipalName(user + '@' + realm);
EncryptionType encryptionType = EncryptionType.fromValue(actorKerberosKey.getKeyType());
byte[] key = Base64.getDecoder().decode(actorKerberosKey.getKeyValue());
EncryptionKey encryptionKey = new EncryptionKey(encryptionType, key);
KerberosTime time = new KerberosTime(clock.getCurrentTimeMillis());
return new KeytabEntry(principalName, time, KEY_VERSION_NUMBER_ZERO, encryptionKey);
}
Aggregations