AlexaClientSDK  1.26.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Types | Static Public Member Functions | List of all members
alexaClientSDK::acsdkProperties::Asn1Helper Struct Reference

Helper for ASN.1 operations. More...

#include <Asn1Helper.h>

Public Types

typedef std::vector< unsigned char > Bytes
 Byte vector type. More...
 

Static Public Member Functions

static bool setOptInt (ASN1_INTEGER *&asn1Integer, int64_t value, int64_t defaultValue) noexcept
 Sets optional integer value. More...
 
static bool getOptInt (ASN1_INTEGER *&asn1Integer, int64_t &value, int64_t defaultValue) noexcept
 Gets optional integer value. More...
 
static bool setStr (ASN1_UTF8STRING *&asn1String, const std::string &value) noexcept
 Sets UTF8 string container value. More...
 
static bool getStr (ASN1_UTF8STRING *&asn1String, std::string &value) noexcept
 Gets UTF8 string from container. More...
 
static bool setData (ASN1_OCTET_STRING *&asn1String, const Bytes &value) noexcept
 Sets binary data container value. More...
 
static bool getData (ASN1_OCTET_STRING *&asn1String, Bytes &value) noexcept
 Gets binary data from container. More...
 
static bool convertAlgTypeToAsn1 (AlgorithmType type, int64_t &asn1Type) noexcept
 Maps algorithm type into ASN.1 value. More...
 
static bool convertAlgTypeFromAsn1 (int64_t asn1Type, AlgorithmType &type) noexcept
 Maps ASN.1 value into algorithm type. More...
 
static bool convertDigTypeToAsn1 (DigestType type, int64_t &asn1Type) noexcept
 Maps digest type into ASN.1. More...
 
static bool convertDigTypeFromAsn1 (int64_t asn1Type, DigestType &type) noexcept
 Maps ASN.1 into digest type. More...
 

Detailed Description

Helper for ASN.1 operations.

Member Typedef Documentation

◆ Bytes

typedef std::vector<unsigned char> alexaClientSDK::acsdkProperties::Asn1Helper::Bytes

Byte vector type.

Member Function Documentation

◆ convertAlgTypeFromAsn1()

bool alexaClientSDK::acsdkProperties::Asn1Helper::convertAlgTypeFromAsn1 ( int64_t  asn1Type,
AlgorithmType &  type 
)
staticnoexcept

Maps ASN.1 value into algorithm type.

Maps ASN.1 constant into Crypto API cipher algorithm type. The method fails, if it doesn't recognize algorithm type.

Parameters
[in]asn1TypeASN.1 constant.
[out]typeDestination for algorithm type.
Returns
True if operation is successful.

◆ convertAlgTypeToAsn1()

bool alexaClientSDK::acsdkProperties::Asn1Helper::convertAlgTypeToAsn1 ( AlgorithmType  type,
int64_t &  asn1Type 
)
staticnoexcept

Maps algorithm type into ASN.1 value.

Maps Crypto API cipher algorithm type value into ASN.1 value. The method fails, if it doesn't recognize algorithm type.

Parameters
[in]typeAlgorithm type.
[out]asn1TypeASN.1 value.
Returns
True if operation is successful.

◆ convertDigTypeFromAsn1()

bool alexaClientSDK::acsdkProperties::Asn1Helper::convertDigTypeFromAsn1 ( int64_t  asn1Type,
DigestType &  type 
)
staticnoexcept

Maps ASN.1 into digest type.

Maps ASN.1 constant into Crypto API digest algorithm type. The method fails, if it doesn't recognize algorithm type.

Parameters
[in]asn1TypeASN.1 constant.
[out]typeDestination for algorithm type.
Returns
True if operation is successful.

◆ convertDigTypeToAsn1()

bool alexaClientSDK::acsdkProperties::Asn1Helper::convertDigTypeToAsn1 ( DigestType  type,
int64_t &  asn1Type 
)
staticnoexcept

Maps digest type into ASN.1.

Maps Crypto API digest algorithm type value into ASN.1 value. The method fails, if it doesn't recognize algorithm type.

Parameters
[in]typeAlgorithm type.
[out]asn1TypeASN.1 constant.
Returns
True if operation is successful.

◆ getData()

bool alexaClientSDK::acsdkProperties::Asn1Helper::getData ( ASN1_OCTET_STRING *&  asn1String,
Bytes value 
)
staticnoexcept

Gets binary data from container.

Parameters
[in]asn1StringReference to container pointer. If pointer is nullptr, the operation fails.
[out]valueValue destination.
Returns
True if operation is successful.

◆ getOptInt()

bool alexaClientSDK::acsdkProperties::Asn1Helper::getOptInt ( ASN1_INTEGER *&  asn1Integer,
int64_t &  value,
int64_t  defaultValue 
)
staticnoexcept

Gets optional integer value.

Gets optional integer value. If the container memory is not allocated, a default value is returned.

Parameters
[in]asn1IntegerReference to container pointer. If the pointer is nullptr, the default value is returned.
[out]valueValue destination.
[in]defaultValueDefault value to use if container pointer is nullptr.
Returns
True if operation is successful.

◆ getStr()

bool alexaClientSDK::acsdkProperties::Asn1Helper::getStr ( ASN1_UTF8STRING *&  asn1String,
std::string &  value 
)
staticnoexcept

Gets UTF8 string from container.

Parameters
[in]asn1StringReference to container pointer. If pointer is nullptr, the operation fails.
[out]valueValue destination.
Returns
True if operation is successful.

◆ setData()

bool alexaClientSDK::acsdkProperties::Asn1Helper::setData ( ASN1_OCTET_STRING *&  asn1String,
const Bytes value 
)
staticnoexcept

Sets binary data container value.

Parameters
[in]asn1StringReference to container pointer. If pointer is nullptr, a new memory is allocated.
[out]valueValue destination.
Returns
True if operation is successful.

◆ setOptInt()

bool alexaClientSDK::acsdkProperties::Asn1Helper::setOptInt ( ASN1_INTEGER *&  asn1Integer,
int64_t  value,
int64_t  defaultValue 
)
staticnoexcept

Sets optional integer value.

Sets optional integer value (with default) to ASN.1 container. If the value doesn't match the default value, and the container pointer is nullptr, a new container is allocated. If the value matches the default, and the container pointer is not nullptr, the memory is released.

The underlying ASN.1 library implementation doesn't have a notion of "default value", so the entry must be nullptr, as otherwise it will be added to the output, which is against DER specification.

Parameters
[in]asn1IntegerReference to container pointer. The method may release or allocate memory and change pointer depending if the value matches the default one.
[in]valueValue to set.
[in]defaultValueDefault value to check against.
Returns
True if operation is successful.

◆ setStr()

bool alexaClientSDK::acsdkProperties::Asn1Helper::setStr ( ASN1_UTF8STRING *&  asn1String,
const std::string &  value 
)
staticnoexcept

Sets UTF8 string container value.

Parameters
asn1StringReference to container pointer. If pointer is nullptr, a new memory is allocated.
valueValue to set.
Returns
True if operation is successful.

The documentation for this struct was generated from the following files:

AlexaClientSDK 1.26.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0