Commit bfe7f4d3 authored by ASN.1 Documenter's avatar ASN.1 Documenter
Browse files

support for Rel 2 and implicit certificates

parent c50fcd41
Loading
Loading
Loading
Loading
+24 −4
Original line number Original line Diff line number Diff line
@@ -45,7 +45,7 @@
 <xsl:template match = "certificate">
 <xsl:template match = "certificate">
  <EtsiTs103097Certificate>
  <EtsiTs103097Certificate>
    <xsl:apply-templates select="version"/>
    <xsl:apply-templates select="version"/>
    <type><explicit/></type>
    <xsl:apply-templates select="." mode="cert_type"/>
    <xsl:apply-templates select="signer"/>
    <xsl:apply-templates select="signer"/>
    <xsl:apply-templates select="subject"/>
    <xsl:apply-templates select="subject"/>
    <xsl:apply-templates select="signature"/>
    <xsl:apply-templates select="signature"/>
@@ -57,6 +57,16 @@
   <version>3</version>
   <version>3</version>
 </xsl:template>
 </xsl:template>
 
 
  <xsl:template match="certificate" mode="cert_type">
    <type><xsl:choose>
      <xsl:when test="@type='implicit'"><implicit/></xsl:when>
      <xsl:when test="@type='explicit'"><explicit/></xsl:when>
      <xsl:when test="subject/attribute[@type='verification_key']/public_key"><explicit/></xsl:when>
      <xsl:when test="subject/attribute[@type='verification_key']/reconstruction_value"><implicit/></xsl:when>
      <xsl:otherwise><explicit/></xsl:otherwise>
    </xsl:choose></type>
  </xsl:template>

 <xsl:template match = "signer">
 <xsl:template match = "signer">
  <xsl:choose>
  <xsl:choose>
  <xsl:when test="@type='digest'">
  <xsl:when test="@type='digest'">
@@ -609,9 +619,16 @@


 <xsl:template match="attribute[@type='verification_key']">
 <xsl:template match="attribute[@type='verification_key']">
 <verifyKeyIndicator>
 <verifyKeyIndicator>
  <xsl:if test="public_key">
    <verificationKey>
    <verificationKey>
     <xsl:apply-templates select="public_key"  mode="verification_key"/>
     <xsl:apply-templates select="public_key"  mode="verification_key"/>
    </verificationKey>
    </verificationKey>
  </xsl:if>
  <xsl:if test="reconstruction_value">
    <reconstructionValue>
     <xsl:apply-templates select="reconstruction_value/ecc_point"/>
    </reconstructionValue>
  </xsl:if>
 </verifyKeyIndicator>
 </verifyKeyIndicator>
 </xsl:template>
 </xsl:template>
 
 
@@ -637,6 +654,9 @@
  </xsl:choose>
  </xsl:choose>
 </xsl:template>
 </xsl:template>


 <!--xsl:template match="reconstruction_value">
 </xsl:template-->

 <xsl:template match="public_key" mode="encryption_key">
 <xsl:template match="public_key" mode="encryption_key">
  <supportedSymmAlg>
  <supportedSymmAlg>
   <xsl:choose>
   <xsl:choose>

certgen/asncodec/ANY.c

0 → 100644
+80 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright (c) 2004-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
 * Redistribution and modifications are permitted subject to BSD license.
 */
#include <asn_internal.h>
#include <ANY.h>

asn_OCTET_STRING_specifics_t asn_SPC_ANY_specs = {
    sizeof(ANY_t),
    offsetof(ANY_t, _asn_ctx),
    ASN_OSUBV_ANY
};
asn_TYPE_operation_t asn_OP_ANY = {
    OCTET_STRING_free,
#if !defined(ASN_DISABLE_PRINT_SUPPORT)
    OCTET_STRING_print,
#else
    0,
#endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */
    OCTET_STRING_compare,
#if !defined(ASN_DISABLE_BER_SUPPORT)
    OCTET_STRING_decode_ber,
    OCTET_STRING_encode_der,
#else
    0,
    0,
#endif  /* !defined(ASN_DISABLE_BER_SUPPORT) */
#if !defined(ASN_DISABLE_XER_SUPPORT)
    OCTET_STRING_decode_xer_hex,
    ANY_encode_xer,
#else
    0,
    0,
#endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_JER_SUPPORT)
    ANY_encode_jer,
#else
    0,
#endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */
#if !defined(ASN_DISABLE_OER_SUPPORT)
    0,
    0,
#else
    0,
    0,
#endif  /* !defined(ASN_DISABLE_OER_SUPPORT) */
#if !defined(ASN_DISABLE_UPER_SUPPORT)
    ANY_decode_uper,
    ANY_encode_uper,
#else
    0,
    0,
#endif  /* !defined(ASN_DISABLE_UPER_SUPPORT) */
#if !defined(ASN_DISABLE_APER_SUPPORT)
    ANY_decode_aper,
    ANY_encode_aper,
#else
    0,
    0,
#endif  /* !defined(ASN_DISABLE_APER_SUPPORT) */
    0,  /* Random fill is not defined for ANY type */
    0  /* Use generic outmost tag fetcher */
};
asn_TYPE_descriptor_t asn_DEF_ANY = {
    "ANY",
    "ANY",
    &asn_OP_ANY,
    0, 0, 0, 0,
    {
#if !defined(ASN_DISABLE_OER_SUPPORT)
        0,
#endif  /* !defined(ASN_DISABLE_OER_SUPPORT) */
#if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT)
        0,
#endif  /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */
        asn_generic_no_constraint
    },  /* No constraints */
    0, 0,  /* No members */
    &asn_SPC_ANY_specs,
};

certgen/asncodec/ANY.h

0 → 100644
+84 −0
Original line number Original line Diff line number Diff line
/*-
 * Copyright (c) 2004-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
 * Redistribution and modifications are permitted subject to BSD license.
 */
#ifndef ASN_TYPE_ANY_H
#define ASN_TYPE_ANY_H

#include <OCTET_STRING.h>	/* Implemented via OCTET STRING type */

#ifdef __cplusplus
extern "C" {
#endif

typedef struct ANY {
	uint8_t *buf;	/* BER-encoded ANY contents */
	int size;	/* Size of the above buffer */

	asn_struct_ctx_t _asn_ctx;	/* Parsing across buffer boundaries */
} ANY_t;

extern asn_TYPE_descriptor_t asn_DEF_ANY;
extern asn_TYPE_operation_t asn_OP_ANY;
extern asn_OCTET_STRING_specifics_t asn_SPC_ANY_specs;

#define ANY_free OCTET_STRING_free

#if !defined(ASN_DISABLE_PRINT_SUPPORT)
#define ANY_print OCTET_STRING_print
#endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */

#define ANY_compare OCTET_STRING_compare

#define ANY_constraint asn_generic_no_constraint

#if !defined(ASN_DISABLE_BER_SUPPORT)
#define ANY_decode_ber OCTET_STRING_decode_ber
#define ANY_encode_der OCTET_STRING_encode_der
#endif  /* !defined(ASN_DISABLE_BER_SUPPORT) */

#if !defined(ASN_DISABLE_XER_SUPPORT)
#define ANY_decode_xer OCTET_STRING_decode_xer_hex
xer_type_encoder_f ANY_encode_xer;
#endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */

#if !defined(ASN_DISABLE_JER_SUPPORT)
jer_type_encoder_f ANY_encode_jer;
#endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */

#if !defined(ASN_DISABLE_UPER_SUPPORT)
per_type_decoder_f ANY_decode_uper;
per_type_encoder_f ANY_encode_uper;
#endif  /* !defined(ASN_DISABLE_UPER_SUPPORT) */
#if !defined(ASN_DISABLE_APER_SUPPORT)
per_type_decoder_f ANY_decode_aper;
per_type_encoder_f ANY_encode_aper;
#endif  /* !defined(ASN_DISABLE_APER_SUPPORT) */

/******************************
 * Handy conversion routines. *
 ******************************/

/* Convert another ASN.1 type into the ANY. This implies DER encoding. */
int ANY_fromType(ANY_t *, asn_TYPE_descriptor_t *td, void *struct_ptr);
ANY_t *ANY_new_fromType(asn_TYPE_descriptor_t *td, void *struct_ptr);
#if !defined(ASN_DISABLE_APER_SUPPORT)
int ANY_fromType_aper(ANY_t *st, asn_TYPE_descriptor_t *td, void *sptr);
ANY_t *ANY_new_fromType_aper(asn_TYPE_descriptor_t *td, void *sptr);
#endif  /* !defined(ASN_DISABLE_APER_SUPPORT) */

/* Convert the contents of the ANY type into the specified type. */
int ANY_to_type(ANY_t *, asn_TYPE_descriptor_t *td, void **struct_ptr);
#if !defined(ASN_DISABLE_APER_SUPPORT)
int ANY_to_type_aper(ANY_t *, asn_TYPE_descriptor_t *td, void **struct_ptr);
#endif  /* !defined(ASN_DISABLE_APER_SUPPORT) */

#define	ANY_fromBuf(s, buf, size)	OCTET_STRING_fromBuf((s), (buf), (size))
#define	ANY_new_fromBuf(buf, size)	OCTET_STRING_new_fromBuf(	\
						&asn_DEF_ANY, (buf), (size))

#ifdef __cplusplus
}
#endif

#endif	/* ASN_TYPE_ANY_H */
+22 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright (c) 2017 Lev Walkin <vlm@lionet.info>.
 * All rights reserved.
 * Redistribution and modifications are permitted subject to BSD license.
 */
#include <asn_internal.h>
#include <ANY.h>

asn_enc_rval_t
ANY_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
               enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb,
               void *app_key) {
    if(flags & XER_F_CANONICAL) {
        /*
         * Canonical XER-encoding of ANY type is not supported.
         */
        ASN__ENCODE_FAILED;
    }

    /* Dump as binary */
    return OCTET_STRING_encode_xer(td, sptr, ilevel, flags, cb, app_key);
}
+30 −6
Original line number Original line Diff line number Diff line
/*
/*
 * Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
 * Generated by asn1c-0.9.29-DF (http://lionet.info/asn1c)
 * From ASN.1 module "EtsiTs102941TrustLists"
 * From ASN.1 module "EtsiTs102941TrustLists"
 * 	found in "../asn1/EtsiTs102941/EtsiTs102941TrustLists.asn"
 * 	found in "asn1/pki_ts102941/EtsiTs102941TrustLists.asn"
 * 	`asn1c -S ../../asn1c/skeletons -fcompound-names -no-gen-PER -gen-autotools -pdu=EtsiTs103097Data -pdu=EnrolmentRequestMessage -pdu=EnrolmentResponseMessage -pdu=AuthorizationRequestMessage -pdu=AuthorizationRequestMessageWithPop -pdu=AuthorizationResponseMessage -pdu=CertificateRevocationListMessage -pdu=TlmCertificateTrustListMessage -pdu=RcaCertificateTrustListMessage -pdu=AuthorizationValidationRequestMessage -pdu=AuthorizationValidationResponseMessage -pdu=CaCertificateRequestMessage`
 * 	`asn1c -S ../../../../asn1c-fillabs2/skeletons -fcompound-names -no-gen-BER -no-gen-JER -no-gen-UPER -no-gen-APER -no-gen-random-fill -no-gen-example -pdu=EtsiTs103097Data -pdu=EnrolmentRequestMessage -pdu=EnrolmentResponseMessage -pdu=AuthorizationRequestMessage -pdu=AuthorizationRequestMessageWithPop -pdu=AuthorizationResponseMessage -pdu=CertificateRevocationListMessage -pdu=TlmCertificateTrustListMessage -pdu=RcaCertificateTrustListMessage -pdu=AuthorizationValidationRequestMessage -pdu=AuthorizationValidationResponseMessage -pdu=CaCertificateRequestMessage -pdu=EtsiTs103097Certificate`
 */
 */


#include "AaEntry.h"
#include "AaEntry.h"
@@ -13,7 +13,15 @@ asn_TYPE_member_t asn_MBR_AaEntry_1[] = {
		-1,	/* IMPLICIT tag at current level */
		-1,	/* IMPLICIT tag at current level */
		&asn_DEF_EtsiTs103097Certificate,
		&asn_DEF_EtsiTs103097Certificate,
		0,
		0,
		{ 0, 0, 0 },
		{
#if !defined(ASN_DISABLE_OER_SUPPORT)
			0,
#endif  /* !defined(ASN_DISABLE_OER_SUPPORT) */
#if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT)
			0,
#endif  /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */
			0
		},
		0, 0, /* No default value */
		0, 0, /* No default value */
		"aaCertificate"
		"aaCertificate"
		},
		},
@@ -22,7 +30,15 @@ asn_TYPE_member_t asn_MBR_AaEntry_1[] = {
		-1,	/* IMPLICIT tag at current level */
		-1,	/* IMPLICIT tag at current level */
		&asn_DEF_Url,
		&asn_DEF_Url,
		0,
		0,
		{ 0, 0, 0 },
		{
#if !defined(ASN_DISABLE_OER_SUPPORT)
			0,
#endif  /* !defined(ASN_DISABLE_OER_SUPPORT) */
#if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT)
			0,
#endif  /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */
			0
		},
		0, 0, /* No default value */
		0, 0, /* No default value */
		"accessPoint"
		"accessPoint"
		},
		},
@@ -52,7 +68,15 @@ asn_TYPE_descriptor_t asn_DEF_AaEntry = {
	asn_DEF_AaEntry_tags_1,	/* Same as above */
	asn_DEF_AaEntry_tags_1,	/* Same as above */
	sizeof(asn_DEF_AaEntry_tags_1)
	sizeof(asn_DEF_AaEntry_tags_1)
		/sizeof(asn_DEF_AaEntry_tags_1[0]), /* 1 */
		/sizeof(asn_DEF_AaEntry_tags_1[0]), /* 1 */
	{ 0, 0, SEQUENCE_constraint },
	{
#if !defined(ASN_DISABLE_OER_SUPPORT)
		0,
#endif  /* !defined(ASN_DISABLE_OER_SUPPORT) */
#if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT)
		0,
#endif  /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */
		SEQUENCE_constraint
	},
	asn_MBR_AaEntry_1,
	asn_MBR_AaEntry_1,
	2,	/* Elements count */
	2,	/* Elements count */
	&asn_SPC_AaEntry_specs_1	/* Additional specs */
	&asn_SPC_AaEntry_specs_1	/* Additional specs */
Loading