Annotation of embedaddon/strongswan/src/libstrongswan/crypto/pkcs5.h, revision 1.1.1.1

1.1       misho       1: /*
                      2:  * Copyright (C) 2013 Tobias Brunner
                      3:  * HSR Hochschule fuer Technik Rapperswil
                      4:  *
                      5:  * This program is free software; you can redistribute it and/or modify it
                      6:  * under the terms of the GNU General Public License as published by the
                      7:  * Free Software Foundation; either version 2 of the License, or (at your
                      8:  * option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
                      9:  *
                     10:  * This program is distributed in the hope that it will be useful, but
                     11:  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
                     12:  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
                     13:  * for more details.
                     14:  */
                     15: 
                     16: /**
                     17:  * @defgroup pkcs5 pkcs5
                     18:  * @{ @ingroup crypto
                     19:  */
                     20: 
                     21: #ifndef PKCS5_H_
                     22: #define PKCS5_H_
                     23: 
                     24: typedef struct pkcs5_t pkcs5_t;
                     25: 
                     26: #include <utils/chunk.h>
                     27: 
                     28: /**
                     29:  * PKCS#5 helper class
                     30:  */
                     31: struct pkcs5_t {
                     32: 
                     33:        /**
                     34:         * Decrypt the given data using the given password and the scheme derived
                     35:         * from the initial AlgorithmIdentifier object.
                     36:         *
                     37:         * @param password      password used for decryption
                     38:         * @param data          data to decrypt
                     39:         * @param decrypted     decrypted data gets allocated
                     40:         * @return                      TRUE on success, FALSE otherwise
                     41:         */
                     42:        bool (*decrypt)(pkcs5_t *this, chunk_t password, chunk_t data,
                     43:                                        chunk_t *decrypted) __attribute__((warn_unused_result));
                     44: 
                     45:        /**
                     46:         * Destroy the object and any associated cryptographic primitive.
                     47:         */
                     48:        void (*destroy)(pkcs5_t *this);
                     49: };
                     50: 
                     51: /**
                     52:  * Create a PKCS#5 helper object from an ASN.1 encoded AlgorithmIdentifier
                     53:  * object.
                     54:  *
                     55:  * @param blob                 ASN.1 encoded AlgorithmIdentifier
                     56:  * @param level0               ASN.1 parser level
                     57:  * @return                             pkcs5_t object, NULL on failure
                     58:  */
                     59: pkcs5_t *pkcs5_from_algorithmIdentifier(chunk_t blob, int level0);
                     60: 
                     61: #endif /** PKCS5_H_ @}*/

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>