Skip to content
This repository was archived by the owner on Jun 23, 2025. It is now read-only.
This repository was archived by the owner on Jun 23, 2025. It is now read-only.

Exception has occurred. ArgumentError (Invalid argument(s): Invalid or corrupted pad block) #331

@miraj98hossain

Description

@miraj98hossain

I am trying to implement this package.
this is my EncryptService

import 'package:encrypt/encrypt.dart';

class EncryptService {
  final _key = Key.fromUtf8('XXym1y2s3o9ftyZZ');
  final _iv = IV.fromLength(16);

  String encrypt({required String plainText}) {
    final encryptService = Encrypter(AES(_key));
    Encrypted encryptedData = encryptService.encrypt(plainText, iv: _iv);
    return encryptedData.base64;
  }

  String decrypt({required String encryptedText}) {
    Encrypted encryptedData = Encrypted.fromBase64(encryptedText);
    final encryptService = Encrypter(AES(_key));
    return encryptService.decrypt(encryptedData, iv: _iv);
  }
}

using this class i am encrypt the passwords and storing into the database.

while login i am trying to decrypting the password but it is showing

ArgumentError (Invalid argument(s): Invalid or corrupted pad block)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions