mirror of
https://github.com/Py-KMS-Organization/py-kms.git
synced 2025-05-17 16:45:15 -04:00
uploaded version 2018_11_15 for python2
This commit is contained in:
parent
73f66ea40f
commit
b0a8ff21fb
18 changed files with 1574 additions and 791 deletions
|
@ -1,9 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import binascii
|
||||
import hashlib
|
||||
import hmac
|
||||
import random
|
||||
import struct
|
||||
|
||||
import aes
|
||||
|
@ -37,9 +35,7 @@ class kmsRequestV6(kmsRequestV5):
|
|||
|
||||
def encryptResponse(self, request, decrypted, response):
|
||||
randomSalt = self.getRandomSalt()
|
||||
sha256 = hashlib.sha256()
|
||||
sha256.update(str(randomSalt))
|
||||
result = sha256.digest()
|
||||
result = hashlib.sha256(str(randomSalt)).digest()
|
||||
|
||||
SaltC = bytearray(request['message']['salt'])
|
||||
DSaltC = bytearray(decrypted['salt'])
|
||||
|
@ -65,10 +61,10 @@ class kmsRequestV6(kmsRequestV5):
|
|||
|
||||
moo = aes.AESModeOfOperation()
|
||||
moo.aes.v6 = True
|
||||
d = moo.decrypt(SaltS, 16, moo.modeOfOperation["CBC"], self.key, moo.aes.keySize["SIZE_128"], SaltS)
|
||||
decry = moo.decrypt(SaltS, 16, moo.modeOfOperation["CBC"], self.key, moo.aes.keySize["SIZE_128"], SaltS)
|
||||
|
||||
# DSaltS
|
||||
DSaltS = bytearray(d)
|
||||
DSaltS = bytearray(decry)
|
||||
|
||||
# HMacMsg
|
||||
HMacMsg = bytearray(16)
|
||||
|
@ -105,4 +101,3 @@ class kmsRequestV6(kmsRequestV5):
|
|||
digest = sha256.digest()
|
||||
|
||||
return digest[16:]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue