aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2020-07-24 23:58:53 -0400
committerGitHub <noreply@github.com>2020-07-24 23:58:53 -0400
commit9226767debe8a54f623a9522658273f5c1915937 (patch)
treee8fa66f65b6c7b59c816c0e9e65b54a13bfbf126
parent5389bfcc8fa87a9362aa1e154ca9e52074f794b5 (diff)
parent7d3129f80b1b2bc40a77e3e610fe09a412c0e0a8 (diff)
downloadrbw-9226767debe8a54f623a9522658273f5c1915937.tar.gz
rbw-9226767debe8a54f623a9522658273f5c1915937.zip
Merge pull request #14 from jakeswenson/ciphertype-6-support
Add CipherString type 6 support
-rw-r--r--src/cipherstring.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/cipherstring.rs b/src/cipherstring.rs
index 7aaaf9f..7f9ce31 100644
--- a/src/cipherstring.rs
+++ b/src/cipherstring.rs
@@ -66,7 +66,11 @@ impl CipherString {
mac,
})
}
- 4 => {
+ 4 | 6 => {
+ // the only difference between 4 and 6 is the HMAC256 signature appended at the end
+ // https://github.com/bitwarden/jslib/blob/785b681f61f81690de6df55159ab07ae710bcfad/src/enums/encryptionType.ts#L8
+ // format is: <cipher_text_b64>|<hmac_sig>
+ let contents = contents.split("|").next().unwrap();
let ciphertext = base64::decode(contents)
.context(crate::error::InvalidBase64)?;
Ok(Self::Asymmetric { ciphertext })