mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-22 07:03:39 -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 ipaserver.plugins.ldap2 import AUTOBIND_DISABLED
|
||||
|
||||
if six.PY3:
|
||||
unicode = str
|
||||
long = int
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -294,43 +290,47 @@ class XMLDecryptor:
|
||||
class PSKCKeyPackage:
|
||||
_XML = {
|
||||
'pskc:DeviceInfo': {
|
||||
'pskc:IssueNo/text()': ('issueno', unicode),
|
||||
'pskc:ExpiryDate/text()': ('notafter.hw', convertDate),
|
||||
'pskc:Manufacturer/text()': ('vendor', unicode),
|
||||
'pskc:Model/text()': ('model', unicode),
|
||||
'pskc:SerialNo/text()': ('serial', unicode),
|
||||
'pskc:StartDate/text()': ('notbefore.hw', convertDate),
|
||||
'pskc:UserId/text()': ('owner', unicode),
|
||||
'pskc:IssueNo/text()': ('issueno', str),
|
||||
'pskc:ExpiryDate/text()': ('notafter.hw', convertDate),
|
||||
'pskc:Manufacturer/text()': ('vendor', str),
|
||||
'pskc:Model/text()': ('model', str),
|
||||
'pskc:SerialNo/text()': ('serial', str),
|
||||
'pskc:StartDate/text()': ('notbefore.hw', convertDate),
|
||||
'pskc:UserId/text()': ('owner', str),
|
||||
},
|
||||
|
||||
'pskc:Key': {
|
||||
'@Algorithm': ('type', convertTokenType),
|
||||
'@Id': ('id', unicode),
|
||||
'pskc:FriendlyName/text()': ('description', unicode),
|
||||
'pskc:Issuer/text()': ('issuer', unicode),
|
||||
'pskc:KeyReference/text()': ('keyref', unicode),
|
||||
'@Algorithm': ('type', convertTokenType),
|
||||
'@Id': ('id', str),
|
||||
'pskc:FriendlyName/text()': ('description', str),
|
||||
'pskc:Issuer/text()': ('issuer', str),
|
||||
'pskc:KeyReference/text()': ('keyref', str),
|
||||
|
||||
'pskc:AlgorithmParameters': {
|
||||
'pskc:Suite/text()': ('algorithm', convertHashName),
|
||||
'pskc:ResponseFormat/@CheckDigit': ('checkdigit', unicode),
|
||||
'pskc:ResponseFormat/@Encoding': ('encoding', unicode),
|
||||
'pskc:ResponseFormat/@Length': ('digits', int),
|
||||
'pskc:Suite/text()': ('algorithm', convertHashName),
|
||||
'pskc:ResponseFormat/@CheckDigit': ('checkdigit', str),
|
||||
'pskc:ResponseFormat/@Encoding': ('encoding', str),
|
||||
'pskc:ResponseFormat/@Length': ('digits', int),
|
||||
},
|
||||
|
||||
'pskc:Data': {
|
||||
'pskc:Counter': ('counter', lambda v, d: convertEncrypted(v, d, long, long)),
|
||||
'pskc:Secret': ('key', convertEncrypted),
|
||||
'pskc:Time': ('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:Counter':
|
||||
('counter', lambda v, d: convertEncrypted(v, d, int, int)),
|
||||
'pskc:Secret': ('key', convertEncrypted),
|
||||
'pskc:Time':
|
||||
('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:ExpiryDate/text()': ('notafter.sw', convertDate),
|
||||
'pskc:KeyUsage/text()': ('keyusage', unicode),
|
||||
'pskc:NumberOfTransactions': ('maxtransact', lambda v: v),
|
||||
'pskc:PINPolicy': ('pinpolicy', lambda v: v),
|
||||
'pskc:StartDate/text()': ('notbefore.sw', convertDate),
|
||||
'pskc:ExpiryDate/text()': ('notafter.sw', convertDate),
|
||||
'pskc:KeyUsage/text()': ('keyusage', str),
|
||||
'pskc:NumberOfTransactions': ('maxtransact', lambda v: v),
|
||||
'pskc:PINPolicy': ('pinpolicy', lambda v: v),
|
||||
'pskc:StartDate/text()': ('notbefore.sw', convertDate),
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -454,7 +454,8 @@ class PSKCKeyPackage:
|
||||
dates = (data.get(key + '.sw', None), data.get(key + '.hw', None))
|
||||
dates = [x for x in dates if x is not None]
|
||||
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:
|
||||
|
Loading…
Reference in New Issue
Block a user