Skip to content
Snippets Groups Projects

Resolve "SMIME Support"

Merged lazarog98 requested to merge 232-smime-support into dev
6 unresolved threads
Compare and Show latest version
3 files
+ 100
98
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -12,8 +12,7 @@ STACK_OF(X509)* create_stack_x509(X509 *arr, int len)
{
STACK_OF(X509) *stack = sk_X509_new_null();
int i = len;
while (i>0)
{
while (i>0) {
i--;
sk_X509_push(stack,&(arr[i]));
}
@@ -25,7 +24,6 @@ char ** stack_to_array(STACK_OF(X509) *stack) {
int i = 0;
while (sk_X509_num(stack) > 0) {
BIO *out = BIO_new(BIO_s_mem());
char *tmp = NULL;
PEM_write_bio_X509(out, sk_X509_pop(stack));
@@ -131,7 +129,6 @@ result * OpenSSL_encrypt(const char *text, const char *pem) {
// this trick allows to hardcode a certificate as a string
rec_cert_bio = BIO_new_mem_buf(pem, (int) strlen(pem));
// rec_cert_bio = BIO_new_file("keys/mykey.pem", "r");
in = BIO_new_mem_buf(text, (int) strlen(text)); // simpletest
if (!rec_cert_bio) {
@@ -150,14 +147,14 @@ result * OpenSSL_encrypt(const char *text, const char *pem) {
// note that if the stack is initialized correctly, the recipient certificate is pushed as a test
if (!cert_stack || !sk_X509_push(cert_stack, rec_cert)) {
printf("Failed at push_stack");
printf("Failed at push_stack");
goto deinit;
}
cms = CMS_encrypt(cert_stack, in, EVP_aes_256_cbc(), CMS_STREAM);
if (!cms)
{
printf("Failed at P7enc");
printf("Failed at P7enc");
goto deinit;
}
@@ -429,7 +426,6 @@ result * OpenSSL_verify(const char *text, const char *pem_cert) {
BIO_get_mem_data(out, &tmp);
long size = BIO_get_mem_data(out, &tmp);
realtext= (char *) malloc(size+1);
realtext[size]=0;//To Nullterminate the string
Loading