[GH-ISSUE #155] Signature Generation, undefined method named getSecurityHandler #671

Closed
opened 2026-03-15 15:00:33 +03:00 by kerem · 2 comments
Owner

Originally created by @gcoda on GitHub (Feb 15, 2018).
Original GitHub issue: https://github.com/flyimg/flyimg/issues/155

Originally assigned to: @sadok-f on GitHub.

When i am trying to run:

 php app.php encrypt

I am getting

Attempted to call an undefined method named 'getSecurityHandler' of class 'Core\Handler\ImageHandler'
Did you mean to call 'securityHandler'?

Looks like this is really the fix, but i have zero experience with modern PHP, just $app['image.handler']->SecurityHandler() is enough?

As a side note, after writing comparable encrypt function in javascript i found something weird.
I needed to convert hashed key and vector to string hex and cut them. Is this expected?

const crypto = require('crypto')
const key = crypto.createHash('sha256').update('keykey').digest();
const ivHash = crypto.createHash('sha256').update('vectorvector').digest();
const iv = new Buffer.alloc(16, ivHash);

const newKey = key
  .toString('hex') // same data is twice the amount bytes now
  .substr(0, 32)   // and now we only have half of original hash

const newIv = iv.toString('hex').substr(0, 16) // iv was 16 bytes, now its 16 again but with less entropy

const cipher = crypto.createCipheriv('aes-256-cbc', newKey, newIv);
const data = cipher.update('w_900,h_200,c_1/https://m0.cl/t/resize-test_1920.jpg', 'utf-8', "base64");
const final = cipher.final("base64")
console.log(Buffer(data + final).toString('base64'))
Originally created by @gcoda on GitHub (Feb 15, 2018). Original GitHub issue: https://github.com/flyimg/flyimg/issues/155 Originally assigned to: @sadok-f on GitHub. When i am trying to run: php app.php encrypt I am getting Attempted to call an undefined method named 'getSecurityHandler' of class 'Core\Handler\ImageHandler' Did you mean to call 'securityHandler'? Looks like this is really the fix, but i have zero experience with modern PHP, just `$app['image.handler']->SecurityHandler()` is enough? As a side note, after writing comparable encrypt function in javascript i found something weird. I needed to convert hashed key and vector to string hex and cut them. Is this expected? ``` const crypto = require('crypto') const key = crypto.createHash('sha256').update('keykey').digest(); const ivHash = crypto.createHash('sha256').update('vectorvector').digest(); const iv = new Buffer.alloc(16, ivHash); const newKey = key .toString('hex') // same data is twice the amount bytes now .substr(0, 32) // and now we only have half of original hash const newIv = iv.toString('hex').substr(0, 16) // iv was 16 bytes, now its 16 again but with less entropy const cipher = crypto.createCipheriv('aes-256-cbc', newKey, newIv); const data = cipher.update('w_900,h_200,c_1/https://m0.cl/t/resize-test_1920.jpg', 'utf-8', "base64"); const final = cipher.final("base64") console.log(Buffer(data + final).toString('base64')) ```
kerem 2026-03-15 15:00:33 +03:00
Author
Owner

@sadok-f commented on GitHub (Feb 15, 2018):

Thank you for submitting the issue.
I identified the bug and it's in review now.

<!-- gh-comment-id:365929977 --> @sadok-f commented on GitHub (Feb 15, 2018): Thank you for submitting the issue. I identified the bug and it's in review now.
Author
Owner

@sadok-f commented on GitHub (Feb 15, 2018):

Fixed is pushed and merged.
Thank you again for reporting the bug, regarding the javascript implementation, I'm really not sure about it, maybe @baamenabar can check with you.

<!-- gh-comment-id:365932175 --> @sadok-f commented on GitHub (Feb 15, 2018): Fixed is pushed and merged. Thank you again for reporting the bug, regarding the javascript implementation, I'm really not sure about it, maybe @baamenabar can check with you.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/flyimg#671
No description provided.