메뉴 건너뛰기

infra

[xmlsec1] 설치와 test

박영식2010.04.22 05:21조회 수 3234댓글 0

  • 1
    • 글자 크기
아래의 글을 위한 xmlsec1설치이다.

우분투에서는 간단하게,

$ sudo apt-get install xmlsec1

으로 설치할 수 있다.

$ xmlsec1
을 입력했을 때,
Usage: xmlsec <command> [<options>] [<file>]

xmlsec is a command line tool for signing, verifying, encrypting and
decrypting XML documents. The allowed <command> values are:
  --help       display this help information and exit
  --help-all   display help information for all commands/options and exit
  --help-<cmd> display help information for command <cmd> and exit
  --version   print version information and exit
  --keys       keys XML file manipulation
  --sign       sign data and output XML document
  --verify     verify signed document
  --sign-tmpl create and sign dynamicaly generated signature template
  --encrypt   encrypt data and output XML document
  --decrypt   decrypt data from XML document


Report bugs to http://www.aleksey.com/xmlsec/bugs.html

Written by Aleksey Sanin <aleksey@aleksey.com>.

Copyright (C) 2002-2003 Aleksey Sanin.
This is free software: see the source for copying information.

와 같이 나오면 설치가 완료된 것이다.

아래글의 [xmlsec.class.php]를 보면
encryption 함수에, 아래와 같은 라인이 존재한다.

    $cmd = "xmlsec1 encrypt --output $outputName --binary-data  $inputName --keys-file $keyfile $tmpfname 2>&1";
    $this->exec();

xmlsec1 을 실행하여 암호화 하는 명령어이다.

xmlsec1 decrypt --keys-file ".$keyfile." ".$inputName." 2>&1";
decrypt는 위와 같이 실행할 수 있다. 파일에는

    $cmd = "xmlsec1>".$outputName." decrypt --keys-file ".$keyfile." ".$inputName." 2>&1";
    $this->cmd = $cmd;
    $this->exec();

위와 같이 실행하여, output파일에 저장한 뒤에 처리한다.

키파일은 아래와 같은 명령어로 실행된다.

xmlsec1 keys --deskey:tripledes-cbc key.bin    keys.xml 2>&1
xmlsec1 keys --aeskey:aes128-cbc key.bin    keys.xml 2>&1

이를 이용할 때, key.bin 파일은 숫자를 포함한 문자열(특수문자 가능)이 들어가는데, key.xml 파일에 base64 인코딩값이 들어간다.
aes와 des를 선택할 수 있는 소스코드파일을 업로드한다.(아래보다 개선된 형태이다)
박영식 (비회원)
  • 1
    • 글자 크기
[xmlsec] xpath를 이용한 element 암호화(Encryption of a single value) (by 박영식) [XML] 임의의 데이터(Arbitrary Data)와 XML문서 암호화 (by 박영식)

댓글 달기

박영식
2011.03.17 조회 1710
박영식
2011.03.07 조회 2059
박영식
2010.04.22 조회 3234
박영식
2010.01.09 조회 3316
첨부 (1)
xmlsec.zip
52.3KB / Download 62
위로