sign method
Signs the value and returns the resulting byte array.
Implementation
List<int> sign(dynamic value) {
if (_privateKey == null) {
throw Exception(
'RSA attempted to sign but [privateKey] is null',
);
}
final signer = Signer(RSASigner(
_digest,
privateKey: _privateKey,
));
List<int> bytes;
if (value == null) {
throw Exception('Required value is null');
} else if (value is List<int>) {
bytes = value;
} else if (value is Uint8List) {
bytes = value.toList();
} else if (value is String) {
bytes = utf8.encode(value);
} else {
bytes = utf8.encode(value.toString());
}
return signer.signBytes(bytes).bytes.toList();
}