1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 * Use of this source code is governed by a BSD-style license that can be 3 * found in the LICENSE file. 4 */ 5 6 /* From private/ppb_x509_certificate_private.idl, 7 * modified Wed Apr 11 17:11:26 2012. 8 */ 9 10 #ifndef PPAPI_C_PRIVATE_PPB_X509_CERTIFICATE_PRIVATE_H_ 11 #define PPAPI_C_PRIVATE_PPB_X509_CERTIFICATE_PRIVATE_H_ 12 13 #include "ppapi/c/pp_bool.h" 14 #include "ppapi/c/pp_instance.h" 15 #include "ppapi/c/pp_macros.h" 16 #include "ppapi/c/pp_resource.h" 17 #include "ppapi/c/pp_stdint.h" 18 #include "ppapi/c/pp_var.h" 19 20 #define PPB_X509CERTIFICATE_PRIVATE_INTERFACE_0_1 \ 21 "PPB_X509Certificate_Private;0.1" 22 #define PPB_X509CERTIFICATE_PRIVATE_INTERFACE \ 23 PPB_X509CERTIFICATE_PRIVATE_INTERFACE_0_1 24 25 /** 26 * @file 27 * This file defines the <code>PPB_X509Certificate_Private</code> interface for 28 * an X509 certificate. 29 */ 30 31 32 /** 33 * @addtogroup Enums 34 * @{ 35 */ 36 /** 37 * This enumeration corresponds to fields of an X509 certificate. Refer to 38 * <a href="http://www.ietf.org/rfc/rfc5280.txt>RFC 5280</a> for further 39 * documentation about particular fields. 40 */ 41 typedef enum { 42 /** This corresponds to a string (<code>PP_VARTYPE_STRING</code>). */ 43 PP_X509CERTIFICATE_PRIVATE_ISSUER_COMMON_NAME = 0, 44 /** This corresponds to a string (<code>PP_VARTYPE_STRING</code>). */ 45 PP_X509CERTIFICATE_PRIVATE_ISSUER_LOCALITY_NAME = 1, 46 /** This corresponds to a string (<code>PP_VARTYPE_STRING</code>). */ 47 PP_X509CERTIFICATE_PRIVATE_ISSUER_STATE_OR_PROVINCE_NAME = 2, 48 /** This corresponds to a string (<code>PP_VARTYPE_STRING</code>). */ 49 PP_X509CERTIFICATE_PRIVATE_ISSUER_COUNTRY_NAME = 3, 50 /** This corresponds to a string (<code>PP_VARTYPE_STRING</code>). */ 51 PP_X509CERTIFICATE_PRIVATE_ISSUER_ORGANIZATION_NAME = 4, 52 /** This corresponds to a string (<code>PP_VARTYPE_STRING</code>). */ 53 PP_X509CERTIFICATE_PRIVATE_ISSUER_ORGANIZATION_UNIT_NAME = 5, 54 /** 55 * Note: This field is unimplemented and will return 56 * <code>PP_VARTYPE_NULL</code>. 57 */ 58 PP_X509CERTIFICATE_PRIVATE_ISSUER_UNIQUE_ID = 6, 59 /** This corresponds to a string (<code>PP_VARTYPE_STRING</code>). */ 60 PP_X509CERTIFICATE_PRIVATE_SUBJECT_COMMON_NAME = 7, 61 /** This corresponds to a string (<code>PP_VARTYPE_STRING</code>). */ 62 PP_X509CERTIFICATE_PRIVATE_SUBJECT_LOCALITY_NAME = 8, 63 /** This corresponds to a string (<code>PP_VARTYPE_STRING</code>). */ 64 PP_X509CERTIFICATE_PRIVATE_SUBJECT_STATE_OR_PROVINCE_NAME = 9, 65 /** This corresponds to a string (<code>PP_VARTYPE_STRING</code>). */ 66 PP_X509CERTIFICATE_PRIVATE_SUBJECT_COUNTRY_NAME = 10, 67 /** This corresponds to a string (<code>PP_VARTYPE_STRING</code>). */ 68 PP_X509CERTIFICATE_PRIVATE_SUBJECT_ORGANIZATION_NAME = 11, 69 /** This corresponds to a string (<code>PP_VARTYPE_STRING</code>). */ 70 PP_X509CERTIFICATE_PRIVATE_SUBJECT_ORGANIZATION_UNIT_NAME = 12, 71 /** 72 * Note: This field is unimplemented and will return 73 * <code>PP_VARTYPE_NULL</code>. 74 */ 75 PP_X509CERTIFICATE_PRIVATE_SUBJECT_UNIQUE_ID = 13, 76 /** 77 * Note: This field is unimplemented and will return 78 * <code>PP_VARTYPE_NULL</code>. 79 */ 80 PP_X509CERTIFICATE_PRIVATE_VERSION = 14, 81 /** 82 * This corresponds to a byte array (<code>PP_VARTYPE_ARRAY_BUFFER</code>). 83 * The serial number may include a leading 0. 84 */ 85 PP_X509CERTIFICATE_PRIVATE_SERIAL_NUMBER = 15, 86 /** 87 * Note: This field is unimplemented and will return 88 * <code>PP_VARTYPE_NULL</code>. 89 */ 90 PP_X509CERTIFICATE_PRIVATE_SIGNATURE_ALGORITHM_OID = 16, 91 /** 92 * Note: This field is unimplemented and will return 93 * <code>PP_VARTYPE_NULL</code>. 94 */ 95 PP_X509CERTIFICATE_PRIVATE_SIGNATURE_ALGORITHM_PARAMATERS_RAW = 17, 96 /** 97 * This corresponds to a double (<code>PP_VARTYPE_DOUBLE</code>) which 98 * can be cast to a <code>PP_TIME</code>. 99 */ 100 PP_X509CERTIFICATE_PRIVATE_VALIDITY_NOT_BEFORE = 18, 101 /** 102 * This corresponds to a double (<code>PP_VARTYPE_DOUBLE</code>) which 103 * can be cast to a <code>PP_TIME</code>. 104 */ 105 PP_X509CERTIFICATE_PRIVATE_VALIDITY_NOT_AFTER = 19, 106 /** This corresponds to a string (<code>PP_VARTYPE_STRING</code>). */ 107 PP_X509CERTIFICATE_PRIVATE_SUBJECT_PUBLIC_KEY_ALGORITHM_OID = 20, 108 /** 109 * Note: This field is unimplemented and will return 110 * <code>PP_VARTYPE_NULL</code>. 111 */ 112 PP_X509CERTIFICATE_PRIVATE_SUBJECT_PUBLIC_KEY = 21, 113 /** 114 * This corresponds to a byte array (<code>PP_VARTYPE_ARRAY_BUFFER</code>). 115 * This is the DER-encoded representation of the certificate. 116 */ 117 PP_X509CERTIFICATE_PRIVATE_RAW = 22, 118 /** This corresponds to a string (<code>PP_VARTYPE_STRING</code>). */ 119 PP_X509CERTIFICATE_PRIVATE_ISSUER_DISTINGUISHED_NAME = 23, 120 /** This corresponds to a string (<code>PP_VARTYPE_STRING</code>). */ 121 PP_X509CERTIFICATE_PRIVATE_SUBJECT_DISTINGUISHED_NAME = 24 122 } PP_X509Certificate_Private_Field; 123 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_X509Certificate_Private_Field, 4); 124 125 /** 126 * This enumeration defines the different possible values for X5O9 certificate 127 * versions as returned by: 128 * <code>GetField(resource, PP_X509CERTIFICATE_PRIVATE_VERSION)</code>. 129 */ 130 typedef enum { 131 PP_X509CERTIFICATE_PRIVATE_V1 = 0, 132 PP_X509CERTIFICATE_PRIVATE_V2 = 1, 133 PP_X509CERTIFICATE_PRIVATE_V3 = 2 134 } PPB_X509Certificate_Private_Version; 135 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PPB_X509Certificate_Private_Version, 4); 136 /** 137 * @} 138 */ 139 140 /** 141 * @addtogroup Interfaces 142 * @{ 143 */ 144 /** 145 * The <code>PPB_X509Certificate_Private</code> interface provides access to 146 * the fields of an X509 certificate. 147 */ 148 struct PPB_X509Certificate_Private_0_1 { 149 /** 150 * Allocates a <code>PPB_X509Certificate_Private</code> resource. 151 * <code>Initialize()</code> must be called before using the certificate. 152 */ 153 PP_Resource (*Create)(PP_Instance instance); 154 /** 155 * Returns <code>PP_TRUE</code> if a given resource is a 156 * <code>PPB_X509Certificate_Private</code>. 157 */ 158 PP_Bool (*IsX509CertificatePrivate)(PP_Resource resource); 159 /** 160 * Initializes a <code>PPB_X509Certificate_Private</code> from the DER-encoded 161 * representation. |bytes| should represent only a single certificate. 162 * <code>PP_FALSE</code> is returned if |bytes| is not a valid DER-encoding of 163 * a certificate. Note: Flash requires this to be synchronous. 164 */ 165 PP_Bool (*Initialize)(PP_Resource resource, 166 const char* bytes, 167 uint32_t length); 168 /** 169 * Get a field of the X509Certificate as a <code>PP_Var</code>. A null 170 * <code>PP_Var</code> is returned if the field is unavailable. 171 */ 172 struct PP_Var (*GetField)(PP_Resource resource, 173 PP_X509Certificate_Private_Field field); 174 }; 175 176 typedef struct PPB_X509Certificate_Private_0_1 PPB_X509Certificate_Private; 177 /** 178 * @} 179 */ 180 181 #endif /* PPAPI_C_PRIVATE_PPB_X509_CERTIFICATE_PRIVATE_H_ */ 182 183