bf01e8179cbb2be476805340636098deda7e1366Sumit Bose/*
bf01e8179cbb2be476805340636098deda7e1366Sumit Bose SSSD - certificate handling utils - openssl version
bf01e8179cbb2be476805340636098deda7e1366Sumit Bose
bf01e8179cbb2be476805340636098deda7e1366Sumit Bose Copyright (C) Sumit Bose <sbose@redhat.com> 2015
bf01e8179cbb2be476805340636098deda7e1366Sumit Bose
bf01e8179cbb2be476805340636098deda7e1366Sumit Bose This program is free software; you can redistribute it and/or modify
bf01e8179cbb2be476805340636098deda7e1366Sumit Bose it under the terms of the GNU General Public License as published by
bf01e8179cbb2be476805340636098deda7e1366Sumit Bose the Free Software Foundation; either version 3 of the License, or
bf01e8179cbb2be476805340636098deda7e1366Sumit Bose (at your option) any later version.
bf01e8179cbb2be476805340636098deda7e1366Sumit Bose
bf01e8179cbb2be476805340636098deda7e1366Sumit Bose This program is distributed in the hope that it will be useful,
bf01e8179cbb2be476805340636098deda7e1366Sumit Bose but WITHOUT ANY WARRANTY; without even the implied warranty of
bf01e8179cbb2be476805340636098deda7e1366Sumit Bose MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bf01e8179cbb2be476805340636098deda7e1366Sumit Bose GNU General Public License for more details.
bf01e8179cbb2be476805340636098deda7e1366Sumit Bose
bf01e8179cbb2be476805340636098deda7e1366Sumit Bose You should have received a copy of the GNU General Public License
bf01e8179cbb2be476805340636098deda7e1366Sumit Bose along with this program. If not, see <http://www.gnu.org/licenses/>.
bf01e8179cbb2be476805340636098deda7e1366Sumit Bose*/
bf01e8179cbb2be476805340636098deda7e1366Sumit Bose
bf01e8179cbb2be476805340636098deda7e1366Sumit Bose#include <stdint.h>
bf01e8179cbb2be476805340636098deda7e1366Sumit Bose#include <talloc.h>
bf01e8179cbb2be476805340636098deda7e1366Sumit Bose
bf01e8179cbb2be476805340636098deda7e1366Sumit Bose#include "util/util.h"
bf01e8179cbb2be476805340636098deda7e1366Sumit Bose
bf01e8179cbb2be476805340636098deda7e1366Sumit Bose#ifndef __CERT_H__
bf01e8179cbb2be476805340636098deda7e1366Sumit Bose#define __CERT_H__
bf01e8179cbb2be476805340636098deda7e1366Sumit Bose
bf01e8179cbb2be476805340636098deda7e1366Sumit Boseerrno_t sss_cert_der_to_pem(TALLOC_CTX *mem_ctx, const uint8_t *der_blob,
bf01e8179cbb2be476805340636098deda7e1366Sumit Bose size_t der_size, char **pem, size_t *pem_size);
bf01e8179cbb2be476805340636098deda7e1366Sumit Bose
bf01e8179cbb2be476805340636098deda7e1366Sumit Boseerrno_t sss_cert_pem_to_der(TALLOC_CTX *mem_ctx, const char *pem,
bf01e8179cbb2be476805340636098deda7e1366Sumit Bose uint8_t **der_blob, size_t *der_size);
bf01e8179cbb2be476805340636098deda7e1366Sumit Bose
bf01e8179cbb2be476805340636098deda7e1366Sumit Boseerrno_t sss_cert_derb64_to_pem(TALLOC_CTX *mem_ctx, const char *derb64,
bf01e8179cbb2be476805340636098deda7e1366Sumit Bose char **pem, size_t *pem_size);
bf01e8179cbb2be476805340636098deda7e1366Sumit Bose
bf01e8179cbb2be476805340636098deda7e1366Sumit Boseerrno_t sss_cert_pem_to_derb64(TALLOC_CTX *mem_ctx, const char *pem,
bf01e8179cbb2be476805340636098deda7e1366Sumit Bose char **derb64);
bf01e8179cbb2be476805340636098deda7e1366Sumit Bose
bf01e8179cbb2be476805340636098deda7e1366Sumit Boseerrno_t sss_cert_derb64_to_ldap_filter(TALLOC_CTX *mem_ctx, const char *derb64,
bf01e8179cbb2be476805340636098deda7e1366Sumit Bose const char *attr_name,
bf01e8179cbb2be476805340636098deda7e1366Sumit Bose char **ldap_filter);
bf01e8179cbb2be476805340636098deda7e1366Sumit Bose
bf01e8179cbb2be476805340636098deda7e1366Sumit Boseerrno_t bin_to_ldap_filter_value(TALLOC_CTX *mem_ctx,
bf01e8179cbb2be476805340636098deda7e1366Sumit Bose const uint8_t *blob, size_t blob_size,
bf01e8179cbb2be476805340636098deda7e1366Sumit Bose char **_str);
4de84af23db74e13e867985c9093f394c9fa8d51Sumit Bose
4de84af23db74e13e867985c9093f394c9fa8d51Sumit Boseerrno_t cert_to_ssh_key(TALLOC_CTX *mem_ctx, const char *ca_db,
4de84af23db74e13e867985c9093f394c9fa8d51Sumit Bose const uint8_t *der_blob, size_t der_size,
aa35995ef056aa8ae052a47c62c6750b7adf065eSumit Bose struct cert_verify_opts *cert_verify_opts,
4de84af23db74e13e867985c9093f394c9fa8d51Sumit Bose uint8_t **key, size_t *key_size);
bf01e8179cbb2be476805340636098deda7e1366Sumit Bose#endif /* __CERT_H__ */