Loading tools/itscertgen/asn1certgen/asn1certgen.c +18 −1 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ static const char * _keyPath = NULL; static int _force = 0; static const char * _cfgFile = NULL; static int _debug = 0; static int _xer = 0; static const char _sha256_emptyString[] = { 0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14, 0x9a, 0xfb, 0xf4, 0xc8, 0x99, 0x6f, 0xb9, 0x24, Loading Loading @@ -75,6 +76,7 @@ static copt_t _options [] = { { "e", "ekey", COPT_STR, (void*)&_decriptionKey, "Encription public key (generate key pair if neccessary)" }, { "s", "signer", COPT_STR, (void*)&_signerName, "Signer certificate name [take from profile by default]" }, { "D", "debug", COPT_BOOL, (void*)&_debug, "Dump hashes and other values [false]" }, { "x", "oxer", COPT_BOOL, (void*)&_xer, "Decode OER certificate to XER [false]" }, { NULL, NULL, COPT_END, NULL, NULL } }; Loading Loading @@ -264,7 +266,7 @@ int main(int argc, char ** argv) ebuf = cstrnload(buf, CERT_MAX_SIZE, argv[1]); if(ebuf == NULL){ fprintf(stderr, "%s: Certificate profile not found\n", argv[1]); fprintf(stderr, "%s: Certificate%s not found\n", argv[1], _xer?"":" profile"); return -1; } Loading @@ -272,6 +274,21 @@ int main(int argc, char ** argv) asn_dec_rval_t rc_d; asn_enc_rval_t rc_e; if(_xer) { rc_d = asn_decode(NULL, ATS_BASIC_OER, &asn_DEF_EtsiTs103097Certificate, (void**)&cert, buf, ebuf - buf); if (rc_d.code != RC_OK){ fprintf(stderr, "%s: failed to load at position %d\n %.30s\n", argv[1], (int)rc_d.consumed, buf + rc_d.consumed); return -1; } rc_e = asn_encode_to_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_EtsiTs103097Certificate, cert, buf, CERT_MAX_SIZE); if (rc_e.encoded <0){ fprintf(stderr, "%s: XER encoding failed for %s\n", argv[1], rc_e.failed_type->name); return -1; } fwrite(buf, 1, rc_e.encoded, stdout); return 0; } asn_TYPE_operation_t issuerOps = *asn_DEF_IssuerIdentifier.op; asn_DEF_IssuerIdentifier.op = &issuerOps; Loading tools/itscertgen/asn1certgen/asn1certgen.vcxproj +1 −1 Original line number Diff line number Diff line Loading @@ -536,7 +536,7 @@ </PrecompiledHeader> <WarningLevel>Level3</WarningLevel> <Optimization>Disabled</Optimization> <PreprocessorDefinitions>WIN32;random=rand;_USE_MATH_DEFINES;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;random=rand;_USE_MATH_DEFINES;_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalIncludeDirectories>C:\OpenSSL\Win64\include;..;asncodec</AdditionalIncludeDirectories> </ClCompile> <Link> Loading tools/itscertgen/asn1certgen/asn1certgen.xslt +6 −6 Original line number Diff line number Diff line Loading @@ -88,12 +88,12 @@ <xsl:template match = "subject"> <xsl:variable name="eeType"> <xsl:choose> <xsl:when test="@type = 'ROOT'">A0</xsl:when> <xsl:when test="@type = 'AA'">80</xsl:when> <xsl:when test="@type = 'AT'">80</xsl:when> <xsl:when test="@type = 'TLM'">80</xsl:when> <xsl:when test="@type = 'EA'">80</xsl:when> <!-- certReqPermissions is not used yet in TS103097 --> <xsl:when test="@type = 'EC'">80</xsl:when> <!-- certReqPermissions is not used yet in TS103097 --> <xsl:when test="@type = 'ROOT'">11000000</xsl:when> <xsl:when test="@type = 'AA'">10000000</xsl:when> <xsl:when test="@type = 'AT'">10000000</xsl:when> <xsl:when test="@type = 'TLM'">10000000</xsl:when> <xsl:when test="@type = 'EA'">10000000</xsl:when> <!-- certReqPermissions is not used yet in TS103097 --> <xsl:when test="@type = 'EC'">10000000</xsl:when> <!-- certReqPermissions is not used yet in TS103097 --> <xsl:otherwise>2</xsl:otherwise> </xsl:choose> </xsl:variable> Loading tools/itscertgen/asn1certgen/asncodec/PsidGroupPermissions.c +1 −1 Original line number Diff line number Diff line Loading @@ -52,7 +52,7 @@ static int asn_DFL_4_set_0(void **sptr) { return 0; } static int asn_DFL_5_cmp_0(const void *sptr) { const uint8_t* def_buf[] = { 0 }; uint8_t def_buf[] = { 0 }; BIT_STRING_t defv = { def_buf, 1, 7 }; return BIT_STRING_compare(&asn_DEF_EndEntityType, sptr, &defv); } Loading tools/itscertgen/asn1certgen/ecc_openssl.c +1 −4 Original line number Diff line number Diff line Loading @@ -7,9 +7,6 @@ ## This code is provided under the CeCill-C license agreement. ###################################################################### *********************************************************************/ #define _CRT_SECURE_NO_WARNINGS #include <openssl/evp.h> #include <openssl/err.h> #include <openssl/ec.h> Loading Loading @@ -191,7 +188,7 @@ int ecc_key_private_save(void* key, const char* path, ecc_format format) ecbn = EC_KEY_get0_private_key(eckey); if (ecbn){ int bnlen = BN_num_bytes(ecbn); int len = (bnlen < fsize) ? fsize : bnlen; size_t len = (bnlen < fsize) ? fsize : bnlen; char * buf = (char *)OPENSSL_malloc(len*2+1); if (bnlen < len) memset(buf, 0, len - bnlen); BN_bn2bin(ecbn, (unsigned char *)(buf + len - bnlen)); Loading Loading
tools/itscertgen/asn1certgen/asn1certgen.c +18 −1 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ static const char * _keyPath = NULL; static int _force = 0; static const char * _cfgFile = NULL; static int _debug = 0; static int _xer = 0; static const char _sha256_emptyString[] = { 0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14, 0x9a, 0xfb, 0xf4, 0xc8, 0x99, 0x6f, 0xb9, 0x24, Loading Loading @@ -75,6 +76,7 @@ static copt_t _options [] = { { "e", "ekey", COPT_STR, (void*)&_decriptionKey, "Encription public key (generate key pair if neccessary)" }, { "s", "signer", COPT_STR, (void*)&_signerName, "Signer certificate name [take from profile by default]" }, { "D", "debug", COPT_BOOL, (void*)&_debug, "Dump hashes and other values [false]" }, { "x", "oxer", COPT_BOOL, (void*)&_xer, "Decode OER certificate to XER [false]" }, { NULL, NULL, COPT_END, NULL, NULL } }; Loading Loading @@ -264,7 +266,7 @@ int main(int argc, char ** argv) ebuf = cstrnload(buf, CERT_MAX_SIZE, argv[1]); if(ebuf == NULL){ fprintf(stderr, "%s: Certificate profile not found\n", argv[1]); fprintf(stderr, "%s: Certificate%s not found\n", argv[1], _xer?"":" profile"); return -1; } Loading @@ -272,6 +274,21 @@ int main(int argc, char ** argv) asn_dec_rval_t rc_d; asn_enc_rval_t rc_e; if(_xer) { rc_d = asn_decode(NULL, ATS_BASIC_OER, &asn_DEF_EtsiTs103097Certificate, (void**)&cert, buf, ebuf - buf); if (rc_d.code != RC_OK){ fprintf(stderr, "%s: failed to load at position %d\n %.30s\n", argv[1], (int)rc_d.consumed, buf + rc_d.consumed); return -1; } rc_e = asn_encode_to_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_EtsiTs103097Certificate, cert, buf, CERT_MAX_SIZE); if (rc_e.encoded <0){ fprintf(stderr, "%s: XER encoding failed for %s\n", argv[1], rc_e.failed_type->name); return -1; } fwrite(buf, 1, rc_e.encoded, stdout); return 0; } asn_TYPE_operation_t issuerOps = *asn_DEF_IssuerIdentifier.op; asn_DEF_IssuerIdentifier.op = &issuerOps; Loading
tools/itscertgen/asn1certgen/asn1certgen.vcxproj +1 −1 Original line number Diff line number Diff line Loading @@ -536,7 +536,7 @@ </PrecompiledHeader> <WarningLevel>Level3</WarningLevel> <Optimization>Disabled</Optimization> <PreprocessorDefinitions>WIN32;random=rand;_USE_MATH_DEFINES;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;random=rand;_USE_MATH_DEFINES;_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalIncludeDirectories>C:\OpenSSL\Win64\include;..;asncodec</AdditionalIncludeDirectories> </ClCompile> <Link> Loading
tools/itscertgen/asn1certgen/asn1certgen.xslt +6 −6 Original line number Diff line number Diff line Loading @@ -88,12 +88,12 @@ <xsl:template match = "subject"> <xsl:variable name="eeType"> <xsl:choose> <xsl:when test="@type = 'ROOT'">A0</xsl:when> <xsl:when test="@type = 'AA'">80</xsl:when> <xsl:when test="@type = 'AT'">80</xsl:when> <xsl:when test="@type = 'TLM'">80</xsl:when> <xsl:when test="@type = 'EA'">80</xsl:when> <!-- certReqPermissions is not used yet in TS103097 --> <xsl:when test="@type = 'EC'">80</xsl:when> <!-- certReqPermissions is not used yet in TS103097 --> <xsl:when test="@type = 'ROOT'">11000000</xsl:when> <xsl:when test="@type = 'AA'">10000000</xsl:when> <xsl:when test="@type = 'AT'">10000000</xsl:when> <xsl:when test="@type = 'TLM'">10000000</xsl:when> <xsl:when test="@type = 'EA'">10000000</xsl:when> <!-- certReqPermissions is not used yet in TS103097 --> <xsl:when test="@type = 'EC'">10000000</xsl:when> <!-- certReqPermissions is not used yet in TS103097 --> <xsl:otherwise>2</xsl:otherwise> </xsl:choose> </xsl:variable> Loading
tools/itscertgen/asn1certgen/asncodec/PsidGroupPermissions.c +1 −1 Original line number Diff line number Diff line Loading @@ -52,7 +52,7 @@ static int asn_DFL_4_set_0(void **sptr) { return 0; } static int asn_DFL_5_cmp_0(const void *sptr) { const uint8_t* def_buf[] = { 0 }; uint8_t def_buf[] = { 0 }; BIT_STRING_t defv = { def_buf, 1, 7 }; return BIT_STRING_compare(&asn_DEF_EndEntityType, sptr, &defv); } Loading
tools/itscertgen/asn1certgen/ecc_openssl.c +1 −4 Original line number Diff line number Diff line Loading @@ -7,9 +7,6 @@ ## This code is provided under the CeCill-C license agreement. ###################################################################### *********************************************************************/ #define _CRT_SECURE_NO_WARNINGS #include <openssl/evp.h> #include <openssl/err.h> #include <openssl/ec.h> Loading Loading @@ -191,7 +188,7 @@ int ecc_key_private_save(void* key, const char* path, ecc_format format) ecbn = EC_KEY_get0_private_key(eckey); if (ecbn){ int bnlen = BN_num_bytes(ecbn); int len = (bnlen < fsize) ? fsize : bnlen; size_t len = (bnlen < fsize) ? fsize : bnlen; char * buf = (char *)OPENSSL_malloc(len*2+1); if (bnlen < len) memset(buf, 0, len - bnlen); BN_bn2bin(ecbn, (unsigned char *)(buf + len - bnlen)); Loading