Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Mono C#.NET Core C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicCkPythonChilkat2-PythonRubySQL ServerSwift 2Swift 3/4TclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.jsExcelGo

Visual Basic 6.0 Examples

Web API Categories

ASN.1
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Service Bus
Base64
Bounced Email
Box
CAdES
CSR
CSV
Certificates
Compression
DKIM / DomainKey
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
ECC
Email Object
Encryption
FTP
FileAccess
Firebase
GMail REST API
Geolocation
Google APIs
Google Calendar
Google Cloud Storage
Google Drive
Google Photos
Google Sheets
Google Tasks
Gzip
HTML-to-XML/Text

HTTP
HTTP Misc
IMAP
JSON
JSON Web Encryption (JWE)
JSON Web Signatures (JWS)
JSON Web Token (JWT)
Java KeyStore (JKS)
MHT / HTML Email
MIME
Microsoft Graph
NTLM
OAuth1
OAuth2
OneDrive
OpenSSL
Outlook
PEM
PFX/P12
POP3
PRNG
REST
REST Misc
RSA
SCP
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
SharePoint
Socket/SSL/TLS
Spider
Stream
Tar Archive
Upload
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Zip
curl

 

 

 

(Visual Basic 6.0) Generate ECC Keys using Specified Values for K

Demonstrates how to verify ECC key generation by using pre-selected values of K with known answer tests.

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

'  This example requires the Chilkat API to have been previously unlocked.
'  See Global Unlock Sample for sample code.

'  Test Vectors for ECC private keys are shown below.

'  Generate a few ECC keys using particular values of k.
Dim curveName As String
curveName = "secp256r1"
Dim encodedK As String
encodedK = "1"
'  The decimal encoding means that the string represents a decimal integer.
'  You'll see that the k values can ge HUGE integers..
Dim encoding As String
encoding = "decimal"

Dim ecc As New ChilkatEcc

Dim privkey As PrivateKey
Set privkey = ecc.GenEccKey2(curveName,encodedK,encoding)
If (ecc.LastMethodSuccess <> 1) Then
    Debug.Print ecc.LastErrorText
    Exit Sub
End If

Dim pubkey As PublicKey
Set pubkey = privkey.GetPublicKey()

'  Get the public key as XML so we can see the individual parts (namely, X and Y).
Dim xml As New ChilkatXml
success = xml.LoadXml(pubkey.GetXml())

'  Check the x and y against the test vectors below..
Debug.Print "k = " & encodedK
Debug.Print "x = " & xml.GetAttrValue("x")
Debug.Print "y = " & xml.GetAttrValue("y")

'  Now let's try a really large k

encodedK = "1769805277975163035253775930842367129093741786725376786007349332653323812656658291413435033257677579095366632521448854141275926144187294499863933403633025023"
Set privkey = ecc.GenEccKey2(curveName,encodedK,encoding)
Set pubkey = privkey.GetPublicKey()
success = xml.LoadXml(pubkey.GetXml())

Debug.Print "k = " & encodedK
Debug.Print "x = " & xml.GetAttrValue("x")
Debug.Print "y = " & xml.GetAttrValue("y")

'  -----------------------------------------------------------------------
'  Test vectors for ECC keys generated for particular decimal values of k.
' 
'  [secp256r1]
'  k = 1
'  X = 0x6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296
'  Y = 0x4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5
' 
'  k = 2
'  X = 0x7CF27B188D034F7E8A52380304B51AC3C08969E277F21B35A60B48FC47669978
'  Y = 0x7775510DB8ED040293D9AC69F7430DBBA7DADE63CE982299E04B79D227873D1
' 
'  k = 3
'  X = 0x5ECBE4D1A6330A44C8F7EF951D4BF165E6C6B721EFADA985FB41661BC6E7FD6C
'  Y = 0x8734640C4998FF7E374B06CE1A64A2ECD82AB036384FB83D9A79B127A27D5032
' 
'  k = 4
'  X = 0xE2534A3532D08FBBA02DDE659EE62BD0031FE2DB785596EF509302446B030852
'  Y = 0xE0F1575A4C633CC719DFEE5FDA862D764EFC96C3F30EE0055C42C23F184ED8C6
' 
'  k = 5
'  X = 0x51590B7A515140D2D784C85608668FDFEF8C82FD1F5BE52421554A0DC3D033ED
'  Y = 0xE0C17DA8904A727D8AE1BF36BF8A79260D012F00D4D80888D1D0BB44FDA16DA4
' 
'  k = 6
'  X = 0xB01A172A76A4602C92D3242CB897DDE3024C740DEBB215B4C6B0AAE93C2291A9
'  Y = 0xE85C10743237DAD56FEC0E2DFBA703791C00F7701C7E16BDFD7C48538FC77FE2
' 
'  k = 7
'  X = 0x8E533B6FA0BF7B4625BB30667C01FB607EF9F8B8A80FEF5B300628703187B2A3
'  Y = 0x73EB1DBDE03318366D069F83A6F5900053C73633CB041B21C55E1A86C1F400B4
' 
'  k = 8
'  X = 0x62D9779DBEE9B0534042742D3AB54CADC1D238980FCE97DBB4DD9DC1DB6FB393
'  Y = 0xAD5ACCBD91E9D8244FF15D771167CEE0A2ED51F6BBE76A78DA540A6A0F09957E
' 
'  k = 9
'  X = 0xEA68D7B6FEDF0B71878938D51D71F8729E0ACB8C2C6DF8B3D79E8A4B90949EE0
'  Y = 0x2A2744C972C9FCE787014A964A8EA0C84D714FEAA4DE823FE85A224A4DD048FA
' 
'  k = 10
'  X = 0xCEF66D6B2A3A993E591214D1EA223FB545CA6C471C48306E4C36069404C5723F
'  Y = 0x878662A229AAAE906E123CDD9D3B4C10590DED29FE751EEECA34BBAA44AF0773
' 
'  k = 11
'  X = 0x3ED113B7883B4C590638379DB0C21CDA16742ED0255048BF433391D374BC21D1
'  Y = 0x9099209ACCC4C8A224C843AFA4F4C68A090D04DA5E9889DAE2F8EEFCE82A3740
' 
'  k = 12
'  X = 0x741DD5BDA817D95E4626537320E5D55179983028B2F82C99D500C5EE8624E3C4
'  Y = 0x770B46A9C385FDC567383554887B1548EEB912C35BA5CA71995FF22CD4481D3
' 
'  k = 13
'  X = 0x177C837AE0AC495A61805DF2D85EE2FC792E284B65EAD58A98E15D9D46072C01
'  Y = 0x63BB58CD4EBEA558A24091ADB40F4E7226EE14C3A1FB4DF39C43BBE2EFC7BFD8
' 
'  k = 14
'  X = 0x54E77A001C3862B97A76647F4336DF3CF126ACBE7A069C5E5709277324D2920B
'  Y = 0xF599F1BB29F4317542121F8C05A2E7C37171EA77735090081BA7C82F60D0B375
' 
'  k = 15
'  X = 0xF0454DC6971ABAE7ADFB378999888265AE03AF92DE3A0EF163668C63E59B9D5F
'  Y = 0xB5B93EE3592E2D1F4E6594E51F9643E62A3B21CE75B5FA3F47E59CDE0D034F36
' 
'  k = 16
'  X = 0x76A94D138A6B41858B821C629836315FCD28392EFF6CA038A5EB4787E1277C6E
'  Y = 0xA985FE61341F260E6CB0A1B5E11E87208599A0040FC78BAA0E9DDD724B8C5110
' 
'  k = 17
'  X = 0x47776904C0F1CC3A9C0984B66F75301A5FA68678F0D64AF8BA1ABCE34738A73E
'  Y = 0xAA005EE6B5B957286231856577648E8381B2804428D5733F32F787FF71F1FCDC
' 
'  k = 18
'  X = 0x1057E0AB5780F470DEFC9378D1C7C87437BB4C6F9EA55C63D936266DBD781FDA
'  Y = 0xF6F1645A15CBE5DC9FA9B7DFD96EE5A7DCC11B5C5EF4F1F78D83B3393C6A45A2
' 
'  k = 19
'  X = 0xCB6D2861102C0C25CE39B7C17108C507782C452257884895C1FC7B74AB03ED83
'  Y = 0x58D7614B24D9EF515C35E7100D6D6CE4A496716E30FA3E03E39150752BCECDAA
' 
'  k = 20
'  X = 0x83A01A9378395BAB9BCD6A0AD03CC56D56E6B19250465A94A234DC4C6B28DA9A
'  Y = 0x76E49B6DE2F73234AE6A5EB9D612B75C9F2202BB6923F54FF8240AAA86F640B8
' 
'  k = 112233445566778899
'  X = 0x339150844EC15234807FE862A86BE77977DBFB3AE3D96F4C22795513AEAAB82F
'  Y = 0xB1C14DDFDC8EC1B2583F51E85A5EB3A155840F2034730E9B5ADA38B674336A21
' 
'  k = 112233445566778899112233445566778899
'  X = 0x1B7E046A076CC25E6D7FA5003F6729F665CC3241B5ADAB12B498CD32F2803264
'  Y = 0xBFEA79BE2B666B073DB69A2A241ADAB0738FE9D2DD28B5604EB8C8CF097C457B
' 
'  k = 1769805277975163035253775930842367129093741786725376786007349332653323812656658291413435033257677579095366632521448854141275926144187294499863933403633025023
'  X = 0x2D3854A31371FE86AFA7A7DC0B22BC2DC255D3B8D3D0AD4EF6C25DA402117103
'  Y = 0xF6D66F0A39465C49852747337CEE6219F5E0872C6A8E8431EE57410C5392F3DB
' 
'  k = 104748400337157462316262627929132596317243790506798133267698218707528750292682889221414310155907963824712114916552440160880550666043997030661040721887239
'  X = 0xAEAFB3C99F1EB63297861CC338C797561091F8E1F22AA807438A82E956CF9478
'  Y = 0x1AAC22154C9472D82E063A69FA8E466854E4BFE815C56B496CFC881D901DF226
' 
'  k = 6703903865078345888141381651430168039496664077350965054288133126549307058741788671148197429777343936466127575938031786147409472627479702469884214509568000
'  X = 0x9F6DC8BAA2C2A276CC9FA95F83A813D249C809D58B43A83DC21F28DFD126A90
'  Y = 0x72D360D755623F7B039B2D8354C76E3534FDE48DB0DDF3DE4922F53CE6E2DC58
' 
'  k = 1675925643682395305404517165643562251880026958780896531698856737024179880343339878336382412050263431942974939646683480906434632963478257639757341102436352
'  X = 0xFB6755D334BBE3138022D9F8B304FC723377906CFE49D5C32211FE5189CA33C3
'  Y = 0xBEED1AB80F1036E3AF55BCE09E38E3D56239E00A042FE0794134936179600C95
' 
'  k = 12785133382149415221402495202586701798620696169446772599038235721862338692190156163951558963856959059232381602864743924427451786769515154396810706943
'  X = 0x4886A382D1B15CA9440F648F3F0B62EAA212CF2EA5FA655020C564FF3F9A2596
'  Y = 0x56E92A8F04D4228AF76553D366FBBCE76D30A88053ACB54DD9F0035323E76252
' 
'  k = 214524875832249255872206855495734426889477529336261655255492425273322727861341825677722947375406711676372335314043071600934941615185418540320233184489636351
'  X = 0x499040AE1ADB07FA27252C346B8CEC987C0F7376B76334A89A8127A5542665D2
'  Y = 0x2AC0FB385AE831BEC5483368A2CE18B217AAABBBE453C7BDAC963D4B8E887E43
' 
'  k = 51140486275567859131139077890835526884648461857823088348651153840508287621366854506831244746531272246620295123104269565867055949378266395604768784399
'  X = 0x1897309BFE4AF9D970F518BA4BF3A5DC8EB8C0CF3C5C70CDE21D6C3E63673F77
'  Y = 0x14A77D8B9106C97458C2C9C976ABFECAA5FEBAA742367F2820B3EDB7A8C003D1
' 
'  k = 6651529716025206881035279952881520627841152247212784520914425039312606120198879080839643311347169019249080198239408356563413447402270445462102068592377843
'  X = 0x88DEF4514AECC834D16A599C580E1B6AEF8053A3E4F0CC0B65D703AC9631924F
'  Y = 0xF156EA66741ECF2870DD6669CBA93A83DDF8761778BBF7BE9CB1E61E4BEB49F3
' 
'  k = 3224551824613232232537680077946818660156835288778087344805370397811379731631671254853846826682273677870214778462237171365140390183770226853329363961324241919
'  X = 0x6D548A62EDCFAB8BF739E74EE0582BE39B95C5A7CE81BBCB687082B7B6C30414
'  Y = 0x67E7F2ABC74B0480DAB3761F8D8A0C760A0D038810383337C707B70BD4EF5CF3
' 
'  k = 12486613128442885430380874043991285080254917488396284953815149251315412600634581539066663092297612040669978017623587752845409653167277021864132608
'  X = 0x653430D254EE638A3C68794E48B3863B2A25CBB5E63306FF5C6BAFDD5B9F501B
'  Y = 0x3E6EF53C0A53F29A1D5F94903D217D792CC905396AA542C51B699097296FF5E2
' 
'  k = 6864797660130609714981900799081393217269435300143305409394463459185543183397655394245057746333217197532963996371363321113864768612440380340372808892707005429
'  X = 0xE861147B179113450D991ECCC243040BE4B2EA83B3A668D44B52DCFCBAA16680
'  Y = 0x536FA8DBF602E5B91A1DF36276BDE27E3C29DF1E8392E056548EEC911993DB23
' 
'  k = 6864797660130609714981900799081393217269435300143305409394463459185543183397655394245057746333217197532963996371363321113864768612440380340372808892707005430
'  X = 0xD6EEF821E1257650E463E6D23AFF7899284672410DAF43E1821EC1CCF3C38750
'  Y = 0x2961FD9956CB06192D3E9A9F06CF8A0EC3B724DECF8F70CC3AC1EDAC9D846159
' 
'  k = 6864797660130609714981900799081393217269435300143305409394463459185543183397655394245057746333217197532963996371363321113864768612440380340372808892707005431
'  X = 0xF5EED3CC425ED32A447973A400540A1253102D5DC8BC31C30C5009334E8BC858
'  Y = 0x6B29B473AA9FC7D79C1F86EDFD2A271A4BCF264F07FA1A42EFD20E6BA324F4EF
' 
'  k = 6864797660130609714981900799081393217269435300143305409394463459185543183397655394245057746333217197532963996371363321113864768612440380340372808892707005432
'  X = 0x5B16C97257650329D8026B9108116866D78495E92537D5AC29C00770FF6DB91
'  Y = 0xE56D1B1C22F914209669DED2F2C477811D7ACC0BE405B724F02102B0CF57DADC
' 
'  k = 6864797660130609714981900799081393217269435300143305409394463459185543183397655394245057746333217197532963996371363321113864768612440380340372808892707005433
'  X = 0x5404BB1F6006E3970A91F654B579349B5645BC8D62ECEEA02E1C69C9BBC7ACF9
'  Y = 0xDDE19DC28B6021F0B9602C1B0DD7AC6F9F871D3BAFE79D335BBFFB6A53FD3FB
' 
'  k = 6864797660130609714981900799081393217269435300143305409394463459185543183397655394245057746333217197532963996371363321113864768612440380340372808892707005434
'  X = 0xBB588F32A40A57D86B3C5FA795A43769BF87A42C2774EDBCBC45D851301DE591
'  Y = 0x9B52D41BD1A3784786D47AFC24D5C493BC0F64EB0AFA34489C87D5A29F1CE259
' 
'  k = 6864797660130609714981900799081393217269435300143305409394463459185543183397655394245057746333217197532963996371363321113864768612440380340372808892707005435
'  X = 0x1BF822D6020CC97B8E479D533140C7D04576D2C444F1C1EC02C57B1044D6506D
'  Y = 0x29607A443FA2E444F4C115CCEB748A05A3D78D1B9E191D5074448764DB723BE9
' 
'  k = 6864797660130609714981900799081393217269435300143305409394463459185543183397655394245057746333217197532963996371363321113864768612440380340372808892707005436
'  X = 0xD88AE8E791AFDCD2B5DDACA65204059FCA9EC59B038B7D5A08F6A39BD7D2D133
'  Y = 0x862552BA73B4789EEC0B157A033ED20C2FC4BF319FAE87DB3F12241971E92AAC
' 
'  k = 6864797660130609714981900799081393217269435300143305409394463459185543183397655394245057746333217197532963996371363321113864768612440380340372808892707005437
'  X = 0x3ED8084EA73640ACAC7AFAB65FB48EE953B4D76B2BA1E986CFC88636467CFD8E
'  Y = 0xE25DD0C1EBD63F9E00DC3ACB0E5134CBFC4AF845AE5BDECCEA161BF5FAA826AA
' 
'  k = 6864797660130609714981900799081393217269435300143305409394463459185543183397655394245057746333217197532963996371363321113864768612440380340372808892707005438
'  X = 0xBDB5768EB2560DB3247C36AB979F9BFEE59AAC1677BCEEB045E87890442D0CF5
'  Y = 0x20E94B2A3BA26DCD091CFD56F24F41D0DCFB2D0BFEA2428EE8BEE04A3B54D745
' 
'  k = 6864797660130609714981900799081393217269435300143305409394463459185543183397655394245057746333217197532963996371363321113864768612440380340372808892707005439
'  X = 0xC6FAB3C0731FCD4EBE1BBE197C97948BC5412185955570D46BF0197CA9048550
'  Y = 0x2EBD9D77F68DEDAAA396AE7FB5C38A3C6F1C34CD03C7B580E9B7B22700CA547E
' 
'  k = 6864797660130609714981900799081393217269435300143305409394463459185543183397655394245057746333217197532963996371363321113864768612440380340372808892707005440
'  X = 0xD8128CF1ADBE0112E6F039DD196E17B2276FCBD77426331228FB55C9AFB9988A
'  Y = 0x6EE1FDD9DA865D7D5CBE33B9C98B6003132437B9F3E17C03694F923D29B1D5EC
' 
'  k = 6864797660130609714981900799081393217269435300143305409394463459185543183397655394245057746333217197532963996371363321113864768612440380340372808892707005441
'  X = 0x51FE8EDAD2B2413AB72C5EDF3B780177D951B403E77424785AEE564D9C97C9E2
'  Y = 0x9F5427EF6124E68CC5027763B83EF7AB9EBAFAE424BE0A7BE2C235C252B80667
' 
'  k = 6864797660130609714981900799081393217269435300143305409394463459185543183397655394245057746333217197532963996371363321113864768612440380340372808892707005442
'  X = 0x125AAFD2CD7D23BE615E2EE4B33D2D6D7DADBFE3581A385BA30943AD11600353
'  Y = 0xBE6EAB18544F9467F0A0962F40FE2BB7390B90D0EE19061E23F2BDDFE7D1E147
' 
'  k = 6864797660130609714981900799081393217269435300143305409394463459185543183397655394245057746333217197532963996371363321113864768612440380340372808892707005443
'  X = 0xDB6B9D504FB3889A8FBC1D8C181AF1B4B75FEC1A0705429A4052FB1D1684F423
'  Y = 0x8029A80E22607E8916021D53E6EED6E8AACB89C2E7B319CD60FFB25544B9ADD8
' 
'  k = 6864797660130609714981900799081393217269435300143305409394463459185543183397655394245057746333217197532963996371363321113864768612440380340372808892707005444
'  X = 0x8ED563B390950C878D103AFC34C8A2F601BA68D8506C23816AE0DCA6B9E8B72A
'  Y = 0x97927DADA6B9741B729A4F388854173B6969638F88086FCE19166D926BF9EE39
' 
'  k = 6864797660130609714981900799081393217269435300143305409394463459185543183397655394245057746333217197532963996371363321113864768612440380340372808892707005445
'  X = 0xD1C5C17B4D4D8D8231A35E1AC0692413EC1131DE9E4D3CCF63D0457AE52470F7
'  Y = 0x7C7CD5C83BF53E0A571B613235B120B1645BC60F8A83BE6EC1795D1BDFC73A93
' 
'  k = 6864797660130609714981900799081393217269435300143305409394463459185543183397655394245057746333217197532963996371363321113864768612440380340372808892707005446
'  X = 0xF460B18ECE8E80F49E019DE5ACCDC3CCB492B4841F879B2432B6DFD1AB0B1B39
'  Y = 0x1733F8A4DF56B4BE7E28A5C395D21CD1F85748DDA6C6517854EF5D958E68CAE9
' 
'  k = 6864797660130609714981900799081393217269435300143305409394463459185543183397655394245057746333217197532963996371363321113864768612440380340372808892707005447
'  X = 0x2A75A7BC8B47276C63DEF73AAA34FC3852983AB7356BDBA086CF559C74573A6B
'  Y = 0xC3C9B2EA70A631B36F73808494EA626EBC93BB5D8ADC2A72DA2DF9C00E97EDA3
' 
'  k = 6864797660130609714981900799081393217269435300143305409394463459185543183397655394245057746333217197532963996371363321113864768612440380340372808892707005448
'  X = 0x6D04A0AD9E96C903869ECD0DD952E1968979ACFA8B2F58AFD65BAD633E81ADB0
'  Y = 0x2B20353E8B6491157E13FF3AC57B11947571F7C2E0124439BEDCEECCC04C40E9

 

© 2000-2019 Chilkat Software, Inc. All Rights Reserved.