Functions
CryptoKeyPlaintext.h File Reference

Detailed Description

============================================================================

Warning
This is a beta API. It may change in future releases.

Overview

This file contains the APIs to initialize and access plaintext CryptoKeys. Plaintext CryptoKeys point to keying material stored in flash or RAM and are not subject to enforced usage restrictions. That only means that calling a function that requires an assymmetric public key with a symmetric key will not return an error. It will likely not yield the desired results.

Usage

Plaintext keys are the simplest of the CryptoKeys. All they do is store the length of and a pointer to the keying material. Their use is hence simple as well. After calling the initialization function, the CryptoKey may be used in any of the crypto operation APIs that take a CryptoKey as an input.

uint8_t keyingMaterial[16];
CryptoKey cryptoKey;
// Initialise the CryptoKey
CryptoKeyPlaintext_initKey(&cryptoKey, keyingMaterial, sizeof(keyingMaterial));
// Use the CryptoKey in another crypto operation
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
#include <ti/drivers/cryptoutils/cryptokey/CryptoKey.h>
Include dependency graph for CryptoKeyPlaintext.h:

Go to the source code of this file.

Functions

int_fast16_t CryptoKeyPlaintext_initKey (CryptoKey *keyHandle, uint8_t *key, size_t keyLength)
 Initializes a CryptoKey type. More...
 
int_fast16_t CryptoKeyPlaintext_initBlankKey (CryptoKey *keyHandle, uint8_t *keyLocation, size_t keyLength)
 Initializes an empty plaintext CryptoKey type. More...
 
int_fast16_t CryptoKeyPlaintext_getKeyLength (CryptoKey *keyHandle, size_t *length)
 Gets the length of a plaintext key. More...
 
int_fast16_t CryptoKeyPlaintext_setKeyLocation (CryptoKey *keyHandle, uint8_t *location)
 Sets the CryptoKey keyMaterial pointer. More...
 

Function Documentation

§ CryptoKeyPlaintext_initKey()

int_fast16_t CryptoKeyPlaintext_initKey ( CryptoKey keyHandle,
uint8_t *  key,
size_t  keyLength 
)

Initializes a CryptoKey type.

Parameters
[in]keyHandlePointer to a CryptoKey which will be initialized to type CryptoKey_PLAINTEXT and ready for use
[in]keyPointer to keying material
[in]keyLengthLength of keying material in bytes
Returns
Returns a status code from CryptoKey.h

§ CryptoKeyPlaintext_initBlankKey()

int_fast16_t CryptoKeyPlaintext_initBlankKey ( CryptoKey keyHandle,
uint8_t *  keyLocation,
size_t  keyLength 
)

Initializes an empty plaintext CryptoKey type.

Parameters
[in]keyHandlePointer to a CryptoKey which will be initialized to type CryptoKey_BLANK_PLAINTEXT
[in]keyLocationPointer to location where plaintext keying material can be stored
[in]keyLengthLength of keying material, in bytes
Returns
Returns a status code from CryptoKey.h

§ CryptoKeyPlaintext_getKeyLength()

int_fast16_t CryptoKeyPlaintext_getKeyLength ( CryptoKey keyHandle,
size_t *  length 
)

Gets the length of a plaintext key.

Parameters
[in]keyHandlePointer to a plaintext CryptoKey
[out]lengthLength of the keying material, in bytes
Returns
Returns a status code from CryptoKey.h
Parameters
[in]keyHandlePointer to a CryptoKey
[out]lengthLength value will be updated to CryptoKey length, in bytes
Returns
Returns a status code from CryptoKey.h

§ CryptoKeyPlaintext_setKeyLocation()

int_fast16_t CryptoKeyPlaintext_setKeyLocation ( CryptoKey keyHandle,
uint8_t *  location 
)

Sets the CryptoKey keyMaterial pointer.

Updates the key location for a plaintext CryptoKey. Does not modify data at the pointer location.

Parameters
[in]keyHandlePointer to a plaintext CryptoKey who's key data pointer will be modified
[in]locationPointer to key data location
Returns
Returns a status code from CryptoKey.h
© Copyright 1995-2019, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale