Thing Edge 教程 - 加密协处理器
ATECC508A 加密协处理器突破使您可以轻松地为IoT节点,物联网设备或嵌入式系统添加强大的身份验证安全性。

Thing Edge 教程 - 加密协处理器

TONYLABS 16 Jan, 2020
Share:

ATECC508A 加密协处理器突破使您可以轻松地为IoT节点,物联网设备或嵌入式系统添加强大的身份验证安全性。

ATECC508A芯片能够执行许多加密过程,包括但不限于:

基于椭圆曲线密码(FIPS186-3)创建并安全地存储唯一的非对称密钥对。

创建和验证64字节的数字签名(来自32字节的消息数据)。

通过椭圆曲线Diffie-Hellman算法在公共频道上创建共享密钥。

使用SHA-256算法的基于哈希的标准质询响应协议。

内部高质量FIPS随机数生成器。

芯片中嵌入了一个10Kb EEPROM阵列,可用于存储密钥,证书,数据,消耗记录和安全配置。然后可以限制对内存部分的访问,并且可以锁定配置以防止更改。

每个ATECC508A均带有保证的唯一72位序列号,并包括多种安全功能,以防止对设备本身进行物理攻击或对在设备之间传输的数据进行逻辑攻击。

我们的连接指南和Arduino库(包括六个示例)将使您立即熟悉椭圆曲线加密的基础知识以及对数据进行签名/验证!

注意:在使用本板之前,请完整阅读连接指南。 永久锁定后,无法重新配置该芯片。

 

 

 

配置

/*
  This example shows how to setup your Cryptographic Co-processor with standard settings.
  ***Configurations settings are PERMENANT***
  We highly encourage advanced users to do their own configuration settings.
  Hardware Connections and initial setup:
  Select TOOLS>>BOARD>>"TONYLABS Thing Edge"
  Select TOOLS>>PORT>> "COM 3" (note, yours may be different)
  Click upload, and follow configuration prompt on serial monitor at 115200.
*/

#include "ATECCX08a.h"
#include 

ATECCX08A objAtecc;

void setup()
{
  Wire.begin();
  Serial.begin(115200);
  if (objAtecc.begin() == true)
  {
    Serial.println("Successful wakeUp(). I2C connections are good.");
  }
  else
  {
    Serial.println("Device not found. Check wiring.");
    while (1); // stall out forever
  }

  printInfo(); // see function below for library calls and data handling

  Serial.println("Would you like to configure your Cryptographic Co-processor with SparkFun Standard settings? (y/n)");
  Serial.println("***Note, this is PERMANENT and cannot be changed later***");
  Serial.println("***If you do not want to do this, type an 'n' or unplug now.***");

  while (Serial.available() == 0); // wait for user input

  if (Serial.read() == 'y')
  {
    Serial.println();
    Serial.println("Configuration beginning.");

    Serial.print("Write Config: \t");
    if (objAtecc.writeConfigSparkFun() == true) Serial.println("Success!");
    else Serial.println("Failure.");

    Serial.print("Lock Config: \t");
    if (objAtecc.lockConfig() == true) Serial.println("Success!");
    else Serial.println("Failure.");

    Serial.print("Key Creation: \t");
    if (objAtecc.createNewKeyPair() == true) Serial.println("Success!");
    else Serial.println("Failure.");

    Serial.print("Lock Data-OTP: \t");
    if (objAtecc.lockDataAndOTP() == true) Serial.println("Success!");
    else Serial.println("Failure.");

    Serial.print("Lock Slot 0: \t");
    if (objAtecc.lockDataSlot0() == true) Serial.println("Success!");
    else Serial.println("Failure.");

    Serial.println("Configuration done.");
    Serial.println();
  }
  else
  {
    Serial.println("Unfortunately, you cannot use any features of the ATECCX08A without configuration and locking.");
  }

  printInfo(); // Print info again to see lock statuses. And if all is good, print the generated public key!
}

void loop()
{
  // do nothing.
}

void printInfo()
{
  // Read all 128 bytes of Configuration Zone
  // These will be stored in an array within the instance named: atecc.configZone[128]
  objAtecc.readConfigZone(false); // Debug argument false (OFF)

  // Print useful information from configuration zone data
  Serial.println();

  Serial.print("Serial Number: \t");
  for (int i = 0 ; i < 9 ; i++)
  {
    if ((objAtecc.serialNumber[i] >> 4) == 0) Serial.print("0"); // print preceeding high nibble if it's zero
    Serial.print(objAtecc.serialNumber[i], HEX);
  }
  Serial.println();

  Serial.print("Rev Number: \t");
  for (int i = 0 ; i < 4 ; i++)
  {
    if ((objAtecc.revisionNumber[i] >> 4) == 0) Serial.print("0"); // print preceeding high nibble if it's zero
    Serial.print(objAtecc.revisionNumber[i], HEX);
  }
  Serial.println();

  Serial.print("Config Zone: \t");
  if (objAtecc.configLockStatus) Serial.println("Locked");
  else Serial.println("NOT Locked");

  Serial.print("Data/OTP Zone: \t");
  if (objAtecc.dataOTPLockStatus) Serial.println("Locked");
  else Serial.println("NOT Locked");

  Serial.print("Data Slot 0: \t");
  if (objAtecc.slot0LockStatus) Serial.println("Locked");
  else Serial.println("NOT Locked");

  Serial.println();

  // if everything is locked up, then configuration is complete, so let's print the public key
  if (objAtecc.configLockStatus && objAtecc.dataOTPLockStatus && objAtecc.slot0LockStatus) 
  {
    if(objAtecc.generatePublicKey() == false)
    {
      Serial.println("Failure to generate This device's Public Key");
      Serial.println();
    }
  }
}

 

 

 

 

签名

 

Like what you're reading? Subscribe to our top stories.

We will continue to update Front; if you have any questions or suggestions, please contact us!

Follow us on Medium, Twitter, Facebook, YouTube, and Dribbble.

Image Description
Written by

Hanna Wolfe

I create advanced website builders made exclusively for web developers.

3 Comments

  • Image Description
    Dave Austin 1 day ago

    As a Special Education teacher this resonates so well with me. Fighting with gen ed teachers to flatten for the students with learning disabilities. It also confirms some things for me in my writing.

    Reply
    • Image Description
      Hanna Wolfe 1 day ago

      Love it Dave! We're all about keeping it up.

      Reply
  • Image Description
    Christina Kray 2 days ago

    Since our attention spans seem to be shrinking by the day — keeping it simple is more important than ever.

    Reply

Post a comment

Stay in the know

Get special offers on the latest developments from Front.