mirror of
https://github.com/ThatNotEasy/PlayReadyProxy-API.git
synced 2026-04-02 18:48:25 +00:00
18 lines
650 B
Python
18 lines
650 B
Python
from ecpy.curves import Point, Curve
|
|
|
|
from modules.pyplayready.crypto.ecc_key import ECCKey
|
|
from modules.pyplayready.crypto.elgamal import ElGamal
|
|
|
|
|
|
class XmlKey:
|
|
def __init__(self):
|
|
self._shared_point = ECCKey.generate()
|
|
self.shared_key_x = self._shared_point.key.pointQ.x
|
|
self.shared_key_y = self._shared_point.key.pointQ.y
|
|
|
|
self._shared_key_x_bytes = ElGamal.to_bytes(int(self.shared_key_x))
|
|
self.aes_iv = self._shared_key_x_bytes[:16]
|
|
self.aes_key = self._shared_key_x_bytes[16:]
|
|
|
|
def get_point(self, curve: Curve) -> Point:
|
|
return Point(self.shared_key_x, self.shared_key_y, curve) |