Skip to content

Commit

Permalink
Merge pull request #17 from AaronFeickert/padding-error
Browse files Browse the repository at this point in the history
Use a separate error for invalid padding flag
  • Loading branch information
julian-CStack authored Jun 28, 2023
2 parents 39a9426 + 62c61ce commit d28e823
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/secure_storage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ class VersionError implements Exception {
String errMsg() => 'Bad version';
}

/// Padding flag is invalid
class InvalidPadding implements Exception {
String errMsg() => 'Padding flag is invalid';
}

///
/// StorageCryptoHandler
///
Expand Down Expand Up @@ -279,7 +284,7 @@ class StorageCryptoHandler {

// The padding flag is invalid, which should never happen
if (paddedValue[0] != 0x01) {
throw BadDecryption();
throw InvalidPadding();
}

// Extract the value length
Expand Down

0 comments on commit d28e823

Please sign in to comment.