asn1: Add helper function to create algorithmIdentifier with parameters
This commit is contained in:
@@ -33,7 +33,15 @@ const chunk_t ASN1_INTEGER_1 = chunk_from_chars(0x02, 0x01, 0x01);
|
||||
const chunk_t ASN1_INTEGER_2 = chunk_from_chars(0x02, 0x01, 0x02);
|
||||
|
||||
/*
|
||||
* Defined in header.
|
||||
* Described in header
|
||||
*/
|
||||
chunk_t asn1_algorithmIdentifier_params(int oid, chunk_t params)
|
||||
{
|
||||
return asn1_wrap(ASN1_SEQUENCE, "mm", asn1_build_known_oid(oid), params);
|
||||
}
|
||||
|
||||
/*
|
||||
* Described in header
|
||||
*/
|
||||
chunk_t asn1_algorithmIdentifier(int oid)
|
||||
{
|
||||
@@ -55,7 +63,7 @@ chunk_t asn1_algorithmIdentifier(int oid)
|
||||
parameters = asn1_simple_object(ASN1_NULL, chunk_empty);
|
||||
break;
|
||||
}
|
||||
return asn1_wrap(ASN1_SEQUENCE, "mm", asn1_build_known_oid(oid), parameters);
|
||||
return asn1_algorithmIdentifier_params(oid, parameters);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* Copyright (C) 2011-2017 Tobias Brunner
|
||||
* Copyright (C) 2006 Martin Will
|
||||
* Copyright (C) 2000-2008 Andreas Steffen
|
||||
*
|
||||
* Hochschule fuer Technik Rapperswil
|
||||
* HSR Hochschule fuer Technik Rapperswil
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
@@ -92,13 +92,22 @@ extern const chunk_t ASN1_INTEGER_2;
|
||||
/** Some ASN.1 analysis functions */
|
||||
|
||||
/**
|
||||
* Build an algorithmIdentifier from a known OID.
|
||||
* Build an algorithmIdentifier from a known OID with empty parameters.
|
||||
*
|
||||
* @param oid known OID index
|
||||
* @return body of the corresponding OID, allocated
|
||||
* @return body of the corresponding ASN.1 structure, allocated
|
||||
*/
|
||||
chunk_t asn1_algorithmIdentifier(int oid);
|
||||
|
||||
/**
|
||||
* Build an algorithmIdentifier from a known OID and the given prameters.
|
||||
*
|
||||
* @param oid known OID index
|
||||
* @param params parameters to encode in the algorithmIdentifier (adopted)
|
||||
* @return body of the corresponding ASN.1 structure, allocated
|
||||
*/
|
||||
chunk_t asn1_algorithmIdentifier_params(int oid, chunk_t params);
|
||||
|
||||
/**
|
||||
* Converts an ASN.1 OID into a known OID index
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user