database.sarang.net
UserID
Passwd
Database
DBMS
MySQL
PostgreSQL
Firebird
Oracle
Informix
Sybase
MS-SQL
DB2
Cache
CUBRID
ㆍLDAP
ALTIBASE
Tibero
DB 문서들
스터디
Community
공지사항
자유게시판
구인|구직
DSN 갤러리
도움주신분들
Admin
운영게시판
최근게시물
LDAP Q&A 1467 게시물 읽기
No. 1467
java api를 이용한 인증서 삽입 방법
작성자
sunny
작성일
2002-04-04 14:27
조회수
4,539

서버는 openldap으로 설치하고 클라이언트는 netscape의 java api를 이용해서 인증서를 삽입하려고 합니다.

string 타입의 attribute를 삽입하는 데는 성공했으나, 인증서와 같은 binary 타입의 attribute를 삽입하는 방법은 모르겠습니다.

objectclass에 strongUserAuthentication을 추가하고

attrs.add( new LDAPAttribute( "userCertificate;binary", *** ) );를 추가하면 될 거 같은데, 파일의 위치를 나타내는 ***을 어떻게 나타내야 할 지 모르겠습니다.

 

 

 

import netscape.ldap.*;

import java.util.*;

 

public class Add {

public static void main( String[] args )

{

/* Specify the DN we're adding */

String dn = "cn=Bill Jensen, o=mycom, c=KR";

 

/* Specify the attributes of the entry */

String objectclass_values[] = { "top",

"person" };

String cn_values[] = { "William B Jensen",

"Bill Jensen" };

String sn_values[] = { "Jensen" };

LDAPAttributeSet attrs = new LDAPAttributeSet();

LDAPAttribute attr = new LDAPAttribute( "objectClass" );

for( int i = 0; i < objectclass_values.length; i++ ) {

attr.addValue( objectclass_values );

}

attrs.add( attr );

attr = new LDAPAttribute( "cn" );

for( int i = 0; i < cn_values.length; i++ ) {

attr.addValue( cn_values );

}

attrs.add( attr );

attr = new LDAPAttribute( "sn" );

for( int i = 0; i < sn_values.length; i++ ) {

attr.addValue( sn_values );

}

attrs.add( attr );

 

/* Create an entry with this DN and these attributes */

LDAPEntry myEntry = new LDAPEntry( dn, attrs );

 

LDAPConnection ld = null;

int status = -1;

try {

ld = new LDAPConnection();

/* Connect to server */

String MY_HOST = "localhost";

int MY_PORT = 389;

ld.connect( MY_HOST, MY_PORT );

 

/* Authenticate to the server as directory manager */

String MGR_DN = "cn=Manager,o=mycom,c=KR";

String MGR_PW = "ldap";

ld.authenticate( MGR_DN, MGR_PW );

 

/* Now add the entry to the directory */

ld.add( myEntry );

System.out.println( "Entry added" );

}

catch( LDAPException e ) {

if ( e.getLDAPResultCode() == LDAPException.ENTRY_ALREADY_EXISTS )

System.out.println( "Error: Entry already present" );

else {

System.out.println( "Error: " + e.toString() );

}

}

 

/* Done, so disconnect */

if ( (ld != null) && ld.isConnected() ) {

try {

ld.disconnect();

} catch ( LDAPException e ) {

System.out.println( "Error: " + e.toString() );

}

}

System.exit(status);

}

[Top]
No.
제목
작성자
작성일
조회
1470김지현님께..??
정하정
2002-04-09
4476
1469[질문]Attribute Matching Rule [2]
박성우
2002-04-08
4589
1468■■■VC++,win32API로 LDAP프로토콜을 구현할려고하는데여..??■■■ [2]
정하정
2002-04-08
4724
1471┕>운영체제와 VC++에서 지원합니다. [2]
김은배
2002-04-09 15:52:13
4585
1467java api를 이용한 인증서 삽입 방법
sunny
2002-04-04
4539
1466userPassword [질문]
박성우
2002-04-03
4487
1465php로 아뒤,passwd 가져오기[질문] [2]
박성우
2002-04-03
4592
1464[질문]감사합니다.이수진님 하나 더 질문합니다. [1]
박웅
2002-04-03
4426
Valid XHTML 1.0!
All about the DATABASE... Copyleft 1999-2024 DSN, All rights reserved.
작업시간: 0.028초, 이곳 서비스는
	PostgreSQL v16.2로 자료를 관리합니다