Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Pass correct mode string to phpseclib #50

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/JOSE/JWE.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@ private function cipher() {
throw new JOSE_Exception_UnexpectedAlgorithm('Algorithm not supported');
case 'A128CBC-HS256':
case 'A256CBC-HS512':
$cipher = new AES(AES::MODE_CBC);
$cipher = new AES(self::MODE_CBC);
break;
default:
throw new JOSE_Exception_UnexpectedAlgorithm('Unknown algorithm');
}
switch ($this->header['enc']) {
case 'A128GCM':
case 'A128CBC-HS256':
$cipher->setBlockLength(128);
//$cipher->setBlockLength(128);
break;
case 'A256GCM':
case 'A256CBC-HS512':
Expand Down
9 changes: 9 additions & 0 deletions src/JOSE/JWT.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
<?php

class JOSE_JWT {
const MODE_CTR = 'ctr';
const MODE_ECB = 'ecb';
const MODE_CBC = 'cbc';
const MODE_CFB = 'cfb';
const MODE_CFB8 = 'cfb8';
const MODE_OFB = 'ofb';
const MODE_OFB8 = 'ofb8';
const MODE_GCM = 'gcm';
const MODE_STREAM = 'stream';
var $header = array(
'typ' => 'JWT',
'alg' => 'none'
Expand Down