mirror of
https://gitlab.com/fabinfra/fabaccess/FabFire-Provisioning-Tool.git
synced 2025-03-12 14:51:45 +01:00
create file with maximum size transaction size for convenience
This commit is contained in:
parent
3974d6a8e9
commit
9542bbb670
@ -126,7 +126,12 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
println!("Contact URI: {}", contact_uri);
|
println!("Contact URI: {}", contact_uri);
|
||||||
|
|
||||||
let token = match args.token {
|
let token = match args.token {
|
||||||
Some(token) => token,
|
Some(token) => {
|
||||||
|
if token.as_bytes().len() >= MAX_BYTES_PER_TRANSACTION {
|
||||||
|
return Err("Token is too long".into())
|
||||||
|
}
|
||||||
|
token
|
||||||
|
},
|
||||||
None => {
|
None => {
|
||||||
Uuid::new_v4().to_string()
|
Uuid::new_v4().to_string()
|
||||||
}
|
}
|
||||||
@ -185,7 +190,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
|
|
||||||
// create file with token
|
// create file with token
|
||||||
let token_accessrights = generate_file_access_rights(FileAccessRights::FREE as u8, 0x00, 0x00, 0x00)?;
|
let token_accessrights = generate_file_access_rights(FileAccessRights::FREE as u8, 0x00, 0x00, 0x00)?;
|
||||||
desfire.create_file_standard(0x03, FileCommunication::PLAIN, token_accessrights, token.as_bytes().len() as u32)?;
|
desfire.create_file_standard(0x03, FileCommunication::PLAIN, token_accessrights, MAX_BYTES_PER_TRANSACTION as u32)?; // Max
|
||||||
desfire.write_data(0x03, 0x00, token.as_bytes())?;
|
desfire.write_data(0x03, 0x00, token.as_bytes())?;
|
||||||
println!("created token file");
|
println!("created token file");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user