Return to pkcs7_attributes.h CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / strongswan / src / libstrongswan / plugins / pkcs7 |
1.1 misho 1: /* 2: * Copyright (C) 2012 Tobias Brunner 3: * Copyright (C) 2008 Andreas Steffen 4: * HSR Hochschule fuer Technik Rapperswil 5: * 6: * This program is free software; you can redistribute it and/or modify it 7: * under the terms of the GNU General Public License as published by the 8: * Free Software Foundation; either version 2 of the License, or (at your 9: * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>. 10: * 11: * This program is distributed in the hope that it will be useful, but 12: * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14: * for more details. 15: */ 16: 17: /** 18: * @defgroup pkcs7_attributes pkcs7_attributes 19: * @{ @ingroup pkcs7p 20: */ 21: 22: #ifndef PKCS7_ATTRIBUTES_H_ 23: #define PKCS7_ATTRIBUTES_H_ 24: 25: typedef struct pkcs7_attributes_t pkcs7_attributes_t; 26: 27: #include <library.h> 28: 29: /** 30: * PKCS#7 attribute lists, aka PKCS#9. 31: */ 32: struct pkcs7_attributes_t { 33: 34: /** 35: * Gets ASN.1 encoding of PKCS#9 attribute list. 36: * 37: * @return ASN.1 encoded PKCSI#9 list 38: */ 39: chunk_t (*get_encoding) (pkcs7_attributes_t *this); 40: 41: /** 42: * Gets a PKCS#9 attribute from the list. 43: * 44: * @param oid OID of the attribute 45: * @return value of the attribute (internal data) 46: */ 47: chunk_t (*get_attribute) (pkcs7_attributes_t *this, int oid); 48: 49: /** 50: * Adds a PKCS#9 attribute. 51: * 52: * @param oid OID of the attribute 53: * @param value value of the attribute, with ASN1 type (gets owned) 54: */ 55: void (*add_attribute) (pkcs7_attributes_t *this, int oid, chunk_t value); 56: 57: /** 58: * Destroys the PKCS#9 attribute list. 59: */ 60: void (*destroy) (pkcs7_attributes_t *this); 61: }; 62: 63: /** 64: * Read a PKCS#7 attribute list (aka PKCS#9) from a DER encoded chunk. 65: * 66: * @param chunk chunk containing DER encoded data 67: * @param level ASN.1 parsing start level 68: * @return created pkcs9 attribute list, or NULL if invalid. 69: */ 70: pkcs7_attributes_t *pkcs7_attributes_create_from_chunk(chunk_t chunk, u_int level); 71: 72: /** 73: * Create an empty PKCS#7 attribute list, aka PKCS#9. 74: * 75: * @return created pkcs9 attribute list. 76: */ 77: pkcs7_attributes_t *pkcs7_attributes_create(void); 78: 79: #endif /** PKCS9_H_ @}*/