Search in sources :

Example 1 with EncryptionType

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;
}
Also used : EncryptionType(org.apache.kerby.kerberos.kerb.type.base.EncryptionType) EncryptionKey(org.apache.kerby.kerberos.kerb.type.base.EncryptionKey)

Example 2 with EncryptionType

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);
}
Also used : EncryptionType(org.apache.kerby.kerberos.kerb.type.base.EncryptionType) KerberosTime(org.apache.kerby.kerberos.kerb.type.KerberosTime) EncryptionKey(org.apache.kerby.kerberos.kerb.type.base.EncryptionKey) PrincipalName(org.apache.kerby.kerberos.kerb.type.base.PrincipalName) KeytabEntry(org.apache.kerby.kerberos.kerb.keytab.KeytabEntry)

Aggregations

EncryptionKey (org.apache.kerby.kerberos.kerb.type.base.EncryptionKey)2 EncryptionType (org.apache.kerby.kerberos.kerb.type.base.EncryptionType)2 KeytabEntry (org.apache.kerby.kerberos.kerb.keytab.KeytabEntry)1 KerberosTime (org.apache.kerby.kerberos.kerb.type.KerberosTime)1 PrincipalName (org.apache.kerby.kerberos.kerb.type.base.PrincipalName)1