public class KerberosUtils
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private static java.util.Map<java.lang.String,java.lang.String> |
cipherAlgoMap
an order preserved map containing cipher names to the corresponding algorithm
names in the descending order of strength
|
static java.util.List<java.lang.String> |
EMPTY_PRINCIPAL_NAME
An empty list of principal names
|
static int |
NULL
A constant for integer optional values
|
private static java.util.Set<EncryptionType> |
oldEncTypes |
static java.text.SimpleDateFormat |
UTC_DATE_FORMAT
Defines a default date format with a "yyyyMMddHHmmss'Z'" pattern
|
static java.util.TimeZone |
UTC_TIME_ZONE |
| Constructor and Description |
|---|
KerberosUtils() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
getAlgoNameFromEncType(EncryptionType encType) |
static EncryptionType |
getBestEncryptionType(java.util.Set<EncryptionType> requestedTypes,
java.util.Set<EncryptionType> configuredTypes)
Get the matching encryption type from the configured types, searching
into the requested types.
|
static java.lang.String |
getEncryptionTypesString(java.util.Set<EncryptionType> encryptionTypes)
Build a list of encryptionTypes
|
static PrincipalStoreEntry |
getEntry(javax.security.auth.kerberos.KerberosPrincipal principal,
PrincipalStore store,
ErrorType errorType)
Get a PrincipalStoreEntry given a principal.
|
static javax.security.auth.kerberos.KerberosPrincipal |
getKerberosPrincipal(PrincipalName principal,
java.lang.String realm)
Constructs a KerberosPrincipal from a PrincipalName and an
optional realm
|
static java.util.List<java.lang.String> |
getNames(javax.security.auth.kerberos.KerberosPrincipal principal)
Parse a KerberosPrincipal instance and return the names.
|
static java.util.List<java.lang.String> |
getNames(java.lang.String principalNames)
Parse a PrincipalName and return the names.
|
static boolean |
isKerberosString(byte[] value) |
static boolean |
isNewEncryptionType(EncryptionType eType)
checks if the given encryption type is *new* (ref sec#3.1.3 of rfc4120)
|
static java.util.Set<EncryptionType> |
orderEtypesByStrength(java.util.Set<EncryptionType> etypes)
Order a list of EncryptionType in a decreasing strength order
|
static Authenticator |
verifyAuthHeader(ApReq authHeader,
Ticket ticket,
EncryptionKey serverKey,
long clockSkew,
ReplayCache replayCache,
boolean emptyAddressesAllowed,
java.net.InetAddress clientAddress,
CipherTextHandler lockBox,
KeyUsage authenticatorKeyUsage,
boolean isValidate)
Verifies an AuthHeader using guidelines from RFC 1510 section A.10., "KRB_AP_REQ verification."
|
public static final int NULL
public static final java.util.List<java.lang.String> EMPTY_PRINCIPAL_NAME
private static final java.util.Map<java.lang.String,java.lang.String> cipherAlgoMap
public static final java.util.TimeZone UTC_TIME_ZONE
public static final java.text.SimpleDateFormat UTC_DATE_FORMAT
private static final java.util.Set<EncryptionType> oldEncTypes
public static java.util.List<java.lang.String> getNames(javax.security.auth.kerberos.KerberosPrincipal principal)
throws java.text.ParseException
principal - The principal to be parsedjava.text.ParseException - if the name is not validpublic static java.util.List<java.lang.String> getNames(java.lang.String principalNames)
throws java.text.ParseException
java.text.ParseExceptionpublic static javax.security.auth.kerberos.KerberosPrincipal getKerberosPrincipal(PrincipalName principal, java.lang.String realm)
principal - The principal name and typerealm - The optional realmpublic static EncryptionType getBestEncryptionType(java.util.Set<EncryptionType> requestedTypes, java.util.Set<EncryptionType> configuredTypes)
requestedTypes - The client encryption typesconfiguredTypes - The configured encryption typespublic static java.lang.String getEncryptionTypesString(java.util.Set<EncryptionType> encryptionTypes)
encryptionTypes - The encryptionTypespublic static boolean isKerberosString(byte[] value)
public static java.lang.String getAlgoNameFromEncType(EncryptionType encType)
public static java.util.Set<EncryptionType> orderEtypesByStrength(java.util.Set<EncryptionType> etypes)
etypes - The ETypes to orderpublic static PrincipalStoreEntry getEntry(javax.security.auth.kerberos.KerberosPrincipal principal, PrincipalStore store, ErrorType errorType) throws KerberosException
KerberosExceptionpublic static Authenticator verifyAuthHeader(ApReq authHeader, Ticket ticket, EncryptionKey serverKey, long clockSkew, ReplayCache replayCache, boolean emptyAddressesAllowed, java.net.InetAddress clientAddress, CipherTextHandler lockBox, KeyUsage authenticatorKeyUsage, boolean isValidate) throws KerberosException
authHeader - ticket - serverKey - clockSkew - replayCache - emptyAddressesAllowed - clientAddress - lockBox - authenticatorKeyUsage - isValidate - KerberosExceptionpublic static boolean isNewEncryptionType(EncryptionType eType)
eType - the encryption type