Documentation
¶
Overview ¶
Copyright (c) 2014-2019 Cesanta Software Limited All rights reserved
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (c) 2014-2019 Cesanta Software Limited All rights reserved
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (c) 2014-2019 Cesanta Software Limited All rights reserved
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (c) 2014-2019 Cesanta Software Limited All rights reserved
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (c) 2014-2019 Cesanta Software Limited All rights reserved
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- func GenKey(ctx context.Context, slot int, dryRun bool, dc dev.DevConn) (*ecdsa.PublicKey, error)
- func GetPubKey(ctx context.Context, slot int, dc dev.DevConn) (*ecdsa.PublicKey, error)
- func JSONStr(v interface{}) string
- func NewSigner(ctx context.Context, dc dev.DevConn, slot int) crypto.Signer
- func ReadHex(data []byte) []byte
- func WriteBinaryConfig(c *Config) ([]byte, error)
- func WriteHex(data []byte, numPerLine int) []byte
- type ChipMode
- type Config
- type GenKeyArgs
- type GenKeyResult
- type GetConfigResult
- type GetPubKeyArgs
- type GetPubKeyResult
- type KeyConfig
- type KeyType
- type LockMode
- type LockZone
- type LockZoneArgs
- type PrivateKeySlotConfig
- type SetConfigArgs
- type SetKeyArgs
- type SignArgs
- type SignResult
- type Signer
- type SlotConfig
- type SlotInfo
- type WatchdogDuration
- type X509Format
Constants ¶
const ( ConfigSize = 128 KeySize = 32 PrivateKeySize = 32 PublicKeySize = 64 SignatureSize = 64 )
const ( KeyTypeECC KeyType = "ECC" KeyTypeAES = "AES" KeyTypeOther = "Other" KeyTypeNonECC = "NonECC" // For backward compatibility only. )
const (
KeyFilePrefix = "ATCA:"
)
Variables ¶
This section is empty.
Functions ¶
func WriteBinaryConfig ¶
Types ¶
type ChipMode ¶
type ChipMode struct {
SelectorWriteOnce bool
TTLEnable bool
WatchDogDuration WatchdogDuration
}
type Config ¶
type Config struct {
SerialNum []byte
Revision uint32
Reserved13 uint8
I2CEnable bool
Reserved15 uint8
I2CAddress uint8
Reserved17 uint8
OTPMode uint8
ChipMode ChipMode
SlotInfo []SlotInfo
Counter0 uint64
Counter1 uint64
LastKeyUse0 uint64
LastKeyUse1 uint64
UserExtra uint8
Selector uint8
LockValue LockMode
LockConfig LockMode
SlotLocked uint16
Reserved90 uint8
Reserved91 uint8
X509Format []X509Format
}
func ParseBinaryConfig ¶
type GenKeyArgs ¶
type GenKeyArgs struct {
Slot int64 `json:"slot"`
}
type GenKeyResult ¶
type GenKeyResult struct {
Pubkey *string `json:"pubkey,omitempty"`
}
type GetConfigResult ¶
type GetConfigResult struct {
Config *string `json:"config,omitempty"`
}
type GetPubKeyArgs ¶
type GetPubKeyArgs struct {
Slot int64 `json:"slot"`
}
type GetPubKeyResult ¶
type GetPubKeyResult struct {
Pubkey *string `json:"pubkey,omitempty"`
}
type LockMode ¶
type LockMode string
const ( LockModeLocked LockMode = "Locked" LockModeUnlocked = "Unlocked" )
type LockZoneArgs ¶
type LockZoneArgs struct {
Zone *int64 `json:"zone,omitempty"`
}
type PrivateKeySlotConfig ¶
type SetConfigArgs ¶
type SetConfigArgs struct {
Config *string `json:"config,omitempty"`
}
type SetKeyArgs ¶
type SignResult ¶
type SignResult struct {
Signature *string `json:"signature,omitempty"`
}
type Signer ¶
type Signer struct {
// contains filtered or unexported fields
}
Implements crypto.Signer interface using ATCA.
type SlotConfig ¶
type SlotInfo ¶
type SlotInfo struct {
Num uint8
SlotConfig SlotConfig
KeyConfig KeyConfig
}
This struct is not stored in the chip and simply contains both SlotConfig and KeyConfig together, for convenience and readability.
type WatchdogDuration ¶
type WatchdogDuration string
const ( Watchdog1 WatchdogDuration = "1s" Watchdog10 = "10s" )