|
RetroArch
|
#include "mbedtls/config.h"#include "mbedtls/pk.h"#include "mbedtls/asn1write.h"#include "mbedtls/oid.h"#include <string.h>#include "mbedtls/rsa.h"#include "mbedtls/ecp.h"#include "mbedtls/ecdsa.h"#include "mbedtls/pem.h"#include "mbedtls/platform.h"Macros | |
| #define | PEM_BEGIN_PUBLIC_KEY "-----BEGIN PUBLIC KEY-----\n" |
| #define | PEM_END_PUBLIC_KEY "-----END PUBLIC KEY-----\n" |
| #define | PEM_BEGIN_PRIVATE_KEY_RSA "-----BEGIN RSA PRIVATE KEY-----\n" |
| #define | PEM_END_PRIVATE_KEY_RSA "-----END RSA PRIVATE KEY-----\n" |
| #define | PEM_BEGIN_PRIVATE_KEY_EC "-----BEGIN EC PRIVATE KEY-----\n" |
| #define | PEM_END_PRIVATE_KEY_EC "-----END EC PRIVATE KEY-----\n" |
| #define | RSA_PUB_DER_MAX_BYTES 38 + 2 * MBEDTLS_MPI_MAX_SIZE |
| #define | MPI_MAX_SIZE_2 |
| #define | RSA_PRV_DER_MAX_BYTES |
| #define | ECP_PUB_DER_MAX_BYTES 30 + 2 * MBEDTLS_ECP_MAX_BYTES |
| #define | ECP_PRV_DER_MAX_BYTES 29 + 3 * MBEDTLS_ECP_MAX_BYTES |
| #define | PUB_DER_MAX_BYTES |
| #define | PRV_DER_MAX_BYTES |
Functions | |
| static int | pk_write_rsa_pubkey (unsigned char **p, unsigned char *start, mbedtls_rsa_context *rsa) |
| static int | pk_write_ec_pubkey (unsigned char **p, unsigned char *start, mbedtls_ecp_keypair *ec) |
| static int | pk_write_ec_param (unsigned char **p, unsigned char *start, mbedtls_ecp_keypair *ec) |
| int | mbedtls_pk_write_pubkey (unsigned char **p, unsigned char *start, const mbedtls_pk_context *key) |
| Write a subjectPublicKey to ASN.1 data Note: function works backwards in data buffer. More... | |
| int | mbedtls_pk_write_pubkey_der (mbedtls_pk_context *key, unsigned char *buf, size_t size) |
| Write a public key to a SubjectPublicKeyInfo DER structure Note: data is written at the end of the buffer! Use the return value to determine where you should start using the buffer. More... | |
| int | mbedtls_pk_write_key_der (mbedtls_pk_context *key, unsigned char *buf, size_t size) |
| Write a private key to a PKCS#1 or SEC1 DER structure Note: data is written at the end of the buffer! Use the return value to determine where you should start using the buffer. More... | |
| int | mbedtls_pk_write_pubkey_pem (mbedtls_pk_context *key, unsigned char *buf, size_t size) |
| Write a public key to a PEM string. More... | |
| int | mbedtls_pk_write_key_pem (mbedtls_pk_context *key, unsigned char *buf, size_t size) |
| Write a private key to a PKCS#1 or SEC1 PEM string. More... | |
| #define ECP_PRV_DER_MAX_BYTES 29 + 3 * MBEDTLS_ECP_MAX_BYTES |
| #define ECP_PUB_DER_MAX_BYTES 30 + 2 * MBEDTLS_ECP_MAX_BYTES |
| #define MPI_MAX_SIZE_2 |
| #define PEM_BEGIN_PRIVATE_KEY_EC "-----BEGIN EC PRIVATE KEY-----\n" |
| #define PEM_BEGIN_PRIVATE_KEY_RSA "-----BEGIN RSA PRIVATE KEY-----\n" |
| #define PEM_BEGIN_PUBLIC_KEY "-----BEGIN PUBLIC KEY-----\n" |
| #define PEM_END_PRIVATE_KEY_EC "-----END EC PRIVATE KEY-----\n" |
| #define PEM_END_PRIVATE_KEY_RSA "-----END RSA PRIVATE KEY-----\n" |
| #define PEM_END_PUBLIC_KEY "-----END PUBLIC KEY-----\n" |
| #define PRV_DER_MAX_BYTES |
| #define PUB_DER_MAX_BYTES |
| #define RSA_PRV_DER_MAX_BYTES |
| #define RSA_PUB_DER_MAX_BYTES 38 + 2 * MBEDTLS_MPI_MAX_SIZE |
| int mbedtls_pk_write_key_der | ( | mbedtls_pk_context * | ctx, |
| unsigned char * | buf, | ||
| size_t | size | ||
| ) |
Write a private key to a PKCS#1 or SEC1 DER structure Note: data is written at the end of the buffer! Use the return value to determine where you should start using the buffer.
| ctx | private to write away |
| buf | buffer to write to |
| size | size of the buffer |
| int mbedtls_pk_write_key_pem | ( | mbedtls_pk_context * | ctx, |
| unsigned char * | buf, | ||
| size_t | size | ||
| ) |
Write a private key to a PKCS#1 or SEC1 PEM string.
| ctx | private to write away |
| buf | buffer to write to |
| size | size of the buffer |
| int mbedtls_pk_write_pubkey | ( | unsigned char ** | p, |
| unsigned char * | start, | ||
| const mbedtls_pk_context * | key | ||
| ) |
Write a subjectPublicKey to ASN.1 data Note: function works backwards in data buffer.
| p | reference to current position pointer |
| start | start of the buffer (for bounds-checking) |
| key | public key to write away |
| int mbedtls_pk_write_pubkey_der | ( | mbedtls_pk_context * | ctx, |
| unsigned char * | buf, | ||
| size_t | size | ||
| ) |
Write a public key to a SubjectPublicKeyInfo DER structure Note: data is written at the end of the buffer! Use the return value to determine where you should start using the buffer.
| ctx | public key to write away |
| buf | buffer to write to |
| size | size of the buffer |
| int mbedtls_pk_write_pubkey_pem | ( | mbedtls_pk_context * | ctx, |
| unsigned char * | buf, | ||
| size_t | size | ||
| ) |
Write a public key to a PEM string.
| ctx | public key to write away |
| buf | buffer to write to |
| size | size of the buffer |
|
static |
|
static |
|
static |
1.8.15