[자답] Current language: auto; currently c 에러.

조야의 이미지

소스

JNIEXPORT jstring JNICALL Java_NativeDes_des (JNIEnv * env, jobject obj, jstring msg, jstring type) {

int m, n, i;
des_context ctx;
des3_context ctx3;
unsigned char buf[2000];
char szHex[2000];
char inputbuf[2000];
unsigned char outbuf[2000];

/* 입력값은 최소 8자리를 Space 시킨다.*/
const char *indata = (*env)->GetStringUTFChars(env, msg, 0);
const char *intype = (*env)->GetStringUTFChars(env, type, 0);

n= 2;
// printf( "\n Triple-DES Monte Carlo Test (ECB mode) - " );
// printf( " Test %d, key size = %3d bits: \n\n", n + 1, 64 + n * 64 );

memset(inputbuf, 0x00, sizeof(inputbuf));
strcat(inputbuf, indata );
// printf("[%s][%d]\n", inputbuf, strlen(inputbuf));
if(strlen(inputbuf) < 8)
{
Fill_Space(inputbuf, strlen(inputbuf), 8);
}
// printf("[%s][%d]\n", inputbuf, strlen(inputbuf));
/* DES 키를 정의한다.*/
des3_set_3keys( &ctx3, DES3_keys[0], DES3_keys[1], DES3_keys[2] );

if(strncmp(intype, "Enc", 3) == 0)
{
// printf("* Encryption\n\n" );

for( i= 0; i < strlen(inputbuf); i++)
{
buf[i]= inputbuf[i];
}

CharStr2HexStr((unsigned char*)buf, szHex, strlen(inputbuf));

for( i = 0; i < 10000; i++ )
{
des3_encrypt( &ctx3, buf, buf );
}

CharStr2HexStr((unsigned char*)buf, szHex, strlen(inputbuf));

return (*env)->NewStringUTF(env,szHex);
}
else if(strncmp(intype, "Dec", 3) == 0)
{
// printf( "*Decryption\n\n" );

// printf("%s\n", inputbuf);
HexStr2CharStr(inputbuf, (unsigned char*)buf, strlen(inputbuf));

for( i = 0; i < 10000; i++ )
{
des3_decrypt( &ctx3, buf, buf );
}

CharStr2HexStr((unsigned char*)buf, szHex, strlen(inputbuf));

HexStr2CharStr(szHex, (unsigned char*)outbuf, strlen(inputbuf));

for(i=0; i< strlen(inputbuf)/2 ; i++)
{
sprintf(szHex+i, "%c", outbuf[i]);
}

// printf("\n");

return (*env)->NewStringUTF(env,szHex);
}
}

Makefile

PROJECT_HOME = ../../../../Test
BASE_DIR = $(PROJECT_HOME)
SRC_DIR = $(BASE_DIR)/src
LIB_DIR = $(BASE_DIR)/lib
BIN_DIR = $(BASE_DIR)/bin
OBJ_DIR = ./OBJ
LIB_NAME = lib3des.so

#
# Flags for compiler
#

CC = gcc
CPP = g++
AR = g++ -shared -o
CAR = -shared
INC = -I$(BASE_DIR)/src/lib/Testutil -I$(BASE_DIR)/src/lib/3DES
LIBS = -ltestutil
IFLAGS =

#LFLAGS = -L$(LIB_DIR)
#DFLAGS = -DDEBUG_MODE -D__UNIX__
DFLAGS =
CFLAGS = -g -w -fPIC $(CAR) #(LFALGS) $(LIBS) $(DFLAGS) $(IFLAGS)
#CFLAGS = -v -g -w -fPIC $(LFLAGS) $(LIBS) $(DFLAGS) $(IFLAGS)
CPPFLAGS = $(CFLAGS)
LFLAGS = -L$(LIB_DIR)

OBJS = des.o
SRCS = des.c

#
# Default libraries: Add extra libraries here
#

all: $(OBJ_DIR) $(LIB_DIR)/$(LIB_NAME).so

full: clean all

#VPATH = .:$(OBJ_DIR)

$(LIB_DIR)/$(LIB_NAME).so : $(OBJS)
-rm -f $(LIB_DIR)/$(LIB_NAME)
$(AR) $(LIB_DIR)/$(LIB_NAME) $(OBJ_DIR)/des.o
#$(addprefix $(OBJ_DIR)/,$(^F))

.SUFFIXES: .cpp .c .o

.cpp.o:
$(CPP) $(CPPFLAGS) $(DFLAGS) $(INC) -c $< -o $(OBJ_DIR)/$@
# $(CPP) $(CPPFLAGS) $(DFLAGS) $(INC) -o $(OBJ_DIR)/$@
.c.o:
$(CC) $(CFLAGS) $(DFLAGS) $(INC) -c $< -o $(OBJ_DIR)/$@
# $(CC) $(CFLAGS) $(DFLAGS) $(INC) -o $(OBJ_DIR)/$@
clean:
-rm -f $(OBJ_DIR)/*.o $(LIB_DIR)/$(LIB_NAME)

해당 Makefile 과 소스입니다.

자바와 C간의 패킷통신 암호화를 하려고 하는데

라이브러리를 만들어서 사용 하면..

Current language: auto; currently c

이런 에러가 납니다.

검색을 해보니.. 컴파일 옵션 때문에 그런다고 하는데.. 컴파일 옵션을

이리저리 바꿔봐도.. 계속 저런 오류가 뜹니다.

많은 도움 부탁 드려요 ㅠ_ㅠ

조야의 이미지

크..C로 자바 함수를 이용하려고 했더니..

저 오류가 나오는거였어요 ㅡ.,ㅡ;;

ㅠ_ㅠ.. 이틀을 삽질 했어요 ㅠ_ㅠ

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.