mbed TLS library

Dependents:   HTTPClient-SSL WS_SERVER

Embed: (wiki syntax)

« Back to documentation index

x509.h File Reference

x509.h File Reference

X.509 generic defines and structures. More...

Go to the source code of this file.

Data Structures

struct  _x509_time
 Container for date and time (precision in seconds). More...

Typedefs

Structures for parsing X.509 certificates, CRLs and CSRs
typedef asn1_buf x509_buf
 Type-length-value structure that allows for ASN1 using DER.
typedef asn1_bitstring x509_bitstring
 Container for ASN1 bit strings.
typedef asn1_named_data x509_name
 Container for ASN1 named information objects.
typedef asn1_sequence x509_sequence
 Container for a sequence of ASN.1 items.
typedef struct _x509_time x509_time
 Container for date and time (precision in seconds).

Functions

int x509_dn_gets (char *buf, size_t size, const x509_name *dn)
 Store the certificate DN in printable form into buf; no more than size characters will be written.
int x509_serial_gets (char *buf, size_t size, const x509_buf *serial)
 Store the certificate serial in printable form into buf; no more than size characters will be written.
const char * x509_oid_get_description (x509_buf *oid) DEPRECATED
 Give an known OID, return its descriptive string.
int x509_oid_get_numeric_string (char *buf, size_t size, x509_buf *oid) DEPRECATED
 Give an OID, return a string version of its OID number.
int x509_time_expired (const x509_time *time)
 Check a given x509_time against the system time and check if it is not expired.
int x509_time_future (const x509_time *time)
 Check a given x509_time against the system time and check if it is not from the future.
int x509_self_test (int verbose)
 Checkup routine.

Detailed Description

X.509 generic defines and structures.

Copyright (C) 2006-2014, ARM Limited, All Rights Reserved

This file is part of mbed TLS (https://tls.mbed.org)

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.

Definition in file x509.h.


Function Documentation

int x509_dn_gets ( char *  buf,
size_t  size,
const x509_name dn 
)

Store the certificate DN in printable form into buf; no more than size characters will be written.

Parameters:
bufBuffer to write to
sizeMaximum size of buffer
dnThe X509 name to represent
Returns:
The amount of data written to the buffer, or -1 in case of an error.

Definition at line 725 of file x509.c.

const char* x509_oid_get_description ( x509_buf oid )

Give an known OID, return its descriptive string.

Warning:
Only works for extended_key_usage OIDs!
Parameters:
oidbuffer containing the oid
Returns:
Return a string if the OID is known, or NULL otherwise.

Definition at line 885 of file x509.c.

int x509_oid_get_numeric_string ( char *  buf,
size_t  size,
x509_buf oid 
)

Give an OID, return a string version of its OID number.

Parameters:
bufBuffer to write to
sizeMaximum size of buffer
oidBuffer containing the OID
Returns:
Length of the string written (excluding final NULL) or POLARSSL_ERR_OID_BUF_TO_SMALL in case of error

Definition at line 901 of file x509.c.

int x509_self_test ( int  verbose )

Checkup routine.

Returns:
0 if successful, or 1 if the test failed

Definition at line 1023 of file x509.c.

int x509_serial_gets ( char *  buf,
size_t  size,
const x509_buf serial 
)

Store the certificate serial in printable form into buf; no more than size characters will be written.

Parameters:
bufBuffer to write to
sizeMaximum size of buffer
serialThe X509 serial to represent
Returns:
The amount of data written to the buffer, or -1 in case of an error.

Definition at line 787 of file x509.c.

int x509_time_expired ( const x509_time time )

Check a given x509_time against the system time and check if it is not expired.

Parameters:
timex509_time to check
Returns:
0 if the x509_time is still valid, 1 otherwise.

Definition at line 1002 of file x509.c.

int x509_time_future ( const x509_time time )

Check a given x509_time against the system time and check if it is not from the future.

Parameters:
timex509_time to check
Returns:
0 if the x509_time is already valid, 1 otherwise.

Definition at line 1008 of file x509.c.