diff options
author | Florian Dold <florian.dold@gmail.com> | 2019-11-30 00:36:20 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2019-11-30 00:36:20 +0100 |
commit | aaf7e1338d6cdb1b4e01ad318938b3eaea2f922b (patch) | |
tree | 594129ccdf20757aeb86d434dd62c0c1e8259ed5 /src/crypto/talerCrypto.ts | |
parent | 809fa186448dbd924f258f89920b9336f1979bb0 (diff) | |
download | wallet-core-aaf7e1338d6cdb1b4e01ad318938b3eaea2f922b.tar.gz wallet-core-aaf7e1338d6cdb1b4e01ad318938b3eaea2f922b.tar.bz2 wallet-core-aaf7e1338d6cdb1b4e01ad318938b3eaea2f922b.zip |
wallet robustness WIP
Diffstat (limited to 'src/crypto/talerCrypto.ts')
-rw-r--r-- | src/crypto/talerCrypto.ts | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/crypto/talerCrypto.ts b/src/crypto/talerCrypto.ts index b754b0c57..317b1af55 100644 --- a/src/crypto/talerCrypto.ts +++ b/src/crypto/talerCrypto.ts @@ -237,6 +237,9 @@ function rsaFullDomainHash(hm: Uint8Array, rsaPub: RsaPub): bigint.BigInteger { function rsaPubDecode(rsaPub: Uint8Array): RsaPub { const modulusLength = (rsaPub[0] << 8) | rsaPub[1]; const exponentLength = (rsaPub[2] << 8) | rsaPub[3]; + if (4 + exponentLength + modulusLength != rsaPub.length) { + throw Error("invalid RSA public key (format wrong)"); + } const modulus = rsaPub.slice(4, 4 + modulusLength); const exponent = rsaPub.slice( 4 + modulusLength, |