trim trailing \0 at the correct point

This commit is contained in:
Kai Jan Kriegel 2022-11-21 06:35:07 +01:00
parent 964293f653
commit dca231f32e
2 changed files with 4 additions and 4 deletions

View File

@ -495,9 +495,9 @@ impl Authentication for FabFire {
Ok(_) => { Ok(_) => {
match apdu_response.body { match apdu_response.body {
Some(data) => { Some(data) => {
let authid = String::from_utf8(data).unwrap(); let authid = String::from_utf8(data).unwrap().trim_matches(char::from(0)).to_string();
let prov = ThisProvider::<AuthId>::with( let prov = ThisProvider::<AuthId>::with(
authid.trim_matches(char::from(0)), &authid,
); );
let key = session let key = session
.need_with::<FabFireCardKey, _, _>(&prov, |key| { .need_with::<FabFireCardKey, _, _>(&prov, |key| {

View File

@ -353,9 +353,9 @@ impl Authentication for FabFire {
Ok(_) => { Ok(_) => {
match apdu_response.body { match apdu_response.body {
Some(data) => { Some(data) => {
let authid = String::from_utf8(data).unwrap(); let authid = String::from_utf8(data).unwrap().trim_matches(char::from(0)).to_string();
let prov = ThisProvider::<AuthId>::with( let prov = ThisProvider::<AuthId>::with(
authid.trim_matches(char::from(0)), &authid,
); );
let key = session let key = session
.need_with::<FabFireCardKey, _, _>(&prov, |key| { .need_with::<FabFireCardKey, _, _>(&prov, |key| {