tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

crmfit.h (5117B)


      1 /* -*- Mode: C; tab-width: 8 -*-*/
      2 /* This Source Code Form is subject to the terms of the Mozilla Public
      3 * License, v. 2.0. If a copy of the MPL was not distributed with this
      4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      5 
      6 #ifndef _CRMFIT_H_
      7 #define _CRMFIT_H_
      8 
      9 struct CRMFCertReqMessagesStr {
     10    CRMFCertReqMsg **messages;
     11    PLArenaPool *poolp;
     12 };
     13 
     14 struct CRMFCertExtensionStr {
     15    SECItem id;
     16    SECItem critical;
     17    SECItem value;
     18 };
     19 
     20 struct CRMFOptionalValidityStr {
     21    SECItem notBefore;
     22    SECItem notAfter;
     23 };
     24 
     25 struct CRMFCertTemplateStr {
     26    SECItem version;
     27    SECItem serialNumber;
     28    SECAlgorithmID *signingAlg;
     29    CERTName *issuer;
     30    CRMFOptionalValidity *validity;
     31    CERTName *subject;
     32    CERTSubjectPublicKeyInfo *publicKey;
     33    SECItem issuerUID;
     34    SECItem subjectUID;
     35    CRMFCertExtension **extensions;
     36    int numExtensions;
     37 };
     38 
     39 struct CRMFCertIDStr {
     40    SECItem issuer;       /* General Name */
     41    SECItem serialNumber; /*INTEGER*/
     42 };
     43 
     44 struct CRMFEncryptedValueStr {
     45    SECAlgorithmID *intendedAlg;
     46    SECAlgorithmID *symmAlg;
     47    SECItem encSymmKey; /*BIT STRING   */
     48    SECAlgorithmID *keyAlg;
     49    SECItem valueHint; /*OCTET STRING */
     50    SECItem encValue;  /*BIT STRING   */
     51 };
     52 
     53 /*
     54 * The field derValue will contain the actual der
     55 * to include in the encoding or that was read in
     56 * from a der blob.
     57 */
     58 struct CRMFEncryptedKeyStr {
     59    union {
     60        SEC_PKCS7ContentInfo *envelopedData;
     61        CRMFEncryptedValue encryptedValue;
     62    } value;
     63    CRMFEncryptedKeyChoice encKeyChoice;
     64    SECItem derValue;
     65 };
     66 
     67 /* ASN1 must only have one of the following 3 options. */
     68 struct CRMFPKIArchiveOptionsStr {
     69    union {
     70        CRMFEncryptedKey encryptedKey;
     71        SECItem keyGenParameters;
     72        SECItem archiveRemGenPrivKey; /* BOOLEAN */
     73    } option;
     74    CRMFPKIArchiveOptionsType archOption;
     75 };
     76 
     77 struct CRMFPKIPublicationInfoStr {
     78    SECItem action; /* Possible values                    */
     79                    /* dontPublish (0), pleasePublish (1) */
     80    CRMFSinglePubInfo **pubInfos;
     81 };
     82 
     83 struct CRMFControlStr {
     84    SECOidTag tag;
     85    SECItem derTag;
     86    SECItem derValue;
     87    /* These will be C structures used to represent the various
     88     * options.  Values that can't be stored as der right away.
     89     * After creating these structures, we'll place their der
     90     * encoding in derValue so the encoder knows how to get to
     91     * it.
     92     */
     93    union {
     94        CRMFCertID oldCertId;
     95        CRMFPKIArchiveOptions archiveOptions;
     96        CRMFPKIPublicationInfo pubInfo;
     97        CRMFProtocolEncrKey protEncrKey;
     98    } value;
     99 };
    100 
    101 struct CRMFCertRequestStr {
    102    SECItem certReqId;
    103    CRMFCertTemplate certTemplate;
    104    CRMFControl **controls;
    105    /* The following members are used by the internal implementation, but
    106     * are not part of the encoding.
    107     */
    108    PLArenaPool *poolp;
    109    PRUint32 requestID; /* This is the value that will be encoded into
    110                         * the certReqId field.
    111                         */
    112 };
    113 
    114 struct CRMFAttributeStr {
    115    SECItem derTag;
    116    SECItem derValue;
    117 };
    118 
    119 struct CRMFCertReqMsgStr {
    120    CRMFCertRequest *certReq;
    121    CRMFProofOfPossession *pop;
    122    CRMFAttribute **regInfo;
    123    SECItem derPOP;
    124    /* This arena will be used for allocating memory when decoding.
    125     */
    126    PLArenaPool *poolp;
    127    PRBool isDecoded;
    128 };
    129 
    130 struct CRMFPOPOSigningKeyInputStr {
    131    /* ASN1 must have only one of the next 2 options */
    132    union {
    133        SECItem sender; /*General Name*/
    134        CRMFPKMACValue *publicKeyMAC;
    135    } authInfo;
    136    CERTSubjectPublicKeyInfo publicKey;
    137 };
    138 
    139 struct CRMFPOPOSigningKeyStr {
    140    SECItem derInput; /*If in the future we support
    141                       *POPOSigningKeyInput, this will
    142                       *a C structure representation
    143                       *instead.
    144                       */
    145    SECAlgorithmID *algorithmIdentifier;
    146    SECItem signature; /* This is a BIT STRING. Remember */
    147 };                     /* that when interpreting.        */
    148 
    149 /* ASN1 must only choose one of these members */
    150 struct CRMFPOPOPrivKeyStr {
    151    union {
    152        SECItem thisMessage;       /* BIT STRING */
    153        SECItem subsequentMessage; /*INTEGER*/
    154        SECItem dhMAC;             /*BIT STRING*/
    155    } message;
    156    CRMFPOPOPrivKeyChoice messageChoice;
    157 };
    158 
    159 /* ASN1 must only have one of these options. */
    160 struct CRMFProofOfPossessionStr {
    161    union {
    162        SECItem raVerified;
    163        CRMFPOPOSigningKey signature;
    164        CRMFPOPOPrivKey keyEncipherment;
    165        CRMFPOPOPrivKey keyAgreement;
    166    } popChoice;
    167    CRMFPOPChoice popUsed; /*Not part of encoding*/
    168 };
    169 
    170 struct CRMFPKMACValueStr {
    171    SECAlgorithmID algID;
    172    SECItem value; /*BIT STRING*/
    173 };
    174 
    175 struct CRMFSinglePubInfoStr {
    176    SECItem pubMethod;            /* Possible Values:
    177                                   *   dontCare (0)
    178                                   *   x500     (1)
    179                                   *   web      (2)
    180                                   *   ldap     (3)
    181                                   */
    182    CERTGeneralName *pubLocation; /* General Name */
    183 };
    184 
    185 #endif /* _CRMFIT_H_ */