WSSVerifyPart API를 사용하여 확인 파트 메소드 선택

WSS API를 사용하여 이용자 바인딩에 대한 서명 검증 정보를 구성할 수 있습니다. 변환 알고리즘 및 요약 메소드는 이용자 바인딩에 사용됩니다. 알고리즘 메소드를 구성하려면 WSSVerifyPart API를 사용하십시오. WSSVerifyPart API는 com.ibm.websphere.wssecurity.wssapi.verification 패키지에 제공되어 있습니다.

메시지 무결성을 보호하기 위해 이용자 확인 파트 정보를 구성하려면 먼저 디지털로 서명한 후 SOAP 메시지에 대한 서명 및 서명된 파트를 확인해야 합니다. 무결성은 디지털 서명을 나타내고, 기밀성은 암호화를 나타냅니다. 무결성은 네트워크를 통해 데이터를 전송할 때 데이터 수정의 위험성을 감소시킵니다.

메소드

서명 정보에 사용되는 메소드는 다음과 같습니다.
요약 메소드
요약 메소드를 설정합니다.
변환 메소드
변환 알고리즘 메소드를 설정합니다.

요약 알고리즘

요약 메소드 알고리즘은 <Digest> 요소에서 사용되는 요소 안에서 지정됩니다. WebSphere® Application Server는 다음 사전 구성된 요약 알고리즘을 지원합니다.

표 1. 확인 파트 요약 메소드. 메시지 무결성을 보호하려면 확인 파트를 사용하십시오.
요약 메소드 설명
WSSVerifyPart.SHA1(기본값) 요약 알고리즘 SHA1의 URI: http://www.w3.org/2000/09/xmldsig#sha1
WSSVerifyPart.SHA256 요약 알고리즘 SHA256의 URI: http://www.w3.org/2001/04/xmlenc#sha256
WSSVerifyPart.SHA512 요약 알고리즘 SHA256의 URI: http://www.w3.org/2001/04/xmlenc#sha512

변환 알고리즘

변환 알고리즘은 <Transform> 요소 내에 지정되며 서명된 파트의 변환 알고리즘을 지정합니다. WebSphere Application Server는 다음 사전 구성된 변환 알고리즘을 지원합니다.

표 2. 확인 파트 변환 메소드. 메시지 무결성을 보호하려면 확인 파트를 사용하십시오.
요약 메소드 설명
WSSVerifyPart.TRANSFORM_ENVELOPED_SIGNATURE 변환 알고리즘인 엔벨로프 서명의 URI: http://www.w3.org/2000/09/xmldsig#enveloped-signature
WSSVerifyPart.TRANSFORM_STRT10 변환 알고리즘 STR-Transform의 URI: http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#STR-Transform
WSSVerifyPart.TRANSFORM_EXC_C14N(기본값) 변환 알고리즘 Exc-C14N의 URI: http://www.w3.org/2001/10/xml-exc-c14n#
WSSVerifyPart.TRANSFORM_XPATH2_FILTER 변환 알고리즘인 XPath2 필터의 URI: http://www.w3.org/2002/06/xmldsig-filter2
WSS API의 경우 WebSphere Application Server는 다음 변환 알고리즘을 지원하지 않습니다.
  • http://www.w3.org/TR/1999/REC-xpath-19991116
  • http://www.w3.org/2002/07/decrypt#XML

다음 예제에서는 SHA256을 요약 메소드로 사용하고 TRANSFORM_EXC_14N 및 TRANSFORM_STRT10을 변환 메소드로 사용하여 본문을 확인하는 샘플 WSS API 코드를 제공합니다.

	  // get the message context
	  Object msgcontext = getMessageContext();

	  // generate WSSFactory instance
	  WSSFactory factory = WSSFactory.getInstance();

	  // generate WSSConsumingContext instance
	  WSSConsumingContext concont = factory.newWSSConsumingContext();


	  // generate the cert list
	  String certpath = "intca2.cer";// The location of the X509 
      certificate file X509Certificate x509cert = null;
	  try {
		  InputStream is = new FileInputStream(certpath);
		  CertificateFactory cf = CertificateFactory.getInstance("X.509");
		  x509cert = (X509Certificate)cf.generateCertificate(is);
	  } catch(FileNotFoundException e1){
		  throw new WSSException(e1);
	  } catch (CertificateException e2) {
		  throw new WSSException(e2);
	  }

	  Set<Object> eeCerts = new HashSet<Object>();
	  eeCerts.add(x509cert);  
	  // create certStore
	  java.util.List<CertStore> certList = new java.util.ArrayList<CertStore>();
	  CollectionCertStoreParameters certparam = new 
         CollectionCertStoreParameters(eeCerts);
	  CertStore cert = null;
	  try {
		  cert = CertStore.getInstance("Collection", certparam, "IBMCertPath");
	  } catch (NoSuchProviderException e1) {
		  throw new WSSException(e1);
	  } catch (InvalidAlgorithmParameterException e2) {
		  throw new WSSException(e2);
	  } catch (NoSuchAlgorithmException e3) {
		  throw new WSSException (e3);
	  }
	  if(certList != null ){
		  certList.add(cert);
	  }

	  // generate callback handler	  	    
	  X509ConsumeCallbackHandler callbackHandler = new 
         X509ConsumeCallbackHandler(
			  "dsig-receiver.ks", 
			  "jks",
			  "server".toCharArray(), 
			  certList, 
			  java.security.Security.getProvider("IBMCertPath")
	  );

	  //generate WSSVerification instance
	  WSSVerification ver = factory.newWSSVerification(X509Token.class, 
        callbackHandler);

	  //set one or more candidates of the signature method used for the 
    //verification (step. 1)
	  // DEFAULT : WSSVerification.RSA_SHA1
	  ver.addAllowedSignatureMethod(WSSVerification.HMAC_SHA1);

	  //set one or more candidates of the canonicalization method used 
    //for the verification (step. 2)
	  // DEFAULT : WSSVerification.EXC_C14N 
	  ver.addAllowedCanonicalizationMethod(WSSVerification.C14N);
	  ver.addAllowedCanonicalizationMethod(WSSVerification.EXC_C14N);

	  //set the part to be specified by WSSVerifyPart
	  WSSVerifyPart verPart = factory.newWSSVerifyPart();

	  //set the part to be specified by the keyword
	  verPart.setRequiredVerifyPart(WSSVerification.BODY);

	  //set the candidates of digest methods to use for verification (step. 3)
	  // DEFAULT : WSSVerifypart.TRANSFORM_EXC_C14N 
	  verPart.addAllowedTransform(WSSVerifyPart.TRANSFORM_EXC_C14N);
	  verPart.addAllowedTransform(WSSVerifyPart.TRANSFORM_STRT10);

	  //set the candidates of digest methods to use for verification (step. 4)
	  // DEFAULT : WSSVerifyPart.SHA1
	  verPart.addAllowedDigestMethod(WSSVerifyPart.SHA256);

	  //set WSSVerifyPart to WSSVerification
	  ver.addRequiredVerifyPart(verPart);

	  //add the WSSVerification to the WSSConsumingContext
	  concont.add(ver);

	  //validate the WS-Security header
	  concont.process(msgcontext);

주제 유형을 표시하는 아이콘 참조 주제



시간소인 아이콘 마지막 업데이트 날짜: last_date
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=rwbs_wssverifypartalgorithms
파일 이름:rwbs_wssverifypartalgorithms.html