Sergey Pastor / 1

Dependents:   Nucleo

Embed: (wiki syntax)

« Back to documentation index

asn1.c File Reference

asn1.c File Reference

ASN.1 (Abstract Syntax Notation One) More...

Go to the source code of this file.

Functions

error_t asn1ReadTag (const uint8_t *data, size_t length, Asn1Tag *tag)
 Read an ASN.1 tag from the input stream.
error_t asn1ReadInt32 (const uint8_t *data, size_t length, Asn1Tag *tag, int32_t *value)
 Read an integer from the input stream.
error_t asn1WriteTag (Asn1Tag *tag, bool_t reverse, uint8_t *data, size_t *written)
 Write an ASN.1 tag.
error_t asn1WriteInt32 (int32_t value, bool_t reverse, uint8_t *data, size_t *written)
 Write an integer to the output stream.
error_t asn1CheckTag (const Asn1Tag *tag, bool_t constructed, uint_t objClass, uint_t objType)
 Enforce the type of a specified tag.
error_t asn1CheckOid (const Asn1Tag *tag, const uint8_t *oid, size_t length)
 Check ASN.1 tag against a specified OID.
error_t asn1DumpObject (const uint8_t *data, size_t length, uint_t level)
 Display an ASN.1 data object.

Detailed Description

ASN.1 (Abstract Syntax Notation One)

License

Copyright (C) 2010-2017 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneCrypto Open.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Author:
Oryx Embedded SARL (www.oryx-embedded.com)
Version:
1.7.6

Definition in file asn1.c.


Function Documentation

error_t asn1CheckOid ( const Asn1Tag tag,
const uint8_t *  oid,
size_t  length 
)

Check ASN.1 tag against a specified OID.

Parameters:
[in]tagPointer to an ASN.1 tag
[in]oidExpected object identifier (OID)
[in]lengthLength of the OID
Returns:
Error code

Definition at line 425 of file asn1.c.

error_t asn1CheckTag ( const Asn1Tag tag,
bool_t  constructed,
uint_t  objClass,
uint_t  objType 
)

Enforce the type of a specified tag.

Parameters:
[in]tagPointer to an ASN.1 tag
[in]constructedExpected encoding (TRUE for constructed, FALSE for primitive)
[in]objClassExpected tag class
[in]objTypeExpected tag type
Returns:
Error code

Definition at line 400 of file asn1.c.

error_t asn1DumpObject ( const uint8_t *  data,
size_t  length,
uint_t  level 
)

Display an ASN.1 data object.

Parameters:
[in]dataPointer to the ASN.1 object to dump
[in]lengthLength of the ASN.1 object
[in]levelCurrent level of recursion (this parameter shall be set to 0)
Returns:
Error code

Definition at line 452 of file asn1.c.

error_t asn1ReadInt32 ( const uint8_t *  data,
size_t  length,
Asn1Tag tag,
int32_t *  value 
)

Read an integer from the input stream.

Parameters:
[in]dataInput stream where to read the tag
[in]lengthNumber of bytes available in the input stream
[out]tagStructure describing the ASN.1 tag
[out]valueInteger value
Returns:
Error code

Definition at line 160 of file asn1.c.

error_t asn1ReadTag ( const uint8_t *  data,
size_t  length,
Asn1Tag tag 
)

Read an ASN.1 tag from the input stream.

Parameters:
[in]dataInput stream where to read the tag
[in]lengthNumber of bytes available in the input stream
[out]tagStructure describing the ASN.1 tag
Returns:
Error code

Definition at line 51 of file asn1.c.

error_t asn1WriteInt32 ( int32_t  value,
bool_t  reverse,
uint8_t *  data,
size_t *  written 
)

Write an integer to the output stream.

Parameters:
[in]valueInteger value
[in]reverseUse reverse encoding
[out]dataOutput stream where to write the tag (optional parameter)
[out]writtenNumber of bytes written to the output stream
Returns:
Error code

Definition at line 346 of file asn1.c.

error_t asn1WriteTag ( Asn1Tag tag,
bool_t  reverse,
uint8_t *  data,
size_t *  written 
)

Write an ASN.1 tag.

Parameters:
[in]tagStructure describing the ASN.1 tag
[in]reverseUse reverse encoding
[out]dataOutput stream where to write the tag (optional parameter)
[out]writtenNumber of bytes written to the output stream (optional parameter)
Returns:
Error code

Definition at line 208 of file asn1.c.