Jump to content
Tuts 4 You

help me des SSL library,THK Y.


diskgetor

Recommended Posts

Quick look on api doc, tells you use same function for encryption and decrypt 64bit block.

Always clear des context at the end and initialize it again for decrypt.

Parameters

ctx 3DES context

input 64-bit input block

output 64-bit output block

Returns

0 if successfulint mbedtls_des3_crypt_ecb ( mbedtls_des3_context * ctx,

const unsigned char input[8],

unsigned char output[8]Parameters

ctx 3DES context

input 64-bit input block

output 64-bit output block

Returns

0 if successful

Edited by b30wulf
Link to comment

yeah,thank you again.the DES ECB was ok,but base64 was wrong.i write thses codes late got the VAR:base64result is : null .

-------------------------------------------------------------------------------------------------------------------------

#include "polarssl/base64.h"

#include "library/base64.c"

#include <stdio.h>

#include <string.h>

int main(void)

{

unsigned char base64mingwen[128]={"1122334455667788"};

unsigned char base64result[128]={0};

size_t dlen;//

size_t slen=128; //

dlen=strlen(base64mingwen);

base64_encode(base64mingwen,&dlen,base64result,slen);

printf("%s",base64result);

printf("\n");

getchar();

}

//the base64 source codes on here:

https://tls.mbed.org/base64-source-code

//

Edited by diskgetor
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...