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

not encrypting with weak keys - using preference settings #3444

Closed
tomholub opened this issue Feb 19, 2021 · 8 comments
Closed

not encrypting with weak keys - using preference settings #3444

tomholub opened this issue Feb 19, 2021 · 8 comments
Labels
PGP or S/MIME requires knowledge of spec internals refactor
Milestone

Comments

@tomholub
Copy link
Collaborator

Once we move to OpenPGP.js v5, I wonder if this PR would address the need we had in #2715 ?

It would be cleaner that way: openpgpjs/openpgpjs#1238

I haven't investigated it in detail.

@tomholub tomholub added this to the Third priority milestone Feb 19, 2021
@tomholub tomholub added refactor PGP or S/MIME requires knowledge of spec internals labels Feb 19, 2021
@alichry
Copy link

alichry commented Feb 19, 2021

Hey @tomholub ✌️

I would be interested in this as I wrote a similar helper functions when it comes to dealing with keys, one of those is canEncrypt which is similar to usableForEncryption. it does not check the validity of the public key, just the underlying algorithm info. I would be happy to submit a PR that adds a usabeForEncryption method to Subkey

Something like the below and we check the RSA bits? (definitely rewritten in the context of Subkey)

/**
 * checks whether the underlying algorithm is suitable for encryption
 * regardless of the validity of the signature
 * @param key 
 */
export const canEncrypt = (key: OpenpgpKey) => {
    const keyPacket = getKeyPacket(key);
    if (! keyPacket) {
        return false;
    }
    const r: any = enums.read;
    if (! keyPacket.algorithm) {
        return false;
    }
    return keyPacket.algorithm !== r(enums.publicKey, enums.publicKey.rsa_encrypt) &&
        keyPacket.algorithm !== r(enums.publicKey, enums.publicKey.elgamal) &&
        keyPacket.algorithm !== r(enums.publicKey, enums.publicKey.ecdh);
}

@tomholub
Copy link
Collaborator Author

Hello, thanks for reaching out!

@rrrooommmaaa may be a better fit for answering.

@alichry
Copy link

alichry commented Feb 19, 2021

Whoops, sorry for that. I thought it's the openpgpjs/openpgpjs repository

@tomholub
Copy link
Collaborator Author

No wonder :) Feel free to create a sister issue there, and link this too. My usecase is that I don't want to use certain algorithms, like RSA less then 2048 bits, or SHA1, or 3DES, ever. We did make this work with v4 openpgpjs library but it feels like a workaround the way we did it, it would be nicer to have that option straight in the library 👍 for which your PR may have helped.

@tomholub
Copy link
Collaborator Author

tomholub commented Feb 22, 2021

Conversation for OpenPGP.js v5 work that may simplify this for us:

openpgpjs/openpgpjs#1243

@tomholub
Copy link
Collaborator Author

Here relevant library PR openpgpjs/openpgpjs#1264

@tomholub
Copy link
Collaborator Author

on our end we've already done this

@tomholub tomholub closed this as not planned Won't fix, can't repro, duplicate, stale Feb 16, 2023
@tomholub
Copy link
Collaborator Author

on our end we've already done this

@tomholub tomholub reopened this Feb 16, 2023
@tomholub tomholub modified the milestones: Third priority, discussion Feb 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PGP or S/MIME requires knowledge of spec internals refactor
Projects
None yet
Development

No branches or pull requests

2 participants