diff --git a/src/Application/Model/Credential/PublicKeyCredential.php b/src/Application/Model/Credential/PublicKeyCredential.php index 4c32048..e807b72 100755 --- a/src/Application/Model/Credential/PublicKeyCredential.php +++ b/src/Application/Model/Credential/PublicKeyCredential.php @@ -54,13 +54,13 @@ class PublicKeyCredential extends BaseModel public function setCredentialId($credentialId) { $this->assign([ - 'credentialid' => bin2hex($credentialId) + 'credentialid' => base64_encode($credentialId) ]); } public function getCredentialId() { - return hex2bin($this->__get($this->_getFieldLongName('credentialid'))->rawValue); + return base64_decode($this->__get($this->_getFieldLongName('credentialid'))->rawValue); } public function setUserId($userId) @@ -78,13 +78,13 @@ class PublicKeyCredential extends BaseModel public function setCredential($credential) { $this->assign([ - 'credential' => bin2hex(serialize($credential)) + 'credential' => base64_encode(serialize($credential)) ]); } public function getCredential() { - return unserialize(hex2bin($this->__get($this->_getFieldLongName('credential'))->rawValue)); + return unserialize(base64_decode($this->__get($this->_getFieldLongName('credential'))->rawValue)); } /** @@ -134,7 +134,7 @@ class PublicKeyCredential extends BaseModel $qb->expr()->and( $qb->expr()->eq( 'credentialid', - $qb->createNamedParameter(bin2hex($publicKeyCredentialId)) + $qb->createNamedParameter(base64_encode($publicKeyCredentialId)) ), $qb->expr()->eq( 'oxshopid', diff --git a/src/Application/Model/Credential/PublicKeyCredentialList.php b/src/Application/Model/Credential/PublicKeyCredentialList.php index b94a629..d96f684 100755 --- a/src/Application/Model/Credential/PublicKeyCredentialList.php +++ b/src/Application/Model/Credential/PublicKeyCredentialList.php @@ -58,7 +58,7 @@ class PublicKeyCredentialList extends ListModel implements PublicKeyCredentialSo $qb->expr()->and( $qb->expr()->eq( 'credentialid', - $qb->createNamedParameter(bin2hex($publicKeyCredentialId)) + $qb->createNamedParameter(base64_encode($publicKeyCredentialId)) ), $qb->expr()->eq( 'oxshopid', @@ -72,7 +72,7 @@ class PublicKeyCredentialList extends ListModel implements PublicKeyCredentialSo return null; } - $credential = unserialize(hex2bin($credential)); + $credential = unserialize(base64_decode($credential)); return $credential instanceof PublicKeyCredentialSource ? $credential : null; } @@ -106,7 +106,7 @@ class PublicKeyCredentialList extends ListModel implements PublicKeyCredentialSo // generate decoded credentials list return array_map(function (array $fields) { - return unserialize(hex2bin($fields['credential'])); + return unserialize(base64_decode($fields['credential'])); }, $qb->execute()->fetchAllAssociative()); } diff --git a/src/Setup/Events.php b/src/Setup/Events.php index cf9d5b0..98ff3ca 100755 --- a/src/Setup/Events.php +++ b/src/Setup/Events.php @@ -45,7 +45,7 @@ class Events `OXUSERID` char(32) NOT NULL, `OXSHOPID` int(11) NOT NULL, `NAME` varchar(100) NOT NULL, - `CREDENTIALID` char(200) NOT NULL, + `CREDENTIALID` char(100) NOT NULL, `CREDENTIAL` varchar(2000) NOT NULL, `OXTIMESTAMP` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`OXID`),