FreeRDP
privatekey.c File Reference
#include <freerdp/config.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <winpr/assert.h>
#include <winpr/wtypes.h>
#include <winpr/crt.h>
#include <winpr/file.h>
#include <winpr/crypto.h>
#include <openssl/pem.h>
#include <openssl/rsa.h>
#include <openssl/bn.h>
#include "privatekey.h"
#include "cert_common.h"
#include <freerdp/crypto/privatekey.h>
#include <openssl/evp.h>
#include "x509_utils.h"
#include "crypto.h"
#include "opensslcompat.h"

Macros

#define TAG   FREERDP_TAG("crypto")
 

Functions

static RSA * evp_pkey_to_rsa (const rdpPrivateKey *key)
 
static EVP_PKEY * evp_pkey_utils_from_pem (const char *data, size_t len, BOOL fromFile)
 
static BOOL key_read_private (rdpPrivateKey *key)
 
rdpPrivateKey * freerdp_key_new_from_pem (const char *pem)
 
rdpPrivateKey * freerdp_key_new_from_file (const char *keyfile)
 
rdpPrivateKey * freerdp_key_new (void)
 
rdpPrivateKey * freerdp_key_clone (const rdpPrivateKey *key)
 
void freerdp_key_free (rdpPrivateKey *key)
 
const rdpCertInfo * freerdp_key_get_info (const rdpPrivateKey *key)
 
const BYTEfreerdp_key_get_exponent (const rdpPrivateKey *key, size_t *plength)
 
EVP_PKEY * freerdp_key_get_evp_pkey (const rdpPrivateKey *key)
 returns a pointer to a EVP_PKEY structure. Call EVP_PKEY_free when done. More...
 
BOOL freerdp_key_is_rsa (const rdpPrivateKey *key)
 
size_t freerdp_key_get_bits (const rdpPrivateKey *key)
 
BOOL freerdp_key_generate (rdpPrivateKey *key, size_t key_length)
 
BYTEfreerdp_key_get_param (const rdpPrivateKey *key, enum FREERDP_KEY_PARAM param, size_t *plength)
 
WINPR_DIGEST_CTX * freerdp_key_digest_sign (rdpPrivateKey *key, WINPR_MD_TYPE digest)
 

Variables

static BYTE tssk_modulus []
 
static BYTE tssk_privateExponent []
 
static const rdpPrivateKey tssk
 
const rdpPrivateKey * priv_key_tssk = &tssk
 

Macro Definition Documentation

◆ TAG

#define TAG   FREERDP_TAG("crypto")

FreeRDP: A Remote Desktop Protocol Implementation Private key Handling

Copyright 2011 Jiten Pathy Copyright 2011 Marc-Andre Moreau marca.nosp@m.ndre.nosp@m..more.nosp@m.au@g.nosp@m.mail..nosp@m.com Copyright 2015 Thincast Technologies GmbH Copyright 2015 DI (FH) Martin Haimberger marti.nosp@m.n.ha.nosp@m.imber.nosp@m.ger@.nosp@m.thinc.nosp@m.ast..nosp@m.com Copyright 2023 Armin Novak anova.nosp@m.k@th.nosp@m.incas.nosp@m.t.co.nosp@m.m Copyright 2023 Thincast Technologies GmbH

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Function Documentation

◆ evp_pkey_to_rsa()

static RSA* evp_pkey_to_rsa ( const rdpPrivateKey *  key)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ evp_pkey_utils_from_pem()

static EVP_PKEY* evp_pkey_utils_from_pem ( const char *  data,
size_t  len,
BOOL  fromFile 
)
static
Here is the caller graph for this function:

◆ freerdp_key_clone()

rdpPrivateKey* freerdp_key_clone ( const rdpPrivateKey *  key)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_key_digest_sign()

WINPR_DIGEST_CTX* freerdp_key_digest_sign ( rdpPrivateKey *  key,
WINPR_MD_TYPE  digest 
)
Here is the call graph for this function:

◆ freerdp_key_free()

void freerdp_key_free ( rdpPrivateKey *  key)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_key_generate()

BOOL freerdp_key_generate ( rdpPrivateKey *  key,
size_t  key_length 
)

◆ freerdp_key_get_bits()

size_t freerdp_key_get_bits ( const rdpPrivateKey *  key)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_key_get_evp_pkey()

EVP_PKEY* freerdp_key_get_evp_pkey ( const rdpPrivateKey *  key)

returns a pointer to a EVP_PKEY structure. Call EVP_PKEY_free when done.

Here is the caller graph for this function:

◆ freerdp_key_get_exponent()

const BYTE* freerdp_key_get_exponent ( const rdpPrivateKey *  key,
size_t *  plength 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_key_get_info()

const rdpCertInfo* freerdp_key_get_info ( const rdpPrivateKey *  key)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_key_get_param()

BYTE* freerdp_key_get_param ( const rdpPrivateKey *  key,
enum FREERDP_KEY_PARAM  param,
size_t *  plength 
)

◆ freerdp_key_is_rsa()

BOOL freerdp_key_is_rsa ( const rdpPrivateKey *  key)
Here is the caller graph for this function:

◆ freerdp_key_new()

rdpPrivateKey* freerdp_key_new ( void  )
Here is the caller graph for this function:

◆ freerdp_key_new_from_file()

rdpPrivateKey* freerdp_key_new_from_file ( const char *  keyfile)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freerdp_key_new_from_pem()

rdpPrivateKey* freerdp_key_new_from_pem ( const char *  pem)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ key_read_private()

static BOOL key_read_private ( rdpPrivateKey *  key)
static
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ priv_key_tssk

const rdpPrivateKey* priv_key_tssk = &tssk

◆ tssk

const rdpPrivateKey tssk
static
Initial value:
= { .PrivateExponent = tssk_privateExponent,
.PrivateExponentLength = sizeof(tssk_privateExponent),
.cert = { .Modulus = tssk_modulus,
.ModulusLength = sizeof(tssk_modulus) } }
static BYTE tssk_privateExponent[]
Definition: privatekey.c:79
static BYTE tssk_modulus[]
Definition: privatekey.c:72

◆ tssk_modulus

BYTE tssk_modulus[]
static
Initial value:
= { 0x3d, 0x3a, 0x5e, 0xbd, 0x72, 0x43, 0x3e, 0xc9, 0x4d, 0xbb, 0xc1,
0x1e, 0x4a, 0xba, 0x5f, 0xcb, 0x3e, 0x88, 0x20, 0x87, 0xef, 0xf5,
0xc1, 0xe2, 0xd7, 0xb7, 0x6b, 0x9a, 0xf2, 0x52, 0x45, 0x95, 0xce,
0x63, 0x65, 0x6b, 0x58, 0x3a, 0xfe, 0xef, 0x7c, 0xe7, 0xbf, 0xfe,
0x3d, 0xf6, 0x5c, 0x7d, 0x6c, 0x5e, 0x06, 0x09, 0x1a, 0xf5, 0x61,
0xbb, 0x20, 0x93, 0x09, 0x5f, 0x05, 0x6d, 0xea, 0x87 }

◆ tssk_privateExponent

BYTE tssk_privateExponent[]
static
Initial value:
= {
0x87, 0xa7, 0x19, 0x32, 0xda, 0x11, 0x87, 0x55, 0x58, 0x00, 0x16, 0x16, 0x25, 0x65, 0x68, 0xf8,
0x24, 0x3e, 0xe6, 0xfa, 0xe9, 0x67, 0x49, 0x94, 0xcf, 0x92, 0xcc, 0x33, 0x99, 0xe8, 0x08, 0x60,
0x17, 0x9a, 0x12, 0x9f, 0x24, 0xdd, 0xb1, 0x24, 0x99, 0xc7, 0x3a, 0xb8, 0x0a, 0x7b, 0x0d, 0xdd,
0x35, 0x07, 0x79, 0x17, 0x0b, 0x51, 0x9b, 0xb3, 0xc7, 0x10, 0x01, 0x13, 0xe7, 0x3f, 0xf3, 0x5f
}