JCaosLib
V1.4.4.0

com.dreamsecurity.jcaos.cms
Class SignedData

java.lang.Object
  extended bycom.dreamsecurity.jcaos.cms.SignedData

public class SignedData
extends java.lang.Object

¼­¸í ¸Þ½ÃÁö(SignedData)¸¦ ó¸®Çϱâ À§ÇÑ Å¬·¡½ºÀÌ´Ù.

¼­¸í ¸Þ½ÃÁö´Â ¼­¸íÀÚÀÇ °³ÀÎ۸¦ ÀÌ¿ëÇÏ¿© ¼­¸í°ªÀ» »ý¼ºÇÔÀ¸·Î¼­ ¸Þ½ÃÁöÀÇ ÀÎÁõ°ú ¹«°á¼ºÀ» Á¦°øÇÏ´Â º¸¾È ¸Þ½ÃÁö Çü½ÄÀÌ´Ù.

ÇØ´ç Ŭ·¡½º¿¡¼­´Â RFC3852¿¡¼­ Á¤ÀÇÇÏ´Â SignedData¿Í PKCS#7¿¡¼­ Á¤ÀÇÇÏ´Â SignedData¸¦ ¸ðµÎ Áö¿øÇÑ´Ù.

¼­¸í ¸Þ½ÃÁö¿¡ ´ëÇÑ ÀÚ¼¼ÇÑ Á¤º¸´Â "RFC3852" ¶Ç´Â "PKCS#7"¿¡¼­ È®ÀÎÇÒ ¼ö ÀÖ´Ù.

¼­¸í ¸Þ½ÃÁöÀÇ ASN.1 Æ÷¸ËÀº ´ÙÀ½°ú °°´Ù.

 RFC3852¿¡¼­ Á¤ÀÇÇÏ´Â SignedData Çü½Ä :
  
 SignedData ::= SEQUENCE {
 		version              CMSVersion,
		digestAlgorithms     DigestAlgorithmIdentifiers,
		encapContentInfo     EncapsulatedContentInfo,
		certificates     [0] IMPLICIT CertificateSet OPTIONAL,
		crls             [1] IMPLICIT RevocationInfoChoices OPTIONAL,
		signerInfos          SignerInfos 
 }
         
 PKCS#7¿¡¼­ Á¤ÀÇÇÏ´Â SignedData Çü½Ä :
  
 SignedData ::= SEQUENCE {
		version               Version,
		digestAlgorithms      DigestAlgorithmIdentifiers,
		contentInfo           ContentInfo,
		certificates      [0] IMPLICIT ExtendedCertificatesAndCertificates OPTIONAL,
		crls              [1] IMPLICIT CertificateRevocationLists OPTIONAL,
		signerInfos           SignerInfos }

 ¼­¸í ¸Þ½ÃÁö °´Ã¼ »ý¼º ¿¹Á¦ :
  
 byte[] signData = <¼­¸í ¸Þ½ÃÁö Àбâ>
 SignedData signedData = SignedData.getInstance(signData);
 

Since:
1.0.0.0

Method Summary
 void addSignerCerts(X509Certificate cert)
          ¼­¸í ¸Þ½ÃÁö¾È¿¡ ¼­¸íÀÚÀÇ ÀÎÁõ¼­°¡ Æ÷ÇԵǾîÀÖÁö ¾ÊÀº °æ¿ì¿¡ ¼­¸í °ª °ËÁõÀ» À§Çؼ­ ÇÊ¿äÇÑ ¼­¸íÀÚÀÇ ÀÎÁõ¼­¸¦ ÁöÁ¤ÇÑ´Ù.
 java.util.ArrayList getCertificates()
          ¼­¸í ¸Þ½ÃÁö¿¡ Æ÷ÇԵǾîÀÖ´Â ÀÎÁõ¼­ ¸ñ·ÏÀ» ȹµæÇÑ´Ù.
 byte[] getContent()
          ¼­¸íÇÑ ¿øº» ¸Þ½ÃÁö¸¦ ȹµæÇÑ´Ù.
 java.lang.String getContentType()
          ¼­¸íÇÑ ¿øº» ¸Þ½ÃÁöÀÇ Á¾·ù¸¦ È®ÀÎÇÑ´Ù.
 java.util.ArrayList getDigestAlgorithms()
          ¼­¸í ¸Þ½ÃÁöÀÇ ´ÙÀÌÁ¦½ºÆ® ¾Ë°í¸®Áò ¸ñ·ÏÀ» ȹµæÇÑ´Ù.
 byte[] getEncoded()
          DER ÀÎÄÚµùµÈ ¼­¸í ¸Þ½ÃÁö¸¦ ȹµæÇÑ´Ù.
 void getEncoded(java.io.OutputStream os)
          DER ÀÎÄÚµùµÈ ¼­¸í ¸Þ½ÃÁö¸¦ ȹµæÇÑ´Ù.
static SignedData getInstance(byte[] data)
          ¼­¸í ¸Þ½ÃÁö¸¦ ÀÔ·ÂÇÏ¿© SignedData °´Ã¼·Î º¯È¯ÇÑ´Ù.
static SignedData getInstance(java.lang.Object o)
          ¼­¸í ¸Þ½ÃÁö¸¦ ÀÔ·ÂÇÏ¿© SignedData °´Ã¼·Î º¯È¯ÇÑ´Ù.
 X509Certificate getSignerCert(SignerIdentifier sid)
          ¼­¸íÀÚ Á¤º¸¿¡ ÀÖ´Â ¼­¸íÀÚ ½Äº°ÀÚ¸¦ ÀÌ¿ëÇÏ¿© ÇØ´ç ¼­¸íÀÚ¿¡ ´ëÇÑ ÀÎÁõ¼­¸¦ ȹµæÇÑ´Ù.
 java.util.ArrayList getSignerInfos()
          ¼­¸í ¸Þ½ÃÁö¿¡ ¼­¸íÇÑ »ç¶÷µéÀÇ Á¤º¸¸¦ È®ÀÎÇÑ´Ù.
 java.lang.String getType()
          ¼­¸í ¸Þ½ÃÁöÀÇ Á¾·ù¸¦ È®ÀÎÇÑ´Ù.
 int getVersion()
          ¼­¸í ¸Þ½ÃÁöÀÇ ¹öÀüÀ» ȹµæÇÑ´Ù.
 void insertUnsignedAttributes(int signerIndex, java.lang.Object attrType, byte[] attrValue)
           
 com.dreamsecurity.jcaos.asn1.cms.SignedData toASN1Object()
          ASN.1 ÇüÅÂÀÇ SignedData¸¦ ȹµæÇÑ´Ù.
 void verify()
          ¼­¸í ¸Þ½ÃÁö¿¡ Æ÷ÇԵǾîÀÖ´Â ¸ðµç ¼­¸íÀÚÀÇ ¼­¸í°ªÀ» °ËÁõÇÑ´Ù.
 void verify(byte[] content)
          ¼­¸í ¸Þ½ÃÁö¿¡ Æ÷ÇԵǾîÀÖ´Â ¸ðµç ¼­¸íÀÚÀÇ ¼­¸í°ªÀ» °ËÁõÇÑ´Ù.
 void verify(java.io.InputStream content)
          ¼­¸í ¸Þ½ÃÁö¿¡ Æ÷ÇԵǾîÀÖ´Â ¸ðµç ¼­¸íÀÚÀÇ ¼­¸í°ªÀ» °ËÁõÇÑ´Ù.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static SignedData getInstance(byte[] data)
                              throws java.io.IOException
¼­¸í ¸Þ½ÃÁö¸¦ ÀÔ·ÂÇÏ¿© SignedData °´Ã¼·Î º¯È¯ÇÑ´Ù.

Parameters:
data - DER ÀÎÄÚµùµÈ ÇüÅÂÀÇ ¼­¸í ¸Þ½ÃÁö
Throws:
java.io.IOException - µðÄÚµù ½ÇÆÐ½Ã ¹ß»ý

getInstance

public static SignedData getInstance(java.lang.Object o)
                              throws java.io.IOException
¼­¸í ¸Þ½ÃÁö¸¦ ÀÔ·ÂÇÏ¿© SignedData °´Ã¼·Î º¯È¯ÇÑ´Ù.

Parameters:
o - ¼­¸í ¸Þ½ÃÁö (DER ÀÎÄÚµùµÈ °ª, ASN.1 ÇüÅ ¶Ç´Â InputStream ÇüÅÂ)
Throws:
java.io.IOException - µðÄÚµù ½ÇÆÐ½Ã ¹ß»ý

getEncoded

public byte[] getEncoded()
                  throws java.io.IOException
DER ÀÎÄÚµùµÈ ¼­¸í ¸Þ½ÃÁö¸¦ ȹµæÇÑ´Ù.

Returns:
DER ÀÎÄÚµùµÈ ¼­¸í ¸Þ½ÃÁö
Throws:
java.io.IOException

getEncoded

public void getEncoded(java.io.OutputStream os)
                throws java.io.IOException
DER ÀÎÄÚµùµÈ ¼­¸í ¸Þ½ÃÁö¸¦ ȹµæÇÑ´Ù.

Parameters:
os - OuputStream Çü½ÄÀÇ DER ÀÎÄÚµùµÈ ¼­¸í ¸Þ½ÃÁö
Throws:
java.io.IOException - Ãâ·Â ½ºÆ®¸²¿¡ ¾²±â ½ÇÆÐ½Ã ¹ß»ý

toASN1Object

public com.dreamsecurity.jcaos.asn1.cms.SignedData toASN1Object()
ASN.1 ÇüÅÂÀÇ SignedData¸¦ ȹµæÇÑ´Ù.

Returns:
ASN.1 ÇüÅÂÀÇ SignedData

addSignerCerts

public void addSignerCerts(X509Certificate cert)
¼­¸í ¸Þ½ÃÁö¾È¿¡ ¼­¸íÀÚÀÇ ÀÎÁõ¼­°¡ Æ÷ÇԵǾîÀÖÁö ¾ÊÀº °æ¿ì¿¡ ¼­¸í °ª °ËÁõÀ» À§Çؼ­ ÇÊ¿äÇÑ ¼­¸íÀÚÀÇ ÀÎÁõ¼­¸¦ ÁöÁ¤ÇÑ´Ù.

Parameters:
cert - ¼­¸íÀÚÀÇ ÀÎÁõ¼­

getType

public java.lang.String getType()
¼­¸í ¸Þ½ÃÁöÀÇ Á¾·ù¸¦ È®ÀÎÇÑ´Ù.

Returns:
¼­¸í ¸Þ½ÃÁöÀÇ Á¾·ù ("CMS", "PKCS7")

getVersion

public int getVersion()
¼­¸í ¸Þ½ÃÁöÀÇ ¹öÀüÀ» ȹµæÇÑ´Ù.

Returns:
¹öÀü

getDigestAlgorithms

public java.util.ArrayList getDigestAlgorithms()
¼­¸í ¸Þ½ÃÁöÀÇ ´ÙÀÌÁ¦½ºÆ® ¾Ë°í¸®Áò ¸ñ·ÏÀ» ȹµæÇÑ´Ù.

Returns:
´ÙÀÌÁ¦½ºÆ® ¾Ë°í¸®Áò ¸ñ·Ï. StringÀÇ ArrayList ÇüÅÂÀÓ

getContentType

public java.lang.String getContentType()
¼­¸íÇÑ ¿øº» ¸Þ½ÃÁöÀÇ Á¾·ù¸¦ È®ÀÎÇÑ´Ù.

Returns:
¸Þ½ÃÁö Á¾·ù OID

getContent

public byte[] getContent()
¼­¸íÇÑ ¿øº» ¸Þ½ÃÁö¸¦ ȹµæÇÑ´Ù.

Returns:
¿øº» ¸Þ½ÃÁö. ¸¸¾à ¿øº» ¸Þ½ÃÁö°¡ Æ÷ÇԵǾîÀÖÁö ¾Ê´Ù¸é nullÀÌ ¸®ÅϵÊ.

getCertificates

public java.util.ArrayList getCertificates()
                                    throws java.io.IOException
¼­¸í ¸Þ½ÃÁö¿¡ Æ÷ÇԵǾîÀÖ´Â ÀÎÁõ¼­ ¸ñ·ÏÀ» ȹµæÇÑ´Ù.

Returns:
ÀÎÁõ¼­ ¸ñ·Ï. X509CertificateÀÇ ArrayList ÇüÅÂ. ¸¸¾à ÀÎÁõ¼­ ¸ñ·ÏÀÌ ¾øÀ¸¸é nullÀÌ ¸®ÅϵÊ.
Throws:
java.io.IOException - ÀÎÁõ¼­ µðÄÚµù ½ÇÆÐ ½Ã ¹ß»ý

getSignerInfos

public java.util.ArrayList getSignerInfos()
                                   throws java.io.IOException
¼­¸í ¸Þ½ÃÁö¿¡ ¼­¸íÇÑ »ç¶÷µéÀÇ Á¤º¸¸¦ È®ÀÎÇÑ´Ù.

Returns:
¼­¸íÀÚ Á¤º¸. SignerInfoÀÇ ArrayList ÇüÅÂ
Throws:
java.io.IOException - ¼­¸íÀÚ Á¤º¸ µðÄÚµù ½ÇÆÐ½Ã ¹ß»ý

getSignerCert

public X509Certificate getSignerCert(SignerIdentifier sid)
                              throws NotExistSignerCertException,
                                     ParsingException,
                                     java.io.IOException
¼­¸íÀÚ Á¤º¸¿¡ ÀÖ´Â ¼­¸íÀÚ ½Äº°ÀÚ¸¦ ÀÌ¿ëÇÏ¿© ÇØ´ç ¼­¸íÀÚ¿¡ ´ëÇÑ ÀÎÁõ¼­¸¦ ȹµæÇÑ´Ù. ¼­¸íÀÚ ½Äº°ÀÚ´Â ¸Þ¼Òµå CMSSignerInfo.getSid()À» ÀÌ¿ëÇÏ¿© ȹµæÇÒ ¼ö ÀÖ´Ù.

Parameters:
sid - ¼­¸íÀÚ ½Äº°ÀÚ
Returns:
¼­¸íÀÚ ÀÎÁõ¼­
Throws:
NotExistSignerCertException - ÇØ´ç ¼­¸íÀÚ ÀÎÁõ¼­°¡ Á¸ÀçÇÏÁö ¾ÊÀ» °æ¿ì¿¡ ¹ß»ý
ParsingException - ¼­¸íÀÚ ½Äº°ÀÚÀÇ À̸§ Á¤º¸¿¡ ó¸®ÇÒ ¼ö ¾ø´Â ¼Ó¼ºÀÌ ÀÖ´Â °æ¿ì¿¡ ¹ß»ý
java.io.IOException - Á¤º¸ µðÄÚµù ½ÇÆÐ ½Ã ¹ß»ý

verify

public void verify(java.io.InputStream content)
            throws ParsingException,
                   java.security.NoSuchAlgorithmException,
                   NotExistSignerCertException,
                   java.security.NoSuchProviderException,
                   java.security.spec.InvalidKeySpecException,
                   java.security.InvalidKeyException,
                   java.security.SignatureException,
                   VerifyException,
                   java.io.IOException
¼­¸í ¸Þ½ÃÁö¿¡ Æ÷ÇԵǾîÀÖ´Â ¸ðµç ¼­¸íÀÚÀÇ ¼­¸í°ªÀ» °ËÁõÇÑ´Ù. º» ÇÔ¼ö´Â ¼­¸í ¸Þ½ÃÁö¿¡ ¿øº»ÀÌ Æ÷ÇԵǾîÀÖÁö ¾ÊÀº °æ¿ì¿¡ »ç¿ëÇÑ´Ù.

Parameters:
content - InputStream Çü½ÄÀÇ ¼­¸í ¸Þ½ÃÁöÀÇ ¿øº» ¸Þ½ÃÁö
Throws:
ParsingException - ¼­¸íÀÚ ½Äº°ÀÚÀÇ À̸§ Á¤º¸¿¡ ó¸®ÇÒ ¼ö ¾ø´Â ¼Ó¼ºÀÌ ÀÖ´Â °æ¿ì¿¡ ¹ß»ý
java.security.NoSuchAlgorithmException - Áö¿øÇÏÁö ¾Ê´Â ¾Ë°í¸®ÁòÀÏ °æ¿ì¿¡ ¹ß»ý
NotExistSignerCertException - ¼­¸í °ËÁõ ½Ã ÇÊ¿äÇÑ ¼­¸íÀÚ ÀÎÁõ¼­°¡ Á¸ÀçÇÏÁö ¾ÊÀ» °æ¿ì¿¡ ¹ß»ý
java.security.NoSuchProviderException - Áö¿øÇÏÁö ¾Ê´Â ¾ÏÈ£ ¸ðµâ Á¦°øÀÚÀÏ °æ¿ì¿¡ ¹ß»ý
java.security.spec.InvalidKeySpecException - ÀûÇÕÇÏÁö ¾ÊÀº Ű Á¤º¸ÀÎ °æ¿ì¿¡ ¹ß»ý
java.security.InvalidKeyException - ¾Ë°í¸®Áò¿¡ ´ëÇÑ ÀûÇÕÇÑ Å°(À߸øµÈ ÀÎÄÚµù, À߸øµÈ ±æÀÌ, ÃʱâÈ­ µÇÁö ¾ÊÀ½ µî)°¡ ¾Æ´Ñ °æ¿ì¿¡ ¹ß»ý
java.security.SignatureException - ÀϹÝÀûÀÎ ¼­¸í°ú °ü·ÃÇÑ ¿¹¿Ü »çÇ× ¹ß»ýÇÑ °æ¿ì ¹ß»ý
VerifyException - ¼­¸í °ËÁõ ½ÇÆÐ ½Ã ¹ß»ý
java.io.IOException - ÀÔ·Â ½ºÆ®¸² ÀÐ±â ½ÇÆÐ ¶Ç´Â ¼­¸í ¸Þ½ÃÁö µðÄÚµù ½ÇÆÐ ½Ã ¹ß»ý
See Also:
verify()

insertUnsignedAttributes

public void insertUnsignedAttributes(int signerIndex,
                                     java.lang.Object attrType,
                                     byte[] attrValue)
                              throws java.io.IOException
Throws:
java.io.IOException

verify

public void verify(byte[] content)
            throws ParsingException,
                   java.security.NoSuchAlgorithmException,
                   NotExistSignerCertException,
                   java.security.NoSuchProviderException,
                   java.security.spec.InvalidKeySpecException,
                   java.security.InvalidKeyException,
                   java.security.SignatureException,
                   VerifyException,
                   java.io.IOException
¼­¸í ¸Þ½ÃÁö¿¡ Æ÷ÇԵǾîÀÖ´Â ¸ðµç ¼­¸íÀÚÀÇ ¼­¸í°ªÀ» °ËÁõÇÑ´Ù. º» ÇÔ¼ö´Â ¼­¸í ¸Þ½ÃÁö¿¡ ¿øº»ÀÌ Æ÷ÇԵǾîÀÖÁö ¾ÊÀº °æ¿ì¿¡ »ç¿ëÇÑ´Ù.

Parameters:
content - ¼­¸í ¸Þ½ÃÁöÀÇ ¿øº» ¸Þ½ÃÁö
Throws:
ParsingException - ¼­¸íÀÚ ½Äº°ÀÚÀÇ À̸§ Á¤º¸¿¡ ó¸®ÇÒ ¼ö ¾ø´Â ¼Ó¼ºÀÌ ÀÖ´Â °æ¿ì¿¡ ¹ß»ý
java.security.NoSuchAlgorithmException - Áö¿øÇÏÁö ¾Ê´Â ¾Ë°í¸®ÁòÀÏ °æ¿ì¿¡ ¹ß»ý
NotExistSignerCertException - ¼­¸í °ËÁõ ½Ã ÇÊ¿äÇÑ ¼­¸íÀÚ ÀÎÁõ¼­°¡ Á¸ÀçÇÏÁö ¾ÊÀ» °æ¿ì¿¡ ¹ß»ý
java.security.NoSuchProviderException - Áö¿øÇÏÁö ¾Ê´Â ¾ÏÈ£ ¸ðµâ Á¦°øÀÚÀÏ °æ¿ì¿¡ ¹ß»ý
java.security.spec.InvalidKeySpecException - ÀûÇÕÇÏÁö ¾ÊÀº Ű Á¤º¸ÀÎ °æ¿ì¿¡ ¹ß»ý
java.security.InvalidKeyException - ¾Ë°í¸®Áò¿¡ ´ëÇÑ ÀûÇÕÇÑ Å°(À߸øµÈ ÀÎÄÚµù, À߸øµÈ ±æÀÌ, ÃʱâÈ­ µÇÁö ¾ÊÀ½ µî)°¡ ¾Æ´Ñ °æ¿ì¿¡ ¹ß»ý
java.security.SignatureException - ÀϹÝÀûÀÎ ¼­¸í°ú °ü·ÃÇÑ ¿¹¿Ü »çÇ× ¹ß»ýÇÑ °æ¿ì ¹ß»ý
VerifyException - ¼­¸í °ËÁõ ½ÇÆÐ ½Ã ¹ß»ý
java.io.IOException - ¼­¸í ¸Þ½ÃÁö µðÄÚµù ½ÇÆÐ ½Ã ¹ß»ý
See Also:
verify()

verify

public void verify()
            throws ParsingException,
                   java.security.NoSuchAlgorithmException,
                   NotExistSignerCertException,
                   java.security.NoSuchProviderException,
                   java.security.spec.InvalidKeySpecException,
                   java.security.InvalidKeyException,
                   java.security.SignatureException,
                   VerifyException,
                   java.io.IOException
¼­¸í ¸Þ½ÃÁö¿¡ Æ÷ÇԵǾîÀÖ´Â ¸ðµç ¼­¸íÀÚÀÇ ¼­¸í°ªÀ» °ËÁõÇÑ´Ù. ´Ü, ¼­¸í ¸Þ½ÃÁö¿¡´Â ¿øº» ¸Þ½ÃÁö°¡ Æ÷ÇԵǾî ÀÖ¾î¾ß ÇÑ´Ù.

Throws:
ParsingException - ¼­¸íÀÚ ½Äº°ÀÚÀÇ À̸§ Á¤º¸¿¡ ó¸®ÇÒ ¼ö ¾ø´Â ¼Ó¼ºÀÌ ÀÖ´Â °æ¿ì¿¡ ¹ß»ý
java.security.NoSuchAlgorithmException - Áö¿øµÇÁö ¾Ê´Â ¼­¸í ¾Ë°í¸®ÁòÀÌ »ç¿ëµÇ¾úÀ» °æ¿ì¿¡ ¹ß»ý
NotExistSignerCertException - ¼­¸í °ËÁõ ½Ã ÇÊ¿äÇÑ ¼­¸íÀÚ ÀÎÁõ¼­°¡ Á¸ÀçÇÏÁö ¾ÊÀ» °æ¿ì¿¡ ¹ß»ý
java.security.NoSuchProviderException - Áö¿øÇÏÁö ¾Ê´Â ¾ÏÈ£ ¸ðµâ Á¦°øÀÚÀÏ °æ¿ì¿¡ ¹ß»ý
java.security.spec.InvalidKeySpecException - ÀûÇÕÇÏÁö ¾ÊÀº Ű Á¤º¸ÀÎ °æ¿ì¿¡ ¹ß»ý
java.security.InvalidKeyException - ¾Ë°í¸®Áò¿¡ ´ëÇÑ ÀûÇÕÇÑ Å°(À߸øµÈ ÀÎÄÚµù, À߸øµÈ ±æÀÌ, ÃʱâÈ­ µÇÁö ¾ÊÀ½ µî)°¡ ¾Æ´Ñ °æ¿ì¿¡ ¹ß»ý
java.security.SignatureException - ÀϹÝÀûÀÎ ¼­¸í°ú °ü·ÃÇÑ ¿¹¿Ü »çÇ× ¹ß»ýÇÑ °æ¿ì ¹ß»ý
VerifyException - ¼­¸í °ËÁõ ½ÇÆÐ ½Ã ¹ß»ý
java.io.IOException - µðÄÚµù ½ÇÆÐ ½Ã ¹ß»ý
See Also:
verify(byte[])

JCaosLib
V1.4.4.0


Copyright ¨Ï2007-2011 DreamSecurity Co.,Ltd . All rights reserved