Add infrastructure for dealing with encryption keys
This commit is contained in:
parent
2d8a1897f0
commit
93e0676147
@ -105,6 +105,15 @@ class OMMClient2:
|
|||||||
# Determine next possible ppn
|
# Determine next possible ppn
|
||||||
next_ppn = int(pp.ppn) + 1
|
next_ppn = int(pp.ppn) + 1
|
||||||
|
|
||||||
|
def get_publickey(self):
|
||||||
|
"""
|
||||||
|
Get public key for encrypted values
|
||||||
|
"""
|
||||||
|
m = messages.GetPublicKey()
|
||||||
|
r = self.connection.request(m)
|
||||||
|
r.raise_on_error()
|
||||||
|
return int(r.modulus, 16), int(r.exponent, 16)
|
||||||
|
|
||||||
def get_user(self, uid):
|
def get_user(self, uid):
|
||||||
"""
|
"""
|
||||||
Get PP user
|
Get PP user
|
||||||
@ -185,7 +194,26 @@ class OMMClient2:
|
|||||||
m = messages.SetPPUser()
|
m = messages.SetPPUser()
|
||||||
m.childs.user = [t]
|
m.childs.user = [t]
|
||||||
r = self.connection.request(m)
|
r = self.connection.request(m)
|
||||||
|
r.raise_on_error()
|
||||||
|
if r.childs.user is None:
|
||||||
|
return None
|
||||||
|
return r.childs.user[0]
|
||||||
|
|
||||||
|
def set_user_sipauth(self, uid, sipAuthId, sipPw):
|
||||||
|
"""
|
||||||
|
Set PP user sip credentials
|
||||||
|
|
||||||
|
:param uid: User id
|
||||||
|
:param sipAuthId: SIP user name
|
||||||
|
:param sipPw: Encrypted sip password
|
||||||
|
"""
|
||||||
|
t = types.PPUserType()
|
||||||
|
t.uid = uid
|
||||||
|
t.sipAuthId = sipAuthId
|
||||||
|
t.sipPw = sipPw
|
||||||
|
m = messages.SetPPUser()
|
||||||
|
m.childs.user = [t]
|
||||||
|
r = self.connection.request(m)
|
||||||
r.raise_on_error()
|
r.raise_on_error()
|
||||||
if r.childs.user is None:
|
if r.childs.user is None:
|
||||||
return None
|
return None
|
||||||
|
@ -137,6 +137,7 @@ def response_type(c):
|
|||||||
from .getaccount import GetAccount, GetAccountResp
|
from .getaccount import GetAccount, GetAccountResp
|
||||||
from .getppdev import GetPPDev, GetPPDevResp
|
from .getppdev import GetPPDev, GetPPDevResp
|
||||||
from .getppuser import GetPPUser, GetPPUserResp
|
from .getppuser import GetPPUser, GetPPUserResp
|
||||||
|
from .getpublickey import GetPublicKey, GetPublicKeyResp
|
||||||
from .open import Open, OpenResp
|
from .open import Open, OpenResp
|
||||||
from .ping import Ping, PingResp
|
from .ping import Ping, PingResp
|
||||||
from .setppuser import SetPPUser, SetPPUserResp
|
from .setppuser import SetPPUser, SetPPUserResp
|
||||||
|
16
mitel_ommclient2/messages/getpublickey.py
Normal file
16
mitel_ommclient2/messages/getpublickey.py
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
from . import Request, Response, request_type, response_type
|
||||||
|
|
||||||
|
|
||||||
|
@request_type
|
||||||
|
class GetPublicKey(Request):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@response_type
|
||||||
|
class GetPublicKeyResp(Response):
|
||||||
|
FIELDS = {
|
||||||
|
"modulus": str,
|
||||||
|
"exponent": str,
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user