BEGIN version
DEFINE VersionNum integer
END version
-DEFINE serialNumber octets tagnum=2
+DEFINE serialNumber octets der_type=integer
DEFINE signature group ref=OID-Tree,is_pair
DEFINE issuer sequence sequence_of=set,is_pairs
return -1;
}
+ /*
+ * The DER type and FreeRADIUS type must be compatible.
+ *
+ * Except for some der_type=integer, such as a
+ * certificate serialNumber. Those are too large for us
+ * to represent in 64 bits, so we just treat them as
+ * 'octets'.
+ */
+ if (!fr_type_to_der_tag_valid((*da_p)->type, der_type) &&
+ (der_type != FR_DER_TAG_INTEGER) && ((*da_p)->type != FR_TYPE_OCTETS)) {
+ fr_strerror_printf("Attribute type %s is not compatible with 'der_type=%s'",
+ fr_type_to_str((*da_p)->type), value);
+ return -1;
+ }
+
flags->der_type = der_type;
return 0;
if (fr_type_is_octets(parent->type)) {
/*
* We will store the value as raw octets if indicated by the dictionary
+ *
+ * This is mainly for large 'integer' types, such as serialNumber.
*/
tag = FR_DER_TAG_OCTETSTRING;
* the contents octets.
*/
+ /*
+ * Some 'integer' types such as serialNumber are too
+ * large for 64-bits. So we just treat them as octet
+ * strings.
+ */
+ if (vp->da->type != FR_TYPE_INT64) {
+ fr_assert(vp->da->type == FR_TYPE_OCTETS);
+ FR_DBUFF_IN_MEMCPY_RETURN(&our_dbuff, vp->vp_octets, vp->vp_length);
+ return fr_dbuff_set(dbuff, &our_dbuff);
+ }
+
/*
* Yes, the type is FR_TYPE_INT64. But we encode the
* data as-is, without caring about things like signed