mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-22 15:13:50 -06:00
Get rid of unicode and long helpers in ipa-otptoken-import
Related: https://pagure.io/freeipa/issue/9641 Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com> Reviewed-By: Rob Crittenden <rcritten@redhat.com>
This commit is contained in:
parent
fc02904340
commit
7b5f3d7971
@ -45,10 +45,6 @@ from ipalib import api, errors
|
|||||||
from ipalib.constants import VAULT_WRAPPING_SUPPORTED_ALGOS, VAULT_WRAPPING_3DES
|
from ipalib.constants import VAULT_WRAPPING_SUPPORTED_ALGOS, VAULT_WRAPPING_3DES
|
||||||
from ipaserver.plugins.ldap2 import AUTOBIND_DISABLED
|
from ipaserver.plugins.ldap2 import AUTOBIND_DISABLED
|
||||||
|
|
||||||
if six.PY3:
|
|
||||||
unicode = str
|
|
||||||
long = int
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@ -294,43 +290,47 @@ class XMLDecryptor:
|
|||||||
class PSKCKeyPackage:
|
class PSKCKeyPackage:
|
||||||
_XML = {
|
_XML = {
|
||||||
'pskc:DeviceInfo': {
|
'pskc:DeviceInfo': {
|
||||||
'pskc:IssueNo/text()': ('issueno', unicode),
|
'pskc:IssueNo/text()': ('issueno', str),
|
||||||
'pskc:ExpiryDate/text()': ('notafter.hw', convertDate),
|
'pskc:ExpiryDate/text()': ('notafter.hw', convertDate),
|
||||||
'pskc:Manufacturer/text()': ('vendor', unicode),
|
'pskc:Manufacturer/text()': ('vendor', str),
|
||||||
'pskc:Model/text()': ('model', unicode),
|
'pskc:Model/text()': ('model', str),
|
||||||
'pskc:SerialNo/text()': ('serial', unicode),
|
'pskc:SerialNo/text()': ('serial', str),
|
||||||
'pskc:StartDate/text()': ('notbefore.hw', convertDate),
|
'pskc:StartDate/text()': ('notbefore.hw', convertDate),
|
||||||
'pskc:UserId/text()': ('owner', unicode),
|
'pskc:UserId/text()': ('owner', str),
|
||||||
},
|
},
|
||||||
|
|
||||||
'pskc:Key': {
|
'pskc:Key': {
|
||||||
'@Algorithm': ('type', convertTokenType),
|
'@Algorithm': ('type', convertTokenType),
|
||||||
'@Id': ('id', unicode),
|
'@Id': ('id', str),
|
||||||
'pskc:FriendlyName/text()': ('description', unicode),
|
'pskc:FriendlyName/text()': ('description', str),
|
||||||
'pskc:Issuer/text()': ('issuer', unicode),
|
'pskc:Issuer/text()': ('issuer', str),
|
||||||
'pskc:KeyReference/text()': ('keyref', unicode),
|
'pskc:KeyReference/text()': ('keyref', str),
|
||||||
|
|
||||||
'pskc:AlgorithmParameters': {
|
'pskc:AlgorithmParameters': {
|
||||||
'pskc:Suite/text()': ('algorithm', convertHashName),
|
'pskc:Suite/text()': ('algorithm', convertHashName),
|
||||||
'pskc:ResponseFormat/@CheckDigit': ('checkdigit', unicode),
|
'pskc:ResponseFormat/@CheckDigit': ('checkdigit', str),
|
||||||
'pskc:ResponseFormat/@Encoding': ('encoding', unicode),
|
'pskc:ResponseFormat/@Encoding': ('encoding', str),
|
||||||
'pskc:ResponseFormat/@Length': ('digits', int),
|
'pskc:ResponseFormat/@Length': ('digits', int),
|
||||||
},
|
},
|
||||||
|
|
||||||
'pskc:Data': {
|
'pskc:Data': {
|
||||||
'pskc:Counter': ('counter', lambda v, d: convertEncrypted(v, d, long, long)),
|
'pskc:Counter':
|
||||||
'pskc:Secret': ('key', convertEncrypted),
|
('counter', lambda v, d: convertEncrypted(v, d, int, int)),
|
||||||
'pskc:Time': ('time', lambda v, d: convertEncrypted(v, d, int, int)),
|
'pskc:Secret': ('key', convertEncrypted),
|
||||||
'pskc:TimeDrift': ('offset', lambda v, d: convertEncrypted(v, d, int, int)),
|
'pskc:Time':
|
||||||
'pskc:TimeInterval': ('interval', lambda v, d: convertEncrypted(v, d, int, int)),
|
('time', lambda v, d: convertEncrypted(v, d, int, int)),
|
||||||
|
'pskc:TimeDrift':
|
||||||
|
('offset', lambda v, d: convertEncrypted(v, d, int, int)),
|
||||||
|
'pskc:TimeInterval':
|
||||||
|
('interval', lambda v, d: convertEncrypted(v, d, int, int))
|
||||||
},
|
},
|
||||||
|
|
||||||
'pskc:Policy': {
|
'pskc:Policy': {
|
||||||
'pskc:ExpiryDate/text()': ('notafter.sw', convertDate),
|
'pskc:ExpiryDate/text()': ('notafter.sw', convertDate),
|
||||||
'pskc:KeyUsage/text()': ('keyusage', unicode),
|
'pskc:KeyUsage/text()': ('keyusage', str),
|
||||||
'pskc:NumberOfTransactions': ('maxtransact', lambda v: v),
|
'pskc:NumberOfTransactions': ('maxtransact', lambda v: v),
|
||||||
'pskc:PINPolicy': ('pinpolicy', lambda v: v),
|
'pskc:PINPolicy': ('pinpolicy', lambda v: v),
|
||||||
'pskc:StartDate/text()': ('notbefore.sw', convertDate),
|
'pskc:StartDate/text()': ('notbefore.sw', convertDate),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -454,7 +454,8 @@ class PSKCKeyPackage:
|
|||||||
dates = (data.get(key + '.sw', None), data.get(key + '.hw', None))
|
dates = (data.get(key + '.sw', None), data.get(key + '.hw', None))
|
||||||
dates = [x for x in dates if x is not None]
|
dates = [x for x in dates if x is not None]
|
||||||
if dates:
|
if dates:
|
||||||
out['ipatoken' + key] = unicode(reducer(dates).strftime("%Y%m%d%H%M%SZ"))
|
out['ipatoken' + key] = str(
|
||||||
|
reducer(dates).strftime("%Y%m%d%H%M%SZ"))
|
||||||
|
|
||||||
|
|
||||||
class PSKCDocument:
|
class PSKCDocument:
|
||||||
|
Loading…
Reference in New Issue
Block a user