Rename decrypt() to decipher(), to correspond with naming in spec.
Add a note to investigate PKCS#1 formatting of the command input.
This commit is contained in:
parent
17ee12566f
commit
7a78271211
3 changed files with 8 additions and 5 deletions
|
@ -93,7 +93,7 @@ impl<'a> crypto::Decryptor for CardDecryptor<'a> {
|
|||
match (ciphertext, self.public.mpis()) {
|
||||
(mpi::Ciphertext::RSA { c: ct }, mpi::PublicKey::RSA { .. }) => {
|
||||
let dm = Cryptogram::RSA(ct.value());
|
||||
let dec = self.ca.decrypt(dm)?;
|
||||
let dec = self.ca.decipher(dm)?;
|
||||
|
||||
let sk = openpgp::crypto::SessionKey::from(&dec[..]);
|
||||
Ok(sk)
|
||||
|
@ -111,7 +111,7 @@ impl<'a> crypto::Decryptor for CardDecryptor<'a> {
|
|||
};
|
||||
|
||||
// Decryption operation on the card
|
||||
let mut dec = self.ca.decrypt(dm)?;
|
||||
let mut dec = self.ca.decipher(dm)?;
|
||||
|
||||
// Specifically handle return value format like Gnuk's
|
||||
// (Gnuk returns a leading '0x04' byte and
|
||||
|
|
|
@ -779,8 +779,8 @@ impl DerefMut for CardUser {
|
|||
|
||||
impl CardUser {
|
||||
/// Decrypt the ciphertext in `dm`, on the card.
|
||||
pub fn decrypt(&mut self, dm: Cryptogram) -> Result<Vec<u8>, Error> {
|
||||
self.card_app.decrypt(dm)
|
||||
pub fn decipher(&mut self, dm: Cryptogram) -> Result<Vec<u8>, Error> {
|
||||
self.card_app.decipher(dm)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -374,10 +374,13 @@ impl CardApp {
|
|||
///
|
||||
/// (This is a wrapper around the low-level pso_decipher
|
||||
/// operation, it builds the required `data` field from `dm`)
|
||||
pub fn decrypt(&mut self, dm: Cryptogram) -> Result<Vec<u8>, Error> {
|
||||
pub fn decipher(&mut self, dm: Cryptogram) -> Result<Vec<u8>, Error> {
|
||||
match dm {
|
||||
Cryptogram::RSA(message) => {
|
||||
let mut data = vec![0x0];
|
||||
|
||||
// FIXME: The spec says we should "format according to PKCS#1"
|
||||
|
||||
data.extend_from_slice(message);
|
||||
|
||||
// Call the card to decrypt `data`
|
||||
|
|
Loading…
Reference in a new issue