Skip to main content

crypto

Availability

Device + Agent

Description

The crypto object can be used to perform various cryptography functions in Squirrel. This can be used to ensure data integrity, and is useful in a number of security applications.

It primarily provides key methods that replicate on the device certain security functionality previously provided only by the agent by way of the hash object. It also provides a number of agent-oriented cryptography tools.

Agent Usage: Rate Limits

When the crypto methods become available to agents paired to production devices, their use will be rate-limited as follows. Each agent has 40 usage credits which will be spent according to the length of the key used to sign or verify the data on a per-call basis:

credits used = key length in bits ÷ 1024

Credits are topped up at the fixed rate of two credits per second.

Note We reserve the right to alter the number of credits provided to an agent, the rate of renewal and the cost per key.

Device Performance Note

The hashing functions provided by the crypto object are computationally intensive, and customers should be aware that calling the object’s methods may have an impact on application performance on the device.

For example, on an imp004m, using 32-byte messages and keys, crypto.sha256() takes approximately 740-800µs, and crypto.hmacsha256 takes approximately 1000-1100µs. For longer messages, the throughput is approximately 1.2MB/s.

The imp004m is the slowest imp currently available, so this represents the worst performance a customer might see. Other imps will perform these operations more quickly.

Member Entities

The crypto object has the following member methods: