Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

ECKey.ES256Sign

Signs the given data with ES256.

Component Version macOS Windows Linux Server iOS SDK
Sign 15.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "ECKey.ES256Sign"; ECKey; Data; DataEncoding { ; OutputEncoding } )   More

Parameters

Parameter Description Example Flags
ECKey The reference number for the key. $Key
Data The hex encoded data. $hash
DataEncoding The text encoding for data parameter.
Default is UTF-8.
Pass base64 if the data is base64 encoded or pass hex if it is hex encoded.
"UTF8"
OutputEncoding The text encoding for the result. e.g. Hex
Default is Base64.
"Base64" Optional

Result

Returns OK or error.

Description

Signs the given data with ES256.
Can be used to build a JWT with ES256.

Examples

Sign and verify:

Let([
    id = MBS( "ECKey.CurveNameToID"; "P-256" );
    ECKey = MBS( "ECKey.Generate"; id );
    signature = MBS( "ECKey.ES256Sign"; ECKey; "Hello World"; "UTF-8"; "Base64" );
    verify = MBS("ECKey.ES256Verify"; ECKey; "Hello World"; "UTF-8"; signature; "Base64");
    description = MBS("ECKey.Description"; ECKey);
    r = MBS("ECKey.Release"; ECKey)
]; signature & ¶ & verify & ¶ & description)

Example result:
MEUCIQCHeCQP3fqCSwL+lrAsEKeYqcOyW80u7ApTnUxBS1Jj4QIgOdsoT7xNscz7e/fzT+MQkbJAKAZp7JFZn4AgMyaPvlM=
OK
Private-Key: (256 bit)
priv:
    3f:3e:e4:b3:79:5f:81:ca:66:d2:66:8f:74:74:9a:
    19:b7:ef:8a:d5:d3:e6:93:1e:5b:a0:ce:40:f1:9c:
    81:07
pub:
    04:cc:da:1f:15:ca:1c:55:61:ea:f0:71:75:99:fa:
    42:08:0b:eb:df:6f:fa:8c:7e:f7:b0:1f:e7:19:55:
    79:e5:d3:ea:76:ab:c2:b6:17:bf:63:9d:e2:73:30:
    3d:9d:54:3c:62:0a:f4:46:e8:9a:89:c6:05:41:e3:
    e6:fc:9c:07:c1
ASN1 OID: prime256v1
NIST CURVE: P-256

See also

Release notes

Blog Entries

This function checks for a license.

Created 3th February 2025, last changed 11st April 2025


ECKey.Duplicate - ECKey.ES256Verify