### CMake Installation Rules for Windows Executable Source: https://github.com/jerson/flutter-rsa/blob/master/example/windows/CMakeLists.txt Configures the installation process for the Windows build, ensuring the executable, libraries, and assets are placed correctly next to the executable for in-place execution. It sets up the installation prefix and defines components. ```cmake set(BUILD_BUNDLE_DIR "$") set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) endif() set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) if(PLUGIN_BUNDLED_LIBRARIES) install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/") install(DIRECTORY "${NATIVE_ASSETS_DIR}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) set(FLUTTER_ASSET_DIR_NAME "flutter_assets") install(CODE " file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") " COMPONENT Runtime) install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" CONFIGURATIONS Profile;Release COMPONENT Runtime) ``` -------------------------------- ### CMake Installation Rules Source: https://github.com/jerson/flutter-rsa/blob/master/example/linux/CMakeLists.txt Defines the installation rules for the application bundle. This includes cleaning the build bundle directory, setting installation destinations for data and libraries, and copying the executable, ICU data, Flutter library, and bundled plugin libraries. ```cmake set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) endif() install(CODE " file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") " COMPONENT Runtime) set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) install(FILES "${bundled_library}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endforeach(bundled_library) ``` -------------------------------- ### Install Fast RSA Plugin Source: https://context7.com/jerson/flutter-rsa/llms.txt Add the fast_rsa dependency to your pubspec.yaml file. For web platform support, include the specified assets. ```yaml dependencies: fast_rsa: ^3.8.6 flutter: assets: - packages/fast_rsa/web/assets/worker.js - packages/fast_rsa/web/assets/wasm_exec.js - packages/fast_rsa/web/assets/rsa.wasm ``` -------------------------------- ### Install Flutter Assets using CMake Source: https://github.com/jerson/flutter-rsa/blob/master/example/linux/CMakeLists.txt This CMake code snippet installs Flutter assets into the application bundle. It first removes any existing 'flutter_assets' directory and then installs the new one from the project's build directory to the bundle's data directory. This ensures that the latest assets are deployed with the application. ```cmake set(FLUTTER_ASSET_DIR_NAME "flutter_assets") install(CODE " file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") " COMPONENT Runtime) install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) ``` -------------------------------- ### CMake Project Setup and Configuration Source: https://github.com/jerson/flutter-rsa/blob/master/example/windows/CMakeLists.txt Initializes the CMake project, sets the project name, and defines build configurations. It handles multi-configuration generators and sets default build types for single-configuration generators. ```cmake cmake_minimum_required(VERSION 3.14) project(fast_rsa_example LANGUAGES CXX) set(BINARY_NAME "fast_rsa_example") cmake_policy(VERSION 3.14...3.25) get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if(IS_MULTICONFIG) set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" CACHE STRING "" FORCE) else() if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Flutter build mode" FORCE) set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Profile" "Release") endif() endif() set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") add_definitions(-DUNICODE -D_UNICODE) ``` -------------------------------- ### RSA Key Format Conversion (Async) - Dart Source: https://github.com/jerson/flutter-rsa/blob/master/README.md Provides examples of asynchronously converting RSA keys between various formats including JWK, PKCS12, PKCS8, PKCS1, and PKIX. Also includes methods for encrypting and decrypting private keys. Requires the 'fast_rsa' package. ```dart import 'package:fast_rsa/fast_rsa.dart'; var result = await RSA.convertJWKToPrivateKey(data, keyId); var result = await RSA.convertJWKToPublicKey(data, keyId); var result = await RSA.convertKeyPairToPKCS12(privateKey, certificate, password); var result = await RSA.convertPKCS12ToKeyPair(pkcs12, password); var result = await RSA.convertPrivateKeyToPKCS8(privateKey); var result = await RSA.convertPrivateKeyToPKCS1(privateKey); var result = await RSA.convertPrivateKeyToJWK(privateKey); var result = await RSA.convertPrivateKeyToPublicKey(privateKey); var result = await RSA.convertPublicKeyToPKIX(publicKey); var result = await RSA.convertPublicKeyToPKCS1(publicKey); var result = await RSA.convertPublicKeyToJWK(publicKey); var result = await RSA.encryptPrivateKey(privateKey, password, PEMCipher.PEMCIPHER_AES256); var result = await RSA.decryptPrivateKey(privateKeyEncrypted, password); ``` -------------------------------- ### CMake Native Assets Installation Source: https://github.com/jerson/flutter-rsa/blob/master/example/linux/CMakeLists.txt Installs native assets provided by the build.dart script into the application bundle's library directory. This ensures that any required native resources are correctly placed for runtime access. ```cmake set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/") install(DIRECTORY "${NATIVE_ASSETS_DIR}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Configure Flutter Library and Headers Source: https://github.com/jerson/flutter-rsa/blob/master/example/windows/flutter/CMakeLists.txt Sets up the Flutter library path, ICU data file, and header files for the Flutter engine. It defines variables for the Flutter library, ICU data, project build directory, and AOT library, making them available in the parent scope for installation and linking. ```cmake set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") # Published to parent scope for install step. set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) list(APPEND FLUTTER_LIBRARY_HEADERS "flutter_export.h" "flutter_windows.h" "flutter_messenger.h" "flutter_plugin_registrar.h" "flutter_texture_registrar.h" ) list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") add_library(flutter INTERFACE) target_include_directories(flutter INTERFACE "${EPHEMERAL_DIR}" ) target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") add_dependencies(flutter flutter_assemble) ``` -------------------------------- ### Install AOT Library Conditionally with CMake Source: https://github.com/jerson/flutter-rsa/blob/master/example/linux/CMakeLists.txt This CMake code snippet conditionally installs the AOT (Ahead-Of-Time) library. The library is only installed if the CMAKE_BUILD_TYPE is not 'Debug'. This is typically done to include optimized libraries in release builds while excluding them from debug builds for faster iteration. ```cmake if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### CMake: Define Flutter Library and Headers Source: https://github.com/jerson/flutter-rsa/blob/master/example/linux/flutter/CMakeLists.txt Sets the path to the Flutter Linux GTK shared library and defines a list of Flutter library header files. These paths are then made available in the parent scope for use in other CMake files or installation steps. The `FLUTTER_LIBRARY_HEADERS` list is populated with specific header filenames. ```cmake set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") # Published to parent scope for install step. set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) list(APPEND FLUTTER_LIBRARY_HEADERS "fl_basic_message_channel.h" "fl_binary_codec.h" "fl_binary_messenger.h" "fl_dart_project.h" "fl_engine.h" "fl_json_message_codec.h" "fl_json_method_codec.h" "fl_message_codec.h" "fl_method_call.h" "fl_method_channel.h" "fl_method_codec.h" "fl_method_response.h" "fl_plugin_registrar.h" "fl_plugin_registry.h" "fl_standard_message_codec.h" "fl_standard_method_codec.h" "fl_string_codec.h" "fl_value.h" "fl_view.h" "flutter_linux.h" ) list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") ``` -------------------------------- ### Perform Synchronous RSA Operations (Dart) Source: https://context7.com/jerson/flutter-rsa/llms.txt Demonstrates synchronous RSA operations using the RSASync extension, suitable for non-async contexts. This includes key generation, OAEP encryption/decryption, PSS signing/verification, hashing, and key format conversions. It requires 'fast_rsa' and 'fast_rsa_sync' packages. ```dart import 'package:fast_rsa/fast_rsa.dart'; import 'package:fast_rsa/fast_rsa_sync.dart'; void synchronousOperations() { // Generate key pair synchronously KeyPair keyPair = RSASync.generate(2048); // Encrypt synchronously String encrypted = RSASync.encryptOAEP( "Secret message", "", Hash.SHA256, keyPair.publicKey, ); // Decrypt synchronously String decrypted = RSASync.decryptOAEP( encrypted, "", Hash.SHA256, keyPair.privateKey, ); // Sign synchronously String signature = RSASync.signPSS( "Document to sign", Hash.SHA256, SaltLength.AUTO, keyPair.privateKey, ); // Verify synchronously bool isValid = RSASync.verifyPSS( signature, "Document to sign", Hash.SHA256, SaltLength.AUTO, keyPair.publicKey, ); // Hash synchronously String hash = RSASync.hash("Data to hash", Hash.SHA256); // Convert keys synchronously dynamic jwk = RSASync.convertPrivateKeyToJWK(keyPair.privateKey); String pkcs8 = RSASync.convertPrivateKeyToPKCS8(keyPair.privateKey); } ``` -------------------------------- ### Apply Standard Build Settings (CMake) Source: https://github.com/jerson/flutter-rsa/blob/master/example/windows/runner/CMakeLists.txt This command applies a predefined set of standard build settings to the application target. This simplifies configuration for common build requirements and can be omitted if custom settings are needed. ```cmake apply_standard_settings(${BINARY_NAME}) ``` -------------------------------- ### RSA.signPSS/RSA.verifyPSS - PSS Digital Signatures in Dart Source: https://context7.com/jerson/flutter-rsa/llms.txt Demonstrates creating and verifying RSA-PSS digital signatures using SHA-256. Supports both string and byte array inputs. Requires the 'fast_rsa' package. ```dart import 'package:fast_rsa/fast_rsa.dart'; import 'dart:convert'; import 'dart:typed_data'; Future signVerifyPSS() async { KeyPair keyPair = await RSA.generate(2048); String message = "Document content to sign"; // Sign with private key using SHA-256 and automatic salt length String signature = await RSA.signPSS( message, Hash.SHA256, SaltLength.AUTO, keyPair.privateKey, ); print('Signature: $signature'); // Verify with public key bool isValid = await RSA.verifyPSS( signature, message, Hash.SHA256, SaltLength.AUTO, keyPair.publicKey, ); print('Signature valid: $isValid'); // Output: Signature valid: true // Verify tampered message returns false bool isTamperedValid = await RSA.verifyPSS( signature, "Tampered message", Hash.SHA256, SaltLength.AUTO, keyPair.publicKey, ); print('Tampered signature valid: $isTamperedValid'); // Output: Tampered signature valid: false // Binary data variant Uint8List messageBytes = Uint8List.fromList(utf8.encode(message)); Uint8List signatureBytes = await RSA.signPSSBytes( messageBytes, Hash.SHA256, SaltLength.AUTO, keyPair.privateKey, ); bool isValidBytes = await RSA.verifyPSSBytes( signatureBytes, messageBytes, Hash.SHA256, SaltLength.AUTO, keyPair.publicKey, ); } ``` -------------------------------- ### RSA.signPKCS1v15/RSA.verifyPKCS1v15 - PKCS1v15 Signatures in Dart Source: https://context7.com/jerson/flutter-rsa/llms.txt Demonstrates creating and verifying RSA PKCS#1 v1.5 digital signatures using SHA-256. Supports both string and byte array inputs and is suitable for compatibility with existing systems. Requires the 'fast_rsa' package. ```dart import 'package:fast_rsa/fast_rsa.dart'; import 'dart:convert'; import 'dart:typed_data'; Future signVerifyPKCS1v15() async { KeyPair keyPair = await RSA.generate(2048); String message = "Contract agreement text"; // Sign with private key using SHA-256 String signature = await RSA.signPKCS1v15( message, Hash.SHA256, keyPair.privateKey, ); print('PKCS1v15 Signature: $signature'); // Verify with public key bool isValid = await RSA.verifyPKCS1v15( signature, message, Hash.SHA256, keyPair.publicKey, ); print('Signature valid: $isValid'); // Output: Signature valid: true // Binary data variant Uint8List messageBytes = Uint8List.fromList(utf8.encode(message)); Uint8List signatureBytes = await RSA.signPKCS1v15Bytes( messageBytes, Hash.SHA256, keyPair.privateKey, ); bool isValidBytes = await RSA.verifyPKCS1v15Bytes( signatureBytes, messageBytes, Hash.SHA256, keyPair.publicKey, ); } ``` -------------------------------- ### Configure Flutter Tool Backend Command Source: https://github.com/jerson/flutter-rsa/blob/master/example/windows/flutter/CMakeLists.txt Sets up a custom CMake command to execute the Flutter tool backend script. This command is designed to run every time by using a phony output file and ensures that the Flutter tool generates necessary build artifacts. ```cmake # _phony_ is a non-existent file to force this command to run every time, since currently there's no way to get a full input/output list from the # flutter tool. set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) add_custom_command( OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} ${CPP_WRAPPER_SOURCES_APP} ${PHONY_OUTPUT} COMMAND ${CMAKE_COMMAND} -E env ${FLUTTER_TOOL_ENVIRONMENT} "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" ${FLUTTER_TARGET_PLATFORM} $ VERBATIM ) add_custom_target(flutter_assemble DEPENDS "${FLUTTER_LIBRARY}" ${FLUTTER_LIBRARY_HEADERS} ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} ${CPP_WRAPPER_SOURCES_APP} ) ``` -------------------------------- ### Convert RSA Public Key Formats (PKIX and PKCS#1) Source: https://context7.com/jerson/flutter-rsa/llms.txt Converts RSA public keys between PKIX (X.509 SubjectPublicKeyInfo) and PKCS#1 formats. This ensures compatibility with various cryptographic implementations. Requires the 'fast_rsa' package. ```dart import 'package:fast_rsa/fast_rsa.dart'; Future convertPublicKeyFormats() async { KeyPair keyPair = await RSA.generate(2048); // Convert to PKIX format (X.509 SubjectPublicKeyInfo) String pkixKey = await RSA.convertPublicKeyToPKIX(keyPair.publicKey); print('PKIX Public Key:'); print(pkixKey); // Convert to PKCS#1 format String pkcs1Key = await RSA.convertPublicKeyToPKCS1(keyPair.publicKey); print('PKCS#1 Public Key:'); print(pkcs1Key); } ``` -------------------------------- ### CMake: Find GTK, GLIB, and GIO Packages Source: https://github.com/jerson/flutter-rsa/blob/master/example/linux/flutter/CMakeLists.txt Uses `pkg-config` to find and check for the required GTK, GLIB, and GIO libraries. This ensures that the necessary development files for these libraries are available for linking. The `REQUIRED` keyword means the build will fail if these packages are not found. ```cmake find_package(PkgConfig REQUIRED) pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) ``` -------------------------------- ### RSA.convertPublicKeyToJWK/RSA.convertJWKToPublicKey - Public Key JWK Conversion in Dart Source: https://context7.com/jerson/flutter-rsa/llms.txt Demonstrates converting RSA public keys between PEM and JSON Web Key (JWK) formats for use in JWT verification and web service authentication. Requires 'fast_rsa' and 'dart:convert'. ```dart import 'package:fast_rsa/fast_rsa.dart'; import 'dart:convert'; Future convertPublicKeyJWK() async { KeyPair keyPair = await RSA.generate(2048); // Convert public key PEM to JWK dynamic jwk = await RSA.convertPublicKeyToJWK(keyPair.publicKey); print('Public Key as JWK:'); print(jsonEncode(jwk)); // Output: {"kty":"RSA","n":"...","e":"AQAB"} // Convert JWK back to PEM String publicKeyPem = await RSA.convertJWKToPublicKey(jwk, ""); print('Public Key PEM:'); print(publicKeyPem); // Output: -----BEGIN PUBLIC KEY----- // MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A... // -----END PUBLIC KEY----- ``` -------------------------------- ### CMake Dependency and Target Definition Source: https://github.com/jerson/flutter-rsa/blob/master/example/linux/CMakeLists.txt Configures system-level dependencies using PkgConfig for GTK, defines the application ID as a preprocessor macro, and declares the main executable target with its source files. ```cmake find_package(PkgConfig REQUIRED) pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") add_executable(${BINARY_NAME} "main.cc" "my_application.cc" "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" ) ``` -------------------------------- ### CMake: Custom Command for Flutter Tool Backend Source: https://github.com/jerson/flutter-rsa/blob/master/example/linux/flutter/CMakeLists.txt Defines a custom command to execute the Flutter tool backend script. This command is set up to generate the Flutter library (`libflutter_linux_gtk.so`) and its headers. A dummy output file `_phony_` is used to ensure the command runs on every build, as determining exact inputs/outputs for the tool is complex. The command is executed with environment variables set by `FLUTTER_TOOL_ENVIRONMENT`. ```cmake add_custom_command( OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} ${CMAKE_CURRENT_BINARY_DIR}/_phony_ COMMAND ${CMAKE_COMMAND} -E env ${FLUTTER_TOOL_ENVIRONMENT} "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} VERBATIM ) ``` -------------------------------- ### RSA.convertPrivateKeyToJWK/RSA.convertJWKToPrivateKey - Private Key JWK Conversion in Dart Source: https://context7.com/jerson/flutter-rsa/llms.txt Shows how to convert RSA private keys between PEM and JSON Web Key (JWK) formats. This is useful for interoperability with JWT libraries and web services. Requires 'fast_rsa' and 'dart:convert'. ```dart import 'package:fast_rsa/fast_rsa.dart'; import 'dart:convert'; Future convertPrivateKeyJWK() async { KeyPair keyPair = await RSA.generate(2048); // Convert private key PEM to JWK dynamic jwk = await RSA.convertPrivateKeyToJWK(keyPair.privateKey); print('Private Key as JWK:'); print(jsonEncode(jwk)); // Output: {"kty":"RSA","n":"...","e":"AQAB","d":"...","p":"...","q":"...","dp":"...","dq":"...","qi":"..."} // Convert JWK back to PEM String privateKeyPem = await RSA.convertJWKToPrivateKey(jwk, ""); print('Private Key PEM:'); print(privateKeyPem); // Output: -----BEGIN RSA PRIVATE KEY----- // MIIEpAIBAAKCAQEA... // -----END RSA PRIVATE KEY----- } ``` -------------------------------- ### Generate RSA Key Pair (Async/Sync) Source: https://context7.com/jerson/flutter-rsa/llms.txt Generates an RSA key pair with a specified bit size. The asynchronous version returns a Future, while the synchronous version directly returns a KeyPair object. Both output keys in PEM format. ```dart import 'package:fast_rsa/fast_rsa.dart'; // Generate a 2048-bit RSA key pair asynchronously Future generateKeyPair() async { try { KeyPair keyPair = await RSA.generate(2048); print('Public Key:'); print(keyPair.publicKey); // Output: -----BEGIN PUBLIC KEY----- // MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A... // -----END PUBLIC KEY----- print('Private Key:'); print(keyPair.privateKey); // Output: -----BEGIN RSA PRIVATE KEY----- // MIIEpAIBAAKCAQEA... // -----END RSA PRIVATE KEY----- } on RSAException catch (e) { print('Key generation failed: $e'); } } ``` ```dart import 'package:fast_rsa/fast_rsa_sync.dart'; KeyPair keyPair = RSASync.generate(2048); ``` -------------------------------- ### CMake Runtime Output Directory Configuration Source: https://github.com/jerson/flutter-rsa/blob/master/example/linux/CMakeLists.txt Configures the runtime output directory for the application executable. This ensures that the executable is placed in a specific subdirectory within the build directory, which is important for bundled applications. ```cmake set_target_properties(${BINARY_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" ) ``` -------------------------------- ### CMake Function for Standard Build Settings Source: https://github.com/jerson/flutter-rsa/blob/master/example/windows/CMakeLists.txt Defines a reusable CMake function `APPLY_STANDARD_SETTINGS` to apply common compilation features, options, and definitions to targets. This promotes consistency across different build targets. ```cmake function(APPLY_STANDARD_SETTINGS TARGET) target_compile_features(${TARGET} PUBLIC cxx_std_17) target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") target_compile_options(${TARGET} PRIVATE /EHsc) target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") target_compile_definitions(${TARGET} PRIVATE "$:_DEBUG") endfunction() ``` -------------------------------- ### RSA Signing (Async) - Dart Source: https://github.com/jerson/flutter-rsa/blob/master/README.md Illustrates asynchronous RSA signing using PSS and PKCS1v15 schemes. Supports string and byte array messages. Requires the 'fast_rsa' package and a private key. ```dart import 'package:fast_rsa/fast_rsa.dart'; var result = await RSA.signPSS(message, Hash.SHA256, SaltLength.SALTLENGTH_AUTO, privateKey) var result = await RSA.signPKCS1v15(message, Hash.SHA256, privateKey) var result = await RSA.signPSSBytes(messageBytes, Hash.SHA256, SaltLength.SALTLENGTH_AUTO, privateKey) var result = await RSA.signPKCS1v15Bytes(messageBytes, Hash.SHA256, privateKey) ``` -------------------------------- ### Convert RSA Key Pairs to and from PKCS#12 Format Source: https://context7.com/jerson/flutter-rsa/llms.txt Handles conversion between RSA key pairs (including certificates) and the PKCS#12 format. PKCS#12 is commonly used for securely storing and exchanging private keys and their associated certificates. Requires the 'fast_rsa' package. ```dart import 'package:fast_rsa/fast_rsa.dart'; Future convertPKCS12() async { // Convert PKCS12 bundle to key pair String pkcs12Base64 = "MIIQSQIBAzCC..."; // Base64-encoded PKCS12 String password = "123456789"; PKCS12KeyPair keyPair = await RSA.convertPKCS12ToKeyPair( pkcs12Base64, password, ); print('Public Key: ${keyPair.publicKey.substring(0, 50)}...'); print('Private Key: ${keyPair.privateKey.substring(0, 50)}...'); print('Certificate: ${keyPair.certificate.substring(0, 50)}...'); // Convert key pair back to PKCS12 String newPkcs12 = await RSA.convertKeyPairToPKCS12( keyPair.privateKey, keyPair.certificate, "newPassword123", ); print('New PKCS12 Bundle: ${newPkcs12.substring(0, 50)}...'); } ``` -------------------------------- ### RSA.convertPrivateKeyToJWK / RSA.convertJWKToPrivateKey - JWK Conversion Source: https://context7.com/jerson/flutter-rsa/llms.txt Converts RSA private keys between PEM format and JSON Web Key (JWK) format, facilitating interoperability with JWT libraries and web services. ```APIDOC ## RSA.convertPrivateKeyToJWK / RSA.convertJWKToPrivateKey - JWK Conversion ### Description Converts RSA private keys between PEM format and JSON Web Key (JWK) format, enabling interoperability with JWT libraries and web services. ### Method `convertPrivateKeyToJWK(String privateKeyPem)` `convertJWKToPrivateKey(dynamic jwk, String password)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None (Methods operate on provided arguments) ### Request Example ```dart import 'package:fast_rsa/fast_rsa.dart'; import 'dart:convert'; Future convertPrivateKeyJWK() async { KeyPair keyPair = await RSA.generate(2048); dynamic jwk = await RSA.convertPrivateKeyToJWK(keyPair.privateKey); String privateKeyPem = await RSA.convertJWKToPrivateKey(jwk, ""); } ``` ### Response #### Success Response (200) `convertPrivateKeyToJWK` returns a dynamic object representing the JWK. `convertJWKToPrivateKey` returns a String representing the private key in PEM format. #### Response Example ```json { "jwk": {"kty":"RSA","n":"...","e":"AQAB","d":"...","p":"...","q":"...","dp":"...","dq":"...","qi":"..."} } ``` ```json { "privateKeyPem": "-----BEGIN RSA PRIVATE KEY-----\n...\n-----END RSA PRIVATE KEY-----" } ``` ``` -------------------------------- ### Configure Executable Target and Source Files (CMake) Source: https://github.com/jerson/flutter-rsa/blob/master/example/windows/runner/CMakeLists.txt This snippet defines the main executable target for the application and lists all the source files required for compilation. It includes C++ source files, generated Flutter files, and Windows resource files. The `BINARY_NAME` variable is crucial for `flutter run` compatibility. ```cmake cmake_minimum_required(VERSION 3.14) project(runner LANGUAGES CXX) # Define the application target. To change its name, change BINARY_NAME in the # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer # work. # # Any new source files that you add to the application should be added here. add_executable(${BINARY_NAME} WIN32 "flutter_window.cpp" "main.cpp" "utils.cpp" "win32_window.cpp" "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" "Runner.rc" "runner.exe.manifest" ) ``` -------------------------------- ### CMake Project Configuration Source: https://github.com/jerson/flutter-rsa/blob/master/example/linux/CMakeLists.txt Initializes the CMake project, sets the minimum required version, and defines the project name and languages. It also configures application-specific identifiers and build policies. ```cmake cmake_minimum_required(VERSION 3.10) project(runner LANGUAGES CXX) set(BINARY_NAME "fast_rsa_example") set(APPLICATION_ID "dev.jerson.fast_rsa") cmake_policy(SET CMP0063 NEW) set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") ``` -------------------------------- ### RSA Enum References (Dart) Source: https://context7.com/jerson/flutter-rsa/llms.txt Provides definitions for essential enums used in RSA operations. These include Hash algorithms for signing and OAEP encryption, PEMCipher for private key encryption, and SaltLength options for PSS signatures. ```dart // Hash algorithms for signing and OAEP encryption enum Hash { MD5, SHA1, SHA224, SHA256, SHA384, SHA512 } // Cipher algorithms for private key encryption enum PEMCipher { DES, D3DES, AES128, AES192, AES256 } // Salt length options for PSS signatures enum SaltLength { AUTO, EQUALS_HASH } ``` -------------------------------- ### RSA Key Generation (Async) - Dart Source: https://github.com/jerson/flutter-rsa/blob/master/README.md Shows how to asynchronously generate an RSA key pair of a specified bit length. Utilizes the 'fast_rsa' package. ```dart import 'package:fast_rsa/fast_rsa.dart'; var result = await RSA.generate(2048) ``` -------------------------------- ### RSA.signPSS / RSA.verifyPSS - PSS Digital Signatures Source: https://context7.com/jerson/flutter-rsa/llms.txt Generates and verifies digital signatures using the RSA-PSS scheme. This is the recommended signature scheme for its provable security. ```APIDOC ## RSA.signPSS / RSA.verifyPSS - PSS Digital Signatures ### Description Creates and verifies digital signatures using RSA-PSS (Probabilistic Signature Scheme), which is the recommended signature scheme providing provable security in the random oracle model. ### Method `signPSS(String message, Hash hash, SaltLength saltLength, String privateKey)` `verifyPSS(String signature, String message, Hash hash, SaltLength saltLength, String publicKey)` `signPSSBytes(Uint8List messageBytes, Hash hash, SaltLength saltLength, String privateKey)` `verifyPSSBytes(Uint8List signatureBytes, Uint8List messageBytes, Hash hash, SaltLength saltLength, String publicKey)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None (Methods operate on provided arguments) ### Request Example ```dart import 'package:fast_rsa/fast_rsa.dart'; Future signVerifyPSS() async { KeyPair keyPair = await RSA.generate(2048); String message = "Document content to sign"; String signature = await RSA.signPSS(message, Hash.SHA256, SaltLength.AUTO, keyPair.privateKey); bool isValid = await RSA.verifyPSS(signature, message, Hash.SHA256, SaltLength.AUTO, keyPair.publicKey); } ``` ### Response #### Success Response (200) `signPSS` and `signPSSBytes` return a String or Uint8List representing the signature. `verifyPSS` and `verifyPSSBytes` return a boolean indicating if the signature is valid. #### Response Example ```json { "signature": "-----BEGIN SIGNATURE-----\n...\n-----END SIGNATURE-----" } ``` ```json { "isValid": true } ``` ``` -------------------------------- ### Convert RSA Private Key Formats (PKCS#8 and PKCS#1) Source: https://context7.com/jerson/flutter-rsa/llms.txt Converts RSA private keys between PKCS#8 (modern, algorithm-independent) and PKCS#1 (older) formats. This is useful for interoperability with different systems and libraries. Requires the 'fast_rsa' package. ```dart import 'package:fast_rsa/fast_rsa.dart'; Future convertPrivateKeyFormats() async { KeyPair keyPair = await RSA.generate(2048); // Convert to PKCS#8 format String pkcs8Key = await RSA.convertPrivateKeyToPKCS8(keyPair.privateKey); print('PKCS#8 Private Key:'); print(pkcs8Key); // Convert to PKCS#1 format String pkcs1Key = await RSA.convertPrivateKeyToPKCS1(keyPair.privateKey); print('PKCS#1 Private Key:'); print(pkcs1Key); } ``` -------------------------------- ### CMake Target Linking and Dependencies Source: https://github.com/jerson/flutter-rsa/blob/master/example/linux/CMakeLists.txt Links the application target to necessary libraries, including Flutter and GTK, and adds build dependencies to ensure Flutter components are assembled before the main executable is built. ```cmake apply_standard_settings(${BINARY_NAME}) target_link_libraries(${BINARY_NAME} PRIVATE flutter) target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) add_dependencies(${BINARY_NAME} flutter_assemble) ``` -------------------------------- ### RSA.convertPublicKeyToJWK / RSA.convertJWKToPublicKey - Public Key JWK Conversion Source: https://context7.com/jerson/flutter-rsa/llms.txt Converts RSA public keys between PEM format and JSON Web Key (JWK) format for use with JWT verification and web service authentication. ```APIDOC ## RSA.convertPublicKeyToJWK / RSA.convertJWKToPublicKey - Public Key JWK Conversion ### Description Converts RSA public keys between PEM format and JSON Web Key (JWK) format for use with JWT verification and web service authentication. ### Method `convertPublicKeyToJWK(String publicKeyPem)` `convertJWKToPublicKey(dynamic jwk, String password)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None (Methods operate on provided arguments) ### Request Example ```dart import 'package:fast_rsa/fast_rsa.dart'; import 'dart:convert'; Future convertPublicKeyJWK() async { KeyPair keyPair = await RSA.generate(2048); dynamic jwk = await RSA.convertPublicKeyToJWK(keyPair.publicKey); String publicKeyPem = await RSA.convertJWKToPublicKey(jwk, ""); } ``` ### Response #### Success Response (200) `convertPublicKeyToJWK` returns a dynamic object representing the JWK. `convertJWKToPublicKey` returns a String representing the public key in PEM format. #### Response Example ```json { "jwk": {"kty":"RSA","n":"...","e":"AQAB"} } ``` ```json { "publicKeyPem": "-----BEGIN PUBLIC KEY-----\n...\n-----END PUBLIC KEY-----" } ``` ``` -------------------------------- ### Link Libraries and Include Directories (CMake) Source: https://github.com/jerson/flutter-rsa/blob/master/example/windows/runner/CMakeLists.txt This section configures the linker to include necessary libraries and header files for the application. It adds Flutter's core libraries, a wrapper library, and the Windows dwmapi library, along with the project's source directory for includes. ```cmake target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib") target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") ``` -------------------------------- ### Define C++ Wrapper Libraries Source: https://github.com/jerson/flutter-rsa/blob/master/example/windows/flutter/CMakeLists.txt Defines static C++ libraries for the Flutter wrapper, separating core, plugin, and application-specific sources. These libraries are configured with independent code and hidden visibility, and linked against the main Flutter library. ```cmake # Wrapper sources needed for a plugin. add_library(flutter_wrapper_plugin STATIC ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} ) apply_standard_settings(flutter_wrapper_plugin) set_target_properties(flutter_wrapper_plugin PROPERTIES POSITION_INDEPENDENT_CODE ON) set_target_properties(flutter_wrapper_plugin PROPERTIES CXX_VISIBILITY_PRESET hidden) target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) target_include_directories(flutter_wrapper_plugin PUBLIC "${WRAPPER_ROOT}/include" ) add_dependencies(flutter_wrapper_plugin flutter_assemble) # Wrapper sources needed for the runner. add_library(flutter_wrapper_app STATIC ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_APP} ) apply_standard_settings(flutter_wrapper_app) target_link_libraries(flutter_wrapper_app PUBLIC flutter) target_include_directories(flutter_wrapper_app PUBLIC "${WRAPPER_ROOT}/include" ) add_dependencies(flutter_wrapper_app flutter_assemble) ``` -------------------------------- ### RSA.signPKCS1v15 / RSA.verifyPKCS1v15 - PKCS1v15 Digital Signatures Source: https://context7.com/jerson/flutter-rsa/llms.txt Generates and verifies digital signatures using the RSA PKCS#1 v1.5 signature scheme. This scheme is deterministic and commonly used for compatibility. ```APIDOC ## RSA.signPKCS1v15 / RSA.verifyPKCS1v15 - PKCS1v15 Digital Signatures ### Description Creates and verifies digital signatures using RSA PKCS#1 v1.5 signature scheme. This is a deterministic signature scheme commonly used for compatibility with existing systems. ### Method `signPKCS1v15(String message, Hash hash, String privateKey)` `verifyPKCS1v15(String signature, String message, Hash hash, String publicKey)` `signPKCS1v15Bytes(Uint8List messageBytes, Hash hash, String privateKey)` `verifyPKCS1v15Bytes(Uint8List signatureBytes, Uint8List messageBytes, Hash hash, String publicKey)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None (Methods operate on provided arguments) ### Request Example ```dart import 'package:fast_rsa/fast_rsa.dart'; Future signVerifyPKCS1v15() async { KeyPair keyPair = await RSA.generate(2048); String message = "Contract agreement text"; String signature = await RSA.signPKCS1v15(message, Hash.SHA256, keyPair.privateKey); bool isValid = await RSA.verifyPKCS1v15(signature, message, Hash.SHA256, keyPair.publicKey); } ``` ### Response #### Success Response (200) `signPKCS1v15` and `signPKCS1v15Bytes` return a String or Uint8List representing the signature. `verifyPKCS1v15` and `verifyPKCS1v15Bytes` return a boolean indicating if the signature is valid. #### Response Example ```json { "signature": "-----BEGIN PKCS1v15 SIGNATURE-----\n...\n-----END PKCS1v15 SIGNATURE-----" } ``` ```json { "isValid": true } ``` ``` -------------------------------- ### CMake: Custom List Prepend Function Source: https://github.com/jerson/flutter-rsa/blob/master/example/linux/flutter/CMakeLists.txt Defines a custom CMake function `list_prepend` to add a prefix to each element of a list. This is a workaround for older CMake versions (pre-3.10) that do not support `list(TRANSFORM ... PREPEND ...)`. It takes the list name and the prefix as arguments and modifies the list in place. ```cmake function(list_prepend LIST_NAME PREFIX) set(NEW_LIST "") foreach(element ${${LIST_NAME}}) list(APPEND NEW_LIST "${PREFIX}${element}") endforeach(element) set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) endfunction() ``` -------------------------------- ### RSA Utility Methods (Async) - Dart Source: https://github.com/jerson/flutter-rsa/blob/master/README.md Demonstrates asynchronous utility functions for RSA operations, including hashing messages with SHA256 and base64 encoding. Requires the 'fast_rsa' package. ```dart import 'package:fast_rsa/fast_rsa.dart'; var result = await RSA.hash(message, Hash.SHA256); var result = await RSA.base64(message); ``` -------------------------------- ### Encrypt and Decrypt RSA Private Keys with Password Source: https://context7.com/jerson/flutter-rsa/llms.txt Provides functionality to encrypt RSA private keys using a password and various cipher algorithms (e.g., AES-256) for secure storage, and to decrypt them when needed. Requires the 'fast_rsa' package. ```dart import 'package:fast_rsa/fast_rsa.dart'; Future passwordProtectKey() async { KeyPair keyPair = await RSA.generate(2048); String password = "strongPassword123!"; // Encrypt private key with AES-256 String encryptedKey = await RSA.encryptPrivateKey( keyPair.privateKey, password, PEMCipher.AES256, ); print('Encrypted Private Key:'); print(encryptedKey); // Decrypt private key String decryptedKey = await RSA.decryptPrivateKey( encryptedKey, password, ); print('Keys match: ${decryptedKey == keyPair.privateKey}'); // Available ciphers: PEMCipher.DES, PEMCipher.D3DES, // PEMCipher.AES128, PEMCipher.AES192, PEMCipher.AES256 } ``` -------------------------------- ### CMake Build Configuration for fast_rsa Flutter Plugin Source: https://github.com/jerson/flutter-rsa/blob/master/linux/CMakeLists.txt This CMakeLists.txt file configures the build process for the fast_rsa Flutter plugin. It sets the project name, defines the shared library, applies standard settings, and specifies visibility, include directories, and linked libraries including flutter and GTK. ```cmake cmake_minimum_required(VERSION 3.10) set(PROJECT_NAME "fast_rsa") project(${PROJECT_NAME} LANGUAGES CXX) # This value is used when generating builds using this plugin, so it must # not be changed set(PLUGIN_NAME "fast_rsa_plugin") add_library(${PLUGIN_NAME} SHARED "fast_rsa_plugin.cc" ) apply_standard_settings(${PLUGIN_NAME}) set_target_properties(${PLUGIN_NAME} PROPERTIES CXX_VISIBILITY_PRESET hidden) target_compile_definitions(${PLUGIN_NAME} PRIVATE FLUTTER_PLUGIN_IMPL) target_include_directories(${PLUGIN_NAME} INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/include") target_link_libraries(${PLUGIN_NAME} PRIVATE flutter) target_link_libraries(${PLUGIN_NAME} PRIVATE PkgConfig::GTK) set(LIBRSA_BRIDGE "librsa_bridge.so") set(LIBRSA_BRIDGE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/shared/${CMAKE_SYSTEM_PROCESSOR}/${LIBRSA_BRIDGE}") # List of absolute paths to libraries that should be bundled with the plugin set(fast_rsa_bundled_libraries ${LIBRSA_BRIDGE_PATH} PARENT_SCOPE ) ``` -------------------------------- ### CMake Subdirectory and Plugin Integration Source: https://github.com/jerson/flutter-rsa/blob/master/example/windows/CMakeLists.txt Includes Flutter's managed directory and the application runner's CMakeLists.txt. It also integrates generated plugin build rules to manage plugin compilation and linking. ```cmake set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") add_subdirectory(${FLUTTER_MANAGED_DIR}) add_subdirectory("runner") set(include_fast_rsa_tests TRUE) include(flutter/generated_plugins.cmake) ``` -------------------------------- ### RSA Encryption (Async) - Dart Source: https://github.com/jerson/flutter-rsa/blob/master/README.md Demonstrates asynchronous RSA encryption using OAEP and PKCS1v15 padding schemes. Supports both string and byte array inputs. Requires the 'fast_rsa' package and appropriate public keys. ```dart import 'package:fast_rsa/fast_rsa.dart'; var result = await RSA.encryptOAEP(message, label, Hash.HASH_SHA256, publicKey) var result = await RSA.encryptPKCS1v15(message, publicKey) var result = await RSA.encryptOAEPBytes(messageBytes, label, Hash.SHA256, publicKey) var result = await RSA.encryptPKCS1v15Bytes(messageBytes, publicKey) ``` -------------------------------- ### RSA OAEP Encryption and Decryption Source: https://context7.com/jerson/flutter-rsa/llms.txt Encrypts and decrypts messages using RSA-OAEP padding with a specified hash algorithm. Supports both string and byte array inputs. OAEP is recommended for semantic security. ```dart import 'package:fast_rsa/fast_rsa.dart'; import 'dart:convert'; // Required for utf8.encode import 'dart:typed_data'; // Required for Uint8List Future encryptDecryptOAEP() async { // Assume keyPair is already generated or loaded KeyPair keyPair = await RSA.generate(2048); String plaintext = "Hello, this is a secret message!"; String label = ""; // Optional label for OAEP // Encrypt with public key using SHA-256 hash String ciphertext = await RSA.encryptOAEP( plaintext, label, Hash.SHA256, keyPair.publicKey, ); print('Encrypted (base64): $ciphertext'); // Decrypt with private key String decrypted = await RSA.decryptOAEP( ciphertext, label, Hash.SHA256, keyPair.privateKey, ); print('Decrypted: $decrypted'); // Output: Hello, this is a secret message! // For binary data, use the Bytes variants Uint8List messageBytes = Uint8List.fromList(utf8.encode(plaintext)); Uint8List encryptedBytes = await RSA.encryptOAEPBytes( messageBytes, label, Hash.SHA256, keyPair.publicKey, ); Uint8List decryptedBytes = await RSA.decryptOAEPBytes( encryptedBytes, label, Hash.SHA256, keyPair.privateKey, ); } ``` -------------------------------- ### RSA Verification (Async) - Dart Source: https://github.com/jerson/flutter-rsa/blob/master/README.md Demonstrates asynchronous RSA signature verification using PSS and PKCS1v15 schemes. Works with string and byte array messages. Requires the 'fast_rsa' package and a public key. ```dart import 'package:fast_rsa/fast_rsa.dart'; var result = await RSA.verifyPSS(signature, message, Hash.SHA256, SaltLength.SALTLENGTH_AUTO, publicKey) var result = await RSA.verifyPKCS1v15(signature, message, Hash.SHA256, publicKey) var result = await RSA.verifyPSSBytes(signatureBytes, messageBytes, Hash.SHA256, SaltLength.SALTLENGTH_AUTO, publicKey) var result = await RSA.verifyPKCS1v15Bytes(signatureBytes, messageBytes, Hash.SHA256, publicKey) ```