how to assemble and link:
nasm -f elf32 -o <filename>.o <filename>.asm
ld -m elf_i386 -o <filename> <filename>.otemplate code (hello world):
section .text
global _start| // To ensure cross-browser support even without a proper SubtleCrypto | |
| // impelmentation (or without access to the impelmentation, as is the case with | |
| // Chrome loaded over HTTP instead of HTTPS), this library can create SHA-256 | |
| // HMAC signatures using nothing but raw JavaScript | |
| /* eslint-disable no-magic-numbers, id-length, no-param-reassign, new-cap */ | |
| // By giving internal functions names that we can mangle, future calls to | |
| // them are reduced to a single byte (minor space savings in minified file) | |
| var uint8Array = Uint8Array; |
This is an example to demo how you generate the RSA key pair from server side(.NetCore 3.1) and pass the public key to the client(Browser) for encrypting the data that <= 245 bytes.
RSA-2048 can only support to encrypt up to 245 bytes data.
using var rsaProvider = new RSACng();
// spki is used for browser side encryption
var spki = Convert.ToBase64String(rsaProvider.ExportSubjectPublicKeyInfo());
var encodedPrivateKey = Convert.ToBase64String(rsaProvider.ExportPkcs8PrivateKey());| /** | |
| * Usage: | |
| * ``` | |
| * std::function<void(int32)> callback; // This should be stored as e.g. class member | |
| * ... | |
| * addInt32Callback (wrapCallable<int32>(callback), &callback); | |
| * ``` | |
| * @tparam T | |
| * @tparam Callable | |
| * @return function pointer |
| UEsDBBQAAAAIABNQjFGCf/GfLgAAACwAAAAHAAAAUHJvLmtleTMqdncpCXQOKDAp9woMzEo1MTVOrHAzTjTLME7VNs1LK8owTjQpcU8tcuLlAgBQSwECFAAUAAAACAATUIxRgn/xny4AAAAsAAAABwAAAAAAAAAAAAAAAAAAAAAAUHJvLmtleVBLBQYAAAAAAQABADUAAABTAAAAAAA= |