Skip to content
The SDK to connect to the RIDDLE&CODE Secure Element
C C++ Other
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin now tracking the cryptoauthlib shared object Aug 21, 2018
golang Merge branch 'master' of https://github.com/riddleandcode/secure-elem… Aug 22, 2018
inc initial commit Aug 20, 2018
.gitignore now tracking compiled go code Aug 21, 2018
README.md Update README.md Feb 6, 2019
license.txt initial commit Aug 20, 2018

README.md

SDK for I²C communication with the RIDDLE&CODE Secure Element

This SDK includes precompiled cryptoauth libraries, header files, and wrapper code for several languages to connect to the RIDDLE&CODE Secure Element via the I²C protocol on various devices.

A generic overview on how to integrate the Secure Element to various boards can be found here.

The SDK has the following structure

  • inc The include files needed to utilize the library.
  • lib precompiled libraries (for several architectures: e.g. arm raspberry pi).
  • golang The wrapper for the Go Language as well as some golang sample code.

The C library

The C libraries are available as shared objects and can be loaded into several languages. The corresponding header files are within the inc folder.

Go wrapper

Using the go wrapper comes with two installation steps

  • Copy the c library from the lib folder to a path contained in LDPATH of the system or to the golang folder if the command is run from there.
  • Add the pkg to your GOPATH

The golang/install.sh script just executes these two steps as shown below

sudo cp ../bin/libcryptoauth.so /usr/lib
cp -R src $GOPATH/.
cp -R pkg $GOPATH/.

Thereafter, the library can be utilized as needed. The concept of the provided Go API is shown in the golang/random_example.go example file.

Example

package main

// Example program demonstrating the usage of Random.
import (
	"encoding/hex"
	"fmt"
	"testing"

	// import the go-cryptoauthlib package into element
	element "github.com/riddleandcode/cryptoauthlib"
)

func main(t *testing.T) {
	// element.Random() returns 32 bytes of random data
	randomBytes := element.Random()
	// print the data to the console
	fmt.Printf("randomBytes:\n%s\n", hex.Dump(randomBytes))
}
You can’t perform that action at this time.