Takes the given data, converts it to an alphabetically sorted JSON object and signs its content using the given wallet.
The Commercio SDK, our own open source tool to format transactions to Commercio.network
- SignHelper signSorted.
- CertificateHelper getPem (only for Kotlin).
From Wikipedia:
In cryptography and computer security, a self-signed certificate is a certificate that is not signed by a certificate authority (CA). Privacy-Enhanced Mail (PEM) is a de facto file format for storing and sending cryptographic keys, certificates, and other data, based on a set of 1993 IETF standards defining "privacy-enhanced mail.
- Execute the SignHelper signSorted to sign your data.
- Generate the wallet;
- Execute the SignHelper signSorted to sign your data. The resulting byte array represents the signature in ASN.1 DER format.
- Generate the wallet;
- Generate rsaKeyPair using KeysHelper generateRsaKeyPair;
- Create an X509 certificate using the given keyPair and walletAddress;
- Execute CertificateHelper getPem to get PEM representation of the given certificate.
Here's an example of the implemetation in all the available languages.
final data = {
"name": "John",
"surname": "Smith",
"email": "[email protected]"
};
await SignHelper.signSorted(data, wallet);
val data ="\"name\": \"John\", \"surname\": \"Smith\",\"email\": \"[email protected]\""
val wallet = Wallet.derive(mnemonic, networkInfo)
val signedData = SignHelper.signSorted(data, wallet)
val wallet = Wallet.derive(mnemonic, networkInfo)
val rsaKeyPair = KeysHelper.generateRsaKeyPair()
val certificate = CertificateHelper.x509certificateFromWallet(wallet.bech32Address, rsaKeyPair)
val pemCertificate = CertificateHelper.getPem(certificate)
var wallet = commercio.sacco.lib.Wallet.derive(mnemonic, networkInfo);
var data = "{'name': 'John', 'surname': 'Smith', 'email': '[email protected]'}";
var res = commercio.sdk.SignHelper.signSorted(data, wallet);