
//---------------------------------------------------------------------
// $VER: example.c 1.0 (16.6.98)
//
// C example for Spirit1.5+
//---------------------------------------------------------------------

#include <misc/spirit.h>
#include <string.h>

#define KEY_LENGTH 512

//---------------------------------------------------------------------
// KeyModule Tags
//---------------------------------------------------------------------

char ver[]="$VER: Example_keymodule 1.0 (16.6.98)\r\n";

struct TagItem KeyModTags[]={
               SPT_Name,(ULONG)"!Example",
               SPT_Version,(ULONG)"1.0",
               SPT_Cracker,(ULONG)"Sunbeam",
               SPT_Group,(ULONG)"DC",
               SPT_Date,(ULONG)"16.6.98",
               SPT_KeyLength,KEY_LENGTH,
               SPT_KeyName,(ULONG)"Example.key",
               SPT_KeyPath,(ULONG)"T:",
               SPT_Encrypt,(ULONG)encrypt,
               SPT_TempBuff,3000,
               SPT_Flags,FLGF_CHECKEMPTY|FLGF_HEXSER|FLGF_RNDFILL|FLGF_DYNAMIC,
               SPT_Anno,(ULONG)"Example SPT_Anno\nCool eh? :-)",
               SPT_NameLen,20,
               SPT_SerialLen,8,
               SPT_StreetLen,10,
               SPT_CityLen,30,
               SPT_CountryLen,3,
               SPT_ComputerLen,50,
               SPT_eMailLen,50,
               SPT_PhoneLen,20,
               SPT_SpiritVer,SPIRITVERSION,
               SPT_CPU,CPU_68020,
               TAG_DONE};

//---------------------------------------------------------------------
// Encrypt Routine
//---------------------------------------------------------------------

__asm void main(keyargs)
{

  strcpy(KeyBase->TempBuffer, "I don't really need this buffer :-)");
  strcpy(KeyBase->KeyBuffer, KeyBase->Name);
  if (SaveFile("T:kb_TempBuffer", strlen(KeyBase->TempBuffer), KeyBase->TempBuffer)) spreturn(RETURN_ERR,NULL);
  spreturn(RETURN_NOERR, KEY_LENGTH);

}
