■ ■ ■ ■ ■ ■
aardwolf/authentication/kerberos/gssapi.py
| skipped 5 lines |
6 | 6 | | |
7 | 7 | | from minikerberos.protocol.constants import EncryptionType |
8 | 8 | | from minikerberos.protocol import encryption |
9 | | - | from minikerberos.crypto.hashing import md5, hmac_md5 |
10 | | - | from minikerberos.crypto.RC4 import RC4 |
| 9 | + | from unicrypto import hmac |
| 10 | + | from unicrypto.hashlib import md5 |
| 11 | + | from unicrypto.symmetric import RC4 |
11 | 12 | | |
12 | 13 | | #TODO: RC4 support! |
13 | 14 | | |
| skipped 191 lines |
205 | 206 | | else: |
206 | 207 | | mic.SND_SEQ = sequenceNumber.to_bytes(4, 'big', signed = False) + b'\xff'*4 |
207 | 208 | | |
208 | | - | Ksign_ctx = hmac_md5(self.session_key.contents) |
| 209 | + | Ksign_ctx = hmac_md5(self.session_key.contents, digestmod='md5') |
209 | 210 | | Ksign_ctx.update(b'signaturekey\0') |
210 | 211 | | Ksign = Ksign_ctx.digest() |
211 | 212 | | |
212 | 213 | | id = 15 |
213 | 214 | | temp = md5( id.to_bytes(4, 'little', signed = False) + mic.to_bytes()[:8] ).digest() |
214 | | - | chksum_ctx = hmac_md5(Ksign) |
| 215 | + | chksum_ctx = hmac_md5(Ksign, digestmod='md5') |
215 | 216 | | chksum_ctx.update(temp) |
216 | 217 | | mic.SGN_CKSUM = chksum_ctx.digest()[:8] |
217 | 218 | | |
218 | 219 | | id = 0 |
219 | | - | temp = hmac_md5(self.session_key.contents) |
| 220 | + | temp = hmac_md5(self.session_key.contents, digestmod='md5') |
220 | 221 | | temp.update(id.to_bytes(4, 'little', signed = False)) |
221 | 222 | | |
222 | | - | Kseq_ctx = hmac_md5(temp.digest()) |
| 223 | + | Kseq_ctx = hmac_md5(temp.digest(), digestmod='md5') |
223 | 224 | | Kseq_ctx.update(mic.SGN_CKSUM) |
224 | 225 | | Kseq = Kseq_ctx.digest() |
225 | 226 | | |
| skipped 38 lines |
264 | 265 | | # #testing purposes only, pls remove |
265 | 266 | | |
266 | 267 | | |
267 | | - | temp = hmac_md5(self.session_key.contents) |
| 268 | + | temp = hmac.new(self.session_key.contents, digestmod='md5') |
268 | 269 | | temp.update(b'signaturekey\0') |
269 | 270 | | Ksign = temp.digest() |
270 | 271 | | |
| skipped 5 lines |
276 | 277 | | klocal += bytes([b ^ 0xf0]) |
277 | 278 | | |
278 | 279 | | id = 0 |
279 | | - | temp = hmac_md5(klocal) |
| 280 | + | temp = hmac.new(klocal, digestmod='md5') |
280 | 281 | | temp.update(id.to_bytes(4, 'little', signed = False)) |
281 | | - | temp = hmac_md5(temp.digest()) |
| 282 | + | temp = hmac.new(temp.digest(), digestmod='md5') |
282 | 283 | | temp.update(seq_num.to_bytes(4, 'big', signed = False)) |
283 | 284 | | Kcrypt = temp.digest() |
284 | 285 | | |
285 | | - | temp = hmac_md5(Ksign) |
| 286 | + | temp = hmac.new(Ksign, digestmod='md5') |
286 | 287 | | temp.update(Sgn_Cksum) |
287 | 288 | | token.SGN_CKSUM = temp.digest()[:8] |
288 | 289 | | |
289 | 290 | | id = 0 |
290 | | - | temp = hmac_md5(self.session_key.contents) |
| 291 | + | temp = hmac.new(self.session_key.contents, digestmod='md5') |
291 | 292 | | temp.update(id.to_bytes(4, 'little', signed = False)) |
292 | | - | temp = hmac_md5(temp.digest()) |
| 293 | + | temp = hmac.new(temp.digest(), digestmod='md5') |
293 | 294 | | temp.update(token.SGN_CKSUM) |
294 | 295 | | Kseq = temp.digest() |
295 | 296 | | |
| skipped 13 lines |
309 | 310 | | wrap = GSSWRAP_RC4.from_bytes(hdr) |
310 | 311 | | |
311 | 312 | | id = 0 |
312 | | - | temp = hmac_md5(self.session_key.contents) |
| 313 | + | temp = hmac.new(self.session_key.contents, digestmod='md5') |
313 | 314 | | temp.update(id.to_bytes(4, 'little', signed = False)) |
314 | | - | temp = hmac_md5(temp.digest()) |
| 315 | + | temp = hmac.new(temp.digest(), digestmod='md5') |
315 | 316 | | temp.update(wrap.SGN_CKSUM) |
316 | 317 | | Kseq = temp.digest() |
317 | 318 | | |
318 | 319 | | snd_seq = RC4(Kseq).encrypt(wrap.SND_SEQ) |
319 | 320 | | |
320 | 321 | | id = 0 |
321 | | - | temp = hmac_md5(klocal) |
| 322 | + | temp = hmac.new(klocal, digestmod='md5') |
322 | 323 | | temp.update(id.to_bytes(4, 'little', signed = False)) |
323 | | - | temp = hmac_md5(temp.digest()) |
| 324 | + | temp = hmac.new(temp.digest(), digestmod='md5') |
324 | 325 | | temp.update(snd_seq[:4]) |
325 | 326 | | Kcrypt = temp.digest() |
326 | 327 | | |
| skipped 4 lines |
331 | 332 | | id = 13 |
332 | 333 | | Sgn_Cksum_calc = md5(id.to_bytes(4, 'little', signed = False) + wrap.to_bytes()[:8] + dec_cofounder + dec_data).digest() |
333 | 334 | | |
334 | | - | temp = hmac_md5(Ksign) |
| 335 | + | temp = hmac.new(Ksign, digestmod='md5') |
335 | 336 | | temp.update(Sgn_Cksum_calc) |
336 | 337 | | Sgn_Cksum_calc = temp.digest()[:8] |
337 | 338 | | |
| skipped 206 lines |