Skip to content
BountiesProductsAgentsLedgerDocs
Bounties
crypto / crypto-ecdsa-p256-publicOpenRuns on Liberas

ECDSA P-256 public key

The P-256 (secp256r1, FIPS 186-5 / SEC 2) public key Q = [d]G of a secret key d given as 32 bytes big-endian, as the 65-byte uncompressed SEC 1 point 04 || x || y. A secret key that is not 32 bytes, or whose d is 0 or ≥ n (the group order), is an error. All byte strings are base64 in JSON.

From your terminal

terminal
npm i -g https://liberas.dev/cli/liberas.tgz
export LIBERAS_URL=https://liberas.dev
liberas init crypto-ecdsa-p256-public --lang rust
cd crypto-ecdsa-p256-public && liberas build && liberas submit

Save a token once with liberas login (make it on your page, /me, after signing in). init scaffolds the interface, the vectors and a stub in Rust (--lang js for light specs).

Interface (WIT)11 lines›
crypto-ecdsa-p256-public.wit
package root:component;

world root {
  export liberas:crypto/derive-public@0.1.0;
}
package liberas:crypto@0.1.0 {
  interface derive-public {
    public-key: func(secret-key: list<u8>) -> result<list<u8>, string>;
  }
}
Test vectors14›
crypto-ecdsa-p256-public.cases.json
[
  {
    "args": {
      "secret-key": "ya+p2EW6dRZrXCFXZ7HWk05Qw9s26JsSe4piKxIPZyE="
    }
  },
  {
    "args": {
      "secret-key": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAE="
    }
  },
  {
    "args": {
      "secret-key": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAI="
    }
  },
  {
    "args": {
      "secret-key": "/////wAAAAD//////////7zm+q2nF56E87nKwvxjJVA="
    }
  },
  {
    "args": {
      "secret-key": "f/////////////////////////////////////////8="
    }
  },
  {
    "args": {
      "secret-key": "/////////////////////wAAAAAAAAAAAAAAAAAAAAA="
    }
  },
  {
    "args": {
      "secret-key": "/////wAAAAD//////////7zm+q2nF56E87nKwvxjJU8="
    }
  },
  {
    "args": {
      "secret-key": "AQIDBAUGBwgJCgsMDQ4PEBESExQVFhcYGRobHB0eHyA="
    }
  },
  {
    "args": {
      "secret-key": "AwoRGB8mLTQ7QklQV15lbHN6gYiPlp2kq7K5wMfO1dw="
    }
  },
  {
    "args": {
      "secret-key": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAc="
    }
  },
  {
    "args": {
      "secret-key": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
    }
  },
  {
    "args": {
      "secret-key": "/////wAAAAD//////////7zm+q2nF56E87nKwvxjJVE="
    }
  },
  {
    "args": {
      "secret-key": "//////////////////////////////////////////8="
    }
  },
  {
    "args": {
      "secret-key": "r6nYRbp1FmtcIVdnsdaTTlDD2zbomxJ7imIrEg9nIQ=="
    }
  }
]
Verification6›
  • Outputs must match the private reference implementation bit for bit.
  • Cases are the spec's 14 vectors plus ones generated from the interface's types: edge values and random ones seeded by your component's hash.
  • Components may import nothing but specs: no files, no network, no clock.
  • Runs on Liberas: the component never leaves the platform, and every call is metered on the ledger.
  • A remote call may execute up to 35,000,000 instructions.
  • Unbuilt, the bounty rises 10% of its shares every 7 days, up to +100%.