Difference between revisions of "Unit ASN.1"

From Ultibo.org
Jump to: navigation, search
Line 195: Line 195:
 
----
 
----
  
''To be documented''
 
  
 +
'''ASN1 functions'''
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function ASN1GetTag(Buffer:PByte; Len:Integer; var Tag:TASN1Tag):Boolean;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function ASN1ParseOID(Buffer:PByte; Len:Integer; var OID:TASN1OID):Boolean;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Parse an OID value from the buffer</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function ASN1GetOID(Buffer:PByte; Len:Integer; var OID:TASN1OID; var Next:PByte):Boolean;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Read the next ASN1 tag from buffer and decode it as an OID value</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function ASN1GetNull(Buffer:PByte; Len:Integer; var Next:PByte):Boolean;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Read the next ASN1 tag from buffer and decode it as a null value</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function ASN1ParseInt(Buffer:PByte; Len:Integer; var Value:Integer):Boolean;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Parse an integer value from the buffer</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function ASN1ParseBigInt(Buffer:PByte; Len:Integer; var Value:PByte; var Size:Integer):Boolean;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Parse a big integer value from the buffer (Does not include the leading negative byte if present)</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| Memory allocated for Value must be freed by the caller when no longer required
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function ASN1GetInt(Buffer:PByte; Len:Integer; var Value:Integer; var Next:PByte):Boolean;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Read the next ASN1 tag from buffer and decode it as an integer value</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function ASN1ParseBoolean(Buffer:PByte; Len:Integer; var Value:Boolean):Boolean;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Parse a boolean value from the buffer</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function ASN1GetBoolean(Buffer:PByte; Len:Integer; var Value:Boolean; var Next:PByte):Boolean;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Read the next ASN1 tag from buffer and decode it as a boolean value</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
 +
'''ASN1 helper functions'''
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function ASN1OIDEqual(const OID1,OID2:TASN1OID):Boolean;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function ASN1OIDEqualPrefix(const OIDPrefix,OID:TASN1OID):Boolean;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function ASN1OIDToString(const OID:TASN1OID):String;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function ASN1BitStringToLongWord(Buffer:PByte; Len:Integer):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
  
 
Return to [[Unit_Reference|Unit Reference]]
 
Return to [[Unit_Reference|Unit Reference]]

Revision as of 00:45, 19 April 2018

Return to Unit Reference


Description


Ultibo ASN.1 interface unit

Abstract Syntax Notation One (ASN.1) is an interface description language for defining data structures that can be serialized and deserialized in a standard, cross-platform way. It's broadly used in telecommunications and computer networking, and especially in cryptography.

This unit currently only provides the basic functionality required by X509 to read and parse a certificate in DER format.

It is expected that this unit will be expanded to incorporate additional functions over time.

Constants



[Expand]
ASN1 specific constants ASN1_*


Type definitions



ASN1 tag

[Expand]

PASN1Tag = ^TASN1Tag;

TASN1Tag = record

ASN1 OID

[Expand]

PASN1OID = ^TASN1OID;

TASN1OID = record


Public variables


None defined

Function declarations



ASN1 functions

[Expand]
function ASN1GetTag(Buffer:PByte; Len:Integer; var Tag:TASN1Tag):Boolean;
Description: To be documented


[Expand]
function ASN1ParseOID(Buffer:PByte; Len:Integer; var OID:TASN1OID):Boolean;
Description: Parse an OID value from the buffer


[Expand]
function ASN1GetOID(Buffer:PByte; Len:Integer; var OID:TASN1OID; var Next:PByte):Boolean;
Description: Read the next ASN1 tag from buffer and decode it as an OID value


[Expand]
function ASN1GetNull(Buffer:PByte; Len:Integer; var Next:PByte):Boolean;
Description: Read the next ASN1 tag from buffer and decode it as a null value


[Expand]
function ASN1ParseInt(Buffer:PByte; Len:Integer; var Value:Integer):Boolean;
Description: Parse an integer value from the buffer


[Expand]
function ASN1ParseBigInt(Buffer:PByte; Len:Integer; var Value:PByte; var Size:Integer):Boolean;
Description: Parse a big integer value from the buffer (Does not include the leading negative byte if present)


[Expand]
function ASN1GetInt(Buffer:PByte; Len:Integer; var Value:Integer; var Next:PByte):Boolean;
Description: Read the next ASN1 tag from buffer and decode it as an integer value


[Expand]
function ASN1ParseBoolean(Buffer:PByte; Len:Integer; var Value:Boolean):Boolean;
Description: Parse a boolean value from the buffer


[Expand]
function ASN1GetBoolean(Buffer:PByte; Len:Integer; var Value:Boolean; var Next:PByte):Boolean;
Description: Read the next ASN1 tag from buffer and decode it as a boolean value


ASN1 helper functions

[Expand]
function ASN1OIDEqual(const OID1,OID2:TASN1OID):Boolean;
Description: To be documented


[Expand]
function ASN1OIDEqualPrefix(const OIDPrefix,OID:TASN1OID):Boolean;
Description: To be documented


[Expand]
function ASN1OIDToString(const OID:TASN1OID):String;
Description: To be documented


[Expand]
function ASN1BitStringToLongWord(Buffer:PByte; Len:Integer):LongWord;
Description: To be documented


Return to Unit Reference