Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update crypto.ts because of this.container.session.slot.getMechanisms() only gets "ECDSA" so set some cases to "ECDSA" #70

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

roschnor
Copy link

Never be true, because of this.container.session.slot.getMechanisms() only gets "ECDSA" so set some cases to "ECDSA".

Never be true, because of this.container.session.slot.getMechanisms() only gets "ECDSA" so set some cases to "ECDSA".
@rmhrisk rmhrisk requested a review from microshine June 3, 2022 23:51
Comment on lines +142 to +150
switch (p11AlgorithmName) {
case "ECDSA":
case "ECDSA_SHA1":
case "ECDSA_SHA256":
case "ECDSA_SHA384":
case "ECDSA_SHA512":
p11AlgorithmName = "ECDSA";
break;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This switch..case forces ECDSA with hash to primitive ECDSA mechanism. What if token doesn't implement ECDSA mechanism and uses ECDSA with hash only?

getAlgorithm function must filter ECDSA mechanisms and select ECDSA with hash if it's possible or use ECDSA without hash

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use the Fortify App and get an Error from this function see => PeculiarVentures/fortify#497

It says "Cannot get PKCS11 EC mechanism by name 'ECDSA_SHA384' ". We're using an Atos Smart Card from D-Trust.

At the moment, the this.container.session.slot.getMechanisms() returns an array where all ECDSA_*** Were Replaced by ECDSA Without Hash.

I found out algName in Array is only "ECDSA", but mechanism.name === p11AlgorithmName (https://github.com/PeculiarVentures/node-webcrypto-p11/blob/master/src/mechs/ec/crypto.ts#L145) is never true than.

So please review my Issue from PeculiarVentures/fortify#497 to understand my problem there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants