mirror of
https://gitlab.com/fabinfra/fabaccess/FabFire-Provisioning-Tool.git
synced 2025-03-12 06:41:44 +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);
|
||||
|
||||
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 => {
|
||||
Uuid::new_v4().to_string()
|
||||
}
|
||||
@ -185,7 +190,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
|
||||
// create file with token
|
||||
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())?;
|
||||
println!("created token file");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user