1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

tests/krb5: Allow PasswordKey_create() to use s2kparams

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Joseph Sutton 2021-11-24 11:37:35 +13:00 committed by Andrew Bartlett
parent 167bd20704
commit a560c2e9ad

View File

@ -1167,10 +1167,11 @@ class RawKerberosTest(TestCaseInTempDir):
key = kcrypto.Key(etype, contents) key = kcrypto.Key(etype, contents)
return RodcPacEncryptionKey(key, kvno) return RodcPacEncryptionKey(key, kvno)
def PasswordKey_create(self, etype=None, pwd=None, salt=None, kvno=None): def PasswordKey_create(self, etype=None, pwd=None, salt=None, kvno=None,
params=None):
self.assertIsNotNone(pwd) self.assertIsNotNone(pwd)
self.assertIsNotNone(salt) self.assertIsNotNone(salt)
key = kcrypto.string_to_key(etype, pwd, salt) key = kcrypto.string_to_key(etype, pwd, salt, params=params)
return RodcPacEncryptionKey(key, kvno) return RodcPacEncryptionKey(key, kvno)
def PasswordKey_from_etype_info2(self, creds, etype_info2, kvno=None): def PasswordKey_from_etype_info2(self, creds, etype_info2, kvno=None):
@ -1182,9 +1183,11 @@ class RawKerberosTest(TestCaseInTempDir):
nthash = creds.get_nt_hash() nthash = creds.get_nt_hash()
return self.SessionKey_create(etype=e, contents=nthash, kvno=kvno) return self.SessionKey_create(etype=e, contents=nthash, kvno=kvno)
params = etype_info2.get('s2kparams')
password = creds.get_password() password = creds.get_password()
return self.PasswordKey_create( return self.PasswordKey_create(
etype=e, pwd=password, salt=salt, kvno=kvno) etype=e, pwd=password, salt=salt, kvno=kvno, params=params)
def TicketDecryptionKey_from_creds(self, creds, etype=None): def TicketDecryptionKey_from_creds(self, creds, etype=None):