OpenCore  1.0.4
OpenCore Bootloader
Loading...
Searching...
No Matches
DER_Keys.c
Go to the documentation of this file.
1/* Copyright (c) 2005-2007 Apple Inc. All Rights Reserved. */
2
3/*
4 * DER_Cert.c - support for decoding RSA keys
5 *
6 * Created Nov. 8 2005 by Doug Mitchell.
7 */
8
9#include "DER_Decode.h"
10#include "DER_Encode.h"
11#include "DER_Keys.h"
12#include "asn1Types.h"
13#include "libDER_config.h"
14
15#ifndef DER_DECODE_ENABLE
16#error Please define DER_DECODE_ENABLE.
17#endif
18#if DER_DECODE_ENABLE
19
20/*
21 * DERItemSpecs for decoding RSA keys.
22 */
23
24/* Algorithm Identifier */
35 sizeof(DERAlgorithmIdItemSpecs) / sizeof(DERItemSpec);
36
37/* X509 SubjectPublicKeyInfo */
50
51/*
52 * RSA private key in CRT format
53 */
55{
56 /* version, n, e, d - skip */
57 { 0,
60 { 0,
63 { 0,
66 { 0,
84 /* ignore the (optional) rest */
85};
87 sizeof(DERRSAPrivKeyCRTItemSpecs) / sizeof(DERItemSpec);
88
89#endif /* DER_DECODE_ENABLE */
90
91#if DER_DECODE_ENABLE || DER_ENCODE_ENABLE
92
93/* RSA public key in PKCS1 format - encode and decode */
104 sizeof(DERRSAPubKeyPKCS1ItemSpecs) / sizeof(DERItemSpec);
105
106/* RSA public key in Apple custome format with reciprocal - encode and decode */
120 sizeof(DERRSAPubKeyAppleItemSpecs) / sizeof(DERItemSpec);
121
122
123#endif /* DER_DECODE_ENABLE || DER_ENCODE_ENABLE */
124
125#ifndef DER_ENCODE_ENABLE
126#error Please define DER_ENCODE_ENABLE.
127#endif
128
129#if DER_ENCODE_ENABLE
130
131/* RSA Key Pair, encode only */
133{
158 { DER_OFFSET(DERRSAKeyPair, qInv),
161};
162
164 sizeof(DERRSAKeyPairItemSpecs) / sizeof(DERItemSpec);
165
166#endif /* DER_ENCODE_ENABLE */
167
UINT8 version
Definition BmfFile.h:126
#define DER_DEC_SKIP
Definition DER_Decode.h:143
#define DER_DEC_NO_OPTS
Definition DER_Decode.h:134
#define DER_DEC_OPTIONAL
Definition DER_Decode.h:137
#define DER_DEC_SAVE_DER
Definition DER_Decode.h:147
#define DER_DEC_ASN_ANY
Definition DER_Decode.h:140
#define DER_ENC_SIGNED_INT
Definition DER_Encode.h:60
const DERItemSpec DERRSAPubKeyAppleItemSpecs[]
Definition DER_Keys.c:107
const DERItemSpec DERRSAPubKeyPKCS1ItemSpecs[]
Definition DER_Keys.c:94
const DERShort DERNumRSAPubKeyAppleItemSpecs
Definition DER_Keys.c:119
const DERShort DERNumSubjPubKeyInfoItemSpecs
Definition DER_Keys.c:48
const DERItemSpec DERSubjPubKeyInfoItemSpecs[]
Definition DER_Keys.c:38
const DERItemSpec DERAlgorithmIdItemSpecs[]
Definition DER_Keys.c:25
const DERShort DERNumAlgorithmIdItemSpecs
Definition DER_Keys.c:34
const DERShort DERNumRSAPrivKeyCRTItemSpecs
Definition DER_Keys.c:86
const DERShort DERNumRSAPubKeyPKCS1ItemSpecs
Definition DER_Keys.c:103
const DERItemSpec DERRSAPrivKeyCRTItemSpecs[]
Definition DER_Keys.c:54
const DERShort DERNumRSAKeyPairItemSpecs
const DERItemSpec DERRSAKeyPairItemSpecs[]
#define ASN1_INTEGER
Definition asn1Types.h:19
#define ASN1_OBJECT_ID
Definition asn1Types.h:23
#define ASN1_BIT_STRING
Definition asn1Types.h:20
#define ASN1_CONSTR_SEQUENCE
Definition asn1Types.h:83
#define DER_OFFSET(type, field)
Definition libDER.h:58
uint16_t DERShort