Skip to content

Error: Recipient defined with id is not found within message info during data decryption. #80

@GibbyBox

Description

@GibbyBox

Hey Team,

We're noticing a small fraction of our users getting this error. These users will always get the following error. The vast majority of our users do not experience this.

Recipient defined with id is not found within message info during data decryption.

We haven't been able to replicate this issue. We use this library to decrypt an encrypted private api key (for a third party integration) sent over the air to the user's device.

Specifically, we first call

const keys = virgilCrypto.generateKeys('SECP256R1');
privateKey = virgilCrypto.exportPrivateKey(keys.privateKey).toString('base64');
publicKey = virgilCrypto.exportPublicKey(keys.publicKey).toString('base64');

then we send the public key up to our api endpoint that's using the nodejs virgil-crypto package and encrypt our api key

import { initCrypto, VirgilCrypto, KeyPairType } from 'virgil-crypto';

// ...

await initCrypto();
const virgilCrypto = new VirgilCrypto({
	/** cSpell:ignore secp */
	defaultKeyPairType: KeyPairType.SECP256R1,
});
return virgilCrypto.encrypt(
	Buffer.from([REDACTED]),
	virgilCrypto.importPublicKey(publicKey),
).toString('base64');

back on the device, we decrypt it as follows. The error gets thrown somewhere here

const key = virgilCrypto.decrypt(encryptedMessage, virgilCrypto.importPrivateKey(privateKey)).toString()

I had tried a retry method that performs this entire sequence again if any error occurred, but this doesn't help the users suffering from this specific issue. What can I do to help this project with resolving this sort of issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions