Skip to content

Commit 95f4e47

Browse files
committed
Fix encoding for non-ascii char in kerberos authentication
1 parent 1e08878 commit 95f4e47

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

impacket/krb5/asn1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ class KerberosString(char.GeneralString):
125125
# TODO marc: I'm not sure how to express this constraint in the API.
126126
# For now, we will be liberal in what we accept.
127127
# subtypeSpec = constraint.PermittedAlphabetConstraint(char.IA5String())
128-
pass
128+
encoding = 'utf-8'
129129

130130
class Realm(KerberosString):
131131
pass

impacket/krb5/kerberosv5.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def getKerberosTGT(clientName, password, domain, lmhash, nthash, aesKey='', kdcH
233233
except PyAsn1Error:
234234
salt = ''
235235

236-
encryptionTypesData[etype2['etype']] = b(salt)
236+
encryptionTypesData[etype2['etype']] = salt.encode('utf-8')
237237
elif method['padata-type'] == constants.PreAuthenticationDataTypes.PA_ETYPE_INFO.value:
238238
etypes = decoder.decode(method['padata-value'], asn1Spec = ETYPE_INFO())[0]
239239
for etype in etypes:
@@ -245,7 +245,7 @@ def getKerberosTGT(clientName, password, domain, lmhash, nthash, aesKey='', kdcH
245245
except PyAsn1Error:
246246
salt = ''
247247

248-
encryptionTypesData[etype['etype']] = b(salt)
248+
encryptionTypesData[etype['etype']] = salt.encode('utf-8')
249249

250250
enctype = supportedCiphers[0]
251251

0 commit comments

Comments
 (0)