Ok so there was a few problems with my initial attempt, but after banging my head against the manual answers fell out:
- The curve file is a file path.
- The curve file path refers to files ON THE CARD.
- You must load the file into the card and read it there.
- You must use the .bin, not the .def file for this.
- The private key uses a 32 byte format and the public key will be the full 64 byte key. (X AND Y position).
- The format is base 256, meaning each char value in the string keys can be an extended ASCII code between 0-255. (Hence my initial tries with decimal and hexadecimal integers were too long!)
This is the card file definition:
Dir "\"
File "CurveFile" Len=0
input "C:\Users\mcb\Dropbox\Hobby stuff\75Branch\secp256k1.16.bin"
End Dir
Here is how to refer to it:
Call ECpSetCurveFromFile("\CurveFile")
If LibError <> 0 Then SW1SW2 = LibError : LibError = 0 : exit command
Here is the key definition, the Chr$ is native and converts the byte array to string:
Eeprom prk$ = Chr$( &H79,&H33,&HBC,&H95,&HD3,&H03,&H9F,&H94,_
&H9F,&H25,&H14,&H0C,&HAA,&H62,&H45,&HC7,_
&H16,&H08,&HBF,&H93,&H43,&H96,&HC6,&HDC,_
&HE4,&HCD,&HB0,&H87,&H5C,&H6A,&H72,&HE8)
(Const type is also allowed) Here is how to use the key for generating a public key:
Call ECpMakePublicKey(Key1, puk$)
If LibError <> 0 Then SW1SW2 = LibError : LibError = 0 : exit command