![]()  | 
  
Chilkat  HOME  Android™  AutoIt  C  C#  C++  Chilkat2-Python  CkPython  Classic ASP  DataFlex  Delphi DLL  Go  Java  Node.js  Objective-C  PHP Extension  Perl  PowerBuilder  PowerShell  PureBasic  Ruby  SQL Server  Swift  Tcl  Unicode C  Unicode C++  VB.NET  VBScript  Visual Basic 6.0  Visual FoxPro  Xojo Plugin
 
      (PureBasic) Load EC Public Key from X,Y ValuesDemonstrates how to load an EC public key from X and Y values. 
 IncludeFile "CkPublicKey.pb" IncludeFile "CkJsonObject.pb" Procedure ChilkatExample() success.i ; We have the following x and y values in base64 (for an EC point on the P-256 curve). x.s = "Dn7uB1O7kgk74G6qfQwFJESeDnxO6lLjGZFWZJE16tw" y.s = "iOWA5DInzK6nuUGvHJbMVq1Dpj248FqSV2teN3HzmhU" ; Build a JWK that looks like this: ; { ; "kty": "EC", ; "crv": "P-256", ; "x": "Dn7uB1O7kgk74G6qfQwFJESeDnxO6lLjGZFWZJE16tw", ; "y": "iOWA5DInzK6nuUGvHJbMVq1Dpj248FqSV2teN3HzmhU" ; } json.i = CkJsonObject::ckCreate() If json.i = 0 Debug "Failed to create object." ProcedureReturn EndIf CkJsonObject::ckUpdateString(json,"kty","EC") CkJsonObject::ckUpdateString(json,"crv","P-256") CkJsonObject::ckUpdateString(json,"x",x) CkJsonObject::ckUpdateString(json,"y",y) ; Load from the JWK. pubkey.i = CkPublicKey::ckCreate() If pubkey.i = 0 Debug "Failed to create object." ProcedureReturn EndIf success = CkPublicKey::ckLoadFromString(pubkey,CkJsonObject::ckEmit(json)) If success = 0 Debug CkPublicKey::ckLastErrorText(pubkey) CkJsonObject::ckDispose(json) CkPublicKey::ckDispose(pubkey) ProcedureReturn EndIf Debug "Success." CkJsonObject::ckDispose(json) CkPublicKey::ckDispose(pubkey) ProcedureReturn EndProcedure  | 
  ||||
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.