diff --git a/ChangeLog.txt b/ChangeLog.txt index 16b6f795..6a66b56e 100755 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,6 +1,28 @@ ChangeLog for jsrsasign +* Changes between 4.6.0 to 4.7.0 (2014-Jul-07) + - RFC 5126 CAdES format supported + - CAdES-BES/EPES/T support in this version. + - asn1cades (NEW) + - asn1tsp 1.0.0 to 1.0.1 + - AbstractTSAAdapter, Fixed/SimpleTSAAdapter class added + - asn1cms 1.0.1 to 1.0.2 + - SigningCertificate and SigningCertificateV2 + attributes are added. + - IssuerAndSerialNumber class constructor now + supports PEM string of certificate. + - properties dDigestAlgs and dCerts of SignedData object + are added for object preservation. + - CMSUtil.newSignedData now supports + SigningCertificate/V2 attributes. + - asn1 + - add DEREnumerate class + - x509 + - fix for strict mode + - crypto + - fix for Signature.signHex/Str + * Changes between 4.5.0 to 4.6.0 (2014-May-25) - RFC 3161 Time Stamp Protocol generator is now supported. - asn1tsp 1.0.0 (NEW) diff --git a/README.md b/README.md index d266d30f..dd842dee 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ jsrsasign ========= -The 'jsrsasign' (RSA-Sign JavaScript Library) is an opensource free pure JavaScript cryptographic library supports RSA/RSAPSS/ECDSA/DSA signing/validation, ASN.1, PKCS#1/5/8 private/public key, X.509 certificate and CRL +The 'jsrsasign' (RSA-Sign JavaScript Library) is an opensource free pure JavaScript cryptographic library supports RSA/RSAPSS/ECDSA/DSA signing/validation, ASN.1, PKCS#1/5/8 private/public key, X.509 certificate and CRL, CMS SignedData, RFC 3161 TimeStamp and RFC 5126 CAdES Long Term Signature. Public page is http://kjur.github.com/jsrsasign . diff --git a/api/files.html b/api/files.html index 9efc9d45..4967f3d0 100755 --- a/api/files.html +++ b/api/files.html @@ -202,6 +202,22 @@

Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -240,6 +256,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -270,8 +288,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -282,6 +304,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • @@ -385,6 +409,25 @@

    asn1-1.0.js

    + + +
    + +
    +

    asn1cades-1.0.js

    + + +
    + +
    Author:
    +
    Kenji Urushima kenji.urushima@gmail.com
    + + +
    Version:
    +
    1.0.0 (2014-May-28)
    + + +

    @@ -400,7 +443,7 @@

    asn1cms-1.0.js

    Version:
    -
    1.0.1 (2014-May-21)
    +
    1.0.2 (2014-Jun-07)
    @@ -438,7 +481,7 @@

    asn1tsp-1.0.js

    Version:
    -
    1.0.0 (2014-May-25)
    +
    1.0.1 (2014-Jun-07)
    diff --git a/api/index.html b/api/index.html index ef5628d2..44c4f309 100755 --- a/api/index.html +++ b/api/index.html @@ -202,6 +202,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -240,6 +256,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -270,8 +288,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -282,6 +304,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • @@ -418,6 +442,54 @@

    KJUR.asn1.ASN1Util


    +
    +

    KJUR.asn1.cades

    + +
    +
    + +
    +

    KJUR.asn1.cades.CAdESUtil

    + CAdES utilities class +
    +
    + +
    +

    KJUR.asn1.cades.CompleteCertificateRefs

    + class for RFC 5126 CAdES CompleteCertificateRefs attribute +
    +
    + +
    +

    KJUR.asn1.cades.OtherCertID

    + class for OtherCertID ASN.1 object +
    +
    + +
    +

    KJUR.asn1.cades.OtherHash

    + class for OtherHash ASN.1 object +
    +
    + +
    +

    KJUR.asn1.cades.OtherHashAlgAndValue

    + class for OtherHashAlgAndValue ASN.1 object +
    +
    + +
    +

    KJUR.asn1.cades.SignaturePolicyIdentifier

    + class for RFC 5126 CAdES SignaturePolicyIdentifier attribute +
    +
    + +
    +

    KJUR.asn1.cades.SignatureTimeStamp

    + class for RFC 5126 CAdES SignatureTimeStamp attribute +
    +
    +

    KJUR.asn1.cms

    @@ -532,6 +604,12 @@

    KJUR.asn1.DERBoolean


    +
    +

    KJUR.asn1.DEREnumerated

    + class for ASN.1 DER Enumerated +
    +
    +

    KJUR.asn1.DERGeneralizedTime

    class for ASN.1 DER GeneralizedTime @@ -622,12 +700,24 @@

    KJUR.asn1.tsp


    +
    +

    KJUR.asn1.tsp.AbstractTSAAdapter

    + abstract class for TimeStampToken generator +
    +
    +

    KJUR.asn1.tsp.Accuracy

    class for TSP Accuracy ASN.1 object

    +
    +

    KJUR.asn1.tsp.FixedTSAAdapter

    + class for fixed TimeStampToken generator +
    +
    +

    KJUR.asn1.tsp.MessageImprint

    class for TSP MessageImprint ASN.1 object @@ -658,6 +748,12 @@

    KJUR.asn1.tsp.PKIStatusIn


    +
    +

    KJUR.asn1.tsp.SimpleTSAAdapter

    + class for simple TimeStampToken generator +
    +
    +

    KJUR.asn1.tsp.TimeStampReq

    class for TSP TimeStampReq ASN.1 object diff --git a/api/symbols/ASN1HEX.html b/api/symbols/ASN1HEX.html index 3b60b2b5..1ae46182 100755 --- a/api/symbols/ASN1HEX.html +++ b/api/symbols/ASN1HEX.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/Base64x.html b/api/symbols/Base64x.html index f582704a..cb7ca6eb 100755 --- a/api/symbols/Base64x.html +++ b/api/symbols/Base64x.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KEYUTIL.html b/api/symbols/KEYUTIL.html index ba7987c6..01ddff3a 100755 --- a/api/symbols/KEYUTIL.html +++ b/api/symbols/KEYUTIL.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.ASN1Object.html b/api/symbols/KJUR.asn1.ASN1Object.html index 5042dda7..96803393 100755 --- a/api/symbols/KJUR.asn1.ASN1Object.html +++ b/api/symbols/KJUR.asn1.ASN1Object.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.ASN1Util.html b/api/symbols/KJUR.asn1.ASN1Util.html index 7b91927b..c2eca80e 100755 --- a/api/symbols/KJUR.asn1.ASN1Util.html +++ b/api/symbols/KJUR.asn1.ASN1Util.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • @@ -653,6 +677,7 @@

  • 'octstr' - DEROctetString
  • 'null' - DERNull
  • 'oid' - DERObjectIdentifier
  • +
  • 'enum' - DEREnumerated
  • 'utf8str' - DERUTF8String
  • 'numstr' - DERNumericString
  • 'prnstr' - DERPrintableString
  • diff --git a/api/symbols/KJUR.asn1.DERAbstractString.html b/api/symbols/KJUR.asn1.DERAbstractString.html index eb730cd0..019a1e91 100755 --- a/api/symbols/KJUR.asn1.DERAbstractString.html +++ b/api/symbols/KJUR.asn1.DERAbstractString.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.DERAbstractStructured.html b/api/symbols/KJUR.asn1.DERAbstractStructured.html index 0fabe4e4..1ce85de5 100755 --- a/api/symbols/KJUR.asn1.DERAbstractStructured.html +++ b/api/symbols/KJUR.asn1.DERAbstractStructured.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.DERAbstractTime.html b/api/symbols/KJUR.asn1.DERAbstractTime.html index c3c6b6df..90d458f5 100755 --- a/api/symbols/KJUR.asn1.DERAbstractTime.html +++ b/api/symbols/KJUR.asn1.DERAbstractTime.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.DERBitString.html b/api/symbols/KJUR.asn1.DERBitString.html index c6518535..447f703c 100755 --- a/api/symbols/KJUR.asn1.DERBitString.html +++ b/api/symbols/KJUR.asn1.DERBitString.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.DERBoolean.html b/api/symbols/KJUR.asn1.DERBoolean.html index 2d07d451..bdfdf1f9 100755 --- a/api/symbols/KJUR.asn1.DERBoolean.html +++ b/api/symbols/KJUR.asn1.DERBoolean.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.DEREnumerated.html b/api/symbols/KJUR.asn1.DEREnumerated.html new file mode 100755 index 00000000..36999124 --- /dev/null +++ b/api/symbols/KJUR.asn1.DEREnumerated.html @@ -0,0 +1,701 @@ + + + + + + + jsrsasign 4.0.0 JavaScript API Reference - KJUR.asn1.DEREnumerated + + + + + + + + + + + + +
    + +
    Class Index +| File Index
    +
    +

    Classes

    + +
    + +
    + +
    + +

    + + Class KJUR.asn1.DEREnumerated +

    + + +

    + +
    Extends + KJUR.asn1.ASN1Object.
    + + + class for ASN.1 DER Enumerated + + +
    Defined in: asn1-1.0.js. + +

    + + + + + + + + + + + + + + + + + +
    Class Summary
    Constructor AttributesConstructor Name and Description
      + +
    class for ASN.1 DER Enumerated +
    +As for argument 'params' for constructor, you can specify one of +following properties: +
      +
    • int - specify initial ASN.1 value(V) by integer value
    • +
    • hex - specify initial ASN.1 value(V) by a hexadecimal string
    • +
    +NOTE: 'params' can be omitted.
    +
    + + + + + + + + +
    +
    Fields borrowed from class KJUR.asn1.ASN1Object:
    hL, hT, hTLV, hV, isModified
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Method Summary
    Method AttributesMethod Name and Description
    <static>   +
    KJUR.asn1.DEREnumerated.setByBigInteger(bigIntegerValue) +
    +
    set value by Tom Wu's BigInteger object
    +
    <static>   +
    KJUR.asn1.DEREnumerated.setByInteger(integer) +
    +
    set value by integer value
    +
    <static>   +
    KJUR.asn1.DEREnumerated.setValueHex(hexadecimal) +
    +
    set value by integer value +
    +NOTE: Value shall be represented by minimum octet length of +two's complement representation.
    +
    + + + +
    + +
    + + + + + + + +
    +
    + Class Detail +
    + +
    + KJUR.asn1.DEREnumerated() +
    + +
    + class for ASN.1 DER Enumerated +
    +As for argument 'params' for constructor, you can specify one of +following properties: +
      +
    • int - specify initial ASN.1 value(V) by integer value
    • +
    • hex - specify initial ASN.1 value(V) by a hexadecimal string
    • +
    +NOTE: 'params' can be omitted. + +
    + + + + + + + + + + + + +
    + + + + + + + +
    + Method Detail +
    + + +
    <static> + + + KJUR.asn1.DEREnumerated.setByBigInteger(bigIntegerValue) + +
    +
    + set value by Tom Wu's BigInteger object + + +
    + + + + +
    +
    Parameters:
    + +
    + {BigInteger} bigIntegerValue + +
    +
    to set
    + +
    + + + + + + + + +
    + + +
    <static> + + + KJUR.asn1.DEREnumerated.setByInteger(integer) + +
    +
    + set value by integer value + + +
    + + + + +
    +
    Parameters:
    + +
    + {Integer} integer + +
    +
    value to set
    + +
    + + + + + + + + +
    + + +
    <static> + + + KJUR.asn1.DEREnumerated.setValueHex(hexadecimal) + +
    +
    + set value by integer value +
    +NOTE: Value shall be represented by minimum octet length of +two's complement representation. + + +
    + + + +
    new KJUR.asn1.DEREnumerated(123);
    +new KJUR.asn1.DEREnumerated({'int': 123});
    +new KJUR.asn1.DEREnumerated({'hex': '1fad'});
    + + + + +
    +
    Parameters:
    + +
    + {String} hexadecimal + +
    +
    string of integer value
    + +
    + + + + + + + + + + + + + + + +
    +
    + + + +
    + © 2012 Kenji Urushima, All rights reserved
    + + Documentation generated by JsDoc Toolkit 2.4.0 +
    + + diff --git a/api/symbols/KJUR.asn1.DERGeneralizedTime.html b/api/symbols/KJUR.asn1.DERGeneralizedTime.html index 06bafab4..1fe69d81 100755 --- a/api/symbols/KJUR.asn1.DERGeneralizedTime.html +++ b/api/symbols/KJUR.asn1.DERGeneralizedTime.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.DERIA5String.html b/api/symbols/KJUR.asn1.DERIA5String.html index 5b22f4ce..ef756842 100755 --- a/api/symbols/KJUR.asn1.DERIA5String.html +++ b/api/symbols/KJUR.asn1.DERIA5String.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.DERInteger.html b/api/symbols/KJUR.asn1.DERInteger.html index 7d522f07..4e8df268 100755 --- a/api/symbols/KJUR.asn1.DERInteger.html +++ b/api/symbols/KJUR.asn1.DERInteger.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.DERNull.html b/api/symbols/KJUR.asn1.DERNull.html index 2c4b5b53..ee604bcd 100755 --- a/api/symbols/KJUR.asn1.DERNull.html +++ b/api/symbols/KJUR.asn1.DERNull.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.DERNumericString.html b/api/symbols/KJUR.asn1.DERNumericString.html index 3d058496..f48dba8f 100755 --- a/api/symbols/KJUR.asn1.DERNumericString.html +++ b/api/symbols/KJUR.asn1.DERNumericString.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.DERObjectIdentifier.html b/api/symbols/KJUR.asn1.DERObjectIdentifier.html index 7a1009be..b358d266 100755 --- a/api/symbols/KJUR.asn1.DERObjectIdentifier.html +++ b/api/symbols/KJUR.asn1.DERObjectIdentifier.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.DEROctetString.html b/api/symbols/KJUR.asn1.DEROctetString.html index 9f5dc4a2..710a3b36 100755 --- a/api/symbols/KJUR.asn1.DEROctetString.html +++ b/api/symbols/KJUR.asn1.DEROctetString.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.DERPrintableString.html b/api/symbols/KJUR.asn1.DERPrintableString.html index 2fedbce7..04f71cb5 100755 --- a/api/symbols/KJUR.asn1.DERPrintableString.html +++ b/api/symbols/KJUR.asn1.DERPrintableString.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.DERSequence.html b/api/symbols/KJUR.asn1.DERSequence.html index 92142eaf..c1434266 100755 --- a/api/symbols/KJUR.asn1.DERSequence.html +++ b/api/symbols/KJUR.asn1.DERSequence.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.DERSet.html b/api/symbols/KJUR.asn1.DERSet.html index f43bbc25..6f0be92d 100755 --- a/api/symbols/KJUR.asn1.DERSet.html +++ b/api/symbols/KJUR.asn1.DERSet.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.DERTaggedObject.html b/api/symbols/KJUR.asn1.DERTaggedObject.html index 1609f4a0..fc9fda27 100755 --- a/api/symbols/KJUR.asn1.DERTaggedObject.html +++ b/api/symbols/KJUR.asn1.DERTaggedObject.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.DERTeletexString.html b/api/symbols/KJUR.asn1.DERTeletexString.html index 0e710f15..1cb0abae 100755 --- a/api/symbols/KJUR.asn1.DERTeletexString.html +++ b/api/symbols/KJUR.asn1.DERTeletexString.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.DERUTCTime.html b/api/symbols/KJUR.asn1.DERUTCTime.html index bd12f2a6..4c41e7b5 100755 --- a/api/symbols/KJUR.asn1.DERUTCTime.html +++ b/api/symbols/KJUR.asn1.DERUTCTime.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.DERUTF8String.html b/api/symbols/KJUR.asn1.DERUTF8String.html index e2a8c02d..fc774ce3 100755 --- a/api/symbols/KJUR.asn1.DERUTF8String.html +++ b/api/symbols/KJUR.asn1.DERUTF8String.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.cades.CAdESUtil.html b/api/symbols/KJUR.asn1.cades.CAdESUtil.html new file mode 100755 index 00000000..1a62b8bd --- /dev/null +++ b/api/symbols/KJUR.asn1.cades.CAdESUtil.html @@ -0,0 +1,675 @@ + + + + + + + jsrsasign 4.0.0 JavaScript API Reference - KJUR.asn1.cades.CAdESUtil + + + + + + + + + + + + +
    + +
    Class Index +| File Index
    +
    +

    Classes

    + +
    + +
    + +
    + +

    + + Class KJUR.asn1.cades.CAdESUtil +

    + + +

    + + + + CAdES utilities class + + +
    Defined in: asn1cades-1.0.js. + +

    + + + + + + + + + + + + + + + + + +
    Class Summary
    Constructor AttributesConstructor Name and Description
      + +
    CAdES utiliteis class
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Method Summary
    Method AttributesMethod Name and Description
    <static>   +
    KJUR.asn1.cades.CAdESUtil.parseSignedDataForAddingUnsigned(hex) +
    +
    parse CMS SignedData to add unsigned attributes +This method will parse a hexadecimal string of +ContentInfo with CMS SignedData to add a attribute +to unsigned attributes field in a signerInfo field.
    +
    <static>   +
    KJUR.asn1.cades.CAdESUtil.parseSignerInfoForAddingUnsigned(hex) +
    +
    parse SignerInfo to add unsigned attributes +This method will parse a hexadecimal string of +SignerInfo to add a attribute +to unsigned attributes field in a signerInfo field.
    +
    + + + + + + + + + +
    +
    + Class Detail +
    + +
    + KJUR.asn1.cades.CAdESUtil() +
    + +
    + CAdES utiliteis class + +
    + + + + + + + +
    +
    Since:
    +
    jsrsasign 4.7.0 asn1cades 1.0.0
    +
    + + + + + + +
    + + + + + + + +
    + Method Detail +
    + + +
    <static> + + {Object} + KJUR.asn1.cades.CAdESUtil.parseSignedDataForAddingUnsigned(hex) + +
    +
    + parse CMS SignedData to add unsigned attributes +This method will parse a hexadecimal string of +ContentInfo with CMS SignedData to add a attribute +to unsigned attributes field in a signerInfo field. +Parsed result will be an associative array which has +following properties: +
      +
    • version - hex of CMSVersion ASN.1 TLV
    • +
    • algs - hex of DigestAlgorithms ASN.1 TLV
    • +
    • encapcontent - hex of EncapContentInfo ASN.1 TLV
    • +
    • certs - hex of Certificates ASN.1 TLV
    • +
    • revs - hex of RevocationInfoChoices ASN.1 TLV
    • +
    • si[] - array of SignerInfo properties
    • +
    • obj - parsed KJUR.asn1.cms.SignedData object
    • +
    + + +
    + + + +
    info = KJUR.asn1.cades.CAdESUtil.parseSignedDataForAddingUnsigned(beshex);
    +sd = info.obj;
    + + + + +
    +
    Parameters:
    + +
    + {String} hex + +
    +
    hexadecimal string of ContentInfo of CMS SignedData
    + +
    + + + + + +
    +
    Returns:
    + +
    {Object} associative array of parsed data
    + +
    + + + + +
    + + +
    <static> + + {Object} + KJUR.asn1.cades.CAdESUtil.parseSignerInfoForAddingUnsigned(hex) + +
    +
    + parse SignerInfo to add unsigned attributes +This method will parse a hexadecimal string of +SignerInfo to add a attribute +to unsigned attributes field in a signerInfo field. +Parsed result will be an associative array which has +following properties: +
      +
    • version - hex TLV of version
    • +
    • si - hex TLV of SignerIdentifier
    • +
    • digalg - hex TLV of DigestAlgorithm
    • +
    • sattrs - hex TLV of SignedAttributes
    • +
    • sigalg - hex TLV of SignatureAlgorithm
    • +
    • sig - hex TLV of signature
    • +
    • sigval = hex V of signature
    • +
    • obj - parsed KJUR.asn1.cms.SignerInfo object
    • +
    +NOTE: Parsing of unsigned attributes will be provided in the +future version. That's way this version provides support +for CAdES-T and not for CAdES-C. + + +
    + + + + +
    +
    Parameters:
    + +
    + {String} hex + +
    +
    hexadecimal string of SignerInfo
    + +
    + + + + + +
    +
    Returns:
    + +
    {Object} associative array of parsed data
    + +
    + + + + + + + + + + + +
    +
    + + + +
    + © 2012 Kenji Urushima, All rights reserved
    + + Documentation generated by JsDoc Toolkit 2.4.0 +
    + + diff --git a/api/symbols/KJUR.asn1.cades.CompleteCertificateRefs.html b/api/symbols/KJUR.asn1.cades.CompleteCertificateRefs.html new file mode 100755 index 00000000..2c5a0475 --- /dev/null +++ b/api/symbols/KJUR.asn1.cades.CompleteCertificateRefs.html @@ -0,0 +1,622 @@ + + + + + + + jsrsasign 4.0.0 JavaScript API Reference - KJUR.asn1.cades.CompleteCertificateRefs + + + + + + + + + + + + +
    + +
    Class Index +| File Index
    +
    +

    Classes

    + +
    + +
    + +
    + +

    + + Class KJUR.asn1.cades.CompleteCertificateRefs +

    + + +

    + +
    Extends + KJUR.asn1.cms.Attribute.
    + + + class for RFC 5126 CAdES CompleteCertificateRefs attribute + + +
    Defined in: asn1cades-1.0.js. + +

    + + + + + + + + + + + + + + + + + +
    Class Summary
    Constructor AttributesConstructor Name and Description
      + +
    class for RFC 5126 CAdES CompleteCertificateRefs attribute +
    +id-aa-ets-certificateRefs OBJECT IDENTIFIER = 
    +   1.2.840.113549.1.9.16.2.21
    +CompleteCertificateRefs ::=  SEQUENCE OF OtherCertID
    +
    +
    + + + + + + + + +
    +
    Fields borrowed from class KJUR.asn1.ASN1Object:
    hL, hT, hTLV, hV, isModified
    +
    + + + + + + + + + + + + + + + + + + + + + + + +
    Method Summary
    Method AttributesMethod Name and Description
    <static>   +
    KJUR.asn1.cades.CompleteCertificateRefs.setByArray(a) +
    +
    set value by array +
    +
    + + + +
    + +
    + + + + + + + +
    +
    + Class Detail +
    + +
    + KJUR.asn1.cades.CompleteCertificateRefs(params) +
    + +
    + class for RFC 5126 CAdES CompleteCertificateRefs attribute +
    +id-aa-ets-certificateRefs OBJECT IDENTIFIER = 
    +   1.2.840.113549.1.9.16.2.21
    +CompleteCertificateRefs ::=  SEQUENCE OF OtherCertID
    +
    + +
    + + + +
    o = new KJUR.asn1.cades.CompleteCertificateRefs([certPEM1,certPEM2]);
    + + + + + +
    +
    Parameters:
    + +
    + {Array} params + +
    +
    associative array of parameters
    + +
    + + + +
    +
    Since:
    +
    jsrsasign 4.7.0 asn1cades 1.0.0
    +
    + + + + + + +
    + + + + + + + +
    + Method Detail +
    + + +
    <static> + + + KJUR.asn1.cades.CompleteCertificateRefs.setByArray(a) + +
    +
    + set value by array + + + +
    + + + + +
    +
    Parameters:
    + +
    + {Array} a + +
    +
    array of KJUR.asn1.cades.OtherCertID argument
    + +
    + + + + + +
    +
    Returns:
    + +
    unspecified
    + +
    + + + + + + + + + + + +
    +
    + + + +
    + © 2012 Kenji Urushima, All rights reserved
    + + Documentation generated by JsDoc Toolkit 2.4.0 +
    + + diff --git a/api/symbols/KJUR.asn1.cades.OtherCertID.html b/api/symbols/KJUR.asn1.cades.OtherCertID.html new file mode 100755 index 00000000..1fc7a45d --- /dev/null +++ b/api/symbols/KJUR.asn1.cades.OtherCertID.html @@ -0,0 +1,625 @@ + + + + + + + jsrsasign 4.0.0 JavaScript API Reference - KJUR.asn1.cades.OtherCertID + + + + + + + + + + + + +
    + +
    Class Index +| File Index
    +
    +

    Classes

    + +
    + +
    + +
    + +

    + + Class KJUR.asn1.cades.OtherCertID +

    + + +

    + +
    Extends + KJUR.asn1.ASN1Object.
    + + + class for OtherCertID ASN.1 object + + +
    Defined in: asn1cades-1.0.js. + +

    + + + + + + + + + + + + + + + + + +
    Class Summary
    Constructor AttributesConstructor Name and Description
      + +
    class for OtherCertID ASN.1 object +
    +OtherCertID ::= SEQUENCE {
    +   otherCertHash    OtherHash,
    +   issuerSerial     IssuerSerial OPTIONAL }
    +
    +
    + + + + + + + + +
    +
    Fields borrowed from class KJUR.asn1.ASN1Object:
    hL, hT, hTLV, hV, isModified
    +
    + + + + + + + + + + + + + + + + + + + + + + + +
    Method Summary
    Method AttributesMethod Name and Description
    <static>   +
    KJUR.asn1.cades.OtherCertID.setByCertPEM(certPEM) +
    +
    set value by PEM string of certificate +This method will set value by a PEM string of a certificate.
    +
    + + + +
    + +
    + + + + + + + +
    +
    + Class Detail +
    + +
    + KJUR.asn1.cades.OtherCertID(params) +
    + +
    + class for OtherCertID ASN.1 object +
    +OtherCertID ::= SEQUENCE {
    +   otherCertHash    OtherHash,
    +   issuerSerial     IssuerSerial OPTIONAL }
    +
    + +
    + + + +
    o = new KJUR.asn1.cades.OtherCertID(certPEM);
    +o = new KJUR.asn1.cades.OtherCertID({cert:certPEM, hasis: false});
    + + + + + +
    +
    Parameters:
    + +
    + {Array} params + +
    +
    associative array of parameters
    + +
    + + + +
    +
    Since:
    +
    jsrsasign 4.7.0 asn1cades 1.0.0
    +
    + + + + + + +
    + + + + + + + +
    + Method Detail +
    + + +
    <static> + + + KJUR.asn1.cades.OtherCertID.setByCertPEM(certPEM) + +
    +
    + set value by PEM string of certificate +This method will set value by a PEM string of a certificate. +This will add IssuerAndSerialNumber by default +which depends on hasIssuerSerial flag. + + +
    + + + + +
    +
    Parameters:
    + +
    + {String} certPEM + +
    +
    PEM string of certificate
    + +
    + + + + + +
    +
    Returns:
    + +
    unspecified
    + +
    + + + + + + + + + + + +
    +
    + + + +
    + © 2012 Kenji Urushima, All rights reserved
    + + Documentation generated by JsDoc Toolkit 2.4.0 +
    + + diff --git a/api/symbols/KJUR.asn1.cades.OtherHash.html b/api/symbols/KJUR.asn1.cades.OtherHash.html new file mode 100755 index 00000000..c3974477 --- /dev/null +++ b/api/symbols/KJUR.asn1.cades.OtherHash.html @@ -0,0 +1,630 @@ + + + + + + + jsrsasign 4.0.0 JavaScript API Reference - KJUR.asn1.cades.OtherHash + + + + + + + + + + + + +
    + +
    Class Index +| File Index
    +
    +

    Classes

    + +
    + +
    + +
    + +

    + + Class KJUR.asn1.cades.OtherHash +

    + + +

    + +
    Extends + KJUR.asn1.ASN1Object.
    + + + class for OtherHash ASN.1 object + + +
    Defined in: asn1cades-1.0.js. + +

    + + + + + + + + + + + + + + + + + +
    Class Summary
    Constructor AttributesConstructor Name and Description
      + +
    class for OtherHash ASN.1 object +
    +OtherHash ::= CHOICE {
    +   sha1Hash   OtherHashValue,  -- This contains a SHA-1 hash
    +   otherHash  OtherHashAlgAndValue}
    +OtherHashValue ::= OCTET STRING
    +
    +
    + + + + + + + + +
    +
    Fields borrowed from class KJUR.asn1.ASN1Object:
    hL, hT, hTLV, hV, isModified
    +
    + + + + + + + + + + + + + + + + + + + + + + + +
    Method Summary
    Method AttributesMethod Name and Description
    <static>   +
    KJUR.asn1.cades.OtherHash.setByCertPEM(certPEM) +
    +
    set value by PEM string of certificate +This method will set value by a PEM string of a certificate.
    +
    + + + +
    + +
    + + + + + + + +
    +
    + Class Detail +
    + +
    + KJUR.asn1.cades.OtherHash(params) +
    + +
    + class for OtherHash ASN.1 object +
    +OtherHash ::= CHOICE {
    +   sha1Hash   OtherHashValue,  -- This contains a SHA-1 hash
    +   otherHash  OtherHashAlgAndValue}
    +OtherHashValue ::= OCTET STRING
    +
    + +
    + + + +
    o = new KJUR.asn1.cades.OtherHash("1234");
    +o = new KJUR.asn1.cades.OtherHash(certPEMStr); // default alg=sha256
    +o = new KJUR.asn1.cades.OtherHash({alg: 'sha256', hash: '1234'});
    +o = new KJUR.asn1.cades.OtherHash({alg: 'sha256', cert: certPEM});
    +o = new KJUR.asn1.cades.OtherHash({cert: certPEM});
    + + + + + +
    +
    Parameters:
    + +
    + {Array} params + +
    +
    associative array of parameters
    + +
    + + + +
    +
    Since:
    +
    jsrsasign 4.7.0 asn1cades 1.0.0
    +
    + + + + + + +
    + + + + + + + +
    + Method Detail +
    + + +
    <static> + + + KJUR.asn1.cades.OtherHash.setByCertPEM(certPEM) + +
    +
    + set value by PEM string of certificate +This method will set value by a PEM string of a certificate. +An algorithm used to hash certificate data will +be defined by 'alg' property and 'sha256' is default. + + +
    + + + + +
    +
    Parameters:
    + +
    + {String} certPEM + +
    +
    PEM string of certificate
    + +
    + + + + + +
    +
    Returns:
    + +
    unspecified
    + +
    + + + + + + + + + + + +
    +
    + + + +
    + © 2012 Kenji Urushima, All rights reserved
    + + Documentation generated by JsDoc Toolkit 2.4.0 +
    + + diff --git a/api/symbols/KJUR.asn1.cades.OtherHashAlgAndValue.html b/api/symbols/KJUR.asn1.cades.OtherHashAlgAndValue.html new file mode 100755 index 00000000..25e99854 --- /dev/null +++ b/api/symbols/KJUR.asn1.cades.OtherHashAlgAndValue.html @@ -0,0 +1,539 @@ + + + + + + + jsrsasign 4.0.0 JavaScript API Reference - KJUR.asn1.cades.OtherHashAlgAndValue + + + + + + + + + + + + +
    + +
    Class Index +| File Index
    +
    +

    Classes

    + +
    + +
    + +
    + +

    + + Class KJUR.asn1.cades.OtherHashAlgAndValue +

    + + +

    + +
    Extends + KJUR.asn1.ASN1Object.
    + + + class for OtherHashAlgAndValue ASN.1 object + + +
    Defined in: asn1cades-1.0.js. + +

    + + + + + + + + + + + + + + + + + +
    Class Summary
    Constructor AttributesConstructor Name and Description
      + +
    class for OtherHashAlgAndValue ASN.1 object +
    +OtherHashAlgAndValue ::= SEQUENCE {
    +   hashAlgorithm   AlgorithmIdentifier,
    +   hashValue       OtherHashValue }
    +OtherHashValue ::= OCTET STRING
    +
    +
    + + + + + + + + +
    +
    Fields borrowed from class KJUR.asn1.ASN1Object:
    hL, hT, hTLV, hV, isModified
    +
    + + + + + + + + + + +
    +
    + Class Detail +
    + +
    + KJUR.asn1.cades.OtherHashAlgAndValue(params) +
    + +
    + class for OtherHashAlgAndValue ASN.1 object +
    +OtherHashAlgAndValue ::= SEQUENCE {
    +   hashAlgorithm   AlgorithmIdentifier,
    +   hashValue       OtherHashValue }
    +OtherHashValue ::= OCTET STRING
    +
    + +
    + + + + + +
    +
    Parameters:
    + +
    + {Array} params + +
    +
    associative array of parameters
    + +
    + + + +
    +
    Since:
    +
    jsrsasign 4.7.0 asn1cades 1.0.0
    +
    + + + + + + +
    + + + + + + + + + + + +
    +
    + + + +
    + © 2012 Kenji Urushima, All rights reserved
    + + Documentation generated by JsDoc Toolkit 2.4.0 +
    + + diff --git a/api/symbols/KJUR.asn1.cades.SignaturePolicyIdentifier.html b/api/symbols/KJUR.asn1.cades.SignaturePolicyIdentifier.html new file mode 100755 index 00000000..7b664b63 --- /dev/null +++ b/api/symbols/KJUR.asn1.cades.SignaturePolicyIdentifier.html @@ -0,0 +1,558 @@ + + + + + + + jsrsasign 4.0.0 JavaScript API Reference - KJUR.asn1.cades.SignaturePolicyIdentifier + + + + + + + + + + + + +
    + +
    Class Index +| File Index
    +
    +

    Classes

    + +
    + +
    + +
    + +

    + + Class KJUR.asn1.cades.SignaturePolicyIdentifier +

    + + +

    + +
    Extends + KJUR.asn1.cms.Attribute.
    + + + class for RFC 5126 CAdES SignaturePolicyIdentifier attribute + + +
    Defined in: asn1cades-1.0.js. + +

    + + + + + + + + + + + + + + + + + +
    Class Summary
    Constructor AttributesConstructor Name and Description
      + +
    class for RFC 5126 CAdES SignaturePolicyIdentifier attribute +
    +SignaturePolicyIdentifier ::= CHOICE {
    +   signaturePolicyId       SignaturePolicyId,
    +   signaturePolicyImplied  SignaturePolicyImplied } -- not used
    +
    +SignaturePolicyImplied ::= NULL
    +SignaturePolicyId ::= SEQUENCE {
    +   sigPolicyId           SigPolicyId,
    +   sigPolicyHash         SigPolicyHash,
    +   sigPolicyQualifiers   SEQUENCE SIZE (1.
    +
    + + + + + + + + +
    +
    Fields borrowed from class KJUR.asn1.ASN1Object:
    hL, hT, hTLV, hV, isModified
    +
    + + + + + + + + + + +
    +
    + Class Detail +
    + +
    + KJUR.asn1.cades.SignaturePolicyIdentifier(params) +
    + +
    + class for RFC 5126 CAdES SignaturePolicyIdentifier attribute +
    +SignaturePolicyIdentifier ::= CHOICE {
    +   signaturePolicyId       SignaturePolicyId,
    +   signaturePolicyImplied  SignaturePolicyImplied } -- not used
    +
    +SignaturePolicyImplied ::= NULL
    +SignaturePolicyId ::= SEQUENCE {
    +   sigPolicyId           SigPolicyId,
    +   sigPolicyHash         SigPolicyHash,
    +   sigPolicyQualifiers   SEQUENCE SIZE (1..MAX) OF
    +                            SigPolicyQualifierInfo OPTIONAL }
    +SigPolicyId ::= OBJECT IDENTIFIER
    +SigPolicyHash ::= OtherHashAlgAndValue
    +
    + +
    + + + +
    var o = new KJUR.asn1.cades.SignaturePolicyIdentifier({
    +  oid: '1.2.3.4.5',
    +  hash: {alg: 'sha1', hash: 'a1a2a3a4...'}
    +});
    + + + + + +
    +
    Parameters:
    + +
    + {Array} params + +
    +
    associative array of parameters
    + +
    + + + +
    +
    Since:
    +
    jsrsasign 4.7.0 asn1cades 1.0.0
    +
    + + + + + + +
    + + + + + + + + + + + +
    +
    + + + +
    + © 2012 Kenji Urushima, All rights reserved
    + + Documentation generated by JsDoc Toolkit 2.4.0 +
    + + diff --git a/api/symbols/KJUR.asn1.cades.SignatureTimeStamp.html b/api/symbols/KJUR.asn1.cades.SignatureTimeStamp.html new file mode 100755 index 00000000..9314f83e --- /dev/null +++ b/api/symbols/KJUR.asn1.cades.SignatureTimeStamp.html @@ -0,0 +1,537 @@ + + + + + + + jsrsasign 4.0.0 JavaScript API Reference - KJUR.asn1.cades.SignatureTimeStamp + + + + + + + + + + + + +
    + +
    Class Index +| File Index
    +
    +

    Classes

    + +
    + +
    + +
    + +

    + + Class KJUR.asn1.cades.SignatureTimeStamp +

    + + +

    + +
    Extends + KJUR.asn1.cms.Attribute.
    + + + class for RFC 5126 CAdES SignatureTimeStamp attribute + + +
    Defined in: asn1cades-1.0.js. + +

    + + + + + + + + + + + + + + + + + +
    Class Summary
    Constructor AttributesConstructor Name and Description
      + +
    class for RFC 5126 CAdES SignatureTimeStamp attribute +
    +id-aa-signatureTimeStampToken OBJECT IDENTIFIER ::=
    +   1.2.840.113549.1.9.16.2.14
    +SignatureTimeStampToken ::= TimeStampToken
    +
    +
    + + + + + + + + +
    +
    Fields borrowed from class KJUR.asn1.ASN1Object:
    hL, hT, hTLV, hV, isModified
    +
    + + + + + + + + + + +
    +
    + Class Detail +
    + +
    + KJUR.asn1.cades.SignatureTimeStamp(params) +
    + +
    + class for RFC 5126 CAdES SignatureTimeStamp attribute +
    +id-aa-signatureTimeStampToken OBJECT IDENTIFIER ::=
    +   1.2.840.113549.1.9.16.2.14
    +SignatureTimeStampToken ::= TimeStampToken
    +
    + +
    + + + + + +
    +
    Parameters:
    + +
    + {Array} params + +
    +
    associative array of parameters
    + +
    + + + +
    +
    Since:
    +
    jsrsasign 4.7.0 asn1cades 1.0.0
    +
    + + + + + + +
    + + + + + + + + + + + +
    +
    + + + +
    + © 2012 Kenji Urushima, All rights reserved
    + + Documentation generated by JsDoc Toolkit 2.4.0 +
    + + diff --git a/api/symbols/KJUR.asn1.cades.html b/api/symbols/KJUR.asn1.cades.html new file mode 100755 index 00000000..fcce371a --- /dev/null +++ b/api/symbols/KJUR.asn1.cades.html @@ -0,0 +1,742 @@ + + + + + + + jsrsasign 4.0.0 JavaScript API Reference - KJUR.asn1.cades + + + + + + + + + + + + +
    + +
    Class Index +| File Index
    +
    +

    Classes

    + +
    + +
    + +
    + +

    + + Namespace KJUR.asn1.cades +

    + + +

    + + + + + + +
    Defined in: asn1cades-1.0.js. + +

    + + + + + + + + + + + + + + + + + +
    Namespace Summary
    Constructor AttributesConstructor Name and Description
      + +
    kjur's ASN.1 class for RFC 5126 CAdES long term signature +

    +This name space provides +RFC 5126 +CAdES(CMS Advanced Electronic Signature) generator.

    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Method Summary
    Method AttributesMethod Name and Description
    <static>   +
    KJUR.asn1.cades.getEncodedHex() +
    +
    +
    <static>   +
    KJUR.asn1.cades.setByCertPEM(certPEM) +
    +
    +
    + + + + + + + + + +
    +
    + Namespace Detail +
    + +
    + KJUR.asn1.cades +
    + +
    + kjur's ASN.1 class for RFC 5126 CAdES long term signature +

    +This name space provides +RFC 5126 +CAdES(CMS Advanced Electronic Signature) generator. + +

    SUPPORTED FORMATS

    +Following CAdES formats is supported by this library. +
      +
    • CAdES-BES - CAdES Basic Electronic Signature
    • +
    • CAdES-EPES - CAdES Explicit Policy-based Electronic Signature
    • +
    • CAdES-T - Electronic Signature with Time
    • +
    +

    + +

    PROVIDED ATTRIBUTE CLASSES

    + +NOTE: Currntly CAdES-C is not supported since parser can't +handle unsigned attribute. + +

    OTHER CLASSES

    + + +

    GENERATE CAdES-BES

    +To generate CAdES-BES, KJUR.asn.cades namespace +classes are not required and already KJUR.asn.cms namespace +provides attributes for CAdES-BES. +Create KJUR.asn1.cms.SignedData with following +mandatory attribute in CAdES-BES: + +CMSUtil.newSignedData method is very useful to generate CAdES-BES. +
    +sd = KJUR.asn1.cms.CMSUtil.newSignedData({
    +  content: {str: "aaa"},
    +  certs: [certPEM],
    +  signerInfos: [{
    +    hashAlg: 'sha256',
    +    sAttr: {SigningCertificateV2: {array: [certPEM]}},
    +    signerCert: certPEM,
    +    sigAlg: 'SHA256withRSA',
    +    signerPrvKey: pkcs8PrvKeyPEM
    +  }]
    +});
    +signedDataHex = sd.getContentInfoEncodedHex();
    +
    +NOTE: ContentType and MessageDigest signed attributes +are automatically added by default. + +

    GENERATE CAdES-BES with multiple signers

    +If you need signature by multiple signers, you can +specify one or more items in 'signerInfos' property as below. +
    +sd = KJUR.asn1.cms.CMSUtil.newSignedData({
    +  content: {str: "aaa"},
    +  certs: [certPEM1, certPEM2],
    +  signerInfos: [{
    +    hashAlg: 'sha256',
    +    sAttr: {SigningCertificateV2: {array: [certPEM1]}},
    +    signerCert: certPEM1,
    +    sigAlg: 'SHA256withRSA',
    +    signerPrvKey: pkcs8PrvKeyPEM1
    +  },{
    +    hashAlg: 'sha1',
    +    sAttr: {SigningCertificateV2: {array: [certPEM2]}},
    +    signerCert: certPEM2,
    +    sigAlg: 'SHA1withRSA',
    +    signerPrvKey: pkcs8PrvKeyPEM2
    +  }]
    +});
    +signedDataHex = sd.getContentInfoEncodedHex();
    +
    + +

    GENERATE CAdES-EPES

    +When you need a CAdES-EPES signature, +you just need to add 'SignaturePolicyIdentifier' +attribute as below. +
    +sd = KJUR.asn1.cms.CMSUtil.newSignedData({
    +  content: {str: "aaa"},
    +  certs: [certPEM],
    +  signerInfos: [{
    +    hashAlg: 'sha256',
    +    sAttr: {
    +      SigningCertificateV2: {array: [certPEM]},
    +      SignaturePolicyIdentifier: {
    +        oid: '1.2.3.4.5',
    +        hash: {alg: 'sha1', hash: 'b1b2b3b4b...'}
    +      },
    +    },
    +    signerCert: certPEM,
    +    sigAlg: 'SHA256withRSA',
    +    signerPrvKey: pkcs8PrvKeyPEM
    +  }]
    +});
    +signedDataHex = sd.getContentInfoEncodedHex();
    +
    + +

    GENERATE CAdES-T

    +After a signed CAdES-BES or CAdES-EPES signature have been generated, +you can generate CAdES-T by adding SigningTimeStamp unsigned attribute. +
    +beshex = "30..."; // hex of CAdES-BES or EPES data 
    +info = KJUR.asn1.cades.CAdESUtil.parseSignedDataForAddingUnsigned(beshex);
    +// You can refer a hexadecimal string of signature value 
    +// in the first signerInfo in the CAdES-BES/EPES with a variable:
    +// 'info.si[0].sigval'. You need to get RFC 3161 TimeStampToken
    +// from a trusted time stamp authority. Otherwise you can also 
    +// get it by 'KJUR.asn1.tsp' module. We suppose that we could 
    +// get proper time stamp.
    +tsthex0 = "30..."; // hex of TimeStampToken for signerInfo[0] sigval
    +si0 = info.obj.signerInfoList[0];
    +si0.addUnsigned(new KJUR.asn1.cades.SignatureTimeStamp({tst: tsthex0});
    +esthex = info.obj.getContentInfoEncodedHex(); // CAdES-T
    +
    +

    + +

    SAMPLE CODES

    + + +
    + + + + + + + + + + + + +
    + + + + + + + +
    + Method Detail +
    + + +
    <static> + + + KJUR.asn1.cades.getEncodedHex() + +
    +
    + + + +
    + + + + + + + + + + + +
    + + +
    <static> + + + KJUR.asn1.cades.setByCertPEM(certPEM) + +
    +
    + + + +
    + + + + +
    +
    Parameters:
    + +
    + certPEM + +
    +
    + +
    + + + + + + + + + + + + + + + +
    +
    + + + +
    + © 2012 Kenji Urushima, All rights reserved
    + + Documentation generated by JsDoc Toolkit 2.4.0 +
    + + diff --git a/api/symbols/KJUR.asn1.cms.Attribute.html b/api/symbols/KJUR.asn1.cms.Attribute.html index c37ce955..18734b04 100755 --- a/api/symbols/KJUR.asn1.cms.Attribute.html +++ b/api/symbols/KJUR.asn1.cms.Attribute.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.cms.AttributeList.html b/api/symbols/KJUR.asn1.cms.AttributeList.html index 74898e3e..131e5389 100755 --- a/api/symbols/KJUR.asn1.cms.AttributeList.html +++ b/api/symbols/KJUR.asn1.cms.AttributeList.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.cms.CMSUtil.html b/api/symbols/KJUR.asn1.cms.CMSUtil.html index e110c2ec..c5116ce1 100755 --- a/api/symbols/KJUR.asn1.cms.CMSUtil.html +++ b/api/symbols/KJUR.asn1.cms.CMSUtil.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • @@ -515,6 +539,7 @@

    hashAlg: 'sha256', sAttr: { SigningTime: {} + SigningCertificateV2: {array: [certPEM]}, }, signerCert: certPEM, sigAlg: 'SHA256withRSA', diff --git a/api/symbols/KJUR.asn1.cms.ContentInfo.html b/api/symbols/KJUR.asn1.cms.ContentInfo.html index 631357e0..acdfbcdd 100755 --- a/api/symbols/KJUR.asn1.cms.ContentInfo.html +++ b/api/symbols/KJUR.asn1.cms.ContentInfo.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.cms.ContentType.html b/api/symbols/KJUR.asn1.cms.ContentType.html index fb385c3b..594d93ab 100755 --- a/api/symbols/KJUR.asn1.cms.ContentType.html +++ b/api/symbols/KJUR.asn1.cms.ContentType.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.cms.EncapsulatedContentInfo.html b/api/symbols/KJUR.asn1.cms.EncapsulatedContentInfo.html index c6d90c7f..afb4bfaf 100755 --- a/api/symbols/KJUR.asn1.cms.EncapsulatedContentInfo.html +++ b/api/symbols/KJUR.asn1.cms.EncapsulatedContentInfo.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.cms.IssuerAndSerialNumber.html b/api/symbols/KJUR.asn1.cms.IssuerAndSerialNumber.html index dfcb10eb..6b65e584 100755 --- a/api/symbols/KJUR.asn1.cms.IssuerAndSerialNumber.html +++ b/api/symbols/KJUR.asn1.cms.IssuerAndSerialNumber.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • @@ -468,7 +492,8 @@

    o = new KJUR.asn1.cms.IssuerAndSerialNumber( {issuer: {str: '/C=US/O=T1'}, serial {int: 3}}); // specify by PEM certificate -o = new KJUR.asn1.cms.IssuerAndSerialNumber({cert: certPEM}); +o = new KJUR.asn1.cms.IssuerAndSerialNumber({cert: certPEM}); +o = new KJUR.asn1.cms.IssuerAndSerialNumber(certPEM); // since 1.0.3 diff --git a/api/symbols/KJUR.asn1.cms.MessageDigest.html b/api/symbols/KJUR.asn1.cms.MessageDigest.html index b8e8ebac..ab2c0d49 100755 --- a/api/symbols/KJUR.asn1.cms.MessageDigest.html +++ b/api/symbols/KJUR.asn1.cms.MessageDigest.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.cms.SignedData.html b/api/symbols/KJUR.asn1.cms.SignedData.html index 1ad3facc..6bf8ebab 100755 --- a/api/symbols/KJUR.asn1.cms.SignedData.html +++ b/api/symbols/KJUR.asn1.cms.SignedData.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.cms.SignerInfo.html b/api/symbols/KJUR.asn1.cms.SignerInfo.html index b4a5531e..574d4fa6 100755 --- a/api/symbols/KJUR.asn1.cms.SignerInfo.html +++ b/api/symbols/KJUR.asn1.cms.SignerInfo.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.cms.SigningCertificate.html b/api/symbols/KJUR.asn1.cms.SigningCertificate.html index b3203d83..4c2ad9f8 100755 --- a/api/symbols/KJUR.asn1.cms.SigningCertificate.html +++ b/api/symbols/KJUR.asn1.cms.SigningCertificate.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.cms.SigningCertificateV2.html b/api/symbols/KJUR.asn1.cms.SigningCertificateV2.html index 27f482f8..4a689183 100755 --- a/api/symbols/KJUR.asn1.cms.SigningCertificateV2.html +++ b/api/symbols/KJUR.asn1.cms.SigningCertificateV2.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.cms.SigningTime.html b/api/symbols/KJUR.asn1.cms.SigningTime.html index 2dd04dc3..05e3fb1b 100755 --- a/api/symbols/KJUR.asn1.cms.SigningTime.html +++ b/api/symbols/KJUR.asn1.cms.SigningTime.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.cms.html b/api/symbols/KJUR.asn1.cms.html index e067dcd7..ee3d6874 100755 --- a/api/symbols/KJUR.asn1.cms.html +++ b/api/symbols/KJUR.asn1.cms.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • @@ -509,6 +533,8 @@

    PROVIDED CLASSES

  • KJUR.asn1.cms.ContentType
  • KJUR.asn1.cms.MessageDigest
  • KJUR.asn1.cms.SigningTime
  • +
  • KJUR.asn1.cms.SigningCertificate
  • +
  • KJUR.asn1.cms.SigningCertificateV2
  • NOTE: Please ignore method summary and document of this namespace. This caused by a bug of jsdoc2. diff --git a/api/symbols/KJUR.asn1.html b/api/symbols/KJUR.asn1.html index 9098ddaf..de4215f3 100755 --- a/api/symbols/KJUR.asn1.html +++ b/api/symbols/KJUR.asn1.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • @@ -460,6 +484,15 @@

    + + <static>   + +
    KJUR.asn1.setByBigInteger(bigIntegerValue) +
    +
    + + + <static>   @@ -469,6 +502,15 @@

    + + <static>   + +
    KJUR.asn1.setByInteger(intValue) +
    +
    + + + <static>   @@ -524,6 +566,7 @@

    PROVIDING ASN.1 PRIMITIVES

  • 0x04 KJUR.asn1.DEROctetString
  • 0x05 KJUR.asn1.DERNull
  • 0x06 KJUR.asn1.DERObjectIdentifier
  • +
  • 0x0a KJUR.asn1.DEREnumerated
  • 0x0c KJUR.asn1.DERUTF8String
  • 0x12 KJUR.asn1.DERNumericString
  • 0x13 KJUR.asn1.DERPrintableString
  • @@ -620,6 +663,42 @@

    OTHER ASN.1 CLASSES

    +
    + + +
    <static> + + + KJUR.asn1.setByBigInteger(bigIntegerValue) + +
    +
    + + + +
    + + + + +
    +
    Parameters:
    + +
    + bigIntegerValue + +
    +
    + +
    + + + + + + + +
    @@ -656,6 +735,42 @@

    OTHER ASN.1 CLASSES

    +
    + + +
    <static> + + + KJUR.asn1.setByInteger(intValue) + +
    +
    + + + +
    + + + + +
    +
    Parameters:
    + +
    + intValue + +
    +
    + +
    + + + + + + + +
    diff --git a/api/symbols/KJUR.asn1.tsp.AbstractTSAAdapter.html b/api/symbols/KJUR.asn1.tsp.AbstractTSAAdapter.html new file mode 100755 index 00000000..4d9f1898 --- /dev/null +++ b/api/symbols/KJUR.asn1.tsp.AbstractTSAAdapter.html @@ -0,0 +1,518 @@ + + + + + + + jsrsasign 4.0.0 JavaScript API Reference - KJUR.asn1.tsp.AbstractTSAAdapter + + + + + + + + + + + + +
    + +
    Class Index +| File Index
    +
    +

    Classes

    + +
    + +
    + +
    + +

    + + Class KJUR.asn1.tsp.AbstractTSAAdapter +

    + + +

    + + + + abstract class for TimeStampToken generator + + +
    Defined in: asn1tsp-1.0.js. + +

    + + + + + + + + + + + + + + + + + +
    Class Summary
    Constructor AttributesConstructor Name and Description
      + +
    abstract class for TimeStampToken generator +
    +
    + + + + + + + + + + + + +
    +
    + Class Detail +
    + +
    + KJUR.asn1.tsp.AbstractTSAAdapter(params) +
    + +
    + abstract class for TimeStampToken generator + + +
    + + + + + +
    +
    Parameters:
    + +
    + {Array} params + +
    +
    associative array of parameters
    + +
    + + + +
    +
    Since:
    +
    jsrsasign 4.7.0 asn1tsp 1.0.1
    +
    + + + + + + +
    + + + + + + + + + + + +
    +
    + + + +
    + © 2012 Kenji Urushima, All rights reserved
    + + Documentation generated by JsDoc Toolkit 2.4.0 +
    + + diff --git a/api/symbols/KJUR.asn1.tsp.Accuracy.html b/api/symbols/KJUR.asn1.tsp.Accuracy.html index f1f5efe9..ee01fb9b 100755 --- a/api/symbols/KJUR.asn1.tsp.Accuracy.html +++ b/api/symbols/KJUR.asn1.tsp.Accuracy.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.tsp.FixedTSAAdapter.html b/api/symbols/KJUR.asn1.tsp.FixedTSAAdapter.html new file mode 100755 index 00000000..78319057 --- /dev/null +++ b/api/symbols/KJUR.asn1.tsp.FixedTSAAdapter.html @@ -0,0 +1,528 @@ + + + + + + + jsrsasign 4.0.0 JavaScript API Reference - KJUR.asn1.tsp.FixedTSAAdapter + + + + + + + + + + + + +
    + +
    Class Index +| File Index
    +
    +

    Classes

    + +
    + +
    + +
    + +

    + + Class KJUR.asn1.tsp.FixedTSAAdapter +

    + + +

    + + + + class for fixed TimeStampToken generator + + +
    Defined in: asn1tsp-1.0.js. + +

    + + + + + + + + + + + + + + + + + +
    Class Summary
    Constructor AttributesConstructor Name and Description
      + +
    class for fixed TimeStampToken generator +This class generates fixed TimeStampToken except messageImprint +for testing purpose.
    +
    + + + + + + + + + + + + +
    +
    + Class Detail +
    + +
    + KJUR.asn1.tsp.FixedTSAAdapter(params) +
    + +
    + class for fixed TimeStampToken generator +This class generates fixed TimeStampToken except messageImprint +for testing purpose. +General TSA generates TimeStampToken which varies following +fields: +
      +
    • genTime
    • +
    • serialNumber
    • +
    • nonce
    • +
    +Those values are provided by initial parameters. + +
    + + + + + +
    +
    Parameters:
    + +
    + {Array} params + +
    +
    associative array of parameters
    + +
    + + + +
    +
    Since:
    +
    jsrsasign 4.7.0 asn1tsp 1.0.1
    +
    + + + + + + +
    + + + + + + + + + + + +
    +
    + + + +
    + © 2012 Kenji Urushima, All rights reserved
    + + Documentation generated by JsDoc Toolkit 2.4.0 +
    + + diff --git a/api/symbols/KJUR.asn1.tsp.MessageImprint.html b/api/symbols/KJUR.asn1.tsp.MessageImprint.html index 1c3fb173..7dbf6e62 100755 --- a/api/symbols/KJUR.asn1.tsp.MessageImprint.html +++ b/api/symbols/KJUR.asn1.tsp.MessageImprint.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.tsp.PKIFailureInfo.html b/api/symbols/KJUR.asn1.tsp.PKIFailureInfo.html index 0dd13162..d64bdb95 100755 --- a/api/symbols/KJUR.asn1.tsp.PKIFailureInfo.html +++ b/api/symbols/KJUR.asn1.tsp.PKIFailureInfo.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.tsp.PKIFreeText.html b/api/symbols/KJUR.asn1.tsp.PKIFreeText.html index 2b548b36..a659b192 100755 --- a/api/symbols/KJUR.asn1.tsp.PKIFreeText.html +++ b/api/symbols/KJUR.asn1.tsp.PKIFreeText.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.tsp.PKIStatus.html b/api/symbols/KJUR.asn1.tsp.PKIStatus.html index 2ab60079..37c8cd45 100755 --- a/api/symbols/KJUR.asn1.tsp.PKIStatus.html +++ b/api/symbols/KJUR.asn1.tsp.PKIStatus.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.tsp.PKIStatusInfo.html b/api/symbols/KJUR.asn1.tsp.PKIStatusInfo.html index f1fe4f94..6811fb33 100755 --- a/api/symbols/KJUR.asn1.tsp.PKIStatusInfo.html +++ b/api/symbols/KJUR.asn1.tsp.PKIStatusInfo.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.tsp.SimpleTSAAdapter.html b/api/symbols/KJUR.asn1.tsp.SimpleTSAAdapter.html new file mode 100755 index 00000000..98935162 --- /dev/null +++ b/api/symbols/KJUR.asn1.tsp.SimpleTSAAdapter.html @@ -0,0 +1,518 @@ + + + + + + + jsrsasign 4.0.0 JavaScript API Reference - KJUR.asn1.tsp.SimpleTSAAdapter + + + + + + + + + + + + +
    + +
    Class Index +| File Index
    +
    +

    Classes

    + +
    + +
    + +
    + +

    + + Class KJUR.asn1.tsp.SimpleTSAAdapter +

    + + +

    + + + + class for simple TimeStampToken generator + + +
    Defined in: asn1tsp-1.0.js. + +

    + + + + + + + + + + + + + + + + + +
    Class Summary
    Constructor AttributesConstructor Name and Description
      + +
    class for simple TimeStampToken generator +
    +
    + + + + + + + + + + + + +
    +
    + Class Detail +
    + +
    + KJUR.asn1.tsp.SimpleTSAAdapter(params) +
    + +
    + class for simple TimeStampToken generator + + +
    + + + + + +
    +
    Parameters:
    + +
    + {Array} params + +
    +
    associative array of parameters
    + +
    + + + +
    +
    Since:
    +
    jsrsasign 4.7.0 asn1tsp 1.0.1
    +
    + + + + + + +
    + + + + + + + + + + + +
    +
    + + + +
    + © 2012 Kenji Urushima, All rights reserved
    + + Documentation generated by JsDoc Toolkit 2.4.0 +
    + + diff --git a/api/symbols/KJUR.asn1.tsp.TSPUtil.html b/api/symbols/KJUR.asn1.tsp.TSPUtil.html index f86ac613..7287dc9c 100755 --- a/api/symbols/KJUR.asn1.tsp.TSPUtil.html +++ b/api/symbols/KJUR.asn1.tsp.TSPUtil.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.tsp.TSTInfo.html b/api/symbols/KJUR.asn1.tsp.TSTInfo.html index 7d4bf686..08c03fd1 100755 --- a/api/symbols/KJUR.asn1.tsp.TSTInfo.html +++ b/api/symbols/KJUR.asn1.tsp.TSTInfo.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.tsp.TimeStampReq.html b/api/symbols/KJUR.asn1.tsp.TimeStampReq.html index 99044264..df59b27d 100755 --- a/api/symbols/KJUR.asn1.tsp.TimeStampReq.html +++ b/api/symbols/KJUR.asn1.tsp.TimeStampReq.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.tsp.TimeStampResp.html b/api/symbols/KJUR.asn1.tsp.TimeStampResp.html index 333e8c4e..3eb3eefa 100755 --- a/api/symbols/KJUR.asn1.tsp.TimeStampResp.html +++ b/api/symbols/KJUR.asn1.tsp.TimeStampResp.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.tsp.html b/api/symbols/KJUR.asn1.tsp.html index 1f293aab..1743f7aa 100755 --- a/api/symbols/KJUR.asn1.tsp.html +++ b/api/symbols/KJUR.asn1.tsp.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • @@ -445,6 +469,15 @@

    + + <static>   + +
    KJUR.asn1.tsp.getTSTHex(msgHex, hashAlg) +
    +
    + + + @@ -532,6 +565,48 @@

    PROVIDED CLASSES

    +
    + + +
    <static> + + + KJUR.asn1.tsp.getTSTHex(msgHex, hashAlg) + +
    +
    + + + +
    + + + + +
    +
    Parameters:
    + +
    + msgHex + +
    +
    + +
    + hashAlg + +
    +
    + +
    + + + + + + + + diff --git a/api/symbols/KJUR.asn1.x509.AlgorithmIdentifier.html b/api/symbols/KJUR.asn1.x509.AlgorithmIdentifier.html index 5b8785c0..0765d101 100755 --- a/api/symbols/KJUR.asn1.x509.AlgorithmIdentifier.html +++ b/api/symbols/KJUR.asn1.x509.AlgorithmIdentifier.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.x509.AttributeTypeAndValue.html b/api/symbols/KJUR.asn1.x509.AttributeTypeAndValue.html index be6aa9bd..50e97a51 100755 --- a/api/symbols/KJUR.asn1.x509.AttributeTypeAndValue.html +++ b/api/symbols/KJUR.asn1.x509.AttributeTypeAndValue.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.x509.AuthorityKeyIdentifier.html b/api/symbols/KJUR.asn1.x509.AuthorityKeyIdentifier.html index c14ac5c6..aa889a8f 100755 --- a/api/symbols/KJUR.asn1.x509.AuthorityKeyIdentifier.html +++ b/api/symbols/KJUR.asn1.x509.AuthorityKeyIdentifier.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.x509.BasicConstraints.html b/api/symbols/KJUR.asn1.x509.BasicConstraints.html index c991350d..d33584ce 100755 --- a/api/symbols/KJUR.asn1.x509.BasicConstraints.html +++ b/api/symbols/KJUR.asn1.x509.BasicConstraints.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.x509.CRL.html b/api/symbols/KJUR.asn1.x509.CRL.html index 80b197f2..15e904ab 100755 --- a/api/symbols/KJUR.asn1.x509.CRL.html +++ b/api/symbols/KJUR.asn1.x509.CRL.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.x509.CRLDistributionPoints.html b/api/symbols/KJUR.asn1.x509.CRLDistributionPoints.html index a1a6ab5e..41aaabee 100755 --- a/api/symbols/KJUR.asn1.x509.CRLDistributionPoints.html +++ b/api/symbols/KJUR.asn1.x509.CRLDistributionPoints.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.x509.CRLEntry.html b/api/symbols/KJUR.asn1.x509.CRLEntry.html index fa7b3d00..ed9681aa 100755 --- a/api/symbols/KJUR.asn1.x509.CRLEntry.html +++ b/api/symbols/KJUR.asn1.x509.CRLEntry.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.x509.Certificate.html b/api/symbols/KJUR.asn1.x509.Certificate.html index 042ced97..df89b43c 100755 --- a/api/symbols/KJUR.asn1.x509.Certificate.html +++ b/api/symbols/KJUR.asn1.x509.Certificate.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.x509.DistributionPoint.html b/api/symbols/KJUR.asn1.x509.DistributionPoint.html index 8bf7e584..db404fee 100755 --- a/api/symbols/KJUR.asn1.x509.DistributionPoint.html +++ b/api/symbols/KJUR.asn1.x509.DistributionPoint.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.x509.DistributionPointName.html b/api/symbols/KJUR.asn1.x509.DistributionPointName.html index 52a52625..85850999 100755 --- a/api/symbols/KJUR.asn1.x509.DistributionPointName.html +++ b/api/symbols/KJUR.asn1.x509.DistributionPointName.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.x509.ExtKeyUsage.html b/api/symbols/KJUR.asn1.x509.ExtKeyUsage.html index fc0a958b..e5a28c1a 100755 --- a/api/symbols/KJUR.asn1.x509.ExtKeyUsage.html +++ b/api/symbols/KJUR.asn1.x509.ExtKeyUsage.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.x509.Extension.html b/api/symbols/KJUR.asn1.x509.Extension.html index d89d8660..090d0403 100755 --- a/api/symbols/KJUR.asn1.x509.Extension.html +++ b/api/symbols/KJUR.asn1.x509.Extension.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.x509.GeneralName.html b/api/symbols/KJUR.asn1.x509.GeneralName.html index ce2fc491..d48dec74 100755 --- a/api/symbols/KJUR.asn1.x509.GeneralName.html +++ b/api/symbols/KJUR.asn1.x509.GeneralName.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.x509.GeneralNames.html b/api/symbols/KJUR.asn1.x509.GeneralNames.html index 87c0ca12..9cf1a3b7 100755 --- a/api/symbols/KJUR.asn1.x509.GeneralNames.html +++ b/api/symbols/KJUR.asn1.x509.GeneralNames.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.x509.KeyUsage.html b/api/symbols/KJUR.asn1.x509.KeyUsage.html index 5e6f6389..3a8ad1f8 100755 --- a/api/symbols/KJUR.asn1.x509.KeyUsage.html +++ b/api/symbols/KJUR.asn1.x509.KeyUsage.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.x509.OID.html b/api/symbols/KJUR.asn1.x509.OID.html index bf63ac11..d64cccbc 100755 --- a/api/symbols/KJUR.asn1.x509.OID.html +++ b/api/symbols/KJUR.asn1.x509.OID.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.x509.RDN.html b/api/symbols/KJUR.asn1.x509.RDN.html index b1e8d124..c863aaba 100755 --- a/api/symbols/KJUR.asn1.x509.RDN.html +++ b/api/symbols/KJUR.asn1.x509.RDN.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.x509.SubjectPublicKeyInfo.html b/api/symbols/KJUR.asn1.x509.SubjectPublicKeyInfo.html index 335fda12..d70f438a 100755 --- a/api/symbols/KJUR.asn1.x509.SubjectPublicKeyInfo.html +++ b/api/symbols/KJUR.asn1.x509.SubjectPublicKeyInfo.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.x509.TBSCertList.html b/api/symbols/KJUR.asn1.x509.TBSCertList.html index 36554d73..ccdc3618 100755 --- a/api/symbols/KJUR.asn1.x509.TBSCertList.html +++ b/api/symbols/KJUR.asn1.x509.TBSCertList.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.x509.TBSCertificate.html b/api/symbols/KJUR.asn1.x509.TBSCertificate.html index 30347c8c..3bd498f0 100755 --- a/api/symbols/KJUR.asn1.x509.TBSCertificate.html +++ b/api/symbols/KJUR.asn1.x509.TBSCertificate.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.x509.Time.html b/api/symbols/KJUR.asn1.x509.Time.html index ec17f79e..4a9b858e 100755 --- a/api/symbols/KJUR.asn1.x509.Time.html +++ b/api/symbols/KJUR.asn1.x509.Time.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.x509.X500Name.html b/api/symbols/KJUR.asn1.x509.X500Name.html index 46920f1f..f7606c5f 100755 --- a/api/symbols/KJUR.asn1.x509.X500Name.html +++ b/api/symbols/KJUR.asn1.x509.X500Name.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.x509.X509Util.html b/api/symbols/KJUR.asn1.x509.X509Util.html index fe841fe2..6f942dca 100755 --- a/api/symbols/KJUR.asn1.x509.X509Util.html +++ b/api/symbols/KJUR.asn1.x509.X509Util.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.asn1.x509.html b/api/symbols/KJUR.asn1.x509.html index d50f533b..0a038e0f 100755 --- a/api/symbols/KJUR.asn1.x509.html +++ b/api/symbols/KJUR.asn1.x509.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.crypto.DSA.html b/api/symbols/KJUR.crypto.DSA.html index 4d3ec2b8..c5667e29 100755 --- a/api/symbols/KJUR.crypto.DSA.html +++ b/api/symbols/KJUR.crypto.DSA.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.crypto.ECDSA.html b/api/symbols/KJUR.crypto.ECDSA.html index 952a1d9c..55a009de 100755 --- a/api/symbols/KJUR.crypto.ECDSA.html +++ b/api/symbols/KJUR.crypto.ECDSA.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.crypto.ECParameterDB.html b/api/symbols/KJUR.crypto.ECParameterDB.html index 78934668..49fc9300 100755 --- a/api/symbols/KJUR.crypto.ECParameterDB.html +++ b/api/symbols/KJUR.crypto.ECParameterDB.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.crypto.Mac.html b/api/symbols/KJUR.crypto.Mac.html index 12580b7f..f905e133 100755 --- a/api/symbols/KJUR.crypto.Mac.html +++ b/api/symbols/KJUR.crypto.Mac.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.crypto.MessageDigest.html b/api/symbols/KJUR.crypto.MessageDigest.html index ccca65e3..f17bf09f 100755 --- a/api/symbols/KJUR.crypto.MessageDigest.html +++ b/api/symbols/KJUR.crypto.MessageDigest.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.crypto.OID.html b/api/symbols/KJUR.crypto.OID.html index 48c5bbee..58adb9ea 100755 --- a/api/symbols/KJUR.crypto.OID.html +++ b/api/symbols/KJUR.crypto.OID.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.crypto.Signature.html b/api/symbols/KJUR.crypto.Signature.html index 69a754ae..cdef3a12 100755 --- a/api/symbols/KJUR.crypto.Signature.html +++ b/api/symbols/KJUR.crypto.Signature.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.crypto.Util.html b/api/symbols/KJUR.crypto.Util.html index ef7caa70..b188f6d9 100755 --- a/api/symbols/KJUR.crypto.Util.html +++ b/api/symbols/KJUR.crypto.Util.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.crypto.html b/api/symbols/KJUR.crypto.html index 71cadec5..475b1269 100755 --- a/api/symbols/KJUR.crypto.html +++ b/api/symbols/KJUR.crypto.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/KJUR.html b/api/symbols/KJUR.html index 2fdb8245..14301430 100755 --- a/api/symbols/KJUR.html +++ b/api/symbols/KJUR.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/PKCS5PKEY.html b/api/symbols/PKCS5PKEY.html index f59a7b10..bda9bd91 100755 --- a/api/symbols/PKCS5PKEY.html +++ b/api/symbols/PKCS5PKEY.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/RSAKey.html b/api/symbols/RSAKey.html index 82a8452a..199b72bb 100755 --- a/api/symbols/RSAKey.html +++ b/api/symbols/RSAKey.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/X509.html b/api/symbols/X509.html index b063b97d..8f5b6593 100755 --- a/api/symbols/X509.html +++ b/api/symbols/X509.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/global__.html b/api/symbols/global__.html index 56e4876a..7503c04a 100755 --- a/api/symbols/global__.html +++ b/api/symbols/global__.html @@ -207,6 +207,22 @@

    Classes

  • KJUR.asn1.ASN1Util
  • +
  • KJUR.asn1.cades
  • + +
  • KJUR.asn1.cades.CAdESUtil
  • + +
  • KJUR.asn1.cades.CompleteCertificateRefs
  • + +
  • KJUR.asn1.cades.OtherCertID
  • + +
  • KJUR.asn1.cades.OtherHash
  • + +
  • KJUR.asn1.cades.OtherHashAlgAndValue
  • + +
  • KJUR.asn1.cades.SignaturePolicyIdentifier
  • + +
  • KJUR.asn1.cades.SignatureTimeStamp
  • +
  • KJUR.asn1.cms
  • KJUR.asn1.cms.Attribute
  • @@ -245,6 +261,8 @@

    Classes

  • KJUR.asn1.DERBoolean
  • +
  • KJUR.asn1.DEREnumerated
  • +
  • KJUR.asn1.DERGeneralizedTime
  • KJUR.asn1.DERIA5String
  • @@ -275,8 +293,12 @@

    Classes

  • KJUR.asn1.tsp
  • +
  • KJUR.asn1.tsp.AbstractTSAAdapter
  • +
  • KJUR.asn1.tsp.Accuracy
  • +
  • KJUR.asn1.tsp.FixedTSAAdapter
  • +
  • KJUR.asn1.tsp.MessageImprint
  • KJUR.asn1.tsp.PKIFailureInfo
  • @@ -287,6 +309,8 @@

    Classes

  • KJUR.asn1.tsp.PKIStatusInfo
  • +
  • KJUR.asn1.tsp.SimpleTSAAdapter
  • +
  • KJUR.asn1.tsp.TimeStampReq
  • KJUR.asn1.tsp.TimeStampResp
  • diff --git a/api/symbols/src/asn1-1.0.js.html b/api/symbols/src/asn1-1.0.js.html index 723f972a..d31041f0 100755 --- a/api/symbols/src/asn1-1.0.js.html +++ b/api/symbols/src/asn1-1.0.js.html @@ -62,1321 +62,1404 @@ 55 * <li>0x04 {@link KJUR.asn1.DEROctetString}</li> 56 * <li>0x05 {@link KJUR.asn1.DERNull}</li> 57 * <li>0x06 {@link KJUR.asn1.DERObjectIdentifier}</li> - 58 * <li>0x0c {@link KJUR.asn1.DERUTF8String}</li> - 59 * <li>0x12 {@link KJUR.asn1.DERNumericString}</li> - 60 * <li>0x13 {@link KJUR.asn1.DERPrintableString}</li> - 61 * <li>0x14 {@link KJUR.asn1.DERTeletexString}</li> - 62 * <li>0x16 {@link KJUR.asn1.DERIA5String}</li> - 63 * <li>0x17 {@link KJUR.asn1.DERUTCTime}</li> - 64 * <li>0x18 {@link KJUR.asn1.DERGeneralizedTime}</li> - 65 * <li>0x30 {@link KJUR.asn1.DERSequence}</li> - 66 * <li>0x31 {@link KJUR.asn1.DERSet}</li> - 67 * </ul> - 68 * - 69 * <h4>OTHER ASN.1 CLASSES</h4> - 70 * <ul> - 71 * <li>{@link KJUR.asn1.ASN1Object}</li> - 72 * <li>{@link KJUR.asn1.DERAbstractString}</li> - 73 * <li>{@link KJUR.asn1.DERAbstractTime}</li> - 74 * <li>{@link KJUR.asn1.DERAbstractStructured}</li> - 75 * <li>{@link KJUR.asn1.DERTaggedObject}</li> - 76 * </ul> - 77 * </p> - 78 * NOTE: Please ignore method summary and document of this namespace. - 79 * This caused by a bug of jsdoc2. - 80 * @name KJUR.asn1 - 81 * @namespace - 82 */ - 83 if (typeof KJUR.asn1 == "undefined" || !KJUR.asn1) KJUR.asn1 = {}; - 84 - 85 /** - 86 * ASN1 utilities class - 87 * @name KJUR.asn1.ASN1Util - 88 * @class ASN1 utilities class - 89 * @since asn1 1.0.2 - 90 */ - 91 KJUR.asn1.ASN1Util = new function() { - 92 this.integerToByteHex = function(i) { - 93 var h = i.toString(16); - 94 if ((h.length % 2) == 1) h = '0' + h; - 95 return h; - 96 }; - 97 this.bigIntToMinTwosComplementsHex = function(bigIntegerValue) { - 98 var h = bigIntegerValue.toString(16); - 99 if (h.substr(0, 1) != '-') { -100 if (h.length % 2 == 1) { -101 h = '0' + h; -102 } else { -103 if (! h.match(/^[0-7]/)) { -104 h = '00' + h; -105 } -106 } -107 } else { -108 var hPos = h.substr(1); -109 var xorLen = hPos.length; -110 if (xorLen % 2 == 1) { -111 xorLen += 1; -112 } else { -113 if (! h.match(/^[0-7]/)) { -114 xorLen += 2; -115 } -116 } -117 var hMask = ''; -118 for (var i = 0; i < xorLen; i++) { -119 hMask += 'f'; -120 } -121 var biMask = new BigInteger(hMask, 16); -122 var biNeg = biMask.xor(bigIntegerValue).add(BigInteger.ONE); -123 h = biNeg.toString(16).replace(/^-/, ''); -124 } -125 return h; -126 }; -127 /** -128 * get PEM string from hexadecimal data and header string -129 * @name getPEMStringFromHex -130 * @memberOf KJUR.asn1.ASN1Util -131 * @function -132 * @param {String} dataHex hexadecimal string of PEM body -133 * @param {String} pemHeader PEM header string (ex. 'RSA PRIVATE KEY') -134 * @return {String} PEM formatted string of input data -135 * @description -136 * @example -137 * var pem = KJUR.asn1.ASN1Util.getPEMStringFromHex('616161', 'RSA PRIVATE KEY'); -138 * // value of pem will be: -139 * -----BEGIN PRIVATE KEY----- -140 * YWFh -141 * -----END PRIVATE KEY----- -142 */ -143 this.getPEMStringFromHex = function(dataHex, pemHeader) { -144 var ns1 = KJUR.asn1; -145 var dataWA = CryptoJS.enc.Hex.parse(dataHex); -146 var dataB64 = CryptoJS.enc.Base64.stringify(dataWA); -147 var pemBody = dataB64.replace(/(.{64})/g, "$1\r\n"); -148 pemBody = pemBody.replace(/\r\n$/, ''); -149 return "-----BEGIN " + pemHeader + "-----\r\n" + -150 pemBody + -151 "\r\n-----END " + pemHeader + "-----\r\n"; -152 }; -153 -154 /** -155 * generate ASN1Object specifed by JSON parameters -156 * @name newObject -157 * @memberOf KJUR.asn1.ASN1Util -158 * @function -159 * @param {Array} param JSON parameter to generate ASN1Object -160 * @return {KJUR.asn1.ASN1Object} generated object -161 * @since asn1 1.0.3 -162 * @description -163 * generate any ASN1Object specified by JSON param -164 * including ASN.1 primitive or structured. -165 * Generally 'param' can be described as follows: -166 * <blockquote> -167 * {TYPE-OF-ASNOBJ: ASN1OBJ-PARAMETER} -168 * </blockquote> -169 * 'TYPE-OF-ASN1OBJ' can be one of following symbols: -170 * <ul> -171 * <li>'bool' - DERBoolean</li> -172 * <li>'int' - DERInteger</li> -173 * <li>'bitstr' - DERBitString</li> -174 * <li>'octstr' - DEROctetString</li> -175 * <li>'null' - DERNull</li> -176 * <li>'oid' - DERObjectIdentifier</li> -177 * <li>'utf8str' - DERUTF8String</li> -178 * <li>'numstr' - DERNumericString</li> -179 * <li>'prnstr' - DERPrintableString</li> -180 * <li>'telstr' - DERTeletexString</li> -181 * <li>'ia5str' - DERIA5String</li> -182 * <li>'utctime' - DERUTCTime</li> -183 * <li>'gentime' - DERGeneralizedTime</li> -184 * <li>'seq' - DERSequence</li> -185 * <li>'set' - DERSet</li> -186 * <li>'tag' - DERTaggedObject</li> -187 * </ul> -188 * @example -189 * newObject({'prnstr': 'aaa'}); -190 * newObject({'seq': [{'int': 3}, {'prnstr': 'aaa'}]}) -191 * // ASN.1 Tagged Object -192 * newObject({'tag': {'tag': 'a1', -193 * 'explicit': true, -194 * 'obj': {'seq': [{'int': 3}, {'prnstr': 'aaa'}]}}}); -195 * // more simple representation of ASN.1 Tagged Object -196 * newObject({'tag': ['a1', -197 * true, -198 * {'seq': [ -199 * {'int': 3}, -200 * {'prnstr': 'aaa'}]} -201 * ]}); -202 */ -203 this.newObject = function(param) { -204 var ns1 = KJUR.asn1; -205 var keys = Object.keys(param); -206 if (keys.length != 1) -207 throw "key of param shall be only one."; -208 var key = keys[0]; -209 -210 if (":bool:int:bitstr:octstr:null:oid:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:".indexOf(":" + key + ":") == -1) -211 throw "undefined key: " + key; -212 -213 if (key == "bool") return new ns1.DERBoolean(param[key]); -214 if (key == "int") return new ns1.DERInteger(param[key]); -215 if (key == "bitstr") return new ns1.DERBitString(param[key]); -216 if (key == "octstr") return new ns1.DEROctetString(param[key]); -217 if (key == "null") return new ns1.DERNull(param[key]); -218 if (key == "oid") return new ns1.DERObjectIdentifier(param[key]); -219 if (key == "utf8str") return new ns1.DERUTF8String(param[key]); -220 if (key == "numstr") return new ns1.DERNumericString(param[key]); -221 if (key == "prnstr") return new ns1.DERPrintableString(param[key]); -222 if (key == "telstr") return new ns1.DERTeletexString(param[key]); -223 if (key == "ia5str") return new ns1.DERIA5String(param[key]); -224 if (key == "utctime") return new ns1.DERUTCTime(param[key]); -225 if (key == "gentime") return new ns1.DERGeneralizedTime(param[key]); -226 -227 if (key == "seq") { -228 var paramList = param[key]; -229 var a = []; -230 for (var i = 0; i < paramList.length; i++) { -231 var asn1Obj = ns1.ASN1Util.newObject(paramList[i]); -232 a.push(asn1Obj); -233 } -234 return new ns1.DERSequence({'array': a}); -235 } -236 -237 if (key == "set") { -238 var paramList = param[key]; -239 var a = []; -240 for (var i = 0; i < paramList.length; i++) { -241 var asn1Obj = ns1.ASN1Util.newObject(paramList[i]); -242 a.push(asn1Obj); -243 } -244 return new ns1.DERSet({'array': a}); -245 } -246 -247 if (key == "tag") { -248 var tagParam = param[key]; -249 if (Object.prototype.toString.call(tagParam) === '[object Array]' && -250 tagParam.length == 3) { -251 var obj = ns1.ASN1Util.newObject(tagParam[2]); -252 return new ns1.DERTaggedObject({tag: tagParam[0], explicit: tagParam[1], obj: obj}); -253 } else { -254 var newParam = {}; -255 if (tagParam.explicit !== undefined) -256 newParam.explicit = tagParam.explicit; -257 if (tagParam.tag !== undefined) -258 newParam.tag = tagParam.tag; -259 if (tagParam.obj === undefined) -260 throw "obj shall be specified for 'tag'."; -261 newParam.obj = ns1.ASN1Util.newObject(tagParam.obj); -262 return new ns1.DERTaggedObject(newParam); -263 } -264 } -265 }; -266 -267 /** -268 * get encoded hexadecimal string of ASN1Object specifed by JSON parameters -269 * @name jsonToASN1HEX -270 * @memberOf KJUR.asn1.ASN1Util -271 * @function -272 * @param {Array} param JSON parameter to generate ASN1Object -273 * @return hexadecimal string of ASN1Object -274 * @since asn1 1.0.4 -275 * @description -276 * As for ASN.1 object representation of JSON object, -277 * please see {@link newObject}. -278 * @example -279 * jsonToASN1HEX({'prnstr': 'aaa'}); -280 */ -281 this.jsonToASN1HEX = function(param) { -282 var asn1Obj = this.newObject(param); -283 return asn1Obj.getEncodedHex(); -284 }; -285 }; -286 -287 // ******************************************************************** -288 // Abstract ASN.1 Classes -289 // ******************************************************************** -290 -291 // ******************************************************************** -292 -293 /** -294 * base class for ASN.1 DER encoder object -295 * @name KJUR.asn1.ASN1Object -296 * @class base class for ASN.1 DER encoder object -297 * @property {Boolean} isModified flag whether internal data was changed -298 * @property {String} hTLV hexadecimal string of ASN.1 TLV -299 * @property {String} hT hexadecimal string of ASN.1 TLV tag(T) -300 * @property {String} hL hexadecimal string of ASN.1 TLV length(L) -301 * @property {String} hV hexadecimal string of ASN.1 TLV value(V) -302 * @description -303 */ -304 KJUR.asn1.ASN1Object = function() { -305 var isModified = true; -306 var hTLV = null; -307 var hT = '00'; -308 var hL = '00'; -309 var hV = ''; -310 -311 /** -312 * get hexadecimal ASN.1 TLV length(L) bytes from TLV value(V) -313 * @name getLengthHexFromValue -314 * @memberOf KJUR.asn1.ASN1Object -315 * @function -316 * @return {String} hexadecimal string of ASN.1 TLV length(L) -317 */ -318 this.getLengthHexFromValue = function() { -319 if (typeof this.hV == "undefined" || this.hV == null) { -320 throw "this.hV is null or undefined."; -321 } -322 if (this.hV.length % 2 == 1) { -323 throw "value hex must be even length: n=" + hV.length + ",v=" + this.hV; + 58 * <li>0x0a {@link KJUR.asn1.DEREnumerated}</li> + 59 * <li>0x0c {@link KJUR.asn1.DERUTF8String}</li> + 60 * <li>0x12 {@link KJUR.asn1.DERNumericString}</li> + 61 * <li>0x13 {@link KJUR.asn1.DERPrintableString}</li> + 62 * <li>0x14 {@link KJUR.asn1.DERTeletexString}</li> + 63 * <li>0x16 {@link KJUR.asn1.DERIA5String}</li> + 64 * <li>0x17 {@link KJUR.asn1.DERUTCTime}</li> + 65 * <li>0x18 {@link KJUR.asn1.DERGeneralizedTime}</li> + 66 * <li>0x30 {@link KJUR.asn1.DERSequence}</li> + 67 * <li>0x31 {@link KJUR.asn1.DERSet}</li> + 68 * </ul> + 69 * + 70 * <h4>OTHER ASN.1 CLASSES</h4> + 71 * <ul> + 72 * <li>{@link KJUR.asn1.ASN1Object}</li> + 73 * <li>{@link KJUR.asn1.DERAbstractString}</li> + 74 * <li>{@link KJUR.asn1.DERAbstractTime}</li> + 75 * <li>{@link KJUR.asn1.DERAbstractStructured}</li> + 76 * <li>{@link KJUR.asn1.DERTaggedObject}</li> + 77 * </ul> + 78 * </p> + 79 * NOTE: Please ignore method summary and document of this namespace. + 80 * This caused by a bug of jsdoc2. + 81 * @name KJUR.asn1 + 82 * @namespace + 83 */ + 84 if (typeof KJUR.asn1 == "undefined" || !KJUR.asn1) KJUR.asn1 = {}; + 85 + 86 /** + 87 * ASN1 utilities class + 88 * @name KJUR.asn1.ASN1Util + 89 * @class ASN1 utilities class + 90 * @since asn1 1.0.2 + 91 */ + 92 KJUR.asn1.ASN1Util = new function() { + 93 this.integerToByteHex = function(i) { + 94 var h = i.toString(16); + 95 if ((h.length % 2) == 1) h = '0' + h; + 96 return h; + 97 }; + 98 this.bigIntToMinTwosComplementsHex = function(bigIntegerValue) { + 99 var h = bigIntegerValue.toString(16); +100 if (h.substr(0, 1) != '-') { +101 if (h.length % 2 == 1) { +102 h = '0' + h; +103 } else { +104 if (! h.match(/^[0-7]/)) { +105 h = '00' + h; +106 } +107 } +108 } else { +109 var hPos = h.substr(1); +110 var xorLen = hPos.length; +111 if (xorLen % 2 == 1) { +112 xorLen += 1; +113 } else { +114 if (! h.match(/^[0-7]/)) { +115 xorLen += 2; +116 } +117 } +118 var hMask = ''; +119 for (var i = 0; i < xorLen; i++) { +120 hMask += 'f'; +121 } +122 var biMask = new BigInteger(hMask, 16); +123 var biNeg = biMask.xor(bigIntegerValue).add(BigInteger.ONE); +124 h = biNeg.toString(16).replace(/^-/, ''); +125 } +126 return h; +127 }; +128 /** +129 * get PEM string from hexadecimal data and header string +130 * @name getPEMStringFromHex +131 * @memberOf KJUR.asn1.ASN1Util +132 * @function +133 * @param {String} dataHex hexadecimal string of PEM body +134 * @param {String} pemHeader PEM header string (ex. 'RSA PRIVATE KEY') +135 * @return {String} PEM formatted string of input data +136 * @description +137 * @example +138 * var pem = KJUR.asn1.ASN1Util.getPEMStringFromHex('616161', 'RSA PRIVATE KEY'); +139 * // value of pem will be: +140 * -----BEGIN PRIVATE KEY----- +141 * YWFh +142 * -----END PRIVATE KEY----- +143 */ +144 this.getPEMStringFromHex = function(dataHex, pemHeader) { +145 var ns1 = KJUR.asn1; +146 var dataWA = CryptoJS.enc.Hex.parse(dataHex); +147 var dataB64 = CryptoJS.enc.Base64.stringify(dataWA); +148 var pemBody = dataB64.replace(/(.{64})/g, "$1\r\n"); +149 pemBody = pemBody.replace(/\r\n$/, ''); +150 return "-----BEGIN " + pemHeader + "-----\r\n" + +151 pemBody + +152 "\r\n-----END " + pemHeader + "-----\r\n"; +153 }; +154 +155 /** +156 * generate ASN1Object specifed by JSON parameters +157 * @name newObject +158 * @memberOf KJUR.asn1.ASN1Util +159 * @function +160 * @param {Array} param JSON parameter to generate ASN1Object +161 * @return {KJUR.asn1.ASN1Object} generated object +162 * @since asn1 1.0.3 +163 * @description +164 * generate any ASN1Object specified by JSON param +165 * including ASN.1 primitive or structured. +166 * Generally 'param' can be described as follows: +167 * <blockquote> +168 * {TYPE-OF-ASNOBJ: ASN1OBJ-PARAMETER} +169 * </blockquote> +170 * 'TYPE-OF-ASN1OBJ' can be one of following symbols: +171 * <ul> +172 * <li>'bool' - DERBoolean</li> +173 * <li>'int' - DERInteger</li> +174 * <li>'bitstr' - DERBitString</li> +175 * <li>'octstr' - DEROctetString</li> +176 * <li>'null' - DERNull</li> +177 * <li>'oid' - DERObjectIdentifier</li> +178 * <li>'enum' - DEREnumerated</li> +179 * <li>'utf8str' - DERUTF8String</li> +180 * <li>'numstr' - DERNumericString</li> +181 * <li>'prnstr' - DERPrintableString</li> +182 * <li>'telstr' - DERTeletexString</li> +183 * <li>'ia5str' - DERIA5String</li> +184 * <li>'utctime' - DERUTCTime</li> +185 * <li>'gentime' - DERGeneralizedTime</li> +186 * <li>'seq' - DERSequence</li> +187 * <li>'set' - DERSet</li> +188 * <li>'tag' - DERTaggedObject</li> +189 * </ul> +190 * @example +191 * newObject({'prnstr': 'aaa'}); +192 * newObject({'seq': [{'int': 3}, {'prnstr': 'aaa'}]}) +193 * // ASN.1 Tagged Object +194 * newObject({'tag': {'tag': 'a1', +195 * 'explicit': true, +196 * 'obj': {'seq': [{'int': 3}, {'prnstr': 'aaa'}]}}}); +197 * // more simple representation of ASN.1 Tagged Object +198 * newObject({'tag': ['a1', +199 * true, +200 * {'seq': [ +201 * {'int': 3}, +202 * {'prnstr': 'aaa'}]} +203 * ]}); +204 */ +205 this.newObject = function(param) { +206 var ns1 = KJUR.asn1; +207 var keys = Object.keys(param); +208 if (keys.length != 1) +209 throw "key of param shall be only one."; +210 var key = keys[0]; +211 +212 if (":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:".indexOf(":" + key + ":") == -1) +213 throw "undefined key: " + key; +214 +215 if (key == "bool") return new ns1.DERBoolean(param[key]); +216 if (key == "int") return new ns1.DERInteger(param[key]); +217 if (key == "bitstr") return new ns1.DERBitString(param[key]); +218 if (key == "octstr") return new ns1.DEROctetString(param[key]); +219 if (key == "null") return new ns1.DERNull(param[key]); +220 if (key == "oid") return new ns1.DERObjectIdentifier(param[key]); +221 if (key == "enum") return new ns1.DEREnumerated(param[key]); +222 if (key == "utf8str") return new ns1.DERUTF8String(param[key]); +223 if (key == "numstr") return new ns1.DERNumericString(param[key]); +224 if (key == "prnstr") return new ns1.DERPrintableString(param[key]); +225 if (key == "telstr") return new ns1.DERTeletexString(param[key]); +226 if (key == "ia5str") return new ns1.DERIA5String(param[key]); +227 if (key == "utctime") return new ns1.DERUTCTime(param[key]); +228 if (key == "gentime") return new ns1.DERGeneralizedTime(param[key]); +229 +230 if (key == "seq") { +231 var paramList = param[key]; +232 var a = []; +233 for (var i = 0; i < paramList.length; i++) { +234 var asn1Obj = ns1.ASN1Util.newObject(paramList[i]); +235 a.push(asn1Obj); +236 } +237 return new ns1.DERSequence({'array': a}); +238 } +239 +240 if (key == "set") { +241 var paramList = param[key]; +242 var a = []; +243 for (var i = 0; i < paramList.length; i++) { +244 var asn1Obj = ns1.ASN1Util.newObject(paramList[i]); +245 a.push(asn1Obj); +246 } +247 return new ns1.DERSet({'array': a}); +248 } +249 +250 if (key == "tag") { +251 var tagParam = param[key]; +252 if (Object.prototype.toString.call(tagParam) === '[object Array]' && +253 tagParam.length == 3) { +254 var obj = ns1.ASN1Util.newObject(tagParam[2]); +255 return new ns1.DERTaggedObject({tag: tagParam[0], explicit: tagParam[1], obj: obj}); +256 } else { +257 var newParam = {}; +258 if (tagParam.explicit !== undefined) +259 newParam.explicit = tagParam.explicit; +260 if (tagParam.tag !== undefined) +261 newParam.tag = tagParam.tag; +262 if (tagParam.obj === undefined) +263 throw "obj shall be specified for 'tag'."; +264 newParam.obj = ns1.ASN1Util.newObject(tagParam.obj); +265 return new ns1.DERTaggedObject(newParam); +266 } +267 } +268 }; +269 +270 /** +271 * get encoded hexadecimal string of ASN1Object specifed by JSON parameters +272 * @name jsonToASN1HEX +273 * @memberOf KJUR.asn1.ASN1Util +274 * @function +275 * @param {Array} param JSON parameter to generate ASN1Object +276 * @return hexadecimal string of ASN1Object +277 * @since asn1 1.0.4 +278 * @description +279 * As for ASN.1 object representation of JSON object, +280 * please see {@link newObject}. +281 * @example +282 * jsonToASN1HEX({'prnstr': 'aaa'}); +283 */ +284 this.jsonToASN1HEX = function(param) { +285 var asn1Obj = this.newObject(param); +286 return asn1Obj.getEncodedHex(); +287 }; +288 }; +289 +290 // ******************************************************************** +291 // Abstract ASN.1 Classes +292 // ******************************************************************** +293 +294 // ******************************************************************** +295 +296 /** +297 * base class for ASN.1 DER encoder object +298 * @name KJUR.asn1.ASN1Object +299 * @class base class for ASN.1 DER encoder object +300 * @property {Boolean} isModified flag whether internal data was changed +301 * @property {String} hTLV hexadecimal string of ASN.1 TLV +302 * @property {String} hT hexadecimal string of ASN.1 TLV tag(T) +303 * @property {String} hL hexadecimal string of ASN.1 TLV length(L) +304 * @property {String} hV hexadecimal string of ASN.1 TLV value(V) +305 * @description +306 */ +307 KJUR.asn1.ASN1Object = function() { +308 var isModified = true; +309 var hTLV = null; +310 var hT = '00'; +311 var hL = '00'; +312 var hV = ''; +313 +314 /** +315 * get hexadecimal ASN.1 TLV length(L) bytes from TLV value(V) +316 * @name getLengthHexFromValue +317 * @memberOf KJUR.asn1.ASN1Object +318 * @function +319 * @return {String} hexadecimal string of ASN.1 TLV length(L) +320 */ +321 this.getLengthHexFromValue = function() { +322 if (typeof this.hV == "undefined" || this.hV == null) { +323 throw "this.hV is null or undefined."; 324 } -325 var n = this.hV.length / 2; -326 var hN = n.toString(16); -327 if (hN.length % 2 == 1) { -328 hN = "0" + hN; -329 } -330 if (n < 128) { -331 return hN; -332 } else { -333 var hNlen = hN.length / 2; -334 if (hNlen > 15) { -335 throw "ASN.1 length too long to represent by 8x: n = " + n.toString(16); -336 } -337 var head = 128 + hNlen; -338 return head.toString(16) + hN; -339 } -340 }; -341 -342 /** -343 * get hexadecimal string of ASN.1 TLV bytes -344 * @name getEncodedHex -345 * @memberOf KJUR.asn1.ASN1Object -346 * @function -347 * @return {String} hexadecimal string of ASN.1 TLV -348 */ -349 this.getEncodedHex = function() { -350 if (this.hTLV == null || this.isModified) { -351 this.hV = this.getFreshValueHex(); -352 this.hL = this.getLengthHexFromValue(); -353 this.hTLV = this.hT + this.hL + this.hV; -354 this.isModified = false; -355 //alert("first time: " + this.hTLV); -356 } -357 return this.hTLV; -358 }; -359 -360 /** -361 * get hexadecimal string of ASN.1 TLV value(V) bytes -362 * @name getValueHex -363 * @memberOf KJUR.asn1.ASN1Object -364 * @function -365 * @return {String} hexadecimal string of ASN.1 TLV value(V) bytes -366 */ -367 this.getValueHex = function() { -368 this.getEncodedHex(); -369 return this.hV; -370 } -371 -372 this.getFreshValueHex = function() { -373 return ''; -374 }; -375 }; -376 -377 // == BEGIN DERAbstractString ================================================ -378 /** -379 * base class for ASN.1 DER string classes -380 * @name KJUR.asn1.DERAbstractString -381 * @class base class for ASN.1 DER string classes -382 * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) -383 * @property {String} s internal string of value -384 * @extends KJUR.asn1.ASN1Object -385 * @description -386 * <br/> -387 * As for argument 'params' for constructor, you can specify one of -388 * following properties: -389 * <ul> -390 * <li>str - specify initial ASN.1 value(V) by a string</li> -391 * <li>hex - specify initial ASN.1 value(V) by a hexadecimal string</li> -392 * </ul> -393 * NOTE: 'params' can be omitted. -394 */ -395 KJUR.asn1.DERAbstractString = function(params) { -396 KJUR.asn1.DERAbstractString.superclass.constructor.call(this); -397 var s = null; -398 var hV = null; -399 -400 /** -401 * get string value of this string object -402 * @name getString -403 * @memberOf KJUR.asn1.DERAbstractString -404 * @function -405 * @return {String} string value of this string object -406 */ -407 this.getString = function() { -408 return this.s; -409 }; -410 -411 /** -412 * set value by a string -413 * @name setString -414 * @memberOf KJUR.asn1.DERAbstractString -415 * @function -416 * @param {String} newS value by a string to set -417 */ -418 this.setString = function(newS) { -419 this.hTLV = null; -420 this.isModified = true; -421 this.s = newS; -422 this.hV = stohex(this.s); -423 }; -424 -425 /** -426 * set value by a hexadecimal string -427 * @name setStringHex -428 * @memberOf KJUR.asn1.DERAbstractString -429 * @function -430 * @param {String} newHexString value by a hexadecimal string to set -431 */ -432 this.setStringHex = function(newHexString) { -433 this.hTLV = null; -434 this.isModified = true; -435 this.s = null; -436 this.hV = newHexString; -437 }; -438 -439 this.getFreshValueHex = function() { -440 return this.hV; -441 }; -442 -443 if (typeof params != "undefined") { -444 if (typeof params == "string") { -445 this.setString(params); -446 } else if (typeof params['str'] != "undefined") { -447 this.setString(params['str']); -448 } else if (typeof params['hex'] != "undefined") { -449 this.setStringHex(params['hex']); -450 } -451 } -452 }; -453 YAHOO.lang.extend(KJUR.asn1.DERAbstractString, KJUR.asn1.ASN1Object); -454 // == END DERAbstractString ================================================ -455 -456 // == BEGIN DERAbstractTime ================================================== -457 /** -458 * base class for ASN.1 DER Generalized/UTCTime class -459 * @name KJUR.asn1.DERAbstractTime -460 * @class base class for ASN.1 DER Generalized/UTCTime class -461 * @param {Array} params associative array of parameters (ex. {'str': '130430235959Z'}) -462 * @extends KJUR.asn1.ASN1Object -463 * @description -464 * @see KJUR.asn1.ASN1Object - superclass -465 */ -466 KJUR.asn1.DERAbstractTime = function(params) { -467 KJUR.asn1.DERAbstractTime.superclass.constructor.call(this); -468 var s = null; -469 var date = null; -470 -471 // --- PRIVATE METHODS -------------------- -472 this.localDateToUTC = function(d) { -473 utc = d.getTime() + (d.getTimezoneOffset() * 60000); -474 var utcDate = new Date(utc); -475 return utcDate; -476 }; -477 -478 /* -479 * format date string by Data object -480 * @name formatDate -481 * @memberOf KJUR.asn1.AbstractTime; -482 * @param {Date} dateObject -483 * @param {string} type 'utc' or 'gen' -484 * @param {boolean} withMillis flag for with millisections or not -485 * @description -486 * 'withMillis' flag is supported from asn1 1.0.6. -487 */ -488 this.formatDate = function(dateObject, type, withMillis) { -489 var pad = this.zeroPadding; -490 var d = this.localDateToUTC(dateObject); -491 var year = String(d.getFullYear()); -492 if (type == 'utc') year = year.substr(2, 2); -493 var month = pad(String(d.getMonth() + 1), 2); -494 var day = pad(String(d.getDate()), 2); -495 var hour = pad(String(d.getHours()), 2); -496 var min = pad(String(d.getMinutes()), 2); -497 var sec = pad(String(d.getSeconds()), 2); -498 var s = year + month + day + hour + min + sec; -499 if (withMillis === true) { -500 var millis = d.getMilliseconds(); -501 if (millis != 0) { -502 var sMillis = pad(String(millis), 3); -503 sMillis = sMillis.replace(/[0]+$/, ""); -504 s = s + "." + sMillis; -505 } -506 } -507 return s + "Z"; -508 }; -509 -510 this.zeroPadding = function(s, len) { -511 if (s.length >= len) return s; -512 return new Array(len - s.length + 1).join('0') + s; -513 }; -514 -515 // --- PUBLIC METHODS -------------------- -516 /** -517 * get string value of this string object -518 * @name getString -519 * @memberOf KJUR.asn1.DERAbstractTime -520 * @function -521 * @return {String} string value of this time object -522 */ -523 this.getString = function() { -524 return this.s; -525 }; -526 -527 /** -528 * set value by a string -529 * @name setString -530 * @memberOf KJUR.asn1.DERAbstractTime -531 * @function -532 * @param {String} newS value by a string to set such like "130430235959Z" -533 */ -534 this.setString = function(newS) { -535 this.hTLV = null; -536 this.isModified = true; -537 this.s = newS; -538 this.hV = stohex(newS); -539 }; -540 -541 /** -542 * set value by a Date object -543 * @name setByDateValue -544 * @memberOf KJUR.asn1.DERAbstractTime -545 * @function -546 * @param {Integer} year year of date (ex. 2013) -547 * @param {Integer} month month of date between 1 and 12 (ex. 12) -548 * @param {Integer} day day of month -549 * @param {Integer} hour hours of date -550 * @param {Integer} min minutes of date -551 * @param {Integer} sec seconds of date -552 */ -553 this.setByDateValue = function(year, month, day, hour, min, sec) { -554 var dateObject = new Date(Date.UTC(year, month - 1, day, hour, min, sec, 0)); -555 this.setByDate(dateObject); -556 }; -557 -558 this.getFreshValueHex = function() { -559 return this.hV; -560 }; -561 }; -562 YAHOO.lang.extend(KJUR.asn1.DERAbstractTime, KJUR.asn1.ASN1Object); -563 // == END DERAbstractTime ================================================== -564 -565 // == BEGIN DERAbstractStructured ============================================ -566 /** -567 * base class for ASN.1 DER structured class -568 * @name KJUR.asn1.DERAbstractStructured -569 * @class base class for ASN.1 DER structured class -570 * @property {Array} asn1Array internal array of ASN1Object -571 * @extends KJUR.asn1.ASN1Object -572 * @description -573 * @see KJUR.asn1.ASN1Object - superclass -574 */ -575 KJUR.asn1.DERAbstractStructured = function(params) { -576 KJUR.asn1.DERAbstractString.superclass.constructor.call(this); -577 var asn1Array = null; -578 -579 /** -580 * set value by array of ASN1Object -581 * @name setByASN1ObjectArray -582 * @memberOf KJUR.asn1.DERAbstractStructured -583 * @function -584 * @param {array} asn1ObjectArray array of ASN1Object to set -585 */ -586 this.setByASN1ObjectArray = function(asn1ObjectArray) { -587 this.hTLV = null; -588 this.isModified = true; -589 this.asn1Array = asn1ObjectArray; -590 }; -591 -592 /** -593 * append an ASN1Object to internal array -594 * @name appendASN1Object -595 * @memberOf KJUR.asn1.DERAbstractStructured -596 * @function -597 * @param {ASN1Object} asn1Object to add -598 */ -599 this.appendASN1Object = function(asn1Object) { -600 this.hTLV = null; -601 this.isModified = true; -602 this.asn1Array.push(asn1Object); -603 }; -604 -605 this.asn1Array = new Array(); -606 if (typeof params != "undefined") { -607 if (typeof params['array'] != "undefined") { -608 this.asn1Array = params['array']; -609 } -610 } -611 }; -612 YAHOO.lang.extend(KJUR.asn1.DERAbstractStructured, KJUR.asn1.ASN1Object); -613 -614 -615 // ******************************************************************** -616 // ASN.1 Object Classes -617 // ******************************************************************** -618 -619 // ******************************************************************** -620 /** -621 * class for ASN.1 DER Boolean -622 * @name KJUR.asn1.DERBoolean -623 * @class class for ASN.1 DER Boolean -624 * @extends KJUR.asn1.ASN1Object -625 * @description -626 * @see KJUR.asn1.ASN1Object - superclass -627 */ -628 KJUR.asn1.DERBoolean = function() { -629 KJUR.asn1.DERBoolean.superclass.constructor.call(this); -630 this.hT = "01"; -631 this.hTLV = "0101ff"; -632 }; -633 YAHOO.lang.extend(KJUR.asn1.DERBoolean, KJUR.asn1.ASN1Object); -634 -635 // ******************************************************************** -636 /** -637 * class for ASN.1 DER Integer -638 * @name KJUR.asn1.DERInteger -639 * @class class for ASN.1 DER Integer -640 * @extends KJUR.asn1.ASN1Object -641 * @description -642 * <br/> -643 * As for argument 'params' for constructor, you can specify one of -644 * following properties: -645 * <ul> -646 * <li>int - specify initial ASN.1 value(V) by integer value</li> -647 * <li>bigint - specify initial ASN.1 value(V) by BigInteger object</li> -648 * <li>hex - specify initial ASN.1 value(V) by a hexadecimal string</li> -649 * </ul> -650 * NOTE: 'params' can be omitted. -651 */ -652 KJUR.asn1.DERInteger = function(params) { -653 KJUR.asn1.DERInteger.superclass.constructor.call(this); -654 this.hT = "02"; -655 -656 /** -657 * set value by Tom Wu's BigInteger object -658 * @name setByBigInteger -659 * @memberOf KJUR.asn1.DERInteger -660 * @function -661 * @param {BigInteger} bigIntegerValue to set -662 */ -663 this.setByBigInteger = function(bigIntegerValue) { -664 this.hTLV = null; -665 this.isModified = true; -666 this.hV = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(bigIntegerValue); -667 }; -668 -669 /** -670 * set value by integer value -671 * @name setByInteger -672 * @memberOf KJUR.asn1.DERInteger -673 * @function -674 * @param {Integer} integer value to set -675 */ -676 this.setByInteger = function(intValue) { -677 var bi = new BigInteger(String(intValue), 10); -678 this.setByBigInteger(bi); -679 }; -680 -681 /** -682 * set value by integer value -683 * @name setValueHex -684 * @memberOf KJUR.asn1.DERInteger -685 * @function -686 * @param {String} hexadecimal string of integer value -687 * @description -688 * <br/> -689 * NOTE: Value shall be represented by minimum octet length of -690 * two's complement representation. -691 * @example -692 * new KJUR.asn1.DERInteger(123); -693 * new KJUR.asn1.DERInteger({'int': 123}); -694 * new KJUR.asn1.DERInteger({'hex': '1fad'}); -695 */ -696 this.setValueHex = function(newHexString) { -697 this.hV = newHexString; -698 }; -699 -700 this.getFreshValueHex = function() { -701 return this.hV; -702 }; -703 -704 if (typeof params != "undefined") { -705 if (typeof params['bigint'] != "undefined") { -706 this.setByBigInteger(params['bigint']); -707 } else if (typeof params['int'] != "undefined") { -708 this.setByInteger(params['int']); -709 } else if (typeof params == "number") { -710 this.setByInteger(params); -711 } else if (typeof params['hex'] != "undefined") { -712 this.setValueHex(params['hex']); -713 } -714 } -715 }; -716 YAHOO.lang.extend(KJUR.asn1.DERInteger, KJUR.asn1.ASN1Object); -717 -718 // ******************************************************************** -719 /** -720 * class for ASN.1 DER encoded BitString primitive -721 * @name KJUR.asn1.DERBitString -722 * @class class for ASN.1 DER encoded BitString primitive -723 * @extends KJUR.asn1.ASN1Object -724 * @description -725 * <br/> -726 * As for argument 'params' for constructor, you can specify one of -727 * following properties: -728 * <ul> -729 * <li>bin - specify binary string (ex. '10111')</li> -730 * <li>array - specify array of boolean (ex. [true,false,true,true])</li> -731 * <li>hex - specify hexadecimal string of ASN.1 value(V) including unused bits</li> -732 * </ul> -733 * NOTE: 'params' can be omitted. -734 */ -735 KJUR.asn1.DERBitString = function(params) { -736 KJUR.asn1.DERBitString.superclass.constructor.call(this); -737 this.hT = "03"; -738 -739 /** -740 * set ASN.1 value(V) by a hexadecimal string including unused bits -741 * @name setHexValueIncludingUnusedBits -742 * @memberOf KJUR.asn1.DERBitString -743 * @function -744 * @param {String} newHexStringIncludingUnusedBits -745 */ -746 this.setHexValueIncludingUnusedBits = function(newHexStringIncludingUnusedBits) { -747 this.hTLV = null; -748 this.isModified = true; -749 this.hV = newHexStringIncludingUnusedBits; -750 }; -751 -752 /** -753 * set ASN.1 value(V) by unused bit and hexadecimal string of value -754 * @name setUnusedBitsAndHexValue -755 * @memberOf KJUR.asn1.DERBitString -756 * @function -757 * @param {Integer} unusedBits -758 * @param {String} hValue -759 */ -760 this.setUnusedBitsAndHexValue = function(unusedBits, hValue) { -761 if (unusedBits < 0 || 7 < unusedBits) { -762 throw "unused bits shall be from 0 to 7: u = " + unusedBits; -763 } -764 var hUnusedBits = "0" + unusedBits; -765 this.hTLV = null; -766 this.isModified = true; -767 this.hV = hUnusedBits + hValue; -768 }; -769 -770 /** -771 * set ASN.1 DER BitString by binary string -772 * @name setByBinaryString -773 * @memberOf KJUR.asn1.DERBitString -774 * @function -775 * @param {String} binaryString binary value string (i.e. '10111') -776 * @description -777 * Its unused bits will be calculated automatically by length of -778 * 'binaryValue'. <br/> -779 * NOTE: Trailing zeros '0' will be ignored. -780 */ -781 this.setByBinaryString = function(binaryString) { -782 binaryString = binaryString.replace(/0+$/, ''); -783 var unusedBits = 8 - binaryString.length % 8; -784 if (unusedBits == 8) unusedBits = 0; -785 for (var i = 0; i <= unusedBits; i++) { -786 binaryString += '0'; -787 } -788 var h = ''; -789 for (var i = 0; i < binaryString.length - 1; i += 8) { -790 var b = binaryString.substr(i, 8); -791 var x = parseInt(b, 2).toString(16); -792 if (x.length == 1) x = '0' + x; -793 h += x; -794 } -795 this.hTLV = null; -796 this.isModified = true; -797 this.hV = '0' + unusedBits + h; -798 }; -799 -800 /** -801 * set ASN.1 TLV value(V) by an array of boolean -802 * @name setByBooleanArray -803 * @memberOf KJUR.asn1.DERBitString -804 * @function -805 * @param {array} booleanArray array of boolean (ex. [true, false, true]) -806 * @description -807 * NOTE: Trailing falses will be ignored. -808 */ -809 this.setByBooleanArray = function(booleanArray) { -810 var s = ''; -811 for (var i = 0; i < booleanArray.length; i++) { -812 if (booleanArray[i] == true) { -813 s += '1'; -814 } else { -815 s += '0'; -816 } -817 } -818 this.setByBinaryString(s); -819 }; -820 -821 /** -822 * generate an array of false with specified length -823 * @name newFalseArray -824 * @memberOf KJUR.asn1.DERBitString -825 * @function -826 * @param {Integer} nLength length of array to generate -827 * @return {array} array of boolean faluse -828 * @description -829 * This static method may be useful to initialize boolean array. -830 */ -831 this.newFalseArray = function(nLength) { -832 var a = new Array(nLength); -833 for (var i = 0; i < nLength; i++) { -834 a[i] = false; -835 } -836 return a; -837 }; -838 -839 this.getFreshValueHex = function() { -840 return this.hV; -841 }; -842 -843 if (typeof params != "undefined") { -844 if (typeof params == "string" && params.toLowerCase().match(/^[0-9a-f]+$/)) { -845 this.setHexValueIncludingUnusedBits(params); -846 } else if (typeof params['hex'] != "undefined") { -847 this.setHexValueIncludingUnusedBits(params['hex']); -848 } else if (typeof params['bin'] != "undefined") { -849 this.setByBinaryString(params['bin']); -850 } else if (typeof params['array'] != "undefined") { -851 this.setByBooleanArray(params['array']); -852 } -853 } -854 }; -855 YAHOO.lang.extend(KJUR.asn1.DERBitString, KJUR.asn1.ASN1Object); -856 -857 // ******************************************************************** -858 /** -859 * class for ASN.1 DER OctetString -860 * @name KJUR.asn1.DEROctetString -861 * @class class for ASN.1 DER OctetString -862 * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) -863 * @extends KJUR.asn1.DERAbstractString -864 * @description -865 * @see KJUR.asn1.DERAbstractString - superclass -866 */ -867 KJUR.asn1.DEROctetString = function(params) { -868 KJUR.asn1.DEROctetString.superclass.constructor.call(this, params); -869 this.hT = "04"; -870 }; -871 YAHOO.lang.extend(KJUR.asn1.DEROctetString, KJUR.asn1.DERAbstractString); -872 -873 // ******************************************************************** -874 /** -875 * class for ASN.1 DER Null -876 * @name KJUR.asn1.DERNull -877 * @class class for ASN.1 DER Null -878 * @extends KJUR.asn1.ASN1Object -879 * @description -880 * @see KJUR.asn1.ASN1Object - superclass -881 */ -882 KJUR.asn1.DERNull = function() { -883 KJUR.asn1.DERNull.superclass.constructor.call(this); -884 this.hT = "05"; -885 this.hTLV = "0500"; -886 }; -887 YAHOO.lang.extend(KJUR.asn1.DERNull, KJUR.asn1.ASN1Object); -888 -889 // ******************************************************************** -890 /** -891 * class for ASN.1 DER ObjectIdentifier -892 * @name KJUR.asn1.DERObjectIdentifier -893 * @class class for ASN.1 DER ObjectIdentifier -894 * @param {Array} params associative array of parameters (ex. {'oid': '2.5.4.5'}) -895 * @extends KJUR.asn1.ASN1Object -896 * @description -897 * <br/> -898 * As for argument 'params' for constructor, you can specify one of -899 * following properties: -900 * <ul> -901 * <li>oid - specify initial ASN.1 value(V) by a oid string (ex. 2.5.4.13)</li> -902 * <li>hex - specify initial ASN.1 value(V) by a hexadecimal string</li> -903 * </ul> -904 * NOTE: 'params' can be omitted. -905 */ -906 KJUR.asn1.DERObjectIdentifier = function(params) { -907 var itox = function(i) { -908 var h = i.toString(16); -909 if (h.length == 1) h = '0' + h; -910 return h; -911 }; -912 var roidtox = function(roid) { -913 var h = ''; -914 var bi = new BigInteger(roid, 10); -915 var b = bi.toString(2); -916 var padLen = 7 - b.length % 7; -917 if (padLen == 7) padLen = 0; -918 var bPad = ''; -919 for (var i = 0; i < padLen; i++) bPad += '0'; -920 b = bPad + b; -921 for (var i = 0; i < b.length - 1; i += 7) { -922 var b8 = b.substr(i, 7); -923 if (i != b.length - 7) b8 = '1' + b8; -924 h += itox(parseInt(b8, 2)); -925 } -926 return h; -927 } -928 -929 KJUR.asn1.DERObjectIdentifier.superclass.constructor.call(this); -930 this.hT = "06"; +325 if (this.hV.length % 2 == 1) { +326 throw "value hex must be even length: n=" + hV.length + ",v=" + this.hV; +327 } +328 var n = this.hV.length / 2; +329 var hN = n.toString(16); +330 if (hN.length % 2 == 1) { +331 hN = "0" + hN; +332 } +333 if (n < 128) { +334 return hN; +335 } else { +336 var hNlen = hN.length / 2; +337 if (hNlen > 15) { +338 throw "ASN.1 length too long to represent by 8x: n = " + n.toString(16); +339 } +340 var head = 128 + hNlen; +341 return head.toString(16) + hN; +342 } +343 }; +344 +345 /** +346 * get hexadecimal string of ASN.1 TLV bytes +347 * @name getEncodedHex +348 * @memberOf KJUR.asn1.ASN1Object +349 * @function +350 * @return {String} hexadecimal string of ASN.1 TLV +351 */ +352 this.getEncodedHex = function() { +353 if (this.hTLV == null || this.isModified) { +354 this.hV = this.getFreshValueHex(); +355 this.hL = this.getLengthHexFromValue(); +356 this.hTLV = this.hT + this.hL + this.hV; +357 this.isModified = false; +358 //alert("first time: " + this.hTLV); +359 } +360 return this.hTLV; +361 }; +362 +363 /** +364 * get hexadecimal string of ASN.1 TLV value(V) bytes +365 * @name getValueHex +366 * @memberOf KJUR.asn1.ASN1Object +367 * @function +368 * @return {String} hexadecimal string of ASN.1 TLV value(V) bytes +369 */ +370 this.getValueHex = function() { +371 this.getEncodedHex(); +372 return this.hV; +373 } +374 +375 this.getFreshValueHex = function() { +376 return ''; +377 }; +378 }; +379 +380 // == BEGIN DERAbstractString ================================================ +381 /** +382 * base class for ASN.1 DER string classes +383 * @name KJUR.asn1.DERAbstractString +384 * @class base class for ASN.1 DER string classes +385 * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) +386 * @property {String} s internal string of value +387 * @extends KJUR.asn1.ASN1Object +388 * @description +389 * <br/> +390 * As for argument 'params' for constructor, you can specify one of +391 * following properties: +392 * <ul> +393 * <li>str - specify initial ASN.1 value(V) by a string</li> +394 * <li>hex - specify initial ASN.1 value(V) by a hexadecimal string</li> +395 * </ul> +396 * NOTE: 'params' can be omitted. +397 */ +398 KJUR.asn1.DERAbstractString = function(params) { +399 KJUR.asn1.DERAbstractString.superclass.constructor.call(this); +400 var s = null; +401 var hV = null; +402 +403 /** +404 * get string value of this string object +405 * @name getString +406 * @memberOf KJUR.asn1.DERAbstractString +407 * @function +408 * @return {String} string value of this string object +409 */ +410 this.getString = function() { +411 return this.s; +412 }; +413 +414 /** +415 * set value by a string +416 * @name setString +417 * @memberOf KJUR.asn1.DERAbstractString +418 * @function +419 * @param {String} newS value by a string to set +420 */ +421 this.setString = function(newS) { +422 this.hTLV = null; +423 this.isModified = true; +424 this.s = newS; +425 this.hV = stohex(this.s); +426 }; +427 +428 /** +429 * set value by a hexadecimal string +430 * @name setStringHex +431 * @memberOf KJUR.asn1.DERAbstractString +432 * @function +433 * @param {String} newHexString value by a hexadecimal string to set +434 */ +435 this.setStringHex = function(newHexString) { +436 this.hTLV = null; +437 this.isModified = true; +438 this.s = null; +439 this.hV = newHexString; +440 }; +441 +442 this.getFreshValueHex = function() { +443 return this.hV; +444 }; +445 +446 if (typeof params != "undefined") { +447 if (typeof params == "string") { +448 this.setString(params); +449 } else if (typeof params['str'] != "undefined") { +450 this.setString(params['str']); +451 } else if (typeof params['hex'] != "undefined") { +452 this.setStringHex(params['hex']); +453 } +454 } +455 }; +456 YAHOO.lang.extend(KJUR.asn1.DERAbstractString, KJUR.asn1.ASN1Object); +457 // == END DERAbstractString ================================================ +458 +459 // == BEGIN DERAbstractTime ================================================== +460 /** +461 * base class for ASN.1 DER Generalized/UTCTime class +462 * @name KJUR.asn1.DERAbstractTime +463 * @class base class for ASN.1 DER Generalized/UTCTime class +464 * @param {Array} params associative array of parameters (ex. {'str': '130430235959Z'}) +465 * @extends KJUR.asn1.ASN1Object +466 * @description +467 * @see KJUR.asn1.ASN1Object - superclass +468 */ +469 KJUR.asn1.DERAbstractTime = function(params) { +470 KJUR.asn1.DERAbstractTime.superclass.constructor.call(this); +471 var s = null; +472 var date = null; +473 +474 // --- PRIVATE METHODS -------------------- +475 this.localDateToUTC = function(d) { +476 utc = d.getTime() + (d.getTimezoneOffset() * 60000); +477 var utcDate = new Date(utc); +478 return utcDate; +479 }; +480 +481 /* +482 * format date string by Data object +483 * @name formatDate +484 * @memberOf KJUR.asn1.AbstractTime; +485 * @param {Date} dateObject +486 * @param {string} type 'utc' or 'gen' +487 * @param {boolean} withMillis flag for with millisections or not +488 * @description +489 * 'withMillis' flag is supported from asn1 1.0.6. +490 */ +491 this.formatDate = function(dateObject, type, withMillis) { +492 var pad = this.zeroPadding; +493 var d = this.localDateToUTC(dateObject); +494 var year = String(d.getFullYear()); +495 if (type == 'utc') year = year.substr(2, 2); +496 var month = pad(String(d.getMonth() + 1), 2); +497 var day = pad(String(d.getDate()), 2); +498 var hour = pad(String(d.getHours()), 2); +499 var min = pad(String(d.getMinutes()), 2); +500 var sec = pad(String(d.getSeconds()), 2); +501 var s = year + month + day + hour + min + sec; +502 if (withMillis === true) { +503 var millis = d.getMilliseconds(); +504 if (millis != 0) { +505 var sMillis = pad(String(millis), 3); +506 sMillis = sMillis.replace(/[0]+$/, ""); +507 s = s + "." + sMillis; +508 } +509 } +510 return s + "Z"; +511 }; +512 +513 this.zeroPadding = function(s, len) { +514 if (s.length >= len) return s; +515 return new Array(len - s.length + 1).join('0') + s; +516 }; +517 +518 // --- PUBLIC METHODS -------------------- +519 /** +520 * get string value of this string object +521 * @name getString +522 * @memberOf KJUR.asn1.DERAbstractTime +523 * @function +524 * @return {String} string value of this time object +525 */ +526 this.getString = function() { +527 return this.s; +528 }; +529 +530 /** +531 * set value by a string +532 * @name setString +533 * @memberOf KJUR.asn1.DERAbstractTime +534 * @function +535 * @param {String} newS value by a string to set such like "130430235959Z" +536 */ +537 this.setString = function(newS) { +538 this.hTLV = null; +539 this.isModified = true; +540 this.s = newS; +541 this.hV = stohex(newS); +542 }; +543 +544 /** +545 * set value by a Date object +546 * @name setByDateValue +547 * @memberOf KJUR.asn1.DERAbstractTime +548 * @function +549 * @param {Integer} year year of date (ex. 2013) +550 * @param {Integer} month month of date between 1 and 12 (ex. 12) +551 * @param {Integer} day day of month +552 * @param {Integer} hour hours of date +553 * @param {Integer} min minutes of date +554 * @param {Integer} sec seconds of date +555 */ +556 this.setByDateValue = function(year, month, day, hour, min, sec) { +557 var dateObject = new Date(Date.UTC(year, month - 1, day, hour, min, sec, 0)); +558 this.setByDate(dateObject); +559 }; +560 +561 this.getFreshValueHex = function() { +562 return this.hV; +563 }; +564 }; +565 YAHOO.lang.extend(KJUR.asn1.DERAbstractTime, KJUR.asn1.ASN1Object); +566 // == END DERAbstractTime ================================================== +567 +568 // == BEGIN DERAbstractStructured ============================================ +569 /** +570 * base class for ASN.1 DER structured class +571 * @name KJUR.asn1.DERAbstractStructured +572 * @class base class for ASN.1 DER structured class +573 * @property {Array} asn1Array internal array of ASN1Object +574 * @extends KJUR.asn1.ASN1Object +575 * @description +576 * @see KJUR.asn1.ASN1Object - superclass +577 */ +578 KJUR.asn1.DERAbstractStructured = function(params) { +579 KJUR.asn1.DERAbstractString.superclass.constructor.call(this); +580 var asn1Array = null; +581 +582 /** +583 * set value by array of ASN1Object +584 * @name setByASN1ObjectArray +585 * @memberOf KJUR.asn1.DERAbstractStructured +586 * @function +587 * @param {array} asn1ObjectArray array of ASN1Object to set +588 */ +589 this.setByASN1ObjectArray = function(asn1ObjectArray) { +590 this.hTLV = null; +591 this.isModified = true; +592 this.asn1Array = asn1ObjectArray; +593 }; +594 +595 /** +596 * append an ASN1Object to internal array +597 * @name appendASN1Object +598 * @memberOf KJUR.asn1.DERAbstractStructured +599 * @function +600 * @param {ASN1Object} asn1Object to add +601 */ +602 this.appendASN1Object = function(asn1Object) { +603 this.hTLV = null; +604 this.isModified = true; +605 this.asn1Array.push(asn1Object); +606 }; +607 +608 this.asn1Array = new Array(); +609 if (typeof params != "undefined") { +610 if (typeof params['array'] != "undefined") { +611 this.asn1Array = params['array']; +612 } +613 } +614 }; +615 YAHOO.lang.extend(KJUR.asn1.DERAbstractStructured, KJUR.asn1.ASN1Object); +616 +617 +618 // ******************************************************************** +619 // ASN.1 Object Classes +620 // ******************************************************************** +621 +622 // ******************************************************************** +623 /** +624 * class for ASN.1 DER Boolean +625 * @name KJUR.asn1.DERBoolean +626 * @class class for ASN.1 DER Boolean +627 * @extends KJUR.asn1.ASN1Object +628 * @description +629 * @see KJUR.asn1.ASN1Object - superclass +630 */ +631 KJUR.asn1.DERBoolean = function() { +632 KJUR.asn1.DERBoolean.superclass.constructor.call(this); +633 this.hT = "01"; +634 this.hTLV = "0101ff"; +635 }; +636 YAHOO.lang.extend(KJUR.asn1.DERBoolean, KJUR.asn1.ASN1Object); +637 +638 // ******************************************************************** +639 /** +640 * class for ASN.1 DER Integer +641 * @name KJUR.asn1.DERInteger +642 * @class class for ASN.1 DER Integer +643 * @extends KJUR.asn1.ASN1Object +644 * @description +645 * <br/> +646 * As for argument 'params' for constructor, you can specify one of +647 * following properties: +648 * <ul> +649 * <li>int - specify initial ASN.1 value(V) by integer value</li> +650 * <li>bigint - specify initial ASN.1 value(V) by BigInteger object</li> +651 * <li>hex - specify initial ASN.1 value(V) by a hexadecimal string</li> +652 * </ul> +653 * NOTE: 'params' can be omitted. +654 */ +655 KJUR.asn1.DERInteger = function(params) { +656 KJUR.asn1.DERInteger.superclass.constructor.call(this); +657 this.hT = "02"; +658 +659 /** +660 * set value by Tom Wu's BigInteger object +661 * @name setByBigInteger +662 * @memberOf KJUR.asn1.DERInteger +663 * @function +664 * @param {BigInteger} bigIntegerValue to set +665 */ +666 this.setByBigInteger = function(bigIntegerValue) { +667 this.hTLV = null; +668 this.isModified = true; +669 this.hV = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(bigIntegerValue); +670 }; +671 +672 /** +673 * set value by integer value +674 * @name setByInteger +675 * @memberOf KJUR.asn1.DERInteger +676 * @function +677 * @param {Integer} integer value to set +678 */ +679 this.setByInteger = function(intValue) { +680 var bi = new BigInteger(String(intValue), 10); +681 this.setByBigInteger(bi); +682 }; +683 +684 /** +685 * set value by integer value +686 * @name setValueHex +687 * @memberOf KJUR.asn1.DERInteger +688 * @function +689 * @param {String} hexadecimal string of integer value +690 * @description +691 * <br/> +692 * NOTE: Value shall be represented by minimum octet length of +693 * two's complement representation. +694 * @example +695 * new KJUR.asn1.DERInteger(123); +696 * new KJUR.asn1.DERInteger({'int': 123}); +697 * new KJUR.asn1.DERInteger({'hex': '1fad'}); +698 */ +699 this.setValueHex = function(newHexString) { +700 this.hV = newHexString; +701 }; +702 +703 this.getFreshValueHex = function() { +704 return this.hV; +705 }; +706 +707 if (typeof params != "undefined") { +708 if (typeof params['bigint'] != "undefined") { +709 this.setByBigInteger(params['bigint']); +710 } else if (typeof params['int'] != "undefined") { +711 this.setByInteger(params['int']); +712 } else if (typeof params == "number") { +713 this.setByInteger(params); +714 } else if (typeof params['hex'] != "undefined") { +715 this.setValueHex(params['hex']); +716 } +717 } +718 }; +719 YAHOO.lang.extend(KJUR.asn1.DERInteger, KJUR.asn1.ASN1Object); +720 +721 // ******************************************************************** +722 /** +723 * class for ASN.1 DER encoded BitString primitive +724 * @name KJUR.asn1.DERBitString +725 * @class class for ASN.1 DER encoded BitString primitive +726 * @extends KJUR.asn1.ASN1Object +727 * @description +728 * <br/> +729 * As for argument 'params' for constructor, you can specify one of +730 * following properties: +731 * <ul> +732 * <li>bin - specify binary string (ex. '10111')</li> +733 * <li>array - specify array of boolean (ex. [true,false,true,true])</li> +734 * <li>hex - specify hexadecimal string of ASN.1 value(V) including unused bits</li> +735 * </ul> +736 * NOTE: 'params' can be omitted. +737 */ +738 KJUR.asn1.DERBitString = function(params) { +739 KJUR.asn1.DERBitString.superclass.constructor.call(this); +740 this.hT = "03"; +741 +742 /** +743 * set ASN.1 value(V) by a hexadecimal string including unused bits +744 * @name setHexValueIncludingUnusedBits +745 * @memberOf KJUR.asn1.DERBitString +746 * @function +747 * @param {String} newHexStringIncludingUnusedBits +748 */ +749 this.setHexValueIncludingUnusedBits = function(newHexStringIncludingUnusedBits) { +750 this.hTLV = null; +751 this.isModified = true; +752 this.hV = newHexStringIncludingUnusedBits; +753 }; +754 +755 /** +756 * set ASN.1 value(V) by unused bit and hexadecimal string of value +757 * @name setUnusedBitsAndHexValue +758 * @memberOf KJUR.asn1.DERBitString +759 * @function +760 * @param {Integer} unusedBits +761 * @param {String} hValue +762 */ +763 this.setUnusedBitsAndHexValue = function(unusedBits, hValue) { +764 if (unusedBits < 0 || 7 < unusedBits) { +765 throw "unused bits shall be from 0 to 7: u = " + unusedBits; +766 } +767 var hUnusedBits = "0" + unusedBits; +768 this.hTLV = null; +769 this.isModified = true; +770 this.hV = hUnusedBits + hValue; +771 }; +772 +773 /** +774 * set ASN.1 DER BitString by binary string +775 * @name setByBinaryString +776 * @memberOf KJUR.asn1.DERBitString +777 * @function +778 * @param {String} binaryString binary value string (i.e. '10111') +779 * @description +780 * Its unused bits will be calculated automatically by length of +781 * 'binaryValue'. <br/> +782 * NOTE: Trailing zeros '0' will be ignored. +783 */ +784 this.setByBinaryString = function(binaryString) { +785 binaryString = binaryString.replace(/0+$/, ''); +786 var unusedBits = 8 - binaryString.length % 8; +787 if (unusedBits == 8) unusedBits = 0; +788 for (var i = 0; i <= unusedBits; i++) { +789 binaryString += '0'; +790 } +791 var h = ''; +792 for (var i = 0; i < binaryString.length - 1; i += 8) { +793 var b = binaryString.substr(i, 8); +794 var x = parseInt(b, 2).toString(16); +795 if (x.length == 1) x = '0' + x; +796 h += x; +797 } +798 this.hTLV = null; +799 this.isModified = true; +800 this.hV = '0' + unusedBits + h; +801 }; +802 +803 /** +804 * set ASN.1 TLV value(V) by an array of boolean +805 * @name setByBooleanArray +806 * @memberOf KJUR.asn1.DERBitString +807 * @function +808 * @param {array} booleanArray array of boolean (ex. [true, false, true]) +809 * @description +810 * NOTE: Trailing falses will be ignored. +811 */ +812 this.setByBooleanArray = function(booleanArray) { +813 var s = ''; +814 for (var i = 0; i < booleanArray.length; i++) { +815 if (booleanArray[i] == true) { +816 s += '1'; +817 } else { +818 s += '0'; +819 } +820 } +821 this.setByBinaryString(s); +822 }; +823 +824 /** +825 * generate an array of false with specified length +826 * @name newFalseArray +827 * @memberOf KJUR.asn1.DERBitString +828 * @function +829 * @param {Integer} nLength length of array to generate +830 * @return {array} array of boolean faluse +831 * @description +832 * This static method may be useful to initialize boolean array. +833 */ +834 this.newFalseArray = function(nLength) { +835 var a = new Array(nLength); +836 for (var i = 0; i < nLength; i++) { +837 a[i] = false; +838 } +839 return a; +840 }; +841 +842 this.getFreshValueHex = function() { +843 return this.hV; +844 }; +845 +846 if (typeof params != "undefined") { +847 if (typeof params == "string" && params.toLowerCase().match(/^[0-9a-f]+$/)) { +848 this.setHexValueIncludingUnusedBits(params); +849 } else if (typeof params['hex'] != "undefined") { +850 this.setHexValueIncludingUnusedBits(params['hex']); +851 } else if (typeof params['bin'] != "undefined") { +852 this.setByBinaryString(params['bin']); +853 } else if (typeof params['array'] != "undefined") { +854 this.setByBooleanArray(params['array']); +855 } +856 } +857 }; +858 YAHOO.lang.extend(KJUR.asn1.DERBitString, KJUR.asn1.ASN1Object); +859 +860 // ******************************************************************** +861 /** +862 * class for ASN.1 DER OctetString +863 * @name KJUR.asn1.DEROctetString +864 * @class class for ASN.1 DER OctetString +865 * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) +866 * @extends KJUR.asn1.DERAbstractString +867 * @description +868 * @see KJUR.asn1.DERAbstractString - superclass +869 */ +870 KJUR.asn1.DEROctetString = function(params) { +871 KJUR.asn1.DEROctetString.superclass.constructor.call(this, params); +872 this.hT = "04"; +873 }; +874 YAHOO.lang.extend(KJUR.asn1.DEROctetString, KJUR.asn1.DERAbstractString); +875 +876 // ******************************************************************** +877 /** +878 * class for ASN.1 DER Null +879 * @name KJUR.asn1.DERNull +880 * @class class for ASN.1 DER Null +881 * @extends KJUR.asn1.ASN1Object +882 * @description +883 * @see KJUR.asn1.ASN1Object - superclass +884 */ +885 KJUR.asn1.DERNull = function() { +886 KJUR.asn1.DERNull.superclass.constructor.call(this); +887 this.hT = "05"; +888 this.hTLV = "0500"; +889 }; +890 YAHOO.lang.extend(KJUR.asn1.DERNull, KJUR.asn1.ASN1Object); +891 +892 // ******************************************************************** +893 /** +894 * class for ASN.1 DER ObjectIdentifier +895 * @name KJUR.asn1.DERObjectIdentifier +896 * @class class for ASN.1 DER ObjectIdentifier +897 * @param {Array} params associative array of parameters (ex. {'oid': '2.5.4.5'}) +898 * @extends KJUR.asn1.ASN1Object +899 * @description +900 * <br/> +901 * As for argument 'params' for constructor, you can specify one of +902 * following properties: +903 * <ul> +904 * <li>oid - specify initial ASN.1 value(V) by a oid string (ex. 2.5.4.13)</li> +905 * <li>hex - specify initial ASN.1 value(V) by a hexadecimal string</li> +906 * </ul> +907 * NOTE: 'params' can be omitted. +908 */ +909 KJUR.asn1.DERObjectIdentifier = function(params) { +910 var itox = function(i) { +911 var h = i.toString(16); +912 if (h.length == 1) h = '0' + h; +913 return h; +914 }; +915 var roidtox = function(roid) { +916 var h = ''; +917 var bi = new BigInteger(roid, 10); +918 var b = bi.toString(2); +919 var padLen = 7 - b.length % 7; +920 if (padLen == 7) padLen = 0; +921 var bPad = ''; +922 for (var i = 0; i < padLen; i++) bPad += '0'; +923 b = bPad + b; +924 for (var i = 0; i < b.length - 1; i += 7) { +925 var b8 = b.substr(i, 7); +926 if (i != b.length - 7) b8 = '1' + b8; +927 h += itox(parseInt(b8, 2)); +928 } +929 return h; +930 } 931 -932 /** -933 * set value by a hexadecimal string -934 * @name setValueHex -935 * @memberOf KJUR.asn1.DERObjectIdentifier -936 * @function -937 * @param {String} newHexString hexadecimal value of OID bytes -938 */ -939 this.setValueHex = function(newHexString) { -940 this.hTLV = null; -941 this.isModified = true; -942 this.s = null; -943 this.hV = newHexString; -944 }; -945 -946 /** -947 * set value by a OID string -948 * @name setValueOidString -949 * @memberOf KJUR.asn1.DERObjectIdentifier -950 * @function -951 * @param {String} oidString OID string (ex. 2.5.4.13) -952 */ -953 this.setValueOidString = function(oidString) { -954 if (! oidString.match(/^[0-9.]+$/)) { -955 throw "malformed oid string: " + oidString; -956 } -957 var h = ''; -958 var a = oidString.split('.'); -959 var i0 = parseInt(a[0]) * 40 + parseInt(a[1]); -960 h += itox(i0); -961 a.splice(0, 2); -962 for (var i = 0; i < a.length; i++) { -963 h += roidtox(a[i]); -964 } -965 this.hTLV = null; -966 this.isModified = true; -967 this.s = null; -968 this.hV = h; -969 }; -970 -971 /** -972 * set value by a OID name -973 * @name setValueName -974 * @memberOf KJUR.asn1.DERObjectIdentifier -975 * @function -976 * @param {String} oidName OID name (ex. 'serverAuth') -977 * @since 1.0.1 -978 * @description -979 * OID name shall be defined in 'KJUR.asn1.x509.OID.name2oidList'. -980 * Otherwise raise error. -981 */ -982 this.setValueName = function(oidName) { -983 if (typeof KJUR.asn1.x509.OID.name2oidList[oidName] != "undefined") { -984 var oid = KJUR.asn1.x509.OID.name2oidList[oidName]; -985 this.setValueOidString(oid); -986 } else { -987 throw "DERObjectIdentifier oidName undefined: " + oidName; -988 } -989 }; -990 -991 this.getFreshValueHex = function() { -992 return this.hV; -993 }; -994 -995 if (typeof params != "undefined") { -996 if (typeof params == "string" && params.match(/^[0-2].[0-9.]+$/)) { -997 this.setValueOidString(params); -998 } else if (KJUR.asn1.x509.OID.name2oidList[params] !== undefined) { -999 this.setValueOidString(KJUR.asn1.x509.OID.name2oidList[params]); -1000 } else if (typeof params['oid'] != "undefined") { -1001 this.setValueOidString(params['oid']); -1002 } else if (typeof params['hex'] != "undefined") { -1003 this.setValueHex(params['hex']); -1004 } else if (typeof params['name'] != "undefined") { -1005 this.setValueName(params['name']); -1006 } -1007 } -1008 }; -1009 YAHOO.lang.extend(KJUR.asn1.DERObjectIdentifier, KJUR.asn1.ASN1Object); -1010 -1011 // ******************************************************************** -1012 /** -1013 * class for ASN.1 DER UTF8String -1014 * @name KJUR.asn1.DERUTF8String -1015 * @class class for ASN.1 DER UTF8String -1016 * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) -1017 * @extends KJUR.asn1.DERAbstractString -1018 * @description -1019 * @see KJUR.asn1.DERAbstractString - superclass -1020 */ -1021 KJUR.asn1.DERUTF8String = function(params) { -1022 KJUR.asn1.DERUTF8String.superclass.constructor.call(this, params); -1023 this.hT = "0c"; -1024 }; -1025 YAHOO.lang.extend(KJUR.asn1.DERUTF8String, KJUR.asn1.DERAbstractString); -1026 -1027 // ******************************************************************** -1028 /** -1029 * class for ASN.1 DER NumericString -1030 * @name KJUR.asn1.DERNumericString -1031 * @class class for ASN.1 DER NumericString -1032 * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) -1033 * @extends KJUR.asn1.DERAbstractString -1034 * @description -1035 * @see KJUR.asn1.DERAbstractString - superclass -1036 */ -1037 KJUR.asn1.DERNumericString = function(params) { -1038 KJUR.asn1.DERNumericString.superclass.constructor.call(this, params); -1039 this.hT = "12"; -1040 }; -1041 YAHOO.lang.extend(KJUR.asn1.DERNumericString, KJUR.asn1.DERAbstractString); -1042 -1043 // ******************************************************************** -1044 /** -1045 * class for ASN.1 DER PrintableString -1046 * @name KJUR.asn1.DERPrintableString -1047 * @class class for ASN.1 DER PrintableString -1048 * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) -1049 * @extends KJUR.asn1.DERAbstractString -1050 * @description -1051 * @see KJUR.asn1.DERAbstractString - superclass -1052 */ -1053 KJUR.asn1.DERPrintableString = function(params) { -1054 KJUR.asn1.DERPrintableString.superclass.constructor.call(this, params); -1055 this.hT = "13"; -1056 }; -1057 YAHOO.lang.extend(KJUR.asn1.DERPrintableString, KJUR.asn1.DERAbstractString); +932 KJUR.asn1.DERObjectIdentifier.superclass.constructor.call(this); +933 this.hT = "06"; +934 +935 /** +936 * set value by a hexadecimal string +937 * @name setValueHex +938 * @memberOf KJUR.asn1.DERObjectIdentifier +939 * @function +940 * @param {String} newHexString hexadecimal value of OID bytes +941 */ +942 this.setValueHex = function(newHexString) { +943 this.hTLV = null; +944 this.isModified = true; +945 this.s = null; +946 this.hV = newHexString; +947 }; +948 +949 /** +950 * set value by a OID string +951 * @name setValueOidString +952 * @memberOf KJUR.asn1.DERObjectIdentifier +953 * @function +954 * @param {String} oidString OID string (ex. 2.5.4.13) +955 */ +956 this.setValueOidString = function(oidString) { +957 if (! oidString.match(/^[0-9.]+$/)) { +958 throw "malformed oid string: " + oidString; +959 } +960 var h = ''; +961 var a = oidString.split('.'); +962 var i0 = parseInt(a[0]) * 40 + parseInt(a[1]); +963 h += itox(i0); +964 a.splice(0, 2); +965 for (var i = 0; i < a.length; i++) { +966 h += roidtox(a[i]); +967 } +968 this.hTLV = null; +969 this.isModified = true; +970 this.s = null; +971 this.hV = h; +972 }; +973 +974 /** +975 * set value by a OID name +976 * @name setValueName +977 * @memberOf KJUR.asn1.DERObjectIdentifier +978 * @function +979 * @param {String} oidName OID name (ex. 'serverAuth') +980 * @since 1.0.1 +981 * @description +982 * OID name shall be defined in 'KJUR.asn1.x509.OID.name2oidList'. +983 * Otherwise raise error. +984 */ +985 this.setValueName = function(oidName) { +986 if (typeof KJUR.asn1.x509.OID.name2oidList[oidName] != "undefined") { +987 var oid = KJUR.asn1.x509.OID.name2oidList[oidName]; +988 this.setValueOidString(oid); +989 } else { +990 throw "DERObjectIdentifier oidName undefined: " + oidName; +991 } +992 }; +993 +994 this.getFreshValueHex = function() { +995 return this.hV; +996 }; +997 +998 if (typeof params != "undefined") { +999 if (typeof params == "string" && params.match(/^[0-2].[0-9.]+$/)) { +1000 this.setValueOidString(params); +1001 } else if (KJUR.asn1.x509.OID.name2oidList[params] !== undefined) { +1002 this.setValueOidString(KJUR.asn1.x509.OID.name2oidList[params]); +1003 } else if (typeof params['oid'] != "undefined") { +1004 this.setValueOidString(params['oid']); +1005 } else if (typeof params['hex'] != "undefined") { +1006 this.setValueHex(params['hex']); +1007 } else if (typeof params['name'] != "undefined") { +1008 this.setValueName(params['name']); +1009 } +1010 } +1011 }; +1012 YAHOO.lang.extend(KJUR.asn1.DERObjectIdentifier, KJUR.asn1.ASN1Object); +1013 +1014 // ******************************************************************** +1015 /** +1016 * class for ASN.1 DER Enumerated +1017 * @name KJUR.asn1.DEREnumerated +1018 * @class class for ASN.1 DER Enumerated +1019 * @extends KJUR.asn1.ASN1Object +1020 * @description +1021 * <br/> +1022 * As for argument 'params' for constructor, you can specify one of +1023 * following properties: +1024 * <ul> +1025 * <li>int - specify initial ASN.1 value(V) by integer value</li> +1026 * <li>hex - specify initial ASN.1 value(V) by a hexadecimal string</li> +1027 * </ul> +1028 * NOTE: 'params' can be omitted. +1029 */ +1030 KJUR.asn1.DEREnumerated = function(params) { +1031 KJUR.asn1.DEREnumerated.superclass.constructor.call(this); +1032 this.hT = "0a"; +1033 +1034 /** +1035 * set value by Tom Wu's BigInteger object +1036 * @name setByBigInteger +1037 * @memberOf KJUR.asn1.DEREnumerated +1038 * @function +1039 * @param {BigInteger} bigIntegerValue to set +1040 */ +1041 this.setByBigInteger = function(bigIntegerValue) { +1042 this.hTLV = null; +1043 this.isModified = true; +1044 this.hV = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(bigIntegerValue); +1045 }; +1046 +1047 /** +1048 * set value by integer value +1049 * @name setByInteger +1050 * @memberOf KJUR.asn1.DEREnumerated +1051 * @function +1052 * @param {Integer} integer value to set +1053 */ +1054 this.setByInteger = function(intValue) { +1055 var bi = new BigInteger(String(intValue), 10); +1056 this.setByBigInteger(bi); +1057 }; 1058 -1059 // ******************************************************************** -1060 /** -1061 * class for ASN.1 DER TeletexString -1062 * @name KJUR.asn1.DERTeletexString -1063 * @class class for ASN.1 DER TeletexString -1064 * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) -1065 * @extends KJUR.asn1.DERAbstractString -1066 * @description -1067 * @see KJUR.asn1.DERAbstractString - superclass -1068 */ -1069 KJUR.asn1.DERTeletexString = function(params) { -1070 KJUR.asn1.DERTeletexString.superclass.constructor.call(this, params); -1071 this.hT = "14"; -1072 }; -1073 YAHOO.lang.extend(KJUR.asn1.DERTeletexString, KJUR.asn1.DERAbstractString); -1074 -1075 // ******************************************************************** -1076 /** -1077 * class for ASN.1 DER IA5String -1078 * @name KJUR.asn1.DERIA5String -1079 * @class class for ASN.1 DER IA5String -1080 * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) -1081 * @extends KJUR.asn1.DERAbstractString -1082 * @description -1083 * @see KJUR.asn1.DERAbstractString - superclass -1084 */ -1085 KJUR.asn1.DERIA5String = function(params) { -1086 KJUR.asn1.DERIA5String.superclass.constructor.call(this, params); -1087 this.hT = "16"; -1088 }; -1089 YAHOO.lang.extend(KJUR.asn1.DERIA5String, KJUR.asn1.DERAbstractString); -1090 -1091 // ******************************************************************** -1092 /** -1093 * class for ASN.1 DER UTCTime -1094 * @name KJUR.asn1.DERUTCTime -1095 * @class class for ASN.1 DER UTCTime -1096 * @param {Array} params associative array of parameters (ex. {'str': '130430235959Z'}) -1097 * @extends KJUR.asn1.DERAbstractTime -1098 * @description -1099 * <br/> -1100 * As for argument 'params' for constructor, you can specify one of -1101 * following properties: -1102 * <ul> -1103 * <li>str - specify initial ASN.1 value(V) by a string (ex.'130430235959Z')</li> -1104 * <li>hex - specify initial ASN.1 value(V) by a hexadecimal string</li> -1105 * <li>date - specify Date object.</li> -1106 * </ul> -1107 * NOTE: 'params' can be omitted. -1108 * <h4>EXAMPLES</h4> -1109 * @example -1110 * var d1 = new KJUR.asn1.DERUTCTime(); -1111 * d1.setString('130430125959Z'); -1112 * -1113 * var d2 = new KJUR.asn1.DERUTCTime({'str': '130430125959Z'}); -1114 * var d3 = new KJUR.asn1.DERUTCTime({'date': new Date(Date.UTC(2015, 0, 31, 0, 0, 0, 0))}); -1115 * var d4 = new KJUR.asn1.DERUTCTime('130430125959Z'); -1116 */ -1117 KJUR.asn1.DERUTCTime = function(params) { -1118 KJUR.asn1.DERUTCTime.superclass.constructor.call(this, params); -1119 this.hT = "17"; -1120 -1121 /** -1122 * set value by a Date object -1123 * @name setByDate -1124 * @memberOf KJUR.asn1.DERUTCTime -1125 * @function -1126 * @param {Date} dateObject Date object to set ASN.1 value(V) -1127 */ -1128 this.setByDate = function(dateObject) { -1129 this.hTLV = null; -1130 this.isModified = true; -1131 this.date = dateObject; -1132 this.s = this.formatDate(this.date, 'utc'); -1133 this.hV = stohex(this.s); -1134 }; -1135 -1136 this.getFreshValueHex = function() { -1137 if (typeof this.date == "undefined" && typeof this.s == "undefined") { -1138 this.date = new Date(); -1139 this.s = this.formatDate(this.date, 'utc'); -1140 this.hV = stohex(this.s); -1141 } -1142 return this.hV; -1143 }; -1144 -1145 if (typeof params != "undefined") { -1146 if (typeof params['str'] != "undefined") { -1147 this.setString(params['str']); -1148 } else if (typeof params == "string" && params.match(/^[0-9]{12}Z$/)) { -1149 this.setString(params); -1150 } else if (typeof params['hex'] != "undefined") { -1151 this.setStringHex(params['hex']); -1152 } else if (typeof params['date'] != "undefined") { -1153 this.setByDate(params['date']); -1154 } -1155 } -1156 }; -1157 YAHOO.lang.extend(KJUR.asn1.DERUTCTime, KJUR.asn1.DERAbstractTime); -1158 -1159 // ******************************************************************** -1160 /** -1161 * class for ASN.1 DER GeneralizedTime -1162 * @name KJUR.asn1.DERGeneralizedTime -1163 * @class class for ASN.1 DER GeneralizedTime -1164 * @param {Array} params associative array of parameters (ex. {'str': '20130430235959Z'}) -1165 * @property {Boolean} withMillis flag to show milliseconds or not -1166 * @extends KJUR.asn1.DERAbstractTime -1167 * @description -1168 * <br/> -1169 * As for argument 'params' for constructor, you can specify one of -1170 * following properties: -1171 * <ul> -1172 * <li>str - specify initial ASN.1 value(V) by a string (ex.'20130430235959Z')</li> -1173 * <li>hex - specify initial ASN.1 value(V) by a hexadecimal string</li> -1174 * <li>date - specify Date object.</li> -1175 * <li>millis - specify flag to show milliseconds (from 1.0.6)</li> -1176 * </ul> -1177 * NOTE1: 'params' can be omitted. -1178 * NOTE2: 'withMillis' property is supported from asn1 1.0.6. -1179 */ -1180 KJUR.asn1.DERGeneralizedTime = function(params) { -1181 KJUR.asn1.DERGeneralizedTime.superclass.constructor.call(this, params); -1182 this.hT = "18"; -1183 this.withMillis = false; -1184 -1185 /** -1186 * set value by a Date object -1187 * @name setByDate -1188 * @memberOf KJUR.asn1.DERGeneralizedTime -1189 * @function -1190 * @param {Date} dateObject Date object to set ASN.1 value(V) -1191 * @example -1192 * When you specify UTC time, use 'Date.UTC' method like this:<br/> -1193 * var o = new DERUTCTime(); -1194 * var date = new Date(Date.UTC(2015, 0, 31, 23, 59, 59, 0)); #2015JAN31 23:59:59 -1195 * o.setByDate(date); -1196 */ -1197 this.setByDate = function(dateObject) { -1198 this.hTLV = null; -1199 this.isModified = true; -1200 this.date = dateObject; -1201 this.s = this.formatDate(this.date, 'gen', this.withMillis); -1202 this.hV = stohex(this.s); -1203 }; -1204 -1205 this.getFreshValueHex = function() { -1206 if (typeof this.date == "undefined" && typeof this.s == "undefined") { -1207 this.date = new Date(); -1208 this.s = this.formatDate(this.date, 'gen', this.withMillis); -1209 this.hV = stohex(this.s); -1210 } -1211 return this.hV; -1212 }; -1213 -1214 if (typeof params != "undefined") { -1215 if (typeof params['str'] != "undefined") { -1216 this.setString(params['str']); -1217 } else if (typeof params == "string" && params.match(/^[0-9]{14}Z$/)) { -1218 this.setString(params); -1219 } else if (typeof params['hex'] != "undefined") { -1220 this.setStringHex(params['hex']); -1221 } else if (typeof params['date'] != "undefined") { -1222 this.setByDate(params['date']); -1223 } else if (params.millis === true) { -1224 this.withMillis = true; -1225 } -1226 } -1227 }; -1228 YAHOO.lang.extend(KJUR.asn1.DERGeneralizedTime, KJUR.asn1.DERAbstractTime); -1229 -1230 // ******************************************************************** -1231 /** -1232 * class for ASN.1 DER Sequence -1233 * @name KJUR.asn1.DERSequence -1234 * @class class for ASN.1 DER Sequence -1235 * @extends KJUR.asn1.DERAbstractStructured -1236 * @description -1237 * <br/> -1238 * As for argument 'params' for constructor, you can specify one of -1239 * following properties: -1240 * <ul> -1241 * <li>array - specify array of ASN1Object to set elements of content</li> -1242 * </ul> -1243 * NOTE: 'params' can be omitted. -1244 */ -1245 KJUR.asn1.DERSequence = function(params) { -1246 KJUR.asn1.DERSequence.superclass.constructor.call(this, params); -1247 this.hT = "30"; -1248 this.getFreshValueHex = function() { -1249 var h = ''; -1250 for (var i = 0; i < this.asn1Array.length; i++) { -1251 var asn1Obj = this.asn1Array[i]; -1252 h += asn1Obj.getEncodedHex(); -1253 } -1254 this.hV = h; -1255 return this.hV; -1256 }; -1257 }; -1258 YAHOO.lang.extend(KJUR.asn1.DERSequence, KJUR.asn1.DERAbstractStructured); -1259 -1260 // ******************************************************************** -1261 /** -1262 * class for ASN.1 DER Set -1263 * @name KJUR.asn1.DERSet -1264 * @class class for ASN.1 DER Set -1265 * @extends KJUR.asn1.DERAbstractStructured -1266 * @description -1267 * <br/> -1268 * As for argument 'params' for constructor, you can specify one of -1269 * following properties: -1270 * <ul> -1271 * <li>array - specify array of ASN1Object to set elements of content</li> -1272 * <li>sortflag - flag for sort (default: true). ASN.1 BER is not sorted in 'SET OF'.</li> -1273 * </ul> -1274 * NOTE1: 'params' can be omitted.<br/> -1275 * NOTE2: sortflag is supported since 1.0.5. -1276 */ -1277 KJUR.asn1.DERSet = function(params) { -1278 KJUR.asn1.DERSet.superclass.constructor.call(this, params); -1279 this.hT = "31"; -1280 this.sortFlag = true; // item shall be sorted only in ASN.1 DER -1281 this.getFreshValueHex = function() { -1282 var a = new Array(); -1283 for (var i = 0; i < this.asn1Array.length; i++) { -1284 var asn1Obj = this.asn1Array[i]; -1285 a.push(asn1Obj.getEncodedHex()); -1286 } -1287 if (this.sortFlag == true) a.sort(); -1288 this.hV = a.join(''); -1289 return this.hV; -1290 }; -1291 -1292 if (typeof params != "undefined") { -1293 if (typeof params.sortflag != "undefined" && -1294 params.sortflag == false) -1295 this.sortFlag = false; -1296 } -1297 }; -1298 YAHOO.lang.extend(KJUR.asn1.DERSet, KJUR.asn1.DERAbstractStructured); -1299 -1300 // ******************************************************************** -1301 /** -1302 * class for ASN.1 DER TaggedObject -1303 * @name KJUR.asn1.DERTaggedObject -1304 * @class class for ASN.1 DER TaggedObject -1305 * @extends KJUR.asn1.ASN1Object -1306 * @description -1307 * <br/> -1308 * Parameter 'tagNoNex' is ASN.1 tag(T) value for this object. -1309 * For example, if you find '[1]' tag in a ASN.1 dump, -1310 * 'tagNoHex' will be 'a1'. -1311 * <br/> -1312 * As for optional argument 'params' for constructor, you can specify *ANY* of -1313 * following properties: -1314 * <ul> -1315 * <li>explicit - specify true if this is explicit tag otherwise false -1316 * (default is 'true').</li> -1317 * <li>tag - specify tag (default is 'a0' which means [0])</li> -1318 * <li>obj - specify ASN1Object which is tagged</li> -1319 * </ul> -1320 * @example -1321 * d1 = new KJUR.asn1.DERUTF8String({'str':'a'}); -1322 * d2 = new KJUR.asn1.DERTaggedObject({'obj': d1}); -1323 * hex = d2.getEncodedHex(); -1324 */ -1325 KJUR.asn1.DERTaggedObject = function(params) { -1326 KJUR.asn1.DERTaggedObject.superclass.constructor.call(this); -1327 this.hT = "a0"; -1328 this.hV = ''; -1329 this.isExplicit = true; -1330 this.asn1Object = null; -1331 -1332 /** -1333 * set value by an ASN1Object -1334 * @name setString -1335 * @memberOf KJUR.asn1.DERTaggedObject -1336 * @function -1337 * @param {Boolean} isExplicitFlag flag for explicit/implicit tag -1338 * @param {Integer} tagNoHex hexadecimal string of ASN.1 tag -1339 * @param {ASN1Object} asn1Object ASN.1 to encapsulate -1340 */ -1341 this.setASN1Object = function(isExplicitFlag, tagNoHex, asn1Object) { -1342 this.hT = tagNoHex; -1343 this.isExplicit = isExplicitFlag; -1344 this.asn1Object = asn1Object; -1345 if (this.isExplicit) { -1346 this.hV = this.asn1Object.getEncodedHex(); -1347 this.hTLV = null; -1348 this.isModified = true; -1349 } else { -1350 this.hV = null; -1351 this.hTLV = asn1Object.getEncodedHex(); -1352 this.hTLV = this.hTLV.replace(/^../, tagNoHex); -1353 this.isModified = false; -1354 } -1355 }; -1356 -1357 this.getFreshValueHex = function() { -1358 return this.hV; -1359 }; -1360 -1361 if (typeof params != "undefined") { -1362 if (typeof params['tag'] != "undefined") { -1363 this.hT = params['tag']; -1364 } -1365 if (typeof params['explicit'] != "undefined") { -1366 this.isExplicit = params['explicit']; -1367 } -1368 if (typeof params['obj'] != "undefined") { -1369 this.asn1Object = params['obj']; -1370 this.setASN1Object(this.isExplicit, this.hT, this.asn1Object); -1371 } -1372 } -1373 }; -1374 YAHOO.lang.extend(KJUR.asn1.DERTaggedObject, KJUR.asn1.ASN1Object); -1375 \ No newline at end of file +1059 /** +1060 * set value by integer value +1061 * @name setValueHex +1062 * @memberOf KJUR.asn1.DEREnumerated +1063 * @function +1064 * @param {String} hexadecimal string of integer value +1065 * @description +1066 * <br/> +1067 * NOTE: Value shall be represented by minimum octet length of +1068 * two's complement representation. +1069 * @example +1070 * new KJUR.asn1.DEREnumerated(123); +1071 * new KJUR.asn1.DEREnumerated({'int': 123}); +1072 * new KJUR.asn1.DEREnumerated({'hex': '1fad'}); +1073 */ +1074 this.setValueHex = function(newHexString) { +1075 this.hV = newHexString; +1076 }; +1077 +1078 this.getFreshValueHex = function() { +1079 return this.hV; +1080 }; +1081 +1082 if (typeof params != "undefined") { +1083 if (typeof params['int'] != "undefined") { +1084 this.setByInteger(params['int']); +1085 } else if (typeof params == "number") { +1086 this.setByInteger(params); +1087 } else if (typeof params['hex'] != "undefined") { +1088 this.setValueHex(params['hex']); +1089 } +1090 } +1091 }; +1092 YAHOO.lang.extend(KJUR.asn1.DEREnumerated, KJUR.asn1.ASN1Object); +1093 +1094 // ******************************************************************** +1095 /** +1096 * class for ASN.1 DER UTF8String +1097 * @name KJUR.asn1.DERUTF8String +1098 * @class class for ASN.1 DER UTF8String +1099 * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) +1100 * @extends KJUR.asn1.DERAbstractString +1101 * @description +1102 * @see KJUR.asn1.DERAbstractString - superclass +1103 */ +1104 KJUR.asn1.DERUTF8String = function(params) { +1105 KJUR.asn1.DERUTF8String.superclass.constructor.call(this, params); +1106 this.hT = "0c"; +1107 }; +1108 YAHOO.lang.extend(KJUR.asn1.DERUTF8String, KJUR.asn1.DERAbstractString); +1109 +1110 // ******************************************************************** +1111 /** +1112 * class for ASN.1 DER NumericString +1113 * @name KJUR.asn1.DERNumericString +1114 * @class class for ASN.1 DER NumericString +1115 * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) +1116 * @extends KJUR.asn1.DERAbstractString +1117 * @description +1118 * @see KJUR.asn1.DERAbstractString - superclass +1119 */ +1120 KJUR.asn1.DERNumericString = function(params) { +1121 KJUR.asn1.DERNumericString.superclass.constructor.call(this, params); +1122 this.hT = "12"; +1123 }; +1124 YAHOO.lang.extend(KJUR.asn1.DERNumericString, KJUR.asn1.DERAbstractString); +1125 +1126 // ******************************************************************** +1127 /** +1128 * class for ASN.1 DER PrintableString +1129 * @name KJUR.asn1.DERPrintableString +1130 * @class class for ASN.1 DER PrintableString +1131 * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) +1132 * @extends KJUR.asn1.DERAbstractString +1133 * @description +1134 * @see KJUR.asn1.DERAbstractString - superclass +1135 */ +1136 KJUR.asn1.DERPrintableString = function(params) { +1137 KJUR.asn1.DERPrintableString.superclass.constructor.call(this, params); +1138 this.hT = "13"; +1139 }; +1140 YAHOO.lang.extend(KJUR.asn1.DERPrintableString, KJUR.asn1.DERAbstractString); +1141 +1142 // ******************************************************************** +1143 /** +1144 * class for ASN.1 DER TeletexString +1145 * @name KJUR.asn1.DERTeletexString +1146 * @class class for ASN.1 DER TeletexString +1147 * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) +1148 * @extends KJUR.asn1.DERAbstractString +1149 * @description +1150 * @see KJUR.asn1.DERAbstractString - superclass +1151 */ +1152 KJUR.asn1.DERTeletexString = function(params) { +1153 KJUR.asn1.DERTeletexString.superclass.constructor.call(this, params); +1154 this.hT = "14"; +1155 }; +1156 YAHOO.lang.extend(KJUR.asn1.DERTeletexString, KJUR.asn1.DERAbstractString); +1157 +1158 // ******************************************************************** +1159 /** +1160 * class for ASN.1 DER IA5String +1161 * @name KJUR.asn1.DERIA5String +1162 * @class class for ASN.1 DER IA5String +1163 * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) +1164 * @extends KJUR.asn1.DERAbstractString +1165 * @description +1166 * @see KJUR.asn1.DERAbstractString - superclass +1167 */ +1168 KJUR.asn1.DERIA5String = function(params) { +1169 KJUR.asn1.DERIA5String.superclass.constructor.call(this, params); +1170 this.hT = "16"; +1171 }; +1172 YAHOO.lang.extend(KJUR.asn1.DERIA5String, KJUR.asn1.DERAbstractString); +1173 +1174 // ******************************************************************** +1175 /** +1176 * class for ASN.1 DER UTCTime +1177 * @name KJUR.asn1.DERUTCTime +1178 * @class class for ASN.1 DER UTCTime +1179 * @param {Array} params associative array of parameters (ex. {'str': '130430235959Z'}) +1180 * @extends KJUR.asn1.DERAbstractTime +1181 * @description +1182 * <br/> +1183 * As for argument 'params' for constructor, you can specify one of +1184 * following properties: +1185 * <ul> +1186 * <li>str - specify initial ASN.1 value(V) by a string (ex.'130430235959Z')</li> +1187 * <li>hex - specify initial ASN.1 value(V) by a hexadecimal string</li> +1188 * <li>date - specify Date object.</li> +1189 * </ul> +1190 * NOTE: 'params' can be omitted. +1191 * <h4>EXAMPLES</h4> +1192 * @example +1193 * var d1 = new KJUR.asn1.DERUTCTime(); +1194 * d1.setString('130430125959Z'); +1195 * +1196 * var d2 = new KJUR.asn1.DERUTCTime({'str': '130430125959Z'}); +1197 * var d3 = new KJUR.asn1.DERUTCTime({'date': new Date(Date.UTC(2015, 0, 31, 0, 0, 0, 0))}); +1198 * var d4 = new KJUR.asn1.DERUTCTime('130430125959Z'); +1199 */ +1200 KJUR.asn1.DERUTCTime = function(params) { +1201 KJUR.asn1.DERUTCTime.superclass.constructor.call(this, params); +1202 this.hT = "17"; +1203 +1204 /** +1205 * set value by a Date object +1206 * @name setByDate +1207 * @memberOf KJUR.asn1.DERUTCTime +1208 * @function +1209 * @param {Date} dateObject Date object to set ASN.1 value(V) +1210 */ +1211 this.setByDate = function(dateObject) { +1212 this.hTLV = null; +1213 this.isModified = true; +1214 this.date = dateObject; +1215 this.s = this.formatDate(this.date, 'utc'); +1216 this.hV = stohex(this.s); +1217 }; +1218 +1219 this.getFreshValueHex = function() { +1220 if (typeof this.date == "undefined" && typeof this.s == "undefined") { +1221 this.date = new Date(); +1222 this.s = this.formatDate(this.date, 'utc'); +1223 this.hV = stohex(this.s); +1224 } +1225 return this.hV; +1226 }; +1227 +1228 if (typeof params != "undefined") { +1229 if (typeof params['str'] != "undefined") { +1230 this.setString(params['str']); +1231 } else if (typeof params == "string" && params.match(/^[0-9]{12}Z$/)) { +1232 this.setString(params); +1233 } else if (typeof params['hex'] != "undefined") { +1234 this.setStringHex(params['hex']); +1235 } else if (typeof params['date'] != "undefined") { +1236 this.setByDate(params['date']); +1237 } +1238 } +1239 }; +1240 YAHOO.lang.extend(KJUR.asn1.DERUTCTime, KJUR.asn1.DERAbstractTime); +1241 +1242 // ******************************************************************** +1243 /** +1244 * class for ASN.1 DER GeneralizedTime +1245 * @name KJUR.asn1.DERGeneralizedTime +1246 * @class class for ASN.1 DER GeneralizedTime +1247 * @param {Array} params associative array of parameters (ex. {'str': '20130430235959Z'}) +1248 * @property {Boolean} withMillis flag to show milliseconds or not +1249 * @extends KJUR.asn1.DERAbstractTime +1250 * @description +1251 * <br/> +1252 * As for argument 'params' for constructor, you can specify one of +1253 * following properties: +1254 * <ul> +1255 * <li>str - specify initial ASN.1 value(V) by a string (ex.'20130430235959Z')</li> +1256 * <li>hex - specify initial ASN.1 value(V) by a hexadecimal string</li> +1257 * <li>date - specify Date object.</li> +1258 * <li>millis - specify flag to show milliseconds (from 1.0.6)</li> +1259 * </ul> +1260 * NOTE1: 'params' can be omitted. +1261 * NOTE2: 'withMillis' property is supported from asn1 1.0.6. +1262 */ +1263 KJUR.asn1.DERGeneralizedTime = function(params) { +1264 KJUR.asn1.DERGeneralizedTime.superclass.constructor.call(this, params); +1265 this.hT = "18"; +1266 this.withMillis = false; +1267 +1268 /** +1269 * set value by a Date object +1270 * @name setByDate +1271 * @memberOf KJUR.asn1.DERGeneralizedTime +1272 * @function +1273 * @param {Date} dateObject Date object to set ASN.1 value(V) +1274 * @example +1275 * When you specify UTC time, use 'Date.UTC' method like this:<br/> +1276 * var o = new DERUTCTime(); +1277 * var date = new Date(Date.UTC(2015, 0, 31, 23, 59, 59, 0)); #2015JAN31 23:59:59 +1278 * o.setByDate(date); +1279 */ +1280 this.setByDate = function(dateObject) { +1281 this.hTLV = null; +1282 this.isModified = true; +1283 this.date = dateObject; +1284 this.s = this.formatDate(this.date, 'gen', this.withMillis); +1285 this.hV = stohex(this.s); +1286 }; +1287 +1288 this.getFreshValueHex = function() { +1289 if (typeof this.date == "undefined" && typeof this.s == "undefined") { +1290 this.date = new Date(); +1291 this.s = this.formatDate(this.date, 'gen', this.withMillis); +1292 this.hV = stohex(this.s); +1293 } +1294 return this.hV; +1295 }; +1296 +1297 if (typeof params != "undefined") { +1298 if (typeof params['str'] != "undefined") { +1299 this.setString(params['str']); +1300 } else if (typeof params == "string" && params.match(/^[0-9]{14}Z$/)) { +1301 this.setString(params); +1302 } else if (typeof params['hex'] != "undefined") { +1303 this.setStringHex(params['hex']); +1304 } else if (typeof params['date'] != "undefined") { +1305 this.setByDate(params['date']); +1306 } else if (params.millis === true) { +1307 this.withMillis = true; +1308 } +1309 } +1310 }; +1311 YAHOO.lang.extend(KJUR.asn1.DERGeneralizedTime, KJUR.asn1.DERAbstractTime); +1312 +1313 // ******************************************************************** +1314 /** +1315 * class for ASN.1 DER Sequence +1316 * @name KJUR.asn1.DERSequence +1317 * @class class for ASN.1 DER Sequence +1318 * @extends KJUR.asn1.DERAbstractStructured +1319 * @description +1320 * <br/> +1321 * As for argument 'params' for constructor, you can specify one of +1322 * following properties: +1323 * <ul> +1324 * <li>array - specify array of ASN1Object to set elements of content</li> +1325 * </ul> +1326 * NOTE: 'params' can be omitted. +1327 */ +1328 KJUR.asn1.DERSequence = function(params) { +1329 KJUR.asn1.DERSequence.superclass.constructor.call(this, params); +1330 this.hT = "30"; +1331 this.getFreshValueHex = function() { +1332 var h = ''; +1333 for (var i = 0; i < this.asn1Array.length; i++) { +1334 var asn1Obj = this.asn1Array[i]; +1335 h += asn1Obj.getEncodedHex(); +1336 } +1337 this.hV = h; +1338 return this.hV; +1339 }; +1340 }; +1341 YAHOO.lang.extend(KJUR.asn1.DERSequence, KJUR.asn1.DERAbstractStructured); +1342 +1343 // ******************************************************************** +1344 /** +1345 * class for ASN.1 DER Set +1346 * @name KJUR.asn1.DERSet +1347 * @class class for ASN.1 DER Set +1348 * @extends KJUR.asn1.DERAbstractStructured +1349 * @description +1350 * <br/> +1351 * As for argument 'params' for constructor, you can specify one of +1352 * following properties: +1353 * <ul> +1354 * <li>array - specify array of ASN1Object to set elements of content</li> +1355 * <li>sortflag - flag for sort (default: true). ASN.1 BER is not sorted in 'SET OF'.</li> +1356 * </ul> +1357 * NOTE1: 'params' can be omitted.<br/> +1358 * NOTE2: sortflag is supported since 1.0.5. +1359 */ +1360 KJUR.asn1.DERSet = function(params) { +1361 KJUR.asn1.DERSet.superclass.constructor.call(this, params); +1362 this.hT = "31"; +1363 this.sortFlag = true; // item shall be sorted only in ASN.1 DER +1364 this.getFreshValueHex = function() { +1365 var a = new Array(); +1366 for (var i = 0; i < this.asn1Array.length; i++) { +1367 var asn1Obj = this.asn1Array[i]; +1368 a.push(asn1Obj.getEncodedHex()); +1369 } +1370 if (this.sortFlag == true) a.sort(); +1371 this.hV = a.join(''); +1372 return this.hV; +1373 }; +1374 +1375 if (typeof params != "undefined") { +1376 if (typeof params.sortflag != "undefined" && +1377 params.sortflag == false) +1378 this.sortFlag = false; +1379 } +1380 }; +1381 YAHOO.lang.extend(KJUR.asn1.DERSet, KJUR.asn1.DERAbstractStructured); +1382 +1383 // ******************************************************************** +1384 /** +1385 * class for ASN.1 DER TaggedObject +1386 * @name KJUR.asn1.DERTaggedObject +1387 * @class class for ASN.1 DER TaggedObject +1388 * @extends KJUR.asn1.ASN1Object +1389 * @description +1390 * <br/> +1391 * Parameter 'tagNoNex' is ASN.1 tag(T) value for this object. +1392 * For example, if you find '[1]' tag in a ASN.1 dump, +1393 * 'tagNoHex' will be 'a1'. +1394 * <br/> +1395 * As for optional argument 'params' for constructor, you can specify *ANY* of +1396 * following properties: +1397 * <ul> +1398 * <li>explicit - specify true if this is explicit tag otherwise false +1399 * (default is 'true').</li> +1400 * <li>tag - specify tag (default is 'a0' which means [0])</li> +1401 * <li>obj - specify ASN1Object which is tagged</li> +1402 * </ul> +1403 * @example +1404 * d1 = new KJUR.asn1.DERUTF8String({'str':'a'}); +1405 * d2 = new KJUR.asn1.DERTaggedObject({'obj': d1}); +1406 * hex = d2.getEncodedHex(); +1407 */ +1408 KJUR.asn1.DERTaggedObject = function(params) { +1409 KJUR.asn1.DERTaggedObject.superclass.constructor.call(this); +1410 this.hT = "a0"; +1411 this.hV = ''; +1412 this.isExplicit = true; +1413 this.asn1Object = null; +1414 +1415 /** +1416 * set value by an ASN1Object +1417 * @name setString +1418 * @memberOf KJUR.asn1.DERTaggedObject +1419 * @function +1420 * @param {Boolean} isExplicitFlag flag for explicit/implicit tag +1421 * @param {Integer} tagNoHex hexadecimal string of ASN.1 tag +1422 * @param {ASN1Object} asn1Object ASN.1 to encapsulate +1423 */ +1424 this.setASN1Object = function(isExplicitFlag, tagNoHex, asn1Object) { +1425 this.hT = tagNoHex; +1426 this.isExplicit = isExplicitFlag; +1427 this.asn1Object = asn1Object; +1428 if (this.isExplicit) { +1429 this.hV = this.asn1Object.getEncodedHex(); +1430 this.hTLV = null; +1431 this.isModified = true; +1432 } else { +1433 this.hV = null; +1434 this.hTLV = asn1Object.getEncodedHex(); +1435 this.hTLV = this.hTLV.replace(/^../, tagNoHex); +1436 this.isModified = false; +1437 } +1438 }; +1439 +1440 this.getFreshValueHex = function() { +1441 return this.hV; +1442 }; +1443 +1444 if (typeof params != "undefined") { +1445 if (typeof params['tag'] != "undefined") { +1446 this.hT = params['tag']; +1447 } +1448 if (typeof params['explicit'] != "undefined") { +1449 this.isExplicit = params['explicit']; +1450 } +1451 if (typeof params['obj'] != "undefined") { +1452 this.asn1Object = params['obj']; +1453 this.setASN1Object(this.isExplicit, this.hT, this.asn1Object); +1454 } +1455 } +1456 }; +1457 YAHOO.lang.extend(KJUR.asn1.DERTaggedObject, KJUR.asn1.ASN1Object); +1458 \ No newline at end of file diff --git a/api/symbols/src/asn1cades-1.0.js.html b/api/symbols/src/asn1cades-1.0.js.html new file mode 100755 index 00000000..549fe727 --- /dev/null +++ b/api/symbols/src/asn1cades-1.0.js.html @@ -0,0 +1,783 @@ +
      1 /*! asn1cades-1.0.0.js (c) 2013-2014 Kenji Urushima | kjur.github.com/jsrsasign/license
    +  2  */
    +  3 /*
    +  4  * asn1cades.js - ASN.1 DER encoder classes for RFC 5126 CAdES long term signature
    +  5  *
    +  6  * Copyright (c) 2014 Kenji Urushima (kenji.urushima@gmail.com)
    +  7  *
    +  8  * This software is licensed under the terms of the MIT License.
    +  9  * http://kjur.github.com/jsrsasign/license
    + 10  *
    + 11  * The above copyright and license notice shall be 
    + 12  * included in all copies or substantial portions of the Software.
    + 13  */
    + 14 
    + 15 /**
    + 16  * @fileOverview
    + 17  * @name asn1cades-1.0.js
    + 18  * @author Kenji Urushima kenji.urushima@gmail.com
    + 19  * @version 1.0.0 (2014-May-28)
    + 20  * @since jsrsasign 4.7.0
    + 21  * @license <a href="http://kjur.github.io/jsrsasign/license/">MIT License</a>
    + 22  */
    + 23 
    + 24 /** 
    + 25  * kjur's class library name space
    + 26  * // already documented in asn1-1.0.js
    + 27  * @name KJUR
    + 28  * @namespace kjur's class library name space
    + 29  */
    + 30 if (typeof KJUR == "undefined" || !KJUR) KJUR = {};
    + 31 
    + 32 /**
    + 33  * kjur's ASN.1 class library name space
    + 34  * // already documented in asn1-1.0.js
    + 35  * @name KJUR.asn1
    + 36  * @namespace
    + 37  */
    + 38 if (typeof KJUR.asn1 == "undefined" || !KJUR.asn1) KJUR.asn1 = {};
    + 39 
    + 40 /**
    + 41  * kjur's ASN.1 class for RFC 5126 CAdES long term signature
    + 42  * <p>
    + 43  * This name space provides 
    + 44  * <a href="https://tools.ietf.org/html/rfc5126">RFC 5126
    + 45  * CAdES(CMS Advanced Electronic Signature)</a> generator.
    + 46  *
    + 47  * <h4>SUPPORTED FORMATS</h4>
    + 48  * Following CAdES formats is supported by this library.
    + 49  * <ul>
    + 50  * <li>CAdES-BES - CAdES Basic Electronic Signature</li>
    + 51  * <li>CAdES-EPES - CAdES Explicit Policy-based Electronic Signature</li>
    + 52  * <li>CAdES-T - Electronic Signature with Time</li>
    + 53  * </ul>
    + 54  * </p>
    + 55  *
    + 56  * <h4>PROVIDED ATTRIBUTE CLASSES</h4>
    + 57  * <ul>
    + 58  * <li>{@link KJUR.asn1.cades.SignaturePolicyIdentifier} - for CAdES-EPES</li>
    + 59  * <li>{@link KJUR.asn1.cades.SignatureTimeStamp} - for CAdES-T</li>
    + 60  * <li>{@link KJUR.asn1.cades.CompleteCertificateRefs} - for CAdES-C(for future use)</li>
    + 61  * </ul>
    + 62  * NOTE: Currntly CAdES-C is not supported since parser can't
    + 63  * handle unsigned attribute.
    + 64  * 
    + 65  * <h4>OTHER CLASSES</h4>
    + 66  * <ul>
    + 67  * <li>{@link KJUR.asn1.cades.OtherHashAlgAndValue}</li>
    + 68  * <li>{@link KJUR.asn1.cades.OtherHash}</li>
    + 69  * <li>{@link KJUR.asn1.cades.OtherCertID}</li>
    + 70  * <li>{@link KJUR.asn1.cades.CAdESUtil} - utilities for CAdES</li>
    + 71  * </ul>
    + 72  *
    + 73  * <h4>GENERATE CAdES-BES</h4>
    + 74  * To generate CAdES-BES, {@link KJUR.asn.cades} namespace 
    + 75  * classes are not required and already {@link KJUR.asn.cms} namespace 
    + 76  * provides attributes for CAdES-BES.
    + 77  * Create {@link KJUR.asn1.cms.SignedData} with following
    + 78  * mandatory attribute in CAdES-BES:
    + 79  * <ul>
    + 80  * <li>{@link KJUR.asn1.cms.ContentType}</li>
    + 81  * <li>{@link KJUR.asn1.cms.MessageDigest}</li>
    + 82  * <li>{@link KJUR.asn1.cms.SigningCertificate} or </li>
    + 83  * <li>{@link KJUR.asn1.cms.SigningCertificateV2}</li>
    + 84  * </ul>
    + 85  * CMSUtil.newSignedData method is very useful to generate CAdES-BES.
    + 86  * <pre>
    + 87  * sd = KJUR.asn1.cms.CMSUtil.newSignedData({
    + 88  *   content: {str: "aaa"},
    + 89  *   certs: [certPEM],
    + 90  *   signerInfos: [{
    + 91  *     hashAlg: 'sha256',
    + 92  *     sAttr: {SigningCertificateV2: {array: [certPEM]}},
    + 93  *     signerCert: certPEM,
    + 94  *     sigAlg: 'SHA256withRSA',
    + 95  *     signerPrvKey: pkcs8PrvKeyPEM
    + 96  *   }]
    + 97  * });
    + 98  * signedDataHex = sd.getContentInfoEncodedHex();
    + 99  * </pre>
    +100  * NOTE: ContentType and MessageDigest signed attributes
    +101  * are automatically added by default.
    +102  *
    +103  * <h4>GENERATE CAdES-BES with multiple signers</h4>
    +104  * If you need signature by multiple signers, you can 
    +105  * specify one or more items in 'signerInfos' property as below.
    +106  * <pre>
    +107  * sd = KJUR.asn1.cms.CMSUtil.newSignedData({
    +108  *   content: {str: "aaa"},
    +109  *   certs: [certPEM1, certPEM2],
    +110  *   signerInfos: [{
    +111  *     hashAlg: 'sha256',
    +112  *     sAttr: {SigningCertificateV2: {array: [certPEM1]}},
    +113  *     signerCert: certPEM1,
    +114  *     sigAlg: 'SHA256withRSA',
    +115  *     signerPrvKey: pkcs8PrvKeyPEM1
    +116  *   },{
    +117  *     hashAlg: 'sha1',
    +118  *     sAttr: {SigningCertificateV2: {array: [certPEM2]}},
    +119  *     signerCert: certPEM2,
    +120  *     sigAlg: 'SHA1withRSA',
    +121  *     signerPrvKey: pkcs8PrvKeyPEM2
    +122  *   }]
    +123  * });
    +124  * signedDataHex = sd.getContentInfoEncodedHex();
    +125  * </pre>
    +126  *
    +127  * <h4>GENERATE CAdES-EPES</h4>
    +128  * When you need a CAdES-EPES signature,
    +129  * you just need to add 'SignaturePolicyIdentifier'
    +130  * attribute as below.
    +131  * <pre>
    +132  * sd = KJUR.asn1.cms.CMSUtil.newSignedData({
    +133  *   content: {str: "aaa"},
    +134  *   certs: [certPEM],
    +135  *   signerInfos: [{
    +136  *     hashAlg: 'sha256',
    +137  *     sAttr: {
    +138  *       SigningCertificateV2: {array: [certPEM]},
    +139  *       SignaturePolicyIdentifier: {
    +140  *         oid: '1.2.3.4.5',
    +141  *         hash: {alg: 'sha1', hash: 'b1b2b3b4b...'}
    +142  *       },
    +143  *     },
    +144  *     signerCert: certPEM,
    +145  *     sigAlg: 'SHA256withRSA',
    +146  *     signerPrvKey: pkcs8PrvKeyPEM
    +147  *   }]
    +148  * });
    +149  * signedDataHex = sd.getContentInfoEncodedHex();
    +150  * </pre>
    +151  *
    +152  * <h4>GENERATE CAdES-T</h4>
    +153  * After a signed CAdES-BES or CAdES-EPES signature have been generated,
    +154  * you can generate CAdES-T by adding SigningTimeStamp unsigned attribute.
    +155  * <pre>
    +156  * beshex = "30..."; // hex of CAdES-BES or EPES data 
    +157  * info = KJUR.asn1.cades.CAdESUtil.parseSignedDataForAddingUnsigned(beshex);
    +158  * // You can refer a hexadecimal string of signature value 
    +159  * // in the first signerInfo in the CAdES-BES/EPES with a variable:
    +160  * // 'info.si[0].sigval'. You need to get RFC 3161 TimeStampToken
    +161  * // from a trusted time stamp authority. Otherwise you can also 
    +162  * // get it by 'KJUR.asn1.tsp' module. We suppose that we could 
    +163  * // get proper time stamp.
    +164  * tsthex0 = "30..."; // hex of TimeStampToken for signerInfo[0] sigval
    +165  * si0 = info.obj.signerInfoList[0];
    +166  * si0.addUnsigned(new KJUR.asn1.cades.SignatureTimeStamp({tst: tsthex0});
    +167  * esthex = info.obj.getContentInfoEncodedHex(); // CAdES-T
    +168  * </pre>
    +169  * </p>
    +170  *
    +171  * <h4>SAMPLE CODES</h4>
    +172  * <ul>
    +173  * <li><a href="../../tool_cades.html">demo program for CAdES-BES/EPES/T generation</a></li>
    +174  * <li><a href="../../test/qunit-do-asn1cades.html">Unit test code for KJUR.asn1.cades package</a></li>
    +175  * <li><a href="../../test/qunit-do-asn1tsp.html">Unit test code for KJUR.asn1.tsp package (See SimpleTSAAdaptor test)</a></li>
    +176  * <li><a href="../../test/qunit-do-asn1cms.html">Unit test code for KJUR.asn1.cms package (See newSignedData test)</a></li>
    +177  * </ul>
    +178  * 
    +179  * @name KJUR.asn1.cades
    +180  * @namespace
    +181  */
    +182 if (typeof KJUR.asn1.cades == "undefined" || !KJUR.asn1.cades) KJUR.asn1.cades = {};
    +183 
    +184 /**
    +185  * class for RFC 5126 CAdES SignaturePolicyIdentifier attribute
    +186  * @name KJUR.asn1.cades.SignaturePolicyIdentifier
    +187  * @class class for RFC 5126 CAdES SignaturePolicyIdentifier attribute
    +188  * @param {Array} params associative array of parameters
    +189  * @extends KJUR.asn1.cms.Attribute
    +190  * @since jsrsasign 4.7.0 asn1cades 1.0.0
    +191  * @description
    +192  * <pre>
    +193  * SignaturePolicyIdentifier ::= CHOICE {
    +194  *    signaturePolicyId       SignaturePolicyId,
    +195  *    signaturePolicyImplied  SignaturePolicyImplied } -- not used
    +196  *
    +197  * SignaturePolicyImplied ::= NULL
    +198  * SignaturePolicyId ::= SEQUENCE {
    +199  *    sigPolicyId           SigPolicyId,
    +200  *    sigPolicyHash         SigPolicyHash,
    +201  *    sigPolicyQualifiers   SEQUENCE SIZE (1..MAX) OF
    +202  *                             SigPolicyQualifierInfo OPTIONAL }
    +203  * SigPolicyId ::= OBJECT IDENTIFIER
    +204  * SigPolicyHash ::= OtherHashAlgAndValue
    +205  * </pre>
    +206  * @example
    +207  * var o = new KJUR.asn1.cades.SignaturePolicyIdentifier({
    +208  *   oid: '1.2.3.4.5',
    +209  *   hash: {alg: 'sha1', hash: 'a1a2a3a4...'}
    +210  * });
    +211  */
    +212 /*
    +213  * id-aa-ets-sigPolicyId OBJECT IDENTIFIER ::= { iso(1)
    +214  *    member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9)
    +215  *    smime(16) id-aa(2) 15 }
    +216  *
    +217  * signature-policy-identifier attribute values have ASN.1 type
    +218  * SignaturePolicyIdentifier:
    +219  *
    +220  * SigPolicyQualifierInfo ::= SEQUENCE {
    +221  *    sigPolicyQualifierId  SigPolicyQualifierId,
    +222  *    sigQualifier          ANY DEFINED BY sigPolicyQualifierId } 
    +223  *
    +224  * sigpolicyQualifierIds defined in the present document:
    +225  * SigPolicyQualifierId ::= OBJECT IDENTIFIER
    +226  * id-spq-ets-uri OBJECT IDENTIFIER ::= { iso(1)
    +227  *    member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9)
    +228  *    smime(16) id-spq(5) 1 }
    +229  *
    +230  * SPuri ::= IA5String
    +231  *
    +232  * id-spq-ets-unotice OBJECT IDENTIFIER ::= { iso(1)
    +233  *    member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9)
    +234  *    smime(16) id-spq(5) 2 }
    +235  *
    +236  * SPUserNotice ::= SEQUENCE {
    +237  *    noticeRef        NoticeReference OPTIONAL,
    +238  *    explicitText     DisplayText OPTIONAL}
    +239  *
    +240  * NoticeReference ::= SEQUENCE {
    +241  *    organization     DisplayText,
    +242  *    noticeNumbers    SEQUENCE OF INTEGER }
    +243  *
    +244  * DisplayText ::= CHOICE {
    +245  *    visibleString    VisibleString  (SIZE (1..200)),
    +246  *    bmpString        BMPString      (SIZE (1..200)),
    +247  *    utf8String       UTF8String     (SIZE (1..200)) }
    +248  */
    +249 KJUR.asn1.cades.SignaturePolicyIdentifier = function(params) {
    +250     KJUR.asn1.cades.SignaturePolicyIdentifier.superclass.constructor.call(this);
    +251     this.attrTypeOid = "1.2.840.113549.1.9.16.2.15";
    +252     var nA = KJUR.asn1;
    +253     var nC = KJUR.asn1.cades;
    +254 
    +255     if (typeof params != "undefined") {
    +256         if (typeof params.oid == "string" &&
    +257             typeof params.hash == "object") {
    +258             var dOid = new nA.DERObjectIdentifier({oid: params.oid});
    +259             var dHash = new nC.OtherHashAlgAndValue(params.hash);
    +260             var seq = new nA.DERSequence({array: [dOid, dHash]});
    +261             this.valueList = [seq];
    +262         }
    +263     }
    +264 };
    +265 YAHOO.lang.extend(KJUR.asn1.cades.SignaturePolicyIdentifier,
    +266                   KJUR.asn1.cms.Attribute);
    +267 
    +268 /**
    +269  * class for OtherHashAlgAndValue ASN.1 object
    +270  * @name KJUR.asn1.cades.OtherHashAlgAndValue
    +271  * @class class for OtherHashAlgAndValue ASN.1 object
    +272  * @param {Array} params associative array of parameters
    +273  * @extends KJUR.asn1.ASN1Object
    +274  * @since jsrsasign 4.7.0 asn1cades 1.0.0
    +275  * @description
    +276  * <pre>
    +277  * OtherHashAlgAndValue ::= SEQUENCE {
    +278  *    hashAlgorithm   AlgorithmIdentifier,
    +279  *    hashValue       OtherHashValue }
    +280  * OtherHashValue ::= OCTET STRING
    +281  * </pre>
    +282  */
    +283 KJUR.asn1.cades.OtherHashAlgAndValue = function(params) {
    +284     KJUR.asn1.cades.OtherHashAlgAndValue.superclass.constructor.call(this);
    +285     var nA = KJUR.asn1;
    +286     var nX = KJUR.asn1.x509;
    +287     this.dAlg = null;
    +288     this.dHash = null;
    +289 
    +290     this.getEncodedHex = function() {
    +291         var seq = new nA.DERSequence({array: [this.dAlg, this.dHash]});
    +292         this.hTLV = seq.getEncodedHex();
    +293         return this.hTLV;
    +294     };
    +295 
    +296     if (typeof params != "undefined") {
    +297         if (typeof params.alg == "string" &&
    +298             typeof params.hash == "string") {
    +299             this.dAlg = new nX.AlgorithmIdentifier({name: params.alg});
    +300             this.dHash = new nA.DEROctetString({hex: params.hash});
    +301         }
    +302     }
    +303 };
    +304 YAHOO.lang.extend(KJUR.asn1.cades.OtherHashAlgAndValue, KJUR.asn1.ASN1Object);
    +305 
    +306 /**
    +307  * class for RFC 5126 CAdES SignatureTimeStamp attribute
    +308  * @name KJUR.asn1.cades.SignatureTimeStamp
    +309  * @class class for RFC 5126 CAdES SignatureTimeStamp attribute
    +310  * @param {Array} params associative array of parameters
    +311  * @extends KJUR.asn1.cms.Attribute
    +312  * @since jsrsasign 4.7.0 asn1cades 1.0.0
    +313  * @description
    +314  * <pre>
    +315  * id-aa-signatureTimeStampToken OBJECT IDENTIFIER ::=
    +316  *    1.2.840.113549.1.9.16.2.14
    +317  * SignatureTimeStampToken ::= TimeStampToken
    +318  * </pre>
    +319  */
    +320 KJUR.asn1.cades.SignatureTimeStamp = function(params) {
    +321     KJUR.asn1.cades.SignatureTimeStamp.superclass.constructor.call(this);
    +322     this.attrTypeOid = "1.2.840.113549.1.9.16.2.14";
    +323     this.tstHex = null;
    +324     var nA = KJUR.asn1;
    +325 
    +326     if (typeof params != "undefined") {
    +327         if (typeof params.res != "undefined") {
    +328             if (typeof params.res == "string" &&
    +329                 params.res.match(/^[0-9A-Fa-f]+$/)) {
    +330             } else if (params.res instanceof KJUR.asn1.ASN1Object) {
    +331             } else {
    +332                 throw "res param shall be ASN1Object or hex string";
    +333             }
    +334         }
    +335         if (typeof params.tst != "undefined") {
    +336             if (typeof params.tst == "string" &&
    +337                 params.tst.match(/^[0-9A-Fa-f]+$/)) {
    +338                 var d = new nA.ASN1Object();
    +339                 this.tstHex = params.tst;
    +340                 d.hTLV = this.tstHex;
    +341                 d.getEncodedHex();
    +342                 this.valueList = [d];
    +343             } else if (params.tst instanceof KJUR.asn1.ASN1Object) {
    +344             } else {
    +345                 throw "tst param shall be ASN1Object or hex string";
    +346             }
    +347         }
    +348     }
    +349 };
    +350 YAHOO.lang.extend(KJUR.asn1.cades.SignatureTimeStamp,
    +351                   KJUR.asn1.cms.Attribute);
    +352 
    +353 /**
    +354  * class for RFC 5126 CAdES CompleteCertificateRefs attribute
    +355  * @name KJUR.asn1.cades.CompleteCertificateRefs
    +356  * @class class for RFC 5126 CAdES CompleteCertificateRefs attribute
    +357  * @param {Array} params associative array of parameters
    +358  * @extends KJUR.asn1.cms.Attribute
    +359  * @since jsrsasign 4.7.0 asn1cades 1.0.0
    +360  * @description
    +361  * <pre>
    +362  * id-aa-ets-certificateRefs OBJECT IDENTIFIER = 
    +363  *    1.2.840.113549.1.9.16.2.21
    +364  * CompleteCertificateRefs ::=  SEQUENCE OF OtherCertID
    +365  * </pre>
    +366  * @example
    +367  * o = new KJUR.asn1.cades.CompleteCertificateRefs([certPEM1,certPEM2]);
    +368  */
    +369 KJUR.asn1.cades.CompleteCertificateRefs = function(params) {
    +370     KJUR.asn1.cades.CompleteCertificateRefs.superclass.constructor.call(this);
    +371     this.attrTypeOid = "1.2.840.113549.1.9.16.2.21";
    +372     var nA = KJUR.asn1;
    +373     var nD = KJUR.asn1.cades;
    +374 
    +375     /**
    +376      * set value by array
    +377      * @name setByArray
    +378      * @memberOf KJUR.asn1.cades.CompleteCertificateRefs
    +379      * @function
    +380      * @param {Array} a array of {@link KJUR.asn1.cades.OtherCertID} argument
    +381      * @return unspecified
    +382      * @description
    +383      */
    +384     this.setByArray = function(a) {
    +385         this.valueList = [];
    +386         for (var i = 0; i < a.length; i++) {
    +387             var o = new nD.OtherCertID(a[i]);
    +388             this.valueList.push(o);
    +389         }
    +390     };
    +391 
    +392     if (typeof params != "undefined") {
    +393         if (typeof params == "object" &&
    +394             typeof params.length == "number") {
    +395             this.setByArray(params);
    +396         }
    +397     }
    +398 };
    +399 YAHOO.lang.extend(KJUR.asn1.cades.CompleteCertificateRefs,
    +400                   KJUR.asn1.cms.Attribute);
    +401 
    +402 /**
    +403  * class for OtherCertID ASN.1 object
    +404  * @name KJUR.asn1.cades.OtherCertID
    +405  * @class class for OtherCertID ASN.1 object
    +406  * @param {Array} params associative array of parameters
    +407  * @extends KJUR.asn1.ASN1Object
    +408  * @since jsrsasign 4.7.0 asn1cades 1.0.0
    +409  * @description
    +410  * <pre>
    +411  * OtherCertID ::= SEQUENCE {
    +412  *    otherCertHash    OtherHash,
    +413  *    issuerSerial     IssuerSerial OPTIONAL }
    +414  * </pre>
    +415  * @example
    +416  * o = new KJUR.asn1.cades.OtherCertID(certPEM);
    +417  * o = new KJUR.asn1.cades.OtherCertID({cert:certPEM, hasis: false});
    +418  */
    +419 KJUR.asn1.cades.OtherCertID = function(params) {
    +420     KJUR.asn1.cades.OtherCertID.superclass.constructor.call(this);
    +421     var nA = KJUR.asn1;
    +422     var nC = KJUR.asn1.cms;
    +423     var nD = KJUR.asn1.cades;
    +424     this.hasIssuerSerial = true;
    +425     this.dOtherCertHash = null;
    +426     this.dIssuerSerial = null;
    +427 
    +428     /**
    +429      * set value by PEM string of certificate
    +430      * @name setByCertPEM
    +431      * @memberOf KJUR.asn1.cades.OtherCertID
    +432      * @function
    +433      * @param {String} certPEM PEM string of certificate
    +434      * @return unspecified
    +435      * @description
    +436      * This method will set value by a PEM string of a certificate.
    +437      * This will add IssuerAndSerialNumber by default 
    +438      * which depends on hasIssuerSerial flag.
    +439      */
    +440     this.setByCertPEM = function(certPEM) {
    +441         this.dOtherCertHash = new nD.OtherHash(certPEM);
    +442         if (this.hasIssuerSerial)
    +443             this.dIssuerSerial = new nC.IssuerAndSerialNumber(certPEM);
    +444     };
    +445 
    +446     this.getEncodedHex = function() {
    +447         if (this.hTLV != null) return this.hTLV;
    +448         if (this.dOtherCertHash == null)
    +449             throw "otherCertHash not set";
    +450         var a = [this.dOtherCertHash];
    +451         if (this.dIssuerSerial != null)
    +452             a.push(this.dIssuerSerial);
    +453         var seq = new nA.DERSequence({array: a});
    +454         this.hTLV = seq.getEncodedHex();
    +455         return this.hTLV;
    +456     };
    +457 
    +458     if (typeof params != "undefined") {
    +459         if (typeof params == "string" &&
    +460             params.indexOf("-----BEGIN ") != -1) {
    +461             this.setByCertPEM(params);
    +462         }
    +463         if (typeof params == "object") {
    +464             if (params.hasis === false)
    +465                 this.hasIssuerSerial = false;
    +466             if (typeof params.cert == "string")
    +467                 this.setByCertPEM(params.cert);
    +468         }
    +469     }
    +470 };
    +471 YAHOO.lang.extend(KJUR.asn1.cades.OtherCertID, KJUR.asn1.ASN1Object);
    +472 
    +473 /**
    +474  * class for OtherHash ASN.1 object
    +475  * @name KJUR.asn1.cades.OtherHash
    +476  * @class class for OtherHash ASN.1 object
    +477  * @param {Array} params associative array of parameters
    +478  * @extends KJUR.asn1.ASN1Object
    +479  * @since jsrsasign 4.7.0 asn1cades 1.0.0
    +480  * @description
    +481  * <pre>
    +482  * OtherHash ::= CHOICE {
    +483  *    sha1Hash   OtherHashValue,  -- This contains a SHA-1 hash
    +484  *    otherHash  OtherHashAlgAndValue}
    +485  * OtherHashValue ::= OCTET STRING
    +486  * </pre>
    +487  * @example
    +488  * o = new KJUR.asn1.cades.OtherHash("1234");
    +489  * o = new KJUR.asn1.cades.OtherHash(certPEMStr); // default alg=sha256
    +490  * o = new KJUR.asn1.cades.OtherHash({alg: 'sha256', hash: '1234'});
    +491  * o = new KJUR.asn1.cades.OtherHash({alg: 'sha256', cert: certPEM});
    +492  * o = new KJUR.asn1.cades.OtherHash({cert: certPEM});
    +493  */
    +494 KJUR.asn1.cades.OtherHash = function(params) {
    +495     KJUR.asn1.cades.OtherHash.superclass.constructor.call(this);
    +496     var nA = KJUR.asn1;
    +497     var nD = KJUR.asn1.cades;
    +498     this.alg = 'sha256';
    +499     this.dOtherHash = null;
    +500 
    +501     /**
    +502      * set value by PEM string of certificate
    +503      * @name setByCertPEM
    +504      * @memberOf KJUR.asn1.cades.OtherHash
    +505      * @function
    +506      * @param {String} certPEM PEM string of certificate
    +507      * @return unspecified
    +508      * @description
    +509      * This method will set value by a PEM string of a certificate.
    +510      * An algorithm used to hash certificate data will
    +511      * be defined by 'alg' property and 'sha256' is default.
    +512      */
    +513     this.setByCertPEM = function(certPEM) {
    +514         if (certPEM.indexOf("-----BEGIN ") == -1)
    +515             throw "certPEM not to seem PEM format";
    +516         var hex = X509.pemToHex(certPEM);
    +517         var hash = KJUR.crypto.Util.hashHex(hex, this.alg);
    +518         this.dOtherHash = 
    +519             new nD.OtherHashAlgAndValue({alg: this.alg, hash: hash});
    +520     };
    +521 
    +522     this.getEncodedHex = function() {
    +523         if (this.dOtherHash == null)
    +524             throw "OtherHash not set";
    +525         return this.dOtherHash.getEncodedHex();
    +526     };
    +527 
    +528     if (typeof params != "undefined") {
    +529         if (typeof params == "string") {
    +530             if (params.indexOf("-----BEGIN ") != -1) {
    +531                 this.setByCertPEM(params);
    +532             } else if (params.match(/^[0-9A-Fa-f]+$/)) {
    +533                 this.dOtherHash = new nA.DEROctetString({hex: params});
    +534             } else {
    +535                 throw "unsupported string value for params";
    +536             }
    +537         } else if (typeof params == "object") {
    +538             if (typeof params.cert == "string") {
    +539                 if (typeof params.alg == "string")
    +540                     this.alg = params.alg;
    +541                 this.setByCertPEM(params.cert);
    +542             } else {
    +543                 this.dOtherHash = new nD.OtherHashAlgAndValue(params);
    +544             }
    +545         }
    +546     }
    +547 };
    +548 YAHOO.lang.extend(KJUR.asn1.cades.OtherHash, KJUR.asn1.ASN1Object);
    +549 
    +550 
    +551 // == BEGIN UTILITIES =====================================================
    +552 
    +553 /**
    +554  * CAdES utiliteis class
    +555  * @name KJUR.asn1.cades.CAdESUtil
    +556  * @class CAdES utilities class
    +557  * @since jsrsasign 4.7.0 asn1cades 1.0.0
    +558  */
    +559 KJUR.asn1.cades.CAdESUtil = new function() {
    +560 };
    +561 /*
    +562  *
    +563  */
    +564 KJUR.asn1.cades.CAdESUtil.addSigTS = function(dCMS, siIdx, sigTSHex) {
    +565 };
    +566 /**
    +567  * parse CMS SignedData to add unsigned attributes
    +568  * @name parseSignedDataForAddingUnsigned
    +569  * @memberOf KJUR.asn1.cades.CAdESUtil
    +570  * @function
    +571  * @param {String} hex hexadecimal string of ContentInfo of CMS SignedData
    +572  * @return {Object} associative array of parsed data
    +573  * @description
    +574  * This method will parse a hexadecimal string of 
    +575  * ContentInfo with CMS SignedData to add a attribute
    +576  * to unsigned attributes field in a signerInfo field.
    +577  * Parsed result will be an associative array which has
    +578  * following properties:
    +579  * <ul>
    +580  * <li>version - hex of CMSVersion ASN.1 TLV</li>
    +581  * <li>algs - hex of DigestAlgorithms ASN.1 TLV</li>
    +582  * <li>encapcontent - hex of EncapContentInfo ASN.1 TLV</li>
    +583  * <li>certs - hex of Certificates ASN.1 TLV</li>
    +584  * <li>revs - hex of RevocationInfoChoices ASN.1 TLV</li>
    +585  * <li>si[] - array of SignerInfo properties</li>
    +586  * <li>obj - parsed KJUR.asn1.cms.SignedData object</li>
    +587  * </ul>
    +588  * @example
    +589  * info = KJUR.asn1.cades.CAdESUtil.parseSignedDataForAddingUnsigned(beshex);
    +590  * sd = info.obj;
    +591  */
    +592 KJUR.asn1.cades.CAdESUtil.parseSignedDataForAddingUnsigned = function(hex) {
    +593     var nA = KJUR.asn1;
    +594     var nC = KJUR.asn1.cms;
    +595     var nU = KJUR.asn1.cades.CAdESUtil;
    +596     var r = {};
    +597 
    +598     // 1. not oid signed-data then error
    +599     if (ASN1HEX.getDecendantHexTLVByNthList(hex, 0, [0]) != 
    +600         "06092a864886f70d010702")
    +601         throw "hex is not CMS SignedData";
    +602 
    +603     var iSD = ASN1HEX.getDecendantIndexByNthList(hex, 0, [1, 0]);
    +604     var aSDChildIdx = ASN1HEX.getPosArrayOfChildren_AtObj(hex, iSD);
    +605     if (aSDChildIdx.length < 4)
    +606         throw "num of SignedData elem shall be 4 at least";
    +607 
    +608     // 2. HEXs of SignedData children
    +609     // 2.1. SignedData.CMSVersion
    +610     var iVersion = aSDChildIdx.shift();
    +611     r.version = ASN1HEX.getHexOfTLV_AtObj(hex, iVersion);
    +612 
    +613     // 2.2. SignedData.DigestAlgorithms
    +614     var iAlgs = aSDChildIdx.shift();
    +615     r.algs = ASN1HEX.getHexOfTLV_AtObj(hex, iAlgs);
    +616 
    +617     // 2.3. SignedData.EncapContentInfo
    +618     var iEncapContent = aSDChildIdx.shift();
    +619     r.encapcontent = ASN1HEX.getHexOfTLV_AtObj(hex, iEncapContent);
    +620 
    +621     // 2.4. [0]Certs 
    +622     r.certs = null;
    +623     r.revs = null;
    +624     r.si = [];
    +625 
    +626     var iNext = aSDChildIdx.shift();
    +627     if (hex.substr(iNext, 2) == "a0") {
    +628         r.certs = ASN1HEX.getHexOfTLV_AtObj(hex, iNext);
    +629         iNext = aSDChildIdx.shift();
    +630     }
    +631 
    +632     // 2.5. [1]Revs
    +633     if (hex.substr(iNext, 2) == "a1") {
    +634         r.revs = ASN1HEX.getHexOfTLV_AtObj(hex, iNext);
    +635         iNext = aSDChildIdx.shift();
    +636     }
    +637 
    +638     // 2.6. SignerInfos
    +639     var iSignerInfos = iNext;
    +640     if (hex.substr(iSignerInfos, 2) != "31")
    +641         throw "Can't find signerInfos";
    +642 
    +643     var aSIIndex = ASN1HEX.getPosArrayOfChildren_AtObj(hex, iSignerInfos);
    +644     //alert(aSIIndex.join("-"));
    +645 
    +646     for (var i = 0; i < aSIIndex.length; i++) {
    +647         var iSI = aSIIndex[i];
    +648         var pSI = nU.parseSignerInfoForAddingUnsigned(hex, iSI, i);
    +649         r.si[i] = pSI;
    +650     }
    +651 
    +652     // x. obj(SignedData)
    +653     var tmp = null;
    +654     r.obj = new nC.SignedData();
    +655 
    +656     tmp = new nA.ASN1Object();
    +657     tmp.hTLV = r.version;
    +658     r.obj.dCMSVersion = tmp;
    +659 
    +660     tmp = new nA.ASN1Object();
    +661     tmp.hTLV = r.algs;
    +662     r.obj.dDigestAlgs = tmp;
    +663 
    +664     tmp = new nA.ASN1Object();
    +665     tmp.hTLV = r.encapcontent;
    +666     r.obj.dEncapContentInfo = tmp;
    +667 
    +668     tmp = new nA.ASN1Object();
    +669     tmp.hTLV = r.certs;
    +670     r.obj.dCerts = tmp;
    +671 
    +672     r.obj.signerInfoList = [];
    +673     for (var i = 0; i < r.si.length; i++) {
    +674         r.obj.signerInfoList.push(r.si[i].obj);
    +675     }
    +676 
    +677     return r;
    +678 };
    +679 
    +680 /**
    +681  * parse SignerInfo to add unsigned attributes
    +682  * @name parseSignerInfoForAddingUnsigned
    +683  * @memberOf KJUR.asn1.cades.CAdESUtil
    +684  * @function
    +685  * @param {String} hex hexadecimal string of SignerInfo
    +686  * @return {Object} associative array of parsed data
    +687  * @description
    +688  * This method will parse a hexadecimal string of 
    +689  * SignerInfo to add a attribute
    +690  * to unsigned attributes field in a signerInfo field.
    +691  * Parsed result will be an associative array which has
    +692  * following properties:
    +693  * <ul>
    +694  * <li>version - hex TLV of version</li>
    +695  * <li>si - hex TLV of SignerIdentifier</li>
    +696  * <li>digalg - hex TLV of DigestAlgorithm</li>
    +697  * <li>sattrs - hex TLV of SignedAttributes</li>
    +698  * <li>sigalg - hex TLV of SignatureAlgorithm</li>
    +699  * <li>sig - hex TLV of signature</li>
    +700  * <li>sigval = hex V of signature</li>
    +701  * <li>obj - parsed KJUR.asn1.cms.SignerInfo object</li>
    +702  * </ul>
    +703  * NOTE: Parsing of unsigned attributes will be provided in the
    +704  * future version. That's way this version provides support
    +705  * for CAdES-T and not for CAdES-C.
    +706  */
    +707 KJUR.asn1.cades.CAdESUtil.parseSignerInfoForAddingUnsigned = 
    +708     function(hex, iSI, nth) {
    +709     var nA = KJUR.asn1;
    +710     var nC = KJUR.asn1.cms;
    +711     var r = {};
    +712     var aSIChildIdx = ASN1HEX.getPosArrayOfChildren_AtObj(hex, iSI);
    +713     //alert(aSIChildIdx.join("="));
    +714 
    +715     if (aSIChildIdx.length != 6)
    +716         throw "not supported items for SignerInfo (!=6)"; 
    +717 
    +718     // 1. SignerInfo.CMSVersion
    +719     var iVersion = aSIChildIdx.shift();
    +720     r.version = ASN1HEX.getHexOfTLV_AtObj(hex, iVersion);
    +721 
    +722     // 2. SignerIdentifier(IssuerAndSerialNumber)
    +723     var iIdentifier = aSIChildIdx.shift();
    +724     r.si = ASN1HEX.getHexOfTLV_AtObj(hex, iIdentifier);
    +725 
    +726     // 3. DigestAlgorithm
    +727     var iDigestAlg = aSIChildIdx.shift();
    +728     r.digalg = ASN1HEX.getHexOfTLV_AtObj(hex, iDigestAlg);
    +729 
    +730     // 4. SignedAttrs
    +731     var iSignedAttrs = aSIChildIdx.shift();
    +732     r.sattrs = ASN1HEX.getHexOfTLV_AtObj(hex, iSignedAttrs);
    +733 
    +734     // 5. SigAlg
    +735     var iSigAlg = aSIChildIdx.shift();
    +736     r.sigalg = ASN1HEX.getHexOfTLV_AtObj(hex, iSigAlg);
    +737 
    +738     // 6. Signature
    +739     var iSig = aSIChildIdx.shift();
    +740     r.sig = ASN1HEX.getHexOfTLV_AtObj(hex, iSig);
    +741     r.sigval = ASN1HEX.getHexOfV_AtObj(hex, iSig);
    +742 
    +743     // 7. obj(SignerInfo)
    +744     var tmp = null;
    +745     r.obj = new nC.SignerInfo();
    +746 
    +747     tmp = new nA.ASN1Object();
    +748     tmp.hTLV = r.version;
    +749     r.obj.dCMSVersion = tmp;
    +750 
    +751     tmp = new nA.ASN1Object();
    +752     tmp.hTLV = r.si;
    +753     r.obj.dSignerIdentifier = tmp;
    +754 
    +755     tmp = new nA.ASN1Object();
    +756     tmp.hTLV = r.digalg;
    +757     r.obj.dDigestAlgorithm = tmp;
    +758 
    +759     tmp = new nA.ASN1Object();
    +760     tmp.hTLV = r.sattrs;
    +761     r.obj.dSignedAttrs = tmp;
    +762 
    +763     tmp = new nA.ASN1Object();
    +764     tmp.hTLV = r.sigalg;
    +765     r.obj.dSigAlg = tmp;
    +766 
    +767     tmp = new nA.ASN1Object();
    +768     tmp.hTLV = r.sig;
    +769     r.obj.dSig = tmp;
    +770 
    +771     r.obj.dUnsignedAttrs = new nC.AttributeList();
    +772 
    +773     return r;
    +774 };
    +775 
    +776 
    \ No newline at end of file diff --git a/api/symbols/src/asn1cms-1.0.js.html b/api/symbols/src/asn1cms-1.0.js.html index 4be8888b..356165d3 100755 --- a/api/symbols/src/asn1cms-1.0.js.html +++ b/api/symbols/src/asn1cms-1.0.js.html @@ -5,7 +5,7 @@ .STRN {color: #393;} .REGX {color: #339;} .line {border-right: 1px dotted #666; color: #666; font-style: normal;} -
      1 /*! asn1cms-1.0.1.js (c) 2013-2014 Kenji Urushima | kjur.github.com/jsrsasign/license
    +	
      1 /*! asn1cms-1.0.2.js (c) 2013-2014 Kenji Urushima | kjur.github.com/jsrsasign/license
       2  */
       3 /*
       4  * asn1cms.js - ASN.1 DER encoder classes for Cryptographic Message Syntax(CMS)
    @@ -23,7 +23,7 @@
      16  * @fileOverview
      17  * @name asn1cms-1.0.js
      18  * @author Kenji Urushima kenji.urushima@gmail.com
    - 19  * @version 1.0.1 (2014-May-21)
    + 19  * @version 1.0.2 (2014-Jun-07)
      20  * @since jsrsasign 4.2.4
      21  * @license <a href="http://kjur.github.io/jsrsasign/license/">MIT License</a>
      22  */
    @@ -70,881 +70,923 @@
      63  * <li>{@link KJUR.asn1.cms.ContentType}</li>
      64  * <li>{@link KJUR.asn1.cms.MessageDigest}</li>
      65  * <li>{@link KJUR.asn1.cms.SigningTime}</li>
    - 66  * </ul>
    - 67  * NOTE: Please ignore method summary and document of this namespace. 
    - 68  * This caused by a bug of jsdoc2.
    - 69  * </p>
    - 70  * @name KJUR.asn1.cms
    - 71  * @namespace
    - 72  */
    - 73 if (typeof KJUR.asn1.cms == "undefined" || !KJUR.asn1.cms) KJUR.asn1.cms = {};
    - 74 
    - 75 /**
    - 76  * Attribute class for base of CMS attribute
    - 77  * @name KJUR.asn1.cms.Attribute
    - 78  * @class Attribute class for base of CMS attribute
    - 79  * @param {Array} params associative array of parameters
    - 80  * @extends KJUR.asn1.ASN1Object
    - 81  * @since jsrsasign 4.2.4 asn1cms 1.0.0
    - 82  * @description
    - 83  * <pre>
    - 84  * Attributes ::= SET OF Attribute
    - 85  * Attribute ::= SEQUENCE {
    - 86  *    type               OBJECT IDENTIFIER,
    - 87  *    values             AttributeSetValue }
    - 88  * AttributeSetValue ::= SET OF ANY
    - 89  * </pre>
    - 90  */
    - 91 KJUR.asn1.cms.Attribute = function(params) {
    - 92     KJUR.asn1.cms.Attribute.superclass.constructor.call(this);
    - 93     var valueList = []; // array of values
    - 94 
    - 95     this.getEncodedHex = function() {
    - 96         var attrTypeASN1, attrValueASN1, seq;
    - 97         attrTypeASN1 = new KJUR.asn1.DERObjectIdentifier({"oid": this.attrTypeOid});
    - 98 
    - 99         attrValueASN1 = new KJUR.asn1.DERSet({"array": this.valueList});
    -100         try {
    -101             attrValueASN1.getEncodedHex();
    -102         } catch (ex) {
    -103             throw "fail valueSet.getEncodedHex in Attribute(1)/" + ex;
    -104         }
    -105 
    -106         seq = new KJUR.asn1.DERSequence({"array": [attrTypeASN1, attrValueASN1]});
    -107         try {
    -108             this.hTLV = seq.getEncodedHex();
    -109         } catch (ex) {
    -110             throw "failed seq.getEncodedHex in Attribute(2)/" + ex;
    -111         }
    -112 
    -113         return this.hTLV;
    -114     };
    -115 };
    -116 YAHOO.lang.extend(KJUR.asn1.cms.Attribute, KJUR.asn1.ASN1Object);
    -117 
    -118 /**
    -119  * class for CMS ContentType attribute
    -120  * @name KJUR.asn1.cms.ContentType
    -121  * @class class for CMS ContentType attribute
    -122  * @param {Array} params associative array of parameters
    -123  * @extends KJUR.asn1.cms.Attribute
    -124  * @since jsrsasign 4.2.4 asn1cms 1.0.0
    -125  * @description
    -126  * <pre>
    -127  * Attribute ::= SEQUENCE {
    -128  *    type               OBJECT IDENTIFIER,
    -129  *    values             AttributeSetValue }
    -130  * AttributeSetValue ::= SET OF ANY
    -131  * ContentType ::= OBJECT IDENTIFIER
    -132  * </pre>
    -133  * @example
    -134  * o = new KJUR.asn1.cms.ContentType({name: 'data'});
    -135  * o = new KJUR.asn1.cms.ContentType({oid: '1.2.840.113549.1.9.16.1.4'});
    -136  */
    -137 KJUR.asn1.cms.ContentType = function(params) {
    -138     KJUR.asn1.cms.ContentType.superclass.constructor.call(this);
    -139     this.attrTypeOid = "1.2.840.113549.1.9.3";
    -140     var contentTypeASN1 = null;
    -141 
    -142     if (typeof params != "undefined") {
    -143         var contentTypeASN1 = new KJUR.asn1.DERObjectIdentifier(params);
    -144         this.valueList = [contentTypeASN1];
    -145     }
    -146 };
    -147 YAHOO.lang.extend(KJUR.asn1.cms.ContentType, KJUR.asn1.cms.Attribute);
    -148 
    -149 /**
    -150  * class for CMS MessageDigest attribute
    -151  * @name KJUR.asn1.cms.MessageDigest
    -152  * @class class for CMS MessageDigest attribute
    -153  * @param {Array} params associative array of parameters
    -154  * @extends KJUR.asn1.cms.Attribute
    -155  * @since jsrsasign 4.2.4 asn1cms 1.0.0
    -156  * @description
    -157  * <pre>
    -158  * Attribute ::= SEQUENCE {
    -159  *    type               OBJECT IDENTIFIER,
    -160  *    values             AttributeSetValue }
    -161  * AttributeSetValue ::= SET OF ANY
    -162  * MessageDigest ::= OCTET STRING
    -163  * </pre>
    -164  * @example
    -165  * o = new KJUR.asn1.cms.MessageDigest({hex: 'a1a2a3a4...'});
    -166  */
    -167 KJUR.asn1.cms.MessageDigest = function(params) {
    -168     KJUR.asn1.cms.MessageDigest.superclass.constructor.call(this);
    -169     this.attrTypeOid = "1.2.840.113549.1.9.4";
    -170 
    -171     if (typeof params != "undefined") {
    -172         if (params.eciObj instanceof KJUR.asn1.cms.EncapsulatedContentInfo &&
    -173             typeof params.hashAlg == "string") {
    -174             var dataHex = params.eciObj.eContentValueHex;
    -175             var hashAlg = params.hashAlg;
    -176             var hashValueHex = KJUR.crypto.Util.hashHex(dataHex, hashAlg);
    -177             var dAttrValue1 = new KJUR.asn1.DEROctetString({hex: hashValueHex});
    -178             dAttrValue1.getEncodedHex();
    -179             this.valueList = [dAttrValue1];
    -180         } else {
    -181             var dAttrValue1 = new KJUR.asn1.DEROctetString(params);
    -182             dAttrValue1.getEncodedHex();
    -183             this.valueList = [dAttrValue1];
    -184         }
    -185     }
    -186 };
    -187 YAHOO.lang.extend(KJUR.asn1.cms.MessageDigest, KJUR.asn1.cms.Attribute);
    -188 
    -189 /**
    -190  * class for CMS SigningTime attribute
    -191  * @name KJUR.asn1.cms.SigningTime
    -192  * @class class for CMS SigningTime attribute
    -193  * @param {Array} params associative array of parameters
    -194  * @extends KJUR.asn1.cms.Attribute
    -195  * @since jsrsasign 4.2.4 asn1cms 1.0.0
    -196  * @description
    -197  * <pre>
    -198  * Attribute ::= SEQUENCE {
    -199  *    type               OBJECT IDENTIFIER,
    -200  *    values             AttributeSetValue }
    -201  * AttributeSetValue ::= SET OF ANY
    -202  * SigningTime  ::= Time
    -203  * Time ::= CHOICE {
    -204  *    utcTime UTCTime,
    -205  *    generalTime GeneralizedTime }
    -206  * </pre>
    -207  * @example
    -208  * o = new KJUR.asn1.cms.SigningTime(); // current time UTCTime by default
    -209  * o = new KJUR.asn1.cms.SigningTime({type: 'gen'}); // current time GeneralizedTime
    -210  * o = new KJUR.asn1.cms.SigningTime({str: '20140517093800Z'}); // specified GeneralizedTime
    -211  * o = new KJUR.asn1.cms.SigningTime({str: '140517093800Z'}); // specified UTCTime
    -212  */
    -213 KJUR.asn1.cms.SigningTime = function(params) {
    -214     KJUR.asn1.cms.SigningTime.superclass.constructor.call(this);
    -215     this.attrTypeOid = "1.2.840.113549.1.9.5";
    -216 
    -217     if (typeof params != "undefined") {
    -218         var asn1 = new KJUR.asn1.x509.Time(params);
    -219         try {
    -220             asn1.getEncodedHex();
    -221         } catch (ex) {
    -222             throw "SigningTime.getEncodedHex() failed/" + ex;
    -223         }
    -224         this.valueList = [asn1];
    -225     }
    -226 };
    -227 YAHOO.lang.extend(KJUR.asn1.cms.SigningTime, KJUR.asn1.cms.Attribute);
    -228 
    -229 /**
    -230  * class for CMS SigningCertificate attribute
    -231  * @name KJUR.asn1.cms.SigningCertificate
    -232  * @class class for CMS SigningCertificate attribute
    -233  * @param {Array} params associative array of parameters
    -234  * @extends KJUR.asn1.cms.Attribute
    -235  * @since jsrsasign 4.5.1 asn1cms 1.0.1
    -236  * @description
    -237  * <pre>
    -238  * Attribute ::= SEQUENCE {
    -239  *    type               OBJECT IDENTIFIER,
    -240  *    values             AttributeSetValue }
    -241  * AttributeSetValue ::= SET OF ANY
    -242  * SigningCertificate ::= SEQUENCE {
    -243  *    certs SEQUENCE OF ESSCertID,
    -244  *    policies SEQUENCE OF PolicyInformation OPTIONAL }
    -245  * ESSCertID ::= SEQUENCE {
    -246  *    certHash Hash,
    -247  *    issuerSerial IssuerSerial OPTIONAL }
    -248  * IssuerSerial ::= SEQUENCE {
    -249  *    issuer GeneralNames,
    -250  *    serialNumber CertificateSerialNumber }
    -251  * </pre>
    -252  * @example
    -253  * o = new KJUR.asn1.cms.SigningCertificate({array: [certPEM]});
    -254  */
    -255 KJUR.asn1.cms.SigningCertificate = function(params) {
    -256     KJUR.asn1.cms.SigningCertificate.superclass.constructor.call(this);
    -257     this.attrTypeOid = "1.2.840.113549.1.9.16.2.12";
    -258     var nA = KJUR.asn1;
    -259     var nC = KJUR.asn1.cms;
    -260     var nY = KJUR.crypto;
    -261 
    -262     this.setCerts = function(listPEM) {
    -263         var list = [];
    -264         for (var i = 0; i < listPEM.length; i++) {
    -265             var hex = KEYUTIL.getHexFromPEM(listPEM[i]);
    -266             var certHashHex = nY.Util.hashHex(hex, 'sha1');
    -267             var dCertHash = new nA.DEROctetString({hex: certHashHex});
    -268             dCertHash.getEncodedHex();
    -269             var dIssuerSerial =
    -270                 new nC.IssuerAndSerialNumber({cert: listPEM[i]});
    -271             dIssuerSerial.getEncodedHex();
    -272             var dESSCertID =
    -273                 new nA.DERSequence({array: [dCertHash, dIssuerSerial]});
    -274             dESSCertID.getEncodedHex();
    -275             list.push(dESSCertID);
    -276         }
    -277 
    -278         var dValue = new nA.DERSequence({array: list});
    -279         dValue.getEncodedHex();
    -280         this.valueList = [dValue];
    -281     };
    -282 
    -283     if (typeof params != "undefined") {
    -284         if (typeof params.array == "object") {
    -285             this.setCerts(params.array);
    -286         }
    -287     }
    -288 };
    -289 YAHOO.lang.extend(KJUR.asn1.cms.SigningCertificate, KJUR.asn1.cms.Attribute);
    -290 
    -291 /**
    -292  * class for CMS SigningCertificateV2 attribute
    -293  * @name KJUR.asn1.cms.SigningCertificateV2
    -294  * @class class for CMS SigningCertificateV2 attribute
    -295  * @param {Array} params associative array of parameters
    -296  * @extends KJUR.asn1.cms.Attribute
    -297  * @since jsrsasign 4.5.1 asn1cms 1.0.1
    -298  * @description
    -299  * <pre>
    -300  * oid-signingCertificateV2 = 1.2.840.113549.1.9.16.2.47 
    -301  * Attribute ::= SEQUENCE {
    -302  *    type               OBJECT IDENTIFIER,
    -303  *    values             AttributeSetValue }
    -304  * AttributeSetValue ::= SET OF ANY
    -305  * SigningCertificateV2 ::=  SEQUENCE {
    -306  *    certs        SEQUENCE OF ESSCertIDv2,
    -307  *    policies     SEQUENCE OF PolicyInformation OPTIONAL }
    -308  * ESSCertIDv2 ::=  SEQUENCE {
    -309  *    hashAlgorithm           AlgorithmIdentifier
    -310  *                            DEFAULT {algorithm id-sha256},
    -311  *    certHash                Hash,
    -312  *    issuerSerial            IssuerSerial OPTIONAL }
    -313  * Hash ::= OCTET STRING
    -314  * IssuerSerial ::= SEQUENCE {
    -315  *    issuer                  GeneralNames,
    -316  *    serialNumber            CertificateSerialNumber }
    -317  * </pre>
    -318  * @example
    -319  * // hash algorithm is sha256 by default:
    -320  * o = new KJUR.asn1.cms.SigningCertificateV2({array: [certPEM]});
    -321  * o = new KJUR.asn1.cms.SigningCertificateV2({array: [certPEM],
    -322  *                                             hashAlg: 'sha512'});
    -323  */
    -324 KJUR.asn1.cms.SigningCertificateV2 = function(params) {
    -325     KJUR.asn1.cms.SigningCertificateV2.superclass.constructor.call(this);
    -326     this.attrTypeOid = "1.2.840.113549.1.9.16.2.47";
    -327     var nA = KJUR.asn1;
    -328     var nX = KJUR.asn1.x509;
    -329     var nC = KJUR.asn1.cms;
    -330     var nY = KJUR.crypto;
    -331 
    -332     this.setCerts = function(listPEM, hashAlg) {
    -333         var list = [];
    -334         for (var i = 0; i < listPEM.length; i++) {
    -335             var hex = KEYUTIL.getHexFromPEM(listPEM[i]);
    -336 
    -337             var a = [];
    -338             if (hashAlg != "sha256")
    -339                 a.push(new nX.AlgorithmIdentifier({name: hashAlg}));
    -340 
    -341             var certHashHex = nY.Util.hashHex(hex, hashAlg);
    -342             var dCertHash = new nA.DEROctetString({hex: certHashHex});
    -343             dCertHash.getEncodedHex();
    -344             a.push(dCertHash);
    -345 
    -346             var dIssuerSerial =
    -347                 new nC.IssuerAndSerialNumber({cert: listPEM[i]});
    -348             dIssuerSerial.getEncodedHex();
    -349             a.push(dIssuerSerial);
    -350 
    -351             var dESSCertIDv2 =
    -352                 new nA.DERSequence({array: a});
    -353             dESSCertIDv2.getEncodedHex();
    -354             list.push(dESSCertIDv2);
    -355         }
    -356 
    -357         var dValue = new nA.DERSequence({array: list});
    -358         dValue.getEncodedHex();
    -359         this.valueList = [dValue];
    -360     };
    -361 
    -362     if (typeof params != "undefined") {
    -363         if (typeof params.array == "object") {
    -364             var hashAlg = "sha256"; // sha2 default
    -365             if (typeof params.hashAlg == "string") 
    -366                 hashAlg = params.hashAlg;
    -367             this.setCerts(params.array, hashAlg);
    -368         }
    -369     }
    -370 };
    -371 YAHOO.lang.extend(KJUR.asn1.cms.SigningCertificateV2, KJUR.asn1.cms.Attribute);
    -372 
    -373 /**
    -374  * class for IssuerAndSerialNumber ASN.1 structure for CMS
    -375  * @name KJUR.asn1.cms.IssuerAndSerialNumber
    -376  * @class class for CMS IssuerAndSerialNumber ASN.1 structure for CMS
    -377  * @param {Array} params associative array of parameters
    -378  * @extends KJUR.asn1.ASN1Object
    -379  * @since jsrsasign 4.2.4 asn1cms 1.0.0
    -380  * @description
    -381  * <pre>
    -382  * IssuerAndSerialNumber ::= SEQUENCE {
    -383  *    issuer Name,
    -384  *    serialNumber CertificateSerialNumber }
    -385  * CertificateSerialNumber ::= INTEGER
    -386  * </pre>
    -387  * @example
    -388  * // specify by X500Name and DERInteger
    -389  * o = new KJUR.asn1.cms.IssuerAndSerialNumber(
    -390  *      {issuer: {str: '/C=US/O=T1'}, serial {int: 3}});
    -391  * // specify by PEM certificate
    -392  * o = new KJUR.asn1.cms.IssuerAndSerialNumber({cert: certPEM});
    -393  */
    -394 KJUR.asn1.cms.IssuerAndSerialNumber = function(params) {
    -395     KJUR.asn1.cms.IssuerAndSerialNumber.superclass.constructor.call(this);
    -396     var dIssuer = null;
    -397     var dSerial = null;
    -398     var nA = KJUR.asn1;
    -399     var nX = nA.x509;
    -400 
    -401     /*
    -402      * @since asn1cms 1.0.1
    -403      */
    -404     this.setByCertPEM = function(certPEM) {
    -405         var certHex = KEYUTIL.getHexFromPEM(certPEM);
    -406         var x = new X509();
    -407         x.hex = certHex;
    -408         var issuerTLVHex = x.getIssuerHex();
    -409         this.dIssuer = new nX.X500Name();
    -410         this.dIssuer.hTLV = issuerTLVHex;
    -411         var serialVHex = x.getSerialNumberHex();
    -412         this.dSerial = new nA.DERInteger({hex: serialVHex});
    -413     };
    -414 
    -415     this.getEncodedHex = function() {
    -416         var seq = new KJUR.asn1.DERSequence({"array": [this.dIssuer,
    -417                                                        this.dSerial]});
    -418         this.hTLV = seq.getEncodedHex();
    -419         return this.hTLV;
    -420     };
    -421 
    -422     if (typeof params != "undefined") {
    -423         if (params.issuer && params.serial) {
    -424             if (params.issuer instanceof KJUR.asn1.x509.X500Name) {
    -425                 this.dIssuer = params.issuer;
    -426             } else {
    -427                 this.dIssuer = new KJUR.asn1.x509.X500Name(params.issuer);
    -428             }
    -429             if (params.serial instanceof KJUR.asn1.DERInteger) {
    -430                 this.dSerial = params.serial;
    -431             } else {
    -432                 this.dSerial = new KJUR.asn1.DERInteger(params.serial);
    -433             }
    -434         }
    -435         if (typeof params.cert == "string") {
    -436             this.setByCertPEM(params.cert);
    -437         }
    -438     }
    -439 };
    -440 YAHOO.lang.extend(KJUR.asn1.cms.IssuerAndSerialNumber, KJUR.asn1.ASN1Object);
    -441 
    -442 /**
    -443  * class for Attributes ASN.1 structure for CMS
    -444  * @name KJUR.asn1.cms.AttributeList
    -445  * @class class for Attributes ASN.1 structure for CMS
    -446  * @param {Array} params associative array of parameters
    -447  * @extends KJUR.asn1.ASN1Object
    -448  * @since jsrsasign 4.2.4 asn1cms 1.0.0
    -449  * @description
    -450  * <pre>
    -451  * Attributes ::= SET OF Attribute
    -452  * Attribute ::= SEQUENCE {
    -453  *    type               OBJECT IDENTIFIER,
    -454  *    values             AttributeSetValue }
    -455  * </pre>
    -456  * @example
    -457  * // specify by X500Name and DERInteger
    -458  * o = new KJUR.asn1.cms.AttributeList({sorted: false}); // ASN.1 BER unsorted SET OF
    -459  * o = new KJUR.asn1.cms.AttributeList();  // ASN.1 DER sorted by default
    -460  * o.clear();                              // clear list of Attributes
    -461  * n = o.length();                         // get number of Attribute
    -462  * o.add(new KJUR.asn1.cms.SigningTime()); // add SigningTime attribute
    -463  * hex = o.getEncodedHex();                // get hex encoded ASN.1 data
    -464  */
    -465 KJUR.asn1.cms.AttributeList = function(params) {
    -466     KJUR.asn1.cms.AttributeList.superclass.constructor.call(this);
    -467     this.list = new Array();
    -468     this.sortFlag = true;
    -469 
    -470     this.add = function(item) {
    -471         if (item instanceof KJUR.asn1.cms.Attribute) {
    -472             this.list.push(item);
    -473         }
    -474     };
    -475 
    -476     this.length = function() {
    -477         return this.list.length;
    -478     };
    -479 
    -480     this.clear = function() {
    -481         this.list = new Array();
    -482         this.hTLV = null;
    -483         this.hV = null;
    -484     };
    -485 
    -486     this.getEncodedHex = function() {
    -487         if (typeof this.hTLV == "string") return this.hTLV;
    -488         var set = new KJUR.asn1.DERSet({array: this.list, 
    -489                                         sortflag: this.sortFlag});
    -490         this.hTLV = set.getEncodedHex();
    -491         return this.hTLV;
    -492     };
    -493 
    -494     if (typeof params != "undefined") {
    -495         if (typeof params.sortflag != "undefined" &&
    -496             params.sortflag == false)
    -497             this.sortFlag = false;
    -498     }
    -499 };
    -500 YAHOO.lang.extend(KJUR.asn1.cms.AttributeList, KJUR.asn1.ASN1Object);
    -501 
    -502 /**
    -503  * class for SignerInfo ASN.1 structure of CMS SignedData
    -504  * @name KJUR.asn1.cms.SignerInfo
    -505  * @class class for Attributes ASN.1 structure of CMS SigndData
    -506  * @param {Array} params associative array of parameters
    -507  * @extends KJUR.asn1.ASN1Object
    -508  * @since jsrsasign 4.2.4 asn1cms 1.0.0
    -509  * @description
    -510  * <pre>
    -511  * SignerInfo ::= SEQUENCE {
    -512  *    version CMSVersion,
    -513  *    sid SignerIdentifier,
    -514  *    digestAlgorithm DigestAlgorithmIdentifier,
    -515  *    signedAttrs [0] IMPLICIT SignedAttributes OPTIONAL,
    -516  *    signatureAlgorithm SignatureAlgorithmIdentifier,
    -517  *    signature SignatureValue,
    -518  *    unsignedAttrs [1] IMPLICIT UnsignedAttributes OPTIONAL }
    -519  * </pre>
    -520  * @example
    -521  * o = new KJUR.asn1.cms.SignerInfo();
    -522  * o.setSignerIdentifier(certPEMstring);
    -523  * o.dSignedAttrs.add(new KJUR.asn1.cms.ContentType({name: 'data'}));
    -524  * o.dSignedAttrs.add(new KJUR.asn1.cms.MessageDigest({hex: 'a1b2...'}));
    -525  * o.dSignedAttrs.add(new KJUR.asn1.cms.SigningTime());
    -526  * o.sign(privteKeyParam, "SHA1withRSA");
    -527  */
    -528 KJUR.asn1.cms.SignerInfo = function(params) {
    -529     KJUR.asn1.cms.SignerInfo.superclass.constructor.call(this);
    -530     var nA = KJUR.asn1;
    -531     var nC = KJUR.asn1.cms;
    -532     var nX = KJUR.asn1.x509;
    -533 
    -534     this.dCMSVersion = new nA.DERInteger({'int': 1});
    -535     this.dSignerIdentifier = null;
    -536     this.dDigestAlgorithm = null;
    -537     this.dSignedAttrs = new nC.AttributeList();
    -538     this.dSigAlg = null;
    -539     this.dSig = null;
    -540     this.dUnsignedAttrs = new nC.AttributeList();
    -541 
    -542     this.setSignerIdentifier = function(params) {
    -543         if (typeof params == "string" &&
    -544             params.indexOf("CERTIFICATE") != -1 &&
    -545             params.indexOf("BEGIN") != -1 &&
    -546             params.indexOf("END") != -1) {
    -547 
    -548             var certPEM = params;
    -549             this.dSignerIdentifier = 
    -550                 new nC.IssuerAndSerialNumber({cert: params});
    -551         }
    -552     };
    -553 
    -554     /**
    -555      * set ContentType/MessageDigest/DigestAlgorithms for SignerInfo/SignedData
    -556      * @name setForContentAndHash
    -557      * @memberOf KJUR.asn1.cms.SignerInfo
    -558      * @param {Array} params JSON parameter to set content related field
    -559      * @description
    -560      * This method will specify following fields by a parameters:
    -561      * <ul>
    -562      * <li>add ContentType signed attribute by encapContentInfo</li>
    -563      * <li>add MessageDigest signed attribute by encapContentInfo and hashAlg</li>
    -564      * <li>add a hash algorithm used in MessageDigest to digestAlgorithms field of SignedData</li>
    -565      * <li>set a hash algorithm used in MessageDigest to digestAlgorithm field of SignerInfo</li>
    -566      * </ul>
    -567      * Argument 'params' is an associative array having following elements:
    + 66  * <li>{@link KJUR.asn1.cms.SigningCertificate}</li>
    + 67  * <li>{@link KJUR.asn1.cms.SigningCertificateV2}</li>
    + 68  * </ul>
    + 69  * NOTE: Please ignore method summary and document of this namespace. 
    + 70  * This caused by a bug of jsdoc2.
    + 71  * </p>
    + 72  * @name KJUR.asn1.cms
    + 73  * @namespace
    + 74  */
    + 75 if (typeof KJUR.asn1.cms == "undefined" || !KJUR.asn1.cms) KJUR.asn1.cms = {};
    + 76 
    + 77 /**
    + 78  * Attribute class for base of CMS attribute
    + 79  * @name KJUR.asn1.cms.Attribute
    + 80  * @class Attribute class for base of CMS attribute
    + 81  * @param {Array} params associative array of parameters
    + 82  * @extends KJUR.asn1.ASN1Object
    + 83  * @since jsrsasign 4.2.4 asn1cms 1.0.0
    + 84  * @description
    + 85  * <pre>
    + 86  * Attributes ::= SET OF Attribute
    + 87  * Attribute ::= SEQUENCE {
    + 88  *    type               OBJECT IDENTIFIER,
    + 89  *    values             AttributeSetValue }
    + 90  * AttributeSetValue ::= SET OF ANY
    + 91  * </pre>
    + 92  */
    + 93 KJUR.asn1.cms.Attribute = function(params) {
    + 94     KJUR.asn1.cms.Attribute.superclass.constructor.call(this);
    + 95     var valueList = []; // array of values
    + 96 
    + 97     this.getEncodedHex = function() {
    + 98         var attrTypeASN1, attrValueASN1, seq;
    + 99         attrTypeASN1 = new KJUR.asn1.DERObjectIdentifier({"oid": this.attrTypeOid});
    +100 
    +101         attrValueASN1 = new KJUR.asn1.DERSet({"array": this.valueList});
    +102         try {
    +103             attrValueASN1.getEncodedHex();
    +104         } catch (ex) {
    +105             throw "fail valueSet.getEncodedHex in Attribute(1)/" + ex;
    +106         }
    +107 
    +108         seq = new KJUR.asn1.DERSequence({"array": [attrTypeASN1, attrValueASN1]});
    +109         try {
    +110             this.hTLV = seq.getEncodedHex();
    +111         } catch (ex) {
    +112             throw "failed seq.getEncodedHex in Attribute(2)/" + ex;
    +113         }
    +114 
    +115         return this.hTLV;
    +116     };
    +117 };
    +118 YAHOO.lang.extend(KJUR.asn1.cms.Attribute, KJUR.asn1.ASN1Object);
    +119 
    +120 /**
    +121  * class for CMS ContentType attribute
    +122  * @name KJUR.asn1.cms.ContentType
    +123  * @class class for CMS ContentType attribute
    +124  * @param {Array} params associative array of parameters
    +125  * @extends KJUR.asn1.cms.Attribute
    +126  * @since jsrsasign 4.2.4 asn1cms 1.0.0
    +127  * @description
    +128  * <pre>
    +129  * Attribute ::= SEQUENCE {
    +130  *    type               OBJECT IDENTIFIER,
    +131  *    values             AttributeSetValue }
    +132  * AttributeSetValue ::= SET OF ANY
    +133  * ContentType ::= OBJECT IDENTIFIER
    +134  * </pre>
    +135  * @example
    +136  * o = new KJUR.asn1.cms.ContentType({name: 'data'});
    +137  * o = new KJUR.asn1.cms.ContentType({oid: '1.2.840.113549.1.9.16.1.4'});
    +138  */
    +139 KJUR.asn1.cms.ContentType = function(params) {
    +140     KJUR.asn1.cms.ContentType.superclass.constructor.call(this);
    +141     this.attrTypeOid = "1.2.840.113549.1.9.3";
    +142     var contentTypeASN1 = null;
    +143 
    +144     if (typeof params != "undefined") {
    +145         var contentTypeASN1 = new KJUR.asn1.DERObjectIdentifier(params);
    +146         this.valueList = [contentTypeASN1];
    +147     }
    +148 };
    +149 YAHOO.lang.extend(KJUR.asn1.cms.ContentType, KJUR.asn1.cms.Attribute);
    +150 
    +151 /**
    +152  * class for CMS MessageDigest attribute
    +153  * @name KJUR.asn1.cms.MessageDigest
    +154  * @class class for CMS MessageDigest attribute
    +155  * @param {Array} params associative array of parameters
    +156  * @extends KJUR.asn1.cms.Attribute
    +157  * @since jsrsasign 4.2.4 asn1cms 1.0.0
    +158  * @description
    +159  * <pre>
    +160  * Attribute ::= SEQUENCE {
    +161  *    type               OBJECT IDENTIFIER,
    +162  *    values             AttributeSetValue }
    +163  * AttributeSetValue ::= SET OF ANY
    +164  * MessageDigest ::= OCTET STRING
    +165  * </pre>
    +166  * @example
    +167  * o = new KJUR.asn1.cms.MessageDigest({hex: 'a1a2a3a4...'});
    +168  */
    +169 KJUR.asn1.cms.MessageDigest = function(params) {
    +170     KJUR.asn1.cms.MessageDigest.superclass.constructor.call(this);
    +171     this.attrTypeOid = "1.2.840.113549.1.9.4";
    +172 
    +173     if (typeof params != "undefined") {
    +174         if (params.eciObj instanceof KJUR.asn1.cms.EncapsulatedContentInfo &&
    +175             typeof params.hashAlg == "string") {
    +176             var dataHex = params.eciObj.eContentValueHex;
    +177             var hashAlg = params.hashAlg;
    +178             var hashValueHex = KJUR.crypto.Util.hashHex(dataHex, hashAlg);
    +179             var dAttrValue1 = new KJUR.asn1.DEROctetString({hex: hashValueHex});
    +180             dAttrValue1.getEncodedHex();
    +181             this.valueList = [dAttrValue1];
    +182         } else {
    +183             var dAttrValue1 = new KJUR.asn1.DEROctetString(params);
    +184             dAttrValue1.getEncodedHex();
    +185             this.valueList = [dAttrValue1];
    +186         }
    +187     }
    +188 };
    +189 YAHOO.lang.extend(KJUR.asn1.cms.MessageDigest, KJUR.asn1.cms.Attribute);
    +190 
    +191 /**
    +192  * class for CMS SigningTime attribute
    +193  * @name KJUR.asn1.cms.SigningTime
    +194  * @class class for CMS SigningTime attribute
    +195  * @param {Array} params associative array of parameters
    +196  * @extends KJUR.asn1.cms.Attribute
    +197  * @since jsrsasign 4.2.4 asn1cms 1.0.0
    +198  * @description
    +199  * <pre>
    +200  * Attribute ::= SEQUENCE {
    +201  *    type               OBJECT IDENTIFIER,
    +202  *    values             AttributeSetValue }
    +203  * AttributeSetValue ::= SET OF ANY
    +204  * SigningTime  ::= Time
    +205  * Time ::= CHOICE {
    +206  *    utcTime UTCTime,
    +207  *    generalTime GeneralizedTime }
    +208  * </pre>
    +209  * @example
    +210  * o = new KJUR.asn1.cms.SigningTime(); // current time UTCTime by default
    +211  * o = new KJUR.asn1.cms.SigningTime({type: 'gen'}); // current time GeneralizedTime
    +212  * o = new KJUR.asn1.cms.SigningTime({str: '20140517093800Z'}); // specified GeneralizedTime
    +213  * o = new KJUR.asn1.cms.SigningTime({str: '140517093800Z'}); // specified UTCTime
    +214  */
    +215 KJUR.asn1.cms.SigningTime = function(params) {
    +216     KJUR.asn1.cms.SigningTime.superclass.constructor.call(this);
    +217     this.attrTypeOid = "1.2.840.113549.1.9.5";
    +218 
    +219     if (typeof params != "undefined") {
    +220         var asn1 = new KJUR.asn1.x509.Time(params);
    +221         try {
    +222             asn1.getEncodedHex();
    +223         } catch (ex) {
    +224             throw "SigningTime.getEncodedHex() failed/" + ex;
    +225         }
    +226         this.valueList = [asn1];
    +227     }
    +228 };
    +229 YAHOO.lang.extend(KJUR.asn1.cms.SigningTime, KJUR.asn1.cms.Attribute);
    +230 
    +231 /**
    +232  * class for CMS SigningCertificate attribute
    +233  * @name KJUR.asn1.cms.SigningCertificate
    +234  * @class class for CMS SigningCertificate attribute
    +235  * @param {Array} params associative array of parameters
    +236  * @extends KJUR.asn1.cms.Attribute
    +237  * @since jsrsasign 4.5.1 asn1cms 1.0.1
    +238  * @description
    +239  * <pre>
    +240  * Attribute ::= SEQUENCE {
    +241  *    type               OBJECT IDENTIFIER,
    +242  *    values             AttributeSetValue }
    +243  * AttributeSetValue ::= SET OF ANY
    +244  * SigningCertificate ::= SEQUENCE {
    +245  *    certs SEQUENCE OF ESSCertID,
    +246  *    policies SEQUENCE OF PolicyInformation OPTIONAL }
    +247  * ESSCertID ::= SEQUENCE {
    +248  *    certHash Hash,
    +249  *    issuerSerial IssuerSerial OPTIONAL }
    +250  * IssuerSerial ::= SEQUENCE {
    +251  *    issuer GeneralNames,
    +252  *    serialNumber CertificateSerialNumber }
    +253  * </pre>
    +254  * @example
    +255  * o = new KJUR.asn1.cms.SigningCertificate({array: [certPEM]});
    +256  */
    +257 KJUR.asn1.cms.SigningCertificate = function(params) {
    +258     KJUR.asn1.cms.SigningCertificate.superclass.constructor.call(this);
    +259     this.attrTypeOid = "1.2.840.113549.1.9.16.2.12";
    +260     var nA = KJUR.asn1;
    +261     var nC = KJUR.asn1.cms;
    +262     var nY = KJUR.crypto;
    +263 
    +264     this.setCerts = function(listPEM) {
    +265         var list = [];
    +266         for (var i = 0; i < listPEM.length; i++) {
    +267             var hex = KEYUTIL.getHexFromPEM(listPEM[i]);
    +268             var certHashHex = nY.Util.hashHex(hex, 'sha1');
    +269             var dCertHash = new nA.DEROctetString({hex: certHashHex});
    +270             dCertHash.getEncodedHex();
    +271             var dIssuerSerial =
    +272                 new nC.IssuerAndSerialNumber({cert: listPEM[i]});
    +273             dIssuerSerial.getEncodedHex();
    +274             var dESSCertID =
    +275                 new nA.DERSequence({array: [dCertHash, dIssuerSerial]});
    +276             dESSCertID.getEncodedHex();
    +277             list.push(dESSCertID);
    +278         }
    +279 
    +280         var dValue = new nA.DERSequence({array: list});
    +281         dValue.getEncodedHex();
    +282         this.valueList = [dValue];
    +283     };
    +284 
    +285     if (typeof params != "undefined") {
    +286         if (typeof params.array == "object") {
    +287             this.setCerts(params.array);
    +288         }
    +289     }
    +290 };
    +291 YAHOO.lang.extend(KJUR.asn1.cms.SigningCertificate, KJUR.asn1.cms.Attribute);
    +292 
    +293 /**
    +294  * class for CMS SigningCertificateV2 attribute
    +295  * @name KJUR.asn1.cms.SigningCertificateV2
    +296  * @class class for CMS SigningCertificateV2 attribute
    +297  * @param {Array} params associative array of parameters
    +298  * @extends KJUR.asn1.cms.Attribute
    +299  * @since jsrsasign 4.5.1 asn1cms 1.0.1
    +300  * @description
    +301  * <pre>
    +302  * oid-signingCertificateV2 = 1.2.840.113549.1.9.16.2.47 
    +303  * Attribute ::= SEQUENCE {
    +304  *    type               OBJECT IDENTIFIER,
    +305  *    values             AttributeSetValue }
    +306  * AttributeSetValue ::= SET OF ANY
    +307  * SigningCertificateV2 ::=  SEQUENCE {
    +308  *    certs        SEQUENCE OF ESSCertIDv2,
    +309  *    policies     SEQUENCE OF PolicyInformation OPTIONAL }
    +310  * ESSCertIDv2 ::=  SEQUENCE {
    +311  *    hashAlgorithm           AlgorithmIdentifier
    +312  *                            DEFAULT {algorithm id-sha256},
    +313  *    certHash                Hash,
    +314  *    issuerSerial            IssuerSerial OPTIONAL }
    +315  * Hash ::= OCTET STRING
    +316  * IssuerSerial ::= SEQUENCE {
    +317  *    issuer                  GeneralNames,
    +318  *    serialNumber            CertificateSerialNumber }
    +319  * </pre>
    +320  * @example
    +321  * // hash algorithm is sha256 by default:
    +322  * o = new KJUR.asn1.cms.SigningCertificateV2({array: [certPEM]});
    +323  * o = new KJUR.asn1.cms.SigningCertificateV2({array: [certPEM],
    +324  *                                             hashAlg: 'sha512'});
    +325  */
    +326 KJUR.asn1.cms.SigningCertificateV2 = function(params) {
    +327     KJUR.asn1.cms.SigningCertificateV2.superclass.constructor.call(this);
    +328     this.attrTypeOid = "1.2.840.113549.1.9.16.2.47";
    +329     var nA = KJUR.asn1;
    +330     var nX = KJUR.asn1.x509;
    +331     var nC = KJUR.asn1.cms;
    +332     var nY = KJUR.crypto;
    +333 
    +334     this.setCerts = function(listPEM, hashAlg) {
    +335         var list = [];
    +336         for (var i = 0; i < listPEM.length; i++) {
    +337             var hex = KEYUTIL.getHexFromPEM(listPEM[i]);
    +338 
    +339             var a = [];
    +340             if (hashAlg != "sha256")
    +341                 a.push(new nX.AlgorithmIdentifier({name: hashAlg}));
    +342 
    +343             var certHashHex = nY.Util.hashHex(hex, hashAlg);
    +344             var dCertHash = new nA.DEROctetString({hex: certHashHex});
    +345             dCertHash.getEncodedHex();
    +346             a.push(dCertHash);
    +347 
    +348             var dIssuerSerial =
    +349                 new nC.IssuerAndSerialNumber({cert: listPEM[i]});
    +350             dIssuerSerial.getEncodedHex();
    +351             a.push(dIssuerSerial);
    +352 
    +353             var dESSCertIDv2 =
    +354                 new nA.DERSequence({array: a});
    +355             dESSCertIDv2.getEncodedHex();
    +356             list.push(dESSCertIDv2);
    +357         }
    +358 
    +359         var dValue = new nA.DERSequence({array: list});
    +360         dValue.getEncodedHex();
    +361         this.valueList = [dValue];
    +362     };
    +363 
    +364     if (typeof params != "undefined") {
    +365         if (typeof params.array == "object") {
    +366             var hashAlg = "sha256"; // sha2 default
    +367             if (typeof params.hashAlg == "string") 
    +368                 hashAlg = params.hashAlg;
    +369             this.setCerts(params.array, hashAlg);
    +370         }
    +371     }
    +372 };
    +373 YAHOO.lang.extend(KJUR.asn1.cms.SigningCertificateV2, KJUR.asn1.cms.Attribute);
    +374 
    +375 /**
    +376  * class for IssuerAndSerialNumber ASN.1 structure for CMS
    +377  * @name KJUR.asn1.cms.IssuerAndSerialNumber
    +378  * @class class for CMS IssuerAndSerialNumber ASN.1 structure for CMS
    +379  * @param {Array} params associative array of parameters
    +380  * @extends KJUR.asn1.ASN1Object
    +381  * @since jsrsasign 4.2.4 asn1cms 1.0.0
    +382  * @description
    +383  * <pre>
    +384  * IssuerAndSerialNumber ::= SEQUENCE {
    +385  *    issuer Name,
    +386  *    serialNumber CertificateSerialNumber }
    +387  * CertificateSerialNumber ::= INTEGER
    +388  * </pre>
    +389  * @example
    +390  * // specify by X500Name and DERInteger
    +391  * o = new KJUR.asn1.cms.IssuerAndSerialNumber(
    +392  *      {issuer: {str: '/C=US/O=T1'}, serial {int: 3}});
    +393  * // specify by PEM certificate
    +394  * o = new KJUR.asn1.cms.IssuerAndSerialNumber({cert: certPEM});
    +395  * o = new KJUR.asn1.cms.IssuerAndSerialNumber(certPEM); // since 1.0.3
    +396  */
    +397 KJUR.asn1.cms.IssuerAndSerialNumber = function(params) {
    +398     KJUR.asn1.cms.IssuerAndSerialNumber.superclass.constructor.call(this);
    +399     var dIssuer = null;
    +400     var dSerial = null;
    +401     var nA = KJUR.asn1;
    +402     var nX = nA.x509;
    +403 
    +404     /*
    +405      * @since asn1cms 1.0.1
    +406      */
    +407     this.setByCertPEM = function(certPEM) {
    +408         var certHex = KEYUTIL.getHexFromPEM(certPEM);
    +409         var x = new X509();
    +410         x.hex = certHex;
    +411         var issuerTLVHex = x.getIssuerHex();
    +412         this.dIssuer = new nX.X500Name();
    +413         this.dIssuer.hTLV = issuerTLVHex;
    +414         var serialVHex = x.getSerialNumberHex();
    +415         this.dSerial = new nA.DERInteger({hex: serialVHex});
    +416     };
    +417 
    +418     this.getEncodedHex = function() {
    +419         var seq = new KJUR.asn1.DERSequence({"array": [this.dIssuer,
    +420                                                        this.dSerial]});
    +421         this.hTLV = seq.getEncodedHex();
    +422         return this.hTLV;
    +423     };
    +424 
    +425     if (typeof params != "undefined") {
    +426         if (typeof params == "string" &&
    +427             params.indexOf("-----BEGIN ") != -1) {
    +428             this.setByCertPEM(params);
    +429         }
    +430         if (params.issuer && params.serial) {
    +431             if (params.issuer instanceof KJUR.asn1.x509.X500Name) {
    +432                 this.dIssuer = params.issuer;
    +433             } else {
    +434                 this.dIssuer = new KJUR.asn1.x509.X500Name(params.issuer);
    +435             }
    +436             if (params.serial instanceof KJUR.asn1.DERInteger) {
    +437                 this.dSerial = params.serial;
    +438             } else {
    +439                 this.dSerial = new KJUR.asn1.DERInteger(params.serial);
    +440             }
    +441         }
    +442         if (typeof params.cert == "string") {
    +443             this.setByCertPEM(params.cert);
    +444         }
    +445     }
    +446 };
    +447 YAHOO.lang.extend(KJUR.asn1.cms.IssuerAndSerialNumber, KJUR.asn1.ASN1Object);
    +448 
    +449 /**
    +450  * class for Attributes ASN.1 structure for CMS
    +451  * @name KJUR.asn1.cms.AttributeList
    +452  * @class class for Attributes ASN.1 structure for CMS
    +453  * @param {Array} params associative array of parameters
    +454  * @extends KJUR.asn1.ASN1Object
    +455  * @since jsrsasign 4.2.4 asn1cms 1.0.0
    +456  * @description
    +457  * <pre>
    +458  * Attributes ::= SET OF Attribute
    +459  * Attribute ::= SEQUENCE {
    +460  *    type               OBJECT IDENTIFIER,
    +461  *    values             AttributeSetValue }
    +462  * </pre>
    +463  * @example
    +464  * // specify by X500Name and DERInteger
    +465  * o = new KJUR.asn1.cms.AttributeList({sorted: false}); // ASN.1 BER unsorted SET OF
    +466  * o = new KJUR.asn1.cms.AttributeList();  // ASN.1 DER sorted by default
    +467  * o.clear();                              // clear list of Attributes
    +468  * n = o.length();                         // get number of Attribute
    +469  * o.add(new KJUR.asn1.cms.SigningTime()); // add SigningTime attribute
    +470  * hex = o.getEncodedHex();                // get hex encoded ASN.1 data
    +471  */
    +472 KJUR.asn1.cms.AttributeList = function(params) {
    +473     KJUR.asn1.cms.AttributeList.superclass.constructor.call(this);
    +474     this.list = new Array();
    +475     this.sortFlag = true;
    +476 
    +477     this.add = function(item) {
    +478         if (item instanceof KJUR.asn1.cms.Attribute) {
    +479             this.list.push(item);
    +480         }
    +481     };
    +482 
    +483     this.length = function() {
    +484         return this.list.length;
    +485     };
    +486 
    +487     this.clear = function() {
    +488         this.list = new Array();
    +489         this.hTLV = null;
    +490         this.hV = null;
    +491     };
    +492 
    +493     this.getEncodedHex = function() {
    +494         if (typeof this.hTLV == "string") return this.hTLV;
    +495         var set = new KJUR.asn1.DERSet({array: this.list, 
    +496                                         sortflag: this.sortFlag});
    +497         this.hTLV = set.getEncodedHex();
    +498         return this.hTLV;
    +499     };
    +500 
    +501     if (typeof params != "undefined") {
    +502         if (typeof params.sortflag != "undefined" &&
    +503             params.sortflag == false)
    +504             this.sortFlag = false;
    +505     }
    +506 };
    +507 YAHOO.lang.extend(KJUR.asn1.cms.AttributeList, KJUR.asn1.ASN1Object);
    +508 
    +509 /**
    +510  * class for SignerInfo ASN.1 structure of CMS SignedData
    +511  * @name KJUR.asn1.cms.SignerInfo
    +512  * @class class for Attributes ASN.1 structure of CMS SigndData
    +513  * @param {Array} params associative array of parameters
    +514  * @extends KJUR.asn1.ASN1Object
    +515  * @since jsrsasign 4.2.4 asn1cms 1.0.0
    +516  * @description
    +517  * <pre>
    +518  * SignerInfo ::= SEQUENCE {
    +519  *    version CMSVersion,
    +520  *    sid SignerIdentifier,
    +521  *    digestAlgorithm DigestAlgorithmIdentifier,
    +522  *    signedAttrs [0] IMPLICIT SignedAttributes OPTIONAL,
    +523  *    signatureAlgorithm SignatureAlgorithmIdentifier,
    +524  *    signature SignatureValue,
    +525  *    unsignedAttrs [1] IMPLICIT UnsignedAttributes OPTIONAL }
    +526  * </pre>
    +527  * @example
    +528  * o = new KJUR.asn1.cms.SignerInfo();
    +529  * o.setSignerIdentifier(certPEMstring);
    +530  * o.dSignedAttrs.add(new KJUR.asn1.cms.ContentType({name: 'data'}));
    +531  * o.dSignedAttrs.add(new KJUR.asn1.cms.MessageDigest({hex: 'a1b2...'}));
    +532  * o.dSignedAttrs.add(new KJUR.asn1.cms.SigningTime());
    +533  * o.sign(privteKeyParam, "SHA1withRSA");
    +534  */
    +535 KJUR.asn1.cms.SignerInfo = function(params) {
    +536     KJUR.asn1.cms.SignerInfo.superclass.constructor.call(this);
    +537     var nA = KJUR.asn1;
    +538     var nC = KJUR.asn1.cms;
    +539     var nX = KJUR.asn1.x509;
    +540 
    +541     this.dCMSVersion = new nA.DERInteger({'int': 1});
    +542     this.dSignerIdentifier = null;
    +543     this.dDigestAlgorithm = null;
    +544     this.dSignedAttrs = new nC.AttributeList();
    +545     this.dSigAlg = null;
    +546     this.dSig = null;
    +547     this.dUnsignedAttrs = new nC.AttributeList();
    +548 
    +549     this.setSignerIdentifier = function(params) {
    +550         if (typeof params == "string" &&
    +551             params.indexOf("CERTIFICATE") != -1 &&
    +552             params.indexOf("BEGIN") != -1 &&
    +553             params.indexOf("END") != -1) {
    +554 
    +555             var certPEM = params;
    +556             this.dSignerIdentifier = 
    +557                 new nC.IssuerAndSerialNumber({cert: params});
    +558         }
    +559     };
    +560 
    +561     /**
    +562      * set ContentType/MessageDigest/DigestAlgorithms for SignerInfo/SignedData
    +563      * @name setForContentAndHash
    +564      * @memberOf KJUR.asn1.cms.SignerInfo
    +565      * @param {Array} params JSON parameter to set content related field
    +566      * @description
    +567      * This method will specify following fields by a parameters:
     568      * <ul>
    -569      * <li>eciObj - {@link KJUR.asn1.cms.EncapsulatedContentInfo} object</li>
    -570      * <li>sdObj - {@link KJUR.asn1.cms.SignedData} object (Option) to set DigestAlgorithms</li>
    -571      * <li>hashAlg - string of hash algorithm name which is used for MessageDigest attribute</li>
    -572      * </ul>
    -573      * some of elements can be omited.
    -574      * @example
    -575      * sd = new KJUR.asn1.cms.SignedData();
    -576      * signerInfo.setForContentAndHash({sdObj: sd,
    -577      *                                  eciObj: sd.dEncapContentInfo,
    -578      *                                  hashAlg: 'sha256'});
    -579      */
    -580     this.setForContentAndHash = function(params) {
    -581         if (typeof params != "undefined") {
    -582             if (params.eciObj instanceof KJUR.asn1.cms.EncapsulatedContentInfo) {
    -583                 this.dSignedAttrs.add(new nC.ContentType({oid: '1.2.840.113549.1.7.1'}));
    -584                 this.dSignedAttrs.add(new nC.MessageDigest({eciObj: params.eciObj,
    -585                                                             hashAlg: params.hashAlg}));
    -586             }
    -587             if (typeof params.sdObj != "undefined" &&
    -588                 params.sdObj instanceof KJUR.asn1.cms.SignedData) {
    -589                 if (params.sdObj.digestAlgNameList.join(":").indexOf(params.hashAlg) == -1) {
    -590                     params.sdObj.digestAlgNameList.push(params.hashAlg);
    -591                 }
    -592             }
    -593             if (typeof params.hashAlg == "string") {
    -594                 this.dDigestAlgorithm = new nX.AlgorithmIdentifier({name: params.hashAlg});
    -595             }
    -596         }
    -597     };
    -598 
    -599     this.sign = function(keyParam, sigAlg) {
    -600         // set algorithm
    -601         this.dSigAlg = new nX.AlgorithmIdentifier({name: sigAlg});
    -602 
    -603         // set signature
    -604         var data = this.dSignedAttrs.getEncodedHex();
    -605         var prvKey = KEYUTIL.getKey(keyParam);
    -606         var sig = new KJUR.crypto.Signature({alg: sigAlg});
    -607         sig.init(prvKey);
    -608         sig.updateHex(data);
    -609         var sigValHex = sig.sign();
    -610         this.dSig = new nA.DEROctetString({hex: sigValHex});
    -611     };
    -612 
    -613     this.getEncodedHex = function() {
    -614         if (this.dSignedAttrs.length() == 0) {
    -615             throw "SignedAttrs length = 0 (empty)";
    -616         }
    -617         var sa = new nA.DERTaggedObject({obj: this.dSignedAttrs, tag: 'a0', explicit: false});
    -618         var ua = null;;
    -619         if (this.dUnsignedAttrs.length() > 0) {
    -620             ua = new nA.DERTaggedObject({obj: this.dUnsignedAttrs, tag: 'a1', explicit: false});
    -621         }
    -622 
    -623         var items = [
    -624             this.dCMSVersion,
    -625             this.dSignerIdentifier,
    -626             this.dDigestAlgorithm,
    -627             sa,
    -628             this.dSigAlg,
    -629             this.dSig,
    -630         ];
    -631         if (ua != null) items.push(ua);
    -632 
    -633         var seq = new nA.DERSequence({array: items});
    -634         this.hTLV = seq.getEncodedHex();
    -635         return this.hTLV;
    -636     };
    -637 };
    -638 YAHOO.lang.extend(KJUR.asn1.cms.SignerInfo, KJUR.asn1.ASN1Object);
    -639 
    -640 /**
    -641  * class for EncapsulatedContentInfo ASN.1 structure for CMS
    -642  * @name KJUR.asn1.cms.EncapsulatedContentInfo
    -643  * @class class for EncapsulatedContentInfo ASN.1 structure for CMS
    -644  * @param {Array} params associative array of parameters
    -645  * @extends KJUR.asn1.ASN1Object
    -646  * @since jsrsasign 4.2.4 asn1cms 1.0.0
    -647  * @description
    -648  * <pre>
    -649  * EncapsulatedContentInfo ::= SEQUENCE {
    -650  *    eContentType ContentType,
    -651  *    eContent [0] EXPLICIT OCTET STRING OPTIONAL }
    -652  * ContentType ::= OBJECT IDENTIFIER
    -653  * </pre>
    -654  * @example
    -655  * o = new KJUR.asn1.cms.EncapsulatedContentInfo();
    -656  * o.setContentType('1.2.3.4.5');     // specify eContentType by OID
    -657  * o.setContentType('data');          // specify eContentType by name
    -658  * o.setContentValueHex('a1a2a4...'); // specify eContent data by hex string
    -659  * o.setContentValueStr('apple');     // specify eContent data by UTF-8 string
    -660  * // for detached contents (i.e. data not concluded in eContent)
    -661  * o.isDetached = true;               // false as default 
    -662  */
    -663 KJUR.asn1.cms.EncapsulatedContentInfo = function(params) {
    -664     KJUR.asn1.cms.EncapsulatedContentInfo.superclass.constructor.call(this);
    -665     var nA = KJUR.asn1;
    -666     var nC = KJUR.asn1.cms;
    -667     var nX = KJUR.asn1.x509;
    -668     this.dEContentType = new nA.DERObjectIdentifier({name: 'data'});
    -669     this.dEContent = null;
    -670     this.isDetached = false;
    -671     this.eContentValueHex = null;
    -672     
    -673     this.setContentType = function(nameOrOid) {
    -674         if (nameOrOid.match(/^[0-2][.][0-9.]+$/)) {
    -675             this.dEContentType = new nA.DERObjectIdentifier({oid: nameOrOid});
    -676         } else {
    -677             this.dEContentType = new nA.DERObjectIdentifier({name: nameOrOid});
    -678         }
    -679     };
    -680 
    -681     this.setContentValue = function(params) {
    -682         if (typeof params != "undefined") {
    -683             if (typeof params.hex == "string") {
    -684                 this.eContentValueHex = params.hex;
    -685             } else if (typeof params.str == "string") {
    -686                 this.eContentValueHex = utf8tohex(params.str);
    -687             }
    -688         }
    -689     };
    -690 
    -691     this.setContentValueHex = function(valueHex) {
    -692         this.eContentValueHex = valueHex;
    -693     };
    -694 
    -695     this.setContentValueStr = function(valueStr) {
    -696         this.eContentValueHex = utf8tohex(valueStr);
    -697     };
    -698 
    -699     this.getEncodedHex = function() {
    -700         if (typeof this.eContentValueHex != "string") {
    -701             throw "eContentValue not yet set";
    -702         }
    -703 
    -704         var dValue = new nA.DEROctetString({hex: this.eContentValueHex});
    -705         this.dEContent = new nA.DERTaggedObject({obj: dValue,
    -706                                                  tag: 'a0',
    -707                                                  explicit: true});
    -708 
    -709         var a = [this.dEContentType];
    -710         if (! this.isDetached) a.push(this.dEContent);
    -711         var seq = new nA.DERSequence({array: a});
    -712         this.hTLV = seq.getEncodedHex();
    -713         return this.hTLV;
    -714     };
    -715 };
    -716 YAHOO.lang.extend(KJUR.asn1.cms.EncapsulatedContentInfo, KJUR.asn1.ASN1Object);
    -717 
    -718 // - type
    -719 // - obj
    -720 /**
    -721  * class for ContentInfo ASN.1 structure for CMS
    -722  * @name KJUR.asn1.cms.ContentInfo
    -723  * @class class for ContentInfo ASN.1 structure for CMS
    -724  * @param {Array} params associative array of parameters
    -725  * @extends KJUR.asn1.ASN1Object
    -726  * @since jsrsasign 4.2.4 asn1cms 1.0.0
    -727  * @description
    -728  * <pre>
    -729  * ContentInfo ::= SEQUENCE {
    -730  *    contentType ContentType,
    -731  *    content [0] EXPLICIT ANY DEFINED BY contentType }
    -732  * ContentType ::= OBJECT IDENTIFIER
    -733  * </pre>
    -734  * @example
    -735  * a = [new KJUR.asn1.DERInteger({int: 1}),
    -736  *      new KJUR.asn1.DERInteger({int: 2})];
    -737  * seq = new KJUR.asn1.DERSequence({array: a});
    -738  * o = new KJUR.asn1.cms.ContentInfo({type: 'data', obj: seq});
    -739  */
    -740 KJUR.asn1.cms.ContentInfo = function(params) {
    -741     KJUR.asn1.cms.ContentInfo.superclass.constructor.call(this);
    -742     var nA = KJUR.asn1;
    -743     var nC = KJUR.asn1.cms;
    -744     var nX = KJUR.asn1.x509;
    -745 
    -746     this.dContentType = null;
    -747     this.dContent = null;
    -748 
    -749     this.setContentType = function(params) {
    -750         if (typeof params == "string") {
    -751             this.dContentType = nX.OID.name2obj(params);
    -752         }
    -753     };
    -754 
    -755     this.getEncodedHex = function() {
    -756         var dContent0 = new nA.DERTaggedObject({obj: this.dContent, tag: 'a0', explicit: true});
    -757         var seq = new nA.DERSequence({array: [this.dContentType, dContent0]});
    -758         this.hTLV = seq.getEncodedHex();
    -759         return this.hTLV;
    -760     };
    -761 
    -762     if (typeof params != "undefined") {
    -763         if (params.type) this.setContentType(params.type);
    -764         if (params.obj && params.obj instanceof nA.ASN1Object) this.dContent = params.obj;
    -765     }
    -766 };
    -767 YAHOO.lang.extend(KJUR.asn1.cms.ContentInfo, KJUR.asn1.ASN1Object);
    +569      * <li>add ContentType signed attribute by encapContentInfo</li>
    +570      * <li>add MessageDigest signed attribute by encapContentInfo and hashAlg</li>
    +571      * <li>add a hash algorithm used in MessageDigest to digestAlgorithms field of SignedData</li>
    +572      * <li>set a hash algorithm used in MessageDigest to digestAlgorithm field of SignerInfo</li>
    +573      * </ul>
    +574      * Argument 'params' is an associative array having following elements:
    +575      * <ul>
    +576      * <li>eciObj - {@link KJUR.asn1.cms.EncapsulatedContentInfo} object</li>
    +577      * <li>sdObj - {@link KJUR.asn1.cms.SignedData} object (Option) to set DigestAlgorithms</li>
    +578      * <li>hashAlg - string of hash algorithm name which is used for MessageDigest attribute</li>
    +579      * </ul>
    +580      * some of elements can be omited.
    +581      * @example
    +582      * sd = new KJUR.asn1.cms.SignedData();
    +583      * signerInfo.setForContentAndHash({sdObj: sd,
    +584      *                                  eciObj: sd.dEncapContentInfo,
    +585      *                                  hashAlg: 'sha256'});
    +586      */
    +587     this.setForContentAndHash = function(params) {
    +588         if (typeof params != "undefined") {
    +589             if (params.eciObj instanceof KJUR.asn1.cms.EncapsulatedContentInfo) {
    +590                 this.dSignedAttrs.add(new nC.ContentType({oid: '1.2.840.113549.1.7.1'}));
    +591                 this.dSignedAttrs.add(new nC.MessageDigest({eciObj: params.eciObj,
    +592                                                             hashAlg: params.hashAlg}));
    +593             }
    +594             if (typeof params.sdObj != "undefined" &&
    +595                 params.sdObj instanceof KJUR.asn1.cms.SignedData) {
    +596                 if (params.sdObj.digestAlgNameList.join(":").indexOf(params.hashAlg) == -1) {
    +597                     params.sdObj.digestAlgNameList.push(params.hashAlg);
    +598                 }
    +599             }
    +600             if (typeof params.hashAlg == "string") {
    +601                 this.dDigestAlgorithm = new nX.AlgorithmIdentifier({name: params.hashAlg});
    +602             }
    +603         }
    +604     };
    +605 
    +606     this.sign = function(keyParam, sigAlg) {
    +607         // set algorithm
    +608         this.dSigAlg = new nX.AlgorithmIdentifier({name: sigAlg});
    +609 
    +610         // set signature
    +611         var data = this.dSignedAttrs.getEncodedHex();
    +612         var prvKey = KEYUTIL.getKey(keyParam);
    +613         var sig = new KJUR.crypto.Signature({alg: sigAlg});
    +614         sig.init(prvKey);
    +615         sig.updateHex(data);
    +616         var sigValHex = sig.sign();
    +617         this.dSig = new nA.DEROctetString({hex: sigValHex});
    +618     };
    +619 
    +620     /*
    +621      * @since asn1cms 1.0.3
    +622      */
    +623     this.addUnsigned = function(attr) {
    +624         this.hTLV = null;
    +625         this.dUnsignedAttrs.hTLV = null;
    +626         this.dUnsignedAttrs.add(attr);
    +627     };
    +628 
    +629     this.getEncodedHex = function() {
    +630         //alert("sattrs.hTLV=" + this.dSignedAttrs.hTLV);
    +631         if (this.dSignedAttrs instanceof KJUR.asn1.cms.AttributeList &&
    +632             this.dSignedAttrs.length() == 0) {
    +633             throw "SignedAttrs length = 0 (empty)";
    +634         }
    +635         var sa = new nA.DERTaggedObject({obj: this.dSignedAttrs,
    +636                                          tag: 'a0', explicit: false});
    +637         var ua = null;;
    +638         if (this.dUnsignedAttrs.length() > 0) {
    +639             ua = new nA.DERTaggedObject({obj: this.dUnsignedAttrs,
    +640                                          tag: 'a1', explicit: false});
    +641         }
    +642 
    +643         var items = [
    +644             this.dCMSVersion,
    +645             this.dSignerIdentifier,
    +646             this.dDigestAlgorithm,
    +647             sa,
    +648             this.dSigAlg,
    +649             this.dSig,
    +650         ];
    +651         if (ua != null) items.push(ua);
    +652 
    +653         var seq = new nA.DERSequence({array: items});
    +654         this.hTLV = seq.getEncodedHex();
    +655         return this.hTLV;
    +656     };
    +657 };
    +658 YAHOO.lang.extend(KJUR.asn1.cms.SignerInfo, KJUR.asn1.ASN1Object);
    +659 
    +660 /**
    +661  * class for EncapsulatedContentInfo ASN.1 structure for CMS
    +662  * @name KJUR.asn1.cms.EncapsulatedContentInfo
    +663  * @class class for EncapsulatedContentInfo ASN.1 structure for CMS
    +664  * @param {Array} params associative array of parameters
    +665  * @extends KJUR.asn1.ASN1Object
    +666  * @since jsrsasign 4.2.4 asn1cms 1.0.0
    +667  * @description
    +668  * <pre>
    +669  * EncapsulatedContentInfo ::= SEQUENCE {
    +670  *    eContentType ContentType,
    +671  *    eContent [0] EXPLICIT OCTET STRING OPTIONAL }
    +672  * ContentType ::= OBJECT IDENTIFIER
    +673  * </pre>
    +674  * @example
    +675  * o = new KJUR.asn1.cms.EncapsulatedContentInfo();
    +676  * o.setContentType('1.2.3.4.5');     // specify eContentType by OID
    +677  * o.setContentType('data');          // specify eContentType by name
    +678  * o.setContentValueHex('a1a2a4...'); // specify eContent data by hex string
    +679  * o.setContentValueStr('apple');     // specify eContent data by UTF-8 string
    +680  * // for detached contents (i.e. data not concluded in eContent)
    +681  * o.isDetached = true;               // false as default 
    +682  */
    +683 KJUR.asn1.cms.EncapsulatedContentInfo = function(params) {
    +684     KJUR.asn1.cms.EncapsulatedContentInfo.superclass.constructor.call(this);
    +685     var nA = KJUR.asn1;
    +686     var nC = KJUR.asn1.cms;
    +687     var nX = KJUR.asn1.x509;
    +688     this.dEContentType = new nA.DERObjectIdentifier({name: 'data'});
    +689     this.dEContent = null;
    +690     this.isDetached = false;
    +691     this.eContentValueHex = null;
    +692     
    +693     this.setContentType = function(nameOrOid) {
    +694         if (nameOrOid.match(/^[0-2][.][0-9.]+$/)) {
    +695             this.dEContentType = new nA.DERObjectIdentifier({oid: nameOrOid});
    +696         } else {
    +697             this.dEContentType = new nA.DERObjectIdentifier({name: nameOrOid});
    +698         }
    +699     };
    +700 
    +701     this.setContentValue = function(params) {
    +702         if (typeof params != "undefined") {
    +703             if (typeof params.hex == "string") {
    +704                 this.eContentValueHex = params.hex;
    +705             } else if (typeof params.str == "string") {
    +706                 this.eContentValueHex = utf8tohex(params.str);
    +707             }
    +708         }
    +709     };
    +710 
    +711     this.setContentValueHex = function(valueHex) {
    +712         this.eContentValueHex = valueHex;
    +713     };
    +714 
    +715     this.setContentValueStr = function(valueStr) {
    +716         this.eContentValueHex = utf8tohex(valueStr);
    +717     };
    +718 
    +719     this.getEncodedHex = function() {
    +720         if (typeof this.eContentValueHex != "string") {
    +721             throw "eContentValue not yet set";
    +722         }
    +723 
    +724         var dValue = new nA.DEROctetString({hex: this.eContentValueHex});
    +725         this.dEContent = new nA.DERTaggedObject({obj: dValue,
    +726                                                  tag: 'a0',
    +727                                                  explicit: true});
    +728 
    +729         var a = [this.dEContentType];
    +730         if (! this.isDetached) a.push(this.dEContent);
    +731         var seq = new nA.DERSequence({array: a});
    +732         this.hTLV = seq.getEncodedHex();
    +733         return this.hTLV;
    +734     };
    +735 };
    +736 YAHOO.lang.extend(KJUR.asn1.cms.EncapsulatedContentInfo, KJUR.asn1.ASN1Object);
    +737 
    +738 // - type
    +739 // - obj
    +740 /**
    +741  * class for ContentInfo ASN.1 structure for CMS
    +742  * @name KJUR.asn1.cms.ContentInfo
    +743  * @class class for ContentInfo ASN.1 structure for CMS
    +744  * @param {Array} params associative array of parameters
    +745  * @extends KJUR.asn1.ASN1Object
    +746  * @since jsrsasign 4.2.4 asn1cms 1.0.0
    +747  * @description
    +748  * <pre>
    +749  * ContentInfo ::= SEQUENCE {
    +750  *    contentType ContentType,
    +751  *    content [0] EXPLICIT ANY DEFINED BY contentType }
    +752  * ContentType ::= OBJECT IDENTIFIER
    +753  * </pre>
    +754  * @example
    +755  * a = [new KJUR.asn1.DERInteger({int: 1}),
    +756  *      new KJUR.asn1.DERInteger({int: 2})];
    +757  * seq = new KJUR.asn1.DERSequence({array: a});
    +758  * o = new KJUR.asn1.cms.ContentInfo({type: 'data', obj: seq});
    +759  */
    +760 KJUR.asn1.cms.ContentInfo = function(params) {
    +761     KJUR.asn1.cms.ContentInfo.superclass.constructor.call(this);
    +762     var nA = KJUR.asn1;
    +763     var nC = KJUR.asn1.cms;
    +764     var nX = KJUR.asn1.x509;
    +765 
    +766     this.dContentType = null;
    +767     this.dContent = null;
     768 
    -769 /**
    -770  * class for SignerInfo ASN.1 structure of CMS SignedData
    -771  * @name KJUR.asn1.cms.SignedData
    -772  * @class class for Attributes ASN.1 structure of CMS SigndData
    -773  * @param {Array} params associative array of parameters
    -774  * @extends KJUR.asn1.ASN1Object
    -775  * @since jsrsasign 4.2.4 asn1cms 1.0.0
    -776  *
    -777  * @description
    -778  * <pre>
    -779  * SignedData ::= SEQUENCE {
    -780  *    version CMSVersion,
    -781  *    digestAlgorithms DigestAlgorithmIdentifiers,
    -782  *    encapContentInfo EncapsulatedContentInfo,
    -783  *    certificates [0] IMPLICIT CertificateSet OPTIONAL,
    -784  *    crls [1] IMPLICIT RevocationInfoChoices OPTIONAL,
    -785  *    signerInfos SignerInfos }
    -786  * SignerInfos ::= SET OF SignerInfo
    -787  * CertificateSet ::= SET OF CertificateChoices
    -788  * DigestAlgorithmIdentifiers ::= SET OF DigestAlgorithmIdentifier
    -789  * CertificateSet ::= SET OF CertificateChoices
    -790  * RevocationInfoChoices ::= SET OF RevocationInfoChoice
    -791  * </pre>
    -792  *
    -793  * @example
    -794  * sd = new KJUR.asn1.cms.SignedData();
    -795  * sd.dEncapContentInfo.setContentValueStr("test string");
    -796  * sd.signerInfoList[0].setForContentAndHash({sdObj: sd,
    -797  *                                            eciObj: sd.dEncapContentInfo,
    -798  *                                            hashAlg: 'sha256'});
    -799  * sd.signerInfoList[0].dSignedAttrs.add(new KJUR.asn1.cms.SigningTime());
    -800  * sd.signerInfoList[0].setSignerIdentifier(certPEM);
    -801  * sd.signerInfoList[0].sign(prvP8PEM, "SHA256withRSA");
    -802  * hex = sd.getContentInfoEncodedHex();
    -803  */
    -804 KJUR.asn1.cms.SignedData = function(params) {
    -805     KJUR.asn1.cms.SignedData.superclass.constructor.call(this);
    -806     var nA = KJUR.asn1;
    -807     var nC = KJUR.asn1.cms;
    -808     var nX = KJUR.asn1.x509;
    -809 
    -810     this.dCMSVersion = new nA.DERInteger({'int': 1});
    -811     this.digestAlgNameList = [];
    -812     this.dEncapContentInfo = new nC.EncapsulatedContentInfo();
    -813     this.certificateList = [];
    -814     this.crlList = [];
    -815     this.signerInfoList = [new nC.SignerInfo()];
    -816 
    -817     this.addCertificatesByPEM = function(certPEM) {
    -818         var hex = KEYUTIL.getHexFromPEM(certPEM);
    -819         var o = new nA.ASN1Object();
    -820         o.hTLV = hex;
    -821         this.certificateList.push(o);
    -822     };
    -823 
    -824     this.getEncodedHex = function() {
    -825         if (typeof this.hTLV == "string") return this.hTLV;
    -826         
    -827         var digestAlgList = [];
    -828         for (var i = 0; i < this.digestAlgNameList.length; i++) {
    -829             var o = new nX.AlgorithmIdentifier({name: this.digestAlgNameList[i]});
    -830             digestAlgList.push(o);
    -831         }
    -832 
    -833         var dDigestAlgs = new nA.DERSet({array: digestAlgList});
    -834         var dSignerInfos = new nA.DERSet({array: this.signerInfoList});
    -835 
    -836         var a = [this.dCMSVersion,
    -837                  dDigestAlgs,
    -838                  this.dEncapContentInfo];
    -839 
    -840         if (this.certificateList.length > 0) {
    -841             var o1 = new nA.DERSet({array: this.certificateList});
    -842             var o2 = new nA.DERTaggedObject({obj: o1,
    -843                                              tag: 'a0',
    -844                                              explicit: false});
    -845             a.push(o2);
    -846         }
    -847         
    -848         a.push(dSignerInfos);
    -849 
    -850         var seq = new nA.DERSequence({array: a});
    -851         this.hTLV = seq.getEncodedHex();
    -852         return this.hTLV;
    -853     };
    -854 
    -855     this.getContentInfo = function() {
    -856         this.getEncodedHex();
    -857         var ci = new nC.ContentInfo({type: 'signed-data', obj: this});
    -858 	return ci;
    -859     };
    -860 
    -861     this.getContentInfoEncodedHex = function() {
    -862 	var ci = this.getContentInfo();
    -863         var ciHex = ci.getEncodedHex();
    -864         return ciHex;
    -865     };
    -866 
    -867     this.getPEM = function() {
    -868         var hex = this.getContentInfoEncodedHex();
    -869         var pem = nA.ASN1Util.getPEMStringFromHex(hex, "CMS");
    -870         return pem;
    -871     };
    -872 };
    -873 YAHOO.lang.extend(KJUR.asn1.cms.SignedData, KJUR.asn1.ASN1Object);
    -874 
    -875 /**
    -876  * CMS utiliteis class
    -877  * @name KJUR.asn1.cms.CMSUtil
    -878  * @class CMS utilities class
    -879  */
    -880 KJUR.asn1.cms.CMSUtil = new function() {
    -881 };
    -882 /**
    -883  * generate SignedData object specified by JSON parameters
    -884  * @name newSignedData
    -885  * @memberOf KJUR.asn1.cms.CMSUtil
    -886  * @function
    -887  * @param {Array} param JSON parameter to generate CMS SignedData
    -888  * @return {KJUR.asn1.cms.SignedData} object just generated
    -889  * @description
    -890  * This method provides more easy way to genereate
    -891  * CMS SignedData ASN.1 structure by JSON data.
    -892  * @example
    -893  * var sd = KJUR.asn1.cms.CMSUtil.newSignedData({
    -894  *   content: {str: "jsrsasign"},
    -895  *   certs: [certPEM],
    -896  *   signerInfos: [{
    -897  *     hashAlg: 'sha256',
    -898  *     sAttr: {
    -899  *       SigningTime: {}
    -900  *     },
    -901  *     signerCert: certPEM,
    -902  *     sigAlg: 'SHA256withRSA',
    -903  *     signerPrvKey: prvPEM
    -904  *   }]
    -905  * });
    +769     this.setContentType = function(params) {
    +770         if (typeof params == "string") {
    +771             this.dContentType = nX.OID.name2obj(params);
    +772         }
    +773     };
    +774 
    +775     this.getEncodedHex = function() {
    +776         var dContent0 = new nA.DERTaggedObject({obj: this.dContent, tag: 'a0', explicit: true});
    +777         var seq = new nA.DERSequence({array: [this.dContentType, dContent0]});
    +778         this.hTLV = seq.getEncodedHex();
    +779         return this.hTLV;
    +780     };
    +781 
    +782     if (typeof params != "undefined") {
    +783         if (params.type) this.setContentType(params.type);
    +784         if (params.obj && params.obj instanceof nA.ASN1Object) this.dContent = params.obj;
    +785     }
    +786 };
    +787 YAHOO.lang.extend(KJUR.asn1.cms.ContentInfo, KJUR.asn1.ASN1Object);
    +788 
    +789 /**
    +790  * class for SignerInfo ASN.1 structure of CMS SignedData
    +791  * @name KJUR.asn1.cms.SignedData
    +792  * @class class for Attributes ASN.1 structure of CMS SigndData
    +793  * @param {Array} params associative array of parameters
    +794  * @extends KJUR.asn1.ASN1Object
    +795  * @since jsrsasign 4.2.4 asn1cms 1.0.0
    +796  *
    +797  * @description
    +798  * <pre>
    +799  * SignedData ::= SEQUENCE {
    +800  *    version CMSVersion,
    +801  *    digestAlgorithms DigestAlgorithmIdentifiers,
    +802  *    encapContentInfo EncapsulatedContentInfo,
    +803  *    certificates [0] IMPLICIT CertificateSet OPTIONAL,
    +804  *    crls [1] IMPLICIT RevocationInfoChoices OPTIONAL,
    +805  *    signerInfos SignerInfos }
    +806  * SignerInfos ::= SET OF SignerInfo
    +807  * CertificateSet ::= SET OF CertificateChoices
    +808  * DigestAlgorithmIdentifiers ::= SET OF DigestAlgorithmIdentifier
    +809  * CertificateSet ::= SET OF CertificateChoices
    +810  * RevocationInfoChoices ::= SET OF RevocationInfoChoice
    +811  * </pre>
    +812  *
    +813  * @example
    +814  * sd = new KJUR.asn1.cms.SignedData();
    +815  * sd.dEncapContentInfo.setContentValueStr("test string");
    +816  * sd.signerInfoList[0].setForContentAndHash({sdObj: sd,
    +817  *                                            eciObj: sd.dEncapContentInfo,
    +818  *                                            hashAlg: 'sha256'});
    +819  * sd.signerInfoList[0].dSignedAttrs.add(new KJUR.asn1.cms.SigningTime());
    +820  * sd.signerInfoList[0].setSignerIdentifier(certPEM);
    +821  * sd.signerInfoList[0].sign(prvP8PEM, "SHA256withRSA");
    +822  * hex = sd.getContentInfoEncodedHex();
    +823  */
    +824 KJUR.asn1.cms.SignedData = function(params) {
    +825     KJUR.asn1.cms.SignedData.superclass.constructor.call(this);
    +826     var nA = KJUR.asn1;
    +827     var nC = KJUR.asn1.cms;
    +828     var nX = KJUR.asn1.x509;
    +829 
    +830     this.dCMSVersion = new nA.DERInteger({'int': 1});
    +831     this.dDigestAlgs = null;
    +832     this.digestAlgNameList = [];
    +833     this.dEncapContentInfo = new nC.EncapsulatedContentInfo();
    +834     this.dCerts = null;
    +835     this.certificateList = [];
    +836     this.crlList = [];
    +837     this.signerInfoList = [new nC.SignerInfo()];
    +838 
    +839     this.addCertificatesByPEM = function(certPEM) {
    +840         var hex = KEYUTIL.getHexFromPEM(certPEM);
    +841         var o = new nA.ASN1Object();
    +842         o.hTLV = hex;
    +843         this.certificateList.push(o);
    +844     };
    +845 
    +846     this.getEncodedHex = function() {
    +847         if (typeof this.hTLV == "string") return this.hTLV;
    +848         
    +849         if (this.dDigestAlgs == null) {
    +850             var digestAlgList = [];
    +851             for (var i = 0; i < this.digestAlgNameList.length; i++) {
    +852                 var name = this.digestAlgNameList[i];
    +853                 var o = new nX.AlgorithmIdentifier({name: name});
    +854                 digestAlgList.push(o);
    +855             }
    +856             this.dDigestAlgs = new nA.DERSet({array: digestAlgList});
    +857         }
    +858 
    +859         var a = [this.dCMSVersion,
    +860                  this.dDigestAlgs,
    +861                  this.dEncapContentInfo];
    +862 
    +863         if (this.dCerts == null) {
    +864             if (this.certificateList.length > 0) {
    +865                 var o1 = new nA.DERSet({array: this.certificateList});
    +866                 this.dCerts
    +867                     = new nA.DERTaggedObject({obj: o1,
    +868                                               tag: 'a0',
    +869                                               explicit: false});
    +870             }
    +871         }
    +872         if (this.dCerts != null) a.push(this.dCerts);
    +873         
    +874         var dSignerInfos = new nA.DERSet({array: this.signerInfoList});
    +875         a.push(dSignerInfos);
    +876 
    +877         var seq = new nA.DERSequence({array: a});
    +878         this.hTLV = seq.getEncodedHex();
    +879         return this.hTLV;
    +880     };
    +881 
    +882     this.getContentInfo = function() {
    +883         this.getEncodedHex();
    +884         var ci = new nC.ContentInfo({type: 'signed-data', obj: this});
    +885         return ci;
    +886     };
    +887 
    +888     this.getContentInfoEncodedHex = function() {
    +889         var ci = this.getContentInfo();
    +890         var ciHex = ci.getEncodedHex();
    +891         return ciHex;
    +892     };
    +893 
    +894     this.getPEM = function() {
    +895         var hex = this.getContentInfoEncodedHex();
    +896         var pem = nA.ASN1Util.getPEMStringFromHex(hex, "CMS");
    +897         return pem;
    +898     };
    +899 };
    +900 YAHOO.lang.extend(KJUR.asn1.cms.SignedData, KJUR.asn1.ASN1Object);
    +901 
    +902 /**
    +903  * CMS utiliteis class
    +904  * @name KJUR.asn1.cms.CMSUtil
    +905  * @class CMS utilities class
     906  */
    -907 KJUR.asn1.cms.CMSUtil.newSignedData = function(param) {
    -908     var nC = KJUR.asn1.cms;
    -909     var sd = new nC.SignedData();
    -910 
    -911     sd.dEncapContentInfo.setContentValue(param.content);
    -912 
    -913     if (typeof param.certs == "object") {
    -914         for (var i = 0; i < param.certs.length; i++) {
    -915             sd.addCertificatesByPEM(param.certs[i]);
    -916         }
    -917     }
    -918     
    -919     sd.signerInfoList = [];
    -920     for (var i = 0; i < param.signerInfos.length; i++) {
    -921         var siParam = param.signerInfos[i];
    -922         var si = new nC.SignerInfo();
    -923         si.setSignerIdentifier(siParam.signerCert);
    -924 
    -925         si.setForContentAndHash({sdObj: sd,
    -926                                  eciObj: sd.dEncapContentInfo,
    -927                                  hashAlg: siParam.hashAlg});
    -928 
    -929         for (attrName in siParam.sAttr) {
    -930             if (attrName == "SigningTime") {
    -931                 var attr = new nC.SigningTime(siParam.sAttr[attrName]);
    -932                 si.dSignedAttrs.add(attr);
    -933             }
    -934         }
    -935 
    -936         si.sign(siParam.signerPrvKey, siParam.sigAlg);
    -937         sd.signerInfoList.push(si);
    -938     }
    +907 KJUR.asn1.cms.CMSUtil = new function() {
    +908 };
    +909 /**
    +910  * generate SignedData object specified by JSON parameters
    +911  * @name newSignedData
    +912  * @memberOf KJUR.asn1.cms.CMSUtil
    +913  * @function
    +914  * @param {Array} param JSON parameter to generate CMS SignedData
    +915  * @return {KJUR.asn1.cms.SignedData} object just generated
    +916  * @description
    +917  * This method provides more easy way to genereate
    +918  * CMS SignedData ASN.1 structure by JSON data.
    +919  * @example
    +920  * var sd = KJUR.asn1.cms.CMSUtil.newSignedData({
    +921  *   content: {str: "jsrsasign"},
    +922  *   certs: [certPEM],
    +923  *   signerInfos: [{
    +924  *     hashAlg: 'sha256',
    +925  *     sAttr: {
    +926  *       SigningTime: {}
    +927  *       SigningCertificateV2: {array: [certPEM]},
    +928  *     },
    +929  *     signerCert: certPEM,
    +930  *     sigAlg: 'SHA256withRSA',
    +931  *     signerPrvKey: prvPEM
    +932  *   }]
    +933  * });
    +934  */
    +935 KJUR.asn1.cms.CMSUtil.newSignedData = function(param) {
    +936     var nC = KJUR.asn1.cms;
    +937     var nE = KJUR.asn1.cades;
    +938     var sd = new nC.SignedData();
     939 
    -940     return sd;
    -941 };
    -942 
    -943 
    \ No newline at end of file +940
    sd.dEncapContentInfo.setContentValue(param.content); +941 +942 if (typeof param.certs == "object") { +943 for (var i = 0; i < param.certs.length; i++) { +944 sd.addCertificatesByPEM(param.certs[i]); +945 } +946 } +947 +948 sd.signerInfoList = []; +949 for (var i = 0; i < param.signerInfos.length; i++) { +950 var siParam = param.signerInfos[i]; +951 var si = new nC.SignerInfo(); +952 si.setSignerIdentifier(siParam.signerCert); +953 +954 si.setForContentAndHash({sdObj: sd, +955 eciObj: sd.dEncapContentInfo, +956 hashAlg: siParam.hashAlg}); +957 +958 for (attrName in siParam.sAttr) { +959 var attrParam = siParam.sAttr[attrName]; +960 if (attrName == "SigningTime") { +961 var attr = new nC.SigningTime(attrParam); +962 si.dSignedAttrs.add(attr); +963 } +964 if (attrName == "SigningCertificate") { +965 var attr = new nC.SigningCertificate(attrParam); +966 si.dSignedAttrs.add(attr); +967 } +968 if (attrName == "SigningCertificateV2") { +969 var attr = new nC.SigningCertificateV2(attrParam); +970 si.dSignedAttrs.add(attr); +971 } +972 if (attrName == "SignaturePolicyIdentifier") { +973 var attr = new nE.SignaturePolicyIdentifier(attrParam); +974 si.dSignedAttrs.add(attr); +975 } +976 } +977 +978 si.sign(siParam.signerPrvKey, siParam.sigAlg); +979 sd.signerInfoList.push(si); +980 } +981 +982 return sd; +983 }; +984 +985
    \ No newline at end of file diff --git a/api/symbols/src/asn1tsp-1.0.js.html b/api/symbols/src/asn1tsp-1.0.js.html index 33b2612c..212a2402 100755 --- a/api/symbols/src/asn1tsp-1.0.js.html +++ b/api/symbols/src/asn1tsp-1.0.js.html @@ -5,7 +5,7 @@ .STRN {color: #393;} .REGX {color: #339;} .line {border-right: 1px dotted #666; color: #666; font-style: normal;} -
      1 /*! asn1tsp-1.0.0.js (c) 2014 Kenji Urushima | kjur.github.com/jsrsasign/license
    +	
      1 /*! asn1tsp-1.0.1.js (c) 2014 Kenji Urushima | kjur.github.com/jsrsasign/license
       2  */
       3 /*
       4  * asn1tsp.js - ASN.1 DER encoder classes for RFC 3161 Time Stamp Protocol
    @@ -23,7 +23,7 @@
      16  * @fileOverview
      17  * @name asn1tsp-1.0.js
      18  * @author Kenji Urushima kenji.urushima@gmail.com
    - 19  * @version 1.0.0 (2014-May-25)
    + 19  * @version 1.0.1 (2014-Jun-07)
      20  * @since jsrsasign 4.5.1
      21  * @license <a href="http://kjur.github.io/jsrsasign/license/">MIT License</a>
      22  */
    @@ -157,7 +157,7 @@
     150     this.getEncodedHex = function() {
     151         if (typeof this.hTLV == "string") return this.hTLV;
     152         var seq = 
    -153 	    new nA.DERSequence({array: [this.dHashAlg, this.dHashValue]});
    +153             new nA.DERSequence({array: [this.dHashAlg, this.dHashValue]});
     154         return seq.getEncodedHex();
     155     };
     156 
    @@ -592,143 +592,237 @@
     585     systemFailure:          25
     586 };
     587 
    -588 // --- END OF RFC 2510 CMP -------------------------------------------------
    +588 // --- END OF RFC 2510 CMP -------------------------------------------
     589 
     590 /**
    -591  * TSP utiliteis class
    -592  * @name KJUR.asn1.tsp.TSPUtil
    -593  * @class TSP utilities class
    -594  */
    -595 KJUR.asn1.tsp.TSPUtil = new function() {
    -596 };
    -597 /**
    -598  * generate TimeStampToken ASN.1 object specified by JSON parameters
    -599  * @name newTimeStampToken
    -600  * @memberOf KJUR.asn1.tsp.TSPUtil
    -601  * @function
    -602  * @param {Array} param JSON parameter to generate TimeStampToken
    -603  * @return {KJUR.asn1.cms.SignedData} object just generated
    -604  * @description
    -605  * @example
    -606  */
    -607 KJUR.asn1.tsp.TSPUtil.newTimeStampToken = function(param) {
    -608     var nC = KJUR.asn1.cms;
    -609     var nT = KJUR.asn1.tsp;
    -610     var sd = new nC.SignedData();
    -611 
    -612     var dTSTInfo = new nT.TSTInfo(param.tstInfo);
    -613     var tstInfoHex = dTSTInfo.getEncodedHex();
    -614     sd.dEncapContentInfo.setContentValue({hex: tstInfoHex});
    -615     sd.dEncapContentInfo.setContentType('tstinfo');
    +591  * abstract class for TimeStampToken generator
    +592  * @name KJUR.asn1.tsp.AbstractTSAAdapter
    +593  * @class abstract class for TimeStampToken generator
    +594  * @param {Array} params associative array of parameters
    +595  * @since jsrsasign 4.7.0 asn1tsp 1.0.1
    +596  * @description
    +597  */
    +598 KJUR.asn1.tsp.AbstractTSAAdapter = function(params) {
    +599     this.getTSTHex = function(msgHex, hashAlg) {
    +600         throw "not implemented yet";
    +601     };
    +602 };
    +603 
    +604 /**
    +605  * class for simple TimeStampToken generator
    +606  * @name KJUR.asn1.tsp.SimpleTSAAdapter
    +607  * @class class for simple TimeStampToken generator
    +608  * @param {Array} params associative array of parameters
    +609  * @since jsrsasign 4.7.0 asn1tsp 1.0.1
    +610  * @description
    +611  */
    +612 KJUR.asn1.tsp.SimpleTSAAdapter = function(initParams) {
    +613     KJUR.asn1.tsp.SimpleTSAAdapter.superclass.constructor.call(this);
    +614     this.params = null;
    +615     this.serial = 0;
     616 
    -617     if (typeof param.certs == "object") {
    -618         for (var i = 0; i < param.certs.length; i++) {
    -619             sd.addCertificatesByPEM(param.certs[i]);
    -620         }
    -621     }
    +617     this.getTSTHex = function(msgHex, hashAlg) {
    +618         // messageImprint
    +619         var hashHex = KJUR.crypto.Util.hashHex(msgHex, hashAlg);
    +620         this.params.tstInfo.messageImprint =
    +621             {hashAlg: hashAlg, hashValue: hashHex};
     622 
    -623     var si = sd.signerInfoList[0];
    -624     si.setSignerIdentifier(param.signerCert);
    -625     si.setForContentAndHash({sdObj: sd,
    -626                              eciObj: sd.dEncapContentInfo,
    -627                              hashAlg: param.hashAlg});
    -628     var signingCertificate = 
    -629         new nC.SigningCertificate({array: [param.signerCert]});
    -630     si.dSignedAttrs.add(signingCertificate);
    -631 
    -632     si.sign(param.signerPrvKey, param.sigAlg);
    -633 
    -634     return sd;
    -635 };
    -636 
    -637 /**
    -638  * parse hexadecimal string of TimeStampReq
    -639  * @name parseTimeStampReq
    -640  * @memberOf KJUR.asn1.tsp.TSPUtil
    -641  * @function
    -642  * @param {String} hexadecimal string of TimeStampReq
    -643  * @return {Array} JSON object of parsed parameters
    -644  * @description
    -645  * This method parses a hexadecimal string of TimeStampReq
    -646  * and returns parsed their fields:
    -647  * @example
    -648  * var json = KJUR.asn1.tsp.TSPUtil.parseTimeStampReq("302602...");
    -649  * // resulted DUMP of above 'json':
    -650  * {mi: {hashAlg: 'sha256',          // MessageImprint hashAlg
    -651  *       hashValue: 'a1a2a3a4...'},  // MessageImprint hashValue
    -652  *  policy: '1.2.3.4.5',             // tsaPolicy (OPTION)
    -653  *  nonce: '9abcf318...',            // nonce (OPTION)
    -654  *  certreq: true}                   // certReq (OPTION)
    -655  */
    -656 KJUR.asn1.tsp.TSPUtil.parseTimeStampReq = function(reqHex) {
    -657     var json = {};
    -658     json.certreq = false;
    -659 
    -660     var idxList = ASN1HEX.getPosArrayOfChildren_AtObj(reqHex, 0);
    -661 
    -662     if (idxList.length < 2)
    -663         throw "TimeStampReq must have at least 2 items";
    -664 
    -665     var miHex = ASN1HEX.getHexOfTLV_AtObj(reqHex, idxList[1]);
    -666     json.mi = KJUR.asn1.tsp.TSPUtil.parseMessageImprint(miHex); 
    -667 
    -668     for (var i = 2; i < idxList.length; i++) {
    -669         var idx = idxList[i];
    -670         var tag = reqHex.substr(idx, 2);
    -671         if (tag == "06") { // case OID
    -672             var policyHex = ASN1HEX.getHexOfV_AtObj(reqHex, idx);
    -673             json.policy = ASN1HEX.hextooidstr(policyHex);
    -674         }
    -675         if (tag == "02") { // case INTEGER
    -676             json.nonce = ASN1HEX.getHexOfV_AtObj(reqHex, idx);
    -677         }
    -678         if (tag == "01") { // case BOOLEAN
    -679             json.certreq = true;
    -680         }
    -681     }
    -682 
    -683     return json;
    -684 };
    -685 
    -686 /**
    -687  * parse hexadecimal string of MessageImprint
    -688  * @name parseMessageImprint
    -689  * @memberOf KJUR.asn1.tsp.TSPUtil
    -690  * @function
    -691  * @param {String} hexadecimal string of MessageImprint
    -692  * @return {Array} JSON object of parsed parameters
    -693  * @description
    -694  * This method parses a hexadecimal string of MessageImprint
    -695  * and returns parsed their fields:
    -696  * @example
    -697  * var json = KJUR.asn1.tsp.TSPUtil.parseMessageImprint("302602...");
    -698  * // resulted DUMP of above 'json':
    -699  * {hashAlg: 'sha256',          // MessageImprint hashAlg
    -700  *  hashValue: 'a1a2a3a4...'}   // MessageImprint hashValue
    -701  */
    -702 KJUR.asn1.tsp.TSPUtil.parseMessageImprint = function(miHex) {
    -703     var json = {};
    -704 
    -705     if (miHex.substr(0, 2) != "30")
    -706         throw "head of messageImprint hex shall be '30'";
    -707 
    -708     var idxList = ASN1HEX.getPosArrayOfChildren_AtObj(miHex, 0);
    -709     var hashAlgOidIdx = 
    -710         ASN1HEX.getDecendantIndexByNthList(miHex, 0, [0, 0]);
    -711     var hashAlgHex = ASN1HEX.getHexOfV_AtObj(miHex, hashAlgOidIdx);
    -712     var hashAlgOid = ASN1HEX.hextooidstr(hashAlgHex);
    -713     var hashAlgName = KJUR.asn1.x509.OID.oid2name(hashAlgOid);
    -714     if (hashAlgName == '')
    -715         throw "hashAlg name undefined: " + hashAlgOid;
    -716     var hashAlg = hashAlgName;
    -717 
    -718     var hashValueIdx =
    -719         ASN1HEX.getDecendantIndexByNthList(miHex, 0, [1]);
    -720 
    -721     json.hashAlg = hashAlg;
    -722     json.hashValue = ASN1HEX.getHexOfV_AtObj(miHex, hashValueIdx); 
    -723 
    -724     return json;
    -725 };
    -726 
    -727 
    \ No newline at end of file +623
    // serial +624 this.params.tstInfo.serialNumber = {'int': this.serial++}; +625 +626 // nonce +627 var nonceValue = Math.floor(Math.random() * 1000000000); +628 this.params.tstInfo.nonce = {'int': nonceValue}; +629 +630 var obj = +631 KJUR.asn1.tsp.TSPUtil.newTimeStampToken(this.params); +632 return obj.getContentInfoEncodedHex(); +633 }; +634 +635 if (typeof initParams != "undefined") { +636 this.params = initParams; +637 } +638 }; +639 YAHOO.lang.extend(KJUR.asn1.tsp.SimpleTSAAdapter, +640 KJUR.asn1.tsp.AbstractTSAAdapter); +641 +642 /** +643 * class for fixed TimeStampToken generator +644 * @name KJUR.asn1.tsp.FixedTSAAdapter +645 * @class class for fixed TimeStampToken generator +646 * @param {Array} params associative array of parameters +647 * @since jsrsasign 4.7.0 asn1tsp 1.0.1 +648 * @description +649 * This class generates fixed TimeStampToken except messageImprint +650 * for testing purpose. +651 * General TSA generates TimeStampToken which varies following +652 * fields: +653 * <ul> +654 * <li>genTime</li> +655 * <li>serialNumber</li> +656 * <li>nonce</li> +657 * </ul> +658 * Those values are provided by initial parameters. +659 */ +660 KJUR.asn1.tsp.FixedTSAAdapter = function(initParams) { +661 KJUR.asn1.tsp.FixedTSAAdapter.superclass.constructor.call(this); +662 this.params = null; +663 +664 this.getTSTHex = function(msgHex, hashAlg) { +665 // fixed serialNumber +666 // fixed nonce +667 var hashHex = KJUR.crypto.Util.hashHex(msgHex, hashAlg); +668 this.params.tstInfo.messageImprint = +669 {hashAlg: hashAlg, hashValue: hashHex}; +670 var obj = +671 KJUR.asn1.tsp.TSPUtil.newTimeStampToken(this.params); +672 return obj.getContentInfoEncodedHex(); +673 }; +674 +675 if (typeof initParams != "undefined") { +676 this.params = initParams; +677 } +678 }; +679 YAHOO.lang.extend(KJUR.asn1.tsp.FixedTSAAdapter, +680 KJUR.asn1.tsp.AbstractTSAAdapter); +681 +682 // --- TSP utilities ------------------------------------------------- +683 +684 /** +685 * TSP utiliteis class +686 * @name KJUR.asn1.tsp.TSPUtil +687 * @class TSP utilities class +688 */ +689 KJUR.asn1.tsp.TSPUtil = new function() { +690 }; +691 /** +692 * generate TimeStampToken ASN.1 object specified by JSON parameters +693 * @name newTimeStampToken +694 * @memberOf KJUR.asn1.tsp.TSPUtil +695 * @function +696 * @param {Array} param JSON parameter to generate TimeStampToken +697 * @return {KJUR.asn1.cms.SignedData} object just generated +698 * @description +699 * @example +700 */ +701 KJUR.asn1.tsp.TSPUtil.newTimeStampToken = function(param) { +702 var nC = KJUR.asn1.cms; +703 var nT = KJUR.asn1.tsp; +704 var sd = new nC.SignedData(); +705 +706 var dTSTInfo = new nT.TSTInfo(param.tstInfo); +707 var tstInfoHex = dTSTInfo.getEncodedHex(); +708 sd.dEncapContentInfo.setContentValue({hex: tstInfoHex}); +709 sd.dEncapContentInfo.setContentType('tstinfo'); +710 +711 if (typeof param.certs == "object") { +712 for (var i = 0; i < param.certs.length; i++) { +713 sd.addCertificatesByPEM(param.certs[i]); +714 } +715 } +716 +717 var si = sd.signerInfoList[0]; +718 si.setSignerIdentifier(param.signerCert); +719 si.setForContentAndHash({sdObj: sd, +720 eciObj: sd.dEncapContentInfo, +721 hashAlg: param.hashAlg}); +722 var signingCertificate = +723 new nC.SigningCertificate({array: [param.signerCert]}); +724 si.dSignedAttrs.add(signingCertificate); +725 +726 si.sign(param.signerPrvKey, param.sigAlg); +727 +728 return sd; +729 }; +730 +731 /** +732 * parse hexadecimal string of TimeStampReq +733 * @name parseTimeStampReq +734 * @memberOf KJUR.asn1.tsp.TSPUtil +735 * @function +736 * @param {String} hexadecimal string of TimeStampReq +737 * @return {Array} JSON object of parsed parameters +738 * @description +739 * This method parses a hexadecimal string of TimeStampReq +740 * and returns parsed their fields: +741 * @example +742 * var json = KJUR.asn1.tsp.TSPUtil.parseTimeStampReq("302602..."); +743 * // resulted DUMP of above 'json': +744 * {mi: {hashAlg: 'sha256', // MessageImprint hashAlg +745 * hashValue: 'a1a2a3a4...'}, // MessageImprint hashValue +746 * policy: '1.2.3.4.5', // tsaPolicy (OPTION) +747 * nonce: '9abcf318...', // nonce (OPTION) +748 * certreq: true} // certReq (OPTION) +749 */ +750 KJUR.asn1.tsp.TSPUtil.parseTimeStampReq = function(reqHex) { +751 var json = {}; +752 json.certreq = false; +753 +754 var idxList = ASN1HEX.getPosArrayOfChildren_AtObj(reqHex, 0); +755 +756 if (idxList.length < 2) +757 throw "TimeStampReq must have at least 2 items"; +758 +759 var miHex = ASN1HEX.getHexOfTLV_AtObj(reqHex, idxList[1]); +760 json.mi = KJUR.asn1.tsp.TSPUtil.parseMessageImprint(miHex); +761 +762 for (var i = 2; i < idxList.length; i++) { +763 var idx = idxList[i]; +764 var tag = reqHex.substr(idx, 2); +765 if (tag == "06") { // case OID +766 var policyHex = ASN1HEX.getHexOfV_AtObj(reqHex, idx); +767 json.policy = ASN1HEX.hextooidstr(policyHex); +768 } +769 if (tag == "02") { // case INTEGER +770 json.nonce = ASN1HEX.getHexOfV_AtObj(reqHex, idx); +771 } +772 if (tag == "01") { // case BOOLEAN +773 json.certreq = true; +774 } +775 } +776 +777 return json; +778 }; +779 +780 /** +781 * parse hexadecimal string of MessageImprint +782 * @name parseMessageImprint +783 * @memberOf KJUR.asn1.tsp.TSPUtil +784 * @function +785 * @param {String} hexadecimal string of MessageImprint +786 * @return {Array} JSON object of parsed parameters +787 * @description +788 * This method parses a hexadecimal string of MessageImprint +789 * and returns parsed their fields: +790 * @example +791 * var json = KJUR.asn1.tsp.TSPUtil.parseMessageImprint("302602..."); +792 * // resulted DUMP of above 'json': +793 * {hashAlg: 'sha256', // MessageImprint hashAlg +794 * hashValue: 'a1a2a3a4...'} // MessageImprint hashValue +795 */ +796 KJUR.asn1.tsp.TSPUtil.parseMessageImprint = function(miHex) { +797 var json = {}; +798 +799 if (miHex.substr(0, 2) != "30") +800 throw "head of messageImprint hex shall be '30'"; +801 +802 var idxList = ASN1HEX.getPosArrayOfChildren_AtObj(miHex, 0); +803 var hashAlgOidIdx = +804 ASN1HEX.getDecendantIndexByNthList(miHex, 0, [0, 0]); +805 var hashAlgHex = ASN1HEX.getHexOfV_AtObj(miHex, hashAlgOidIdx); +806 var hashAlgOid = ASN1HEX.hextooidstr(hashAlgHex); +807 var hashAlgName = KJUR.asn1.x509.OID.oid2name(hashAlgOid); +808 if (hashAlgName == '') +809 throw "hashAlg name undefined: " + hashAlgOid; +810 var hashAlg = hashAlgName; +811 +812 var hashValueIdx = +813 ASN1HEX.getDecendantIndexByNthList(miHex, 0, [1]); +814 +815 json.hashAlg = hashAlg; +816 json.hashValue = ASN1HEX.getHexOfV_AtObj(miHex, hashValueIdx); +817 +818 return json; +819 }; +820 +821
    \ No newline at end of file diff --git a/api/symbols/src/crypto-1.1.js.html b/api/symbols/src/crypto-1.1.js.html index e18508cc..fa539b37 100755 --- a/api/symbols/src/crypto-1.1.js.html +++ b/api/symbols/src/crypto-1.1.js.html @@ -861,11 +861,11 @@ 854 }; 855 this.signString = function(str) { 856 this.updateString(str); -857 this.sign(); +857 return this.sign(); 858 }; 859 this.signHex = function(hex) { 860 this.updateHex(hex); -861 this.sign(); +861 return this.sign(); 862 }; 863 this.verify = function(hSigVal) { 864 this.sHashHex = this.md.digest(); diff --git a/api/symbols/src/x509-1.1.js.html b/api/symbols/src/x509-1.1.js.html index 58993b17..d2c27e89 100755 --- a/api/symbols/src/x509-1.1.js.html +++ b/api/symbols/src/x509-1.1.js.html @@ -356,7 +356,7 @@ 349 } 350 351 // 5. Public Key Hex -352 if (hCert.substr(a3[1], 02) != "03") +352 if (hCert.substr(a3[1], 2) != "03") 353 throw "malformed X.509 certificate PEM (code:006)"; // not bitstring 354 355 var unusedBitAndKeyHex = ASN1HEX.getHexOfV_AtObj(hCert, a3[1]); diff --git a/asn1cades-1.0.js b/asn1cades-1.0.js new file mode 100755 index 00000000..c1807561 --- /dev/null +++ b/asn1cades-1.0.js @@ -0,0 +1,775 @@ +/*! asn1cades-1.0.0.js (c) 2013-2014 Kenji Urushima | kjur.github.com/jsrsasign/license + */ +/* + * asn1cades.js - ASN.1 DER encoder classes for RFC 5126 CAdES long term signature + * + * Copyright (c) 2014 Kenji Urushima (kenji.urushima@gmail.com) + * + * This software is licensed under the terms of the MIT License. + * http://kjur.github.com/jsrsasign/license + * + * The above copyright and license notice shall be + * included in all copies or substantial portions of the Software. + */ + +/** + * @fileOverview + * @name asn1cades-1.0.js + * @author Kenji Urushima kenji.urushima@gmail.com + * @version 1.0.0 (2014-May-28) + * @since jsrsasign 4.7.0 + * @license MIT License + */ + +/** + * kjur's class library name space + * // already documented in asn1-1.0.js + * @name KJUR + * @namespace kjur's class library name space + */ +if (typeof KJUR == "undefined" || !KJUR) KJUR = {}; + +/** + * kjur's ASN.1 class library name space + * // already documented in asn1-1.0.js + * @name KJUR.asn1 + * @namespace + */ +if (typeof KJUR.asn1 == "undefined" || !KJUR.asn1) KJUR.asn1 = {}; + +/** + * kjur's ASN.1 class for RFC 5126 CAdES long term signature + *

    + * This name space provides + * RFC 5126 + * CAdES(CMS Advanced Electronic Signature) generator. + * + *

    SUPPORTED FORMATS

    + * Following CAdES formats is supported by this library. + * + *

    + * + *

    PROVIDED ATTRIBUTE CLASSES

    + * + * NOTE: Currntly CAdES-C is not supported since parser can't + * handle unsigned attribute. + * + *

    OTHER CLASSES

    + * + * + *

    GENERATE CAdES-BES

    + * To generate CAdES-BES, {@link KJUR.asn.cades} namespace + * classes are not required and already {@link KJUR.asn.cms} namespace + * provides attributes for CAdES-BES. + * Create {@link KJUR.asn1.cms.SignedData} with following + * mandatory attribute in CAdES-BES: + * + * CMSUtil.newSignedData method is very useful to generate CAdES-BES. + *
    + * sd = KJUR.asn1.cms.CMSUtil.newSignedData({
    + *   content: {str: "aaa"},
    + *   certs: [certPEM],
    + *   signerInfos: [{
    + *     hashAlg: 'sha256',
    + *     sAttr: {SigningCertificateV2: {array: [certPEM]}},
    + *     signerCert: certPEM,
    + *     sigAlg: 'SHA256withRSA',
    + *     signerPrvKey: pkcs8PrvKeyPEM
    + *   }]
    + * });
    + * signedDataHex = sd.getContentInfoEncodedHex();
    + * 
    + * NOTE: ContentType and MessageDigest signed attributes + * are automatically added by default. + * + *

    GENERATE CAdES-BES with multiple signers

    + * If you need signature by multiple signers, you can + * specify one or more items in 'signerInfos' property as below. + *
    + * sd = KJUR.asn1.cms.CMSUtil.newSignedData({
    + *   content: {str: "aaa"},
    + *   certs: [certPEM1, certPEM2],
    + *   signerInfos: [{
    + *     hashAlg: 'sha256',
    + *     sAttr: {SigningCertificateV2: {array: [certPEM1]}},
    + *     signerCert: certPEM1,
    + *     sigAlg: 'SHA256withRSA',
    + *     signerPrvKey: pkcs8PrvKeyPEM1
    + *   },{
    + *     hashAlg: 'sha1',
    + *     sAttr: {SigningCertificateV2: {array: [certPEM2]}},
    + *     signerCert: certPEM2,
    + *     sigAlg: 'SHA1withRSA',
    + *     signerPrvKey: pkcs8PrvKeyPEM2
    + *   }]
    + * });
    + * signedDataHex = sd.getContentInfoEncodedHex();
    + * 
    + * + *

    GENERATE CAdES-EPES

    + * When you need a CAdES-EPES signature, + * you just need to add 'SignaturePolicyIdentifier' + * attribute as below. + *
    + * sd = KJUR.asn1.cms.CMSUtil.newSignedData({
    + *   content: {str: "aaa"},
    + *   certs: [certPEM],
    + *   signerInfos: [{
    + *     hashAlg: 'sha256',
    + *     sAttr: {
    + *       SigningCertificateV2: {array: [certPEM]},
    + *       SignaturePolicyIdentifier: {
    + *         oid: '1.2.3.4.5',
    + *         hash: {alg: 'sha1', hash: 'b1b2b3b4b...'}
    + *       },
    + *     },
    + *     signerCert: certPEM,
    + *     sigAlg: 'SHA256withRSA',
    + *     signerPrvKey: pkcs8PrvKeyPEM
    + *   }]
    + * });
    + * signedDataHex = sd.getContentInfoEncodedHex();
    + * 
    + * + *

    GENERATE CAdES-T

    + * After a signed CAdES-BES or CAdES-EPES signature have been generated, + * you can generate CAdES-T by adding SigningTimeStamp unsigned attribute. + *
    + * beshex = "30..."; // hex of CAdES-BES or EPES data 
    + * info = KJUR.asn1.cades.CAdESUtil.parseSignedDataForAddingUnsigned(beshex);
    + * // You can refer a hexadecimal string of signature value 
    + * // in the first signerInfo in the CAdES-BES/EPES with a variable:
    + * // 'info.si[0].sigval'. You need to get RFC 3161 TimeStampToken
    + * // from a trusted time stamp authority. Otherwise you can also 
    + * // get it by 'KJUR.asn1.tsp' module. We suppose that we could 
    + * // get proper time stamp.
    + * tsthex0 = "30..."; // hex of TimeStampToken for signerInfo[0] sigval
    + * si0 = info.obj.signerInfoList[0];
    + * si0.addUnsigned(new KJUR.asn1.cades.SignatureTimeStamp({tst: tsthex0});
    + * esthex = info.obj.getContentInfoEncodedHex(); // CAdES-T
    + * 
    + *

    + * + *

    SAMPLE CODES

    + * + * + * @name KJUR.asn1.cades + * @namespace + */ +if (typeof KJUR.asn1.cades == "undefined" || !KJUR.asn1.cades) KJUR.asn1.cades = {}; + +/** + * class for RFC 5126 CAdES SignaturePolicyIdentifier attribute + * @name KJUR.asn1.cades.SignaturePolicyIdentifier + * @class class for RFC 5126 CAdES SignaturePolicyIdentifier attribute + * @param {Array} params associative array of parameters + * @extends KJUR.asn1.cms.Attribute + * @since jsrsasign 4.7.0 asn1cades 1.0.0 + * @description + *
    + * SignaturePolicyIdentifier ::= CHOICE {
    + *    signaturePolicyId       SignaturePolicyId,
    + *    signaturePolicyImplied  SignaturePolicyImplied } -- not used
    + *
    + * SignaturePolicyImplied ::= NULL
    + * SignaturePolicyId ::= SEQUENCE {
    + *    sigPolicyId           SigPolicyId,
    + *    sigPolicyHash         SigPolicyHash,
    + *    sigPolicyQualifiers   SEQUENCE SIZE (1..MAX) OF
    + *                             SigPolicyQualifierInfo OPTIONAL }
    + * SigPolicyId ::= OBJECT IDENTIFIER
    + * SigPolicyHash ::= OtherHashAlgAndValue
    + * 
    + * @example + * var o = new KJUR.asn1.cades.SignaturePolicyIdentifier({ + * oid: '1.2.3.4.5', + * hash: {alg: 'sha1', hash: 'a1a2a3a4...'} + * }); + */ +/* + * id-aa-ets-sigPolicyId OBJECT IDENTIFIER ::= { iso(1) + * member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9) + * smime(16) id-aa(2) 15 } + * + * signature-policy-identifier attribute values have ASN.1 type + * SignaturePolicyIdentifier: + * + * SigPolicyQualifierInfo ::= SEQUENCE { + * sigPolicyQualifierId SigPolicyQualifierId, + * sigQualifier ANY DEFINED BY sigPolicyQualifierId } + * + * sigpolicyQualifierIds defined in the present document: + * SigPolicyQualifierId ::= OBJECT IDENTIFIER + * id-spq-ets-uri OBJECT IDENTIFIER ::= { iso(1) + * member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9) + * smime(16) id-spq(5) 1 } + * + * SPuri ::= IA5String + * + * id-spq-ets-unotice OBJECT IDENTIFIER ::= { iso(1) + * member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9) + * smime(16) id-spq(5) 2 } + * + * SPUserNotice ::= SEQUENCE { + * noticeRef NoticeReference OPTIONAL, + * explicitText DisplayText OPTIONAL} + * + * NoticeReference ::= SEQUENCE { + * organization DisplayText, + * noticeNumbers SEQUENCE OF INTEGER } + * + * DisplayText ::= CHOICE { + * visibleString VisibleString (SIZE (1..200)), + * bmpString BMPString (SIZE (1..200)), + * utf8String UTF8String (SIZE (1..200)) } + */ +KJUR.asn1.cades.SignaturePolicyIdentifier = function(params) { + KJUR.asn1.cades.SignaturePolicyIdentifier.superclass.constructor.call(this); + this.attrTypeOid = "1.2.840.113549.1.9.16.2.15"; + var nA = KJUR.asn1; + var nC = KJUR.asn1.cades; + + if (typeof params != "undefined") { + if (typeof params.oid == "string" && + typeof params.hash == "object") { + var dOid = new nA.DERObjectIdentifier({oid: params.oid}); + var dHash = new nC.OtherHashAlgAndValue(params.hash); + var seq = new nA.DERSequence({array: [dOid, dHash]}); + this.valueList = [seq]; + } + } +}; +YAHOO.lang.extend(KJUR.asn1.cades.SignaturePolicyIdentifier, + KJUR.asn1.cms.Attribute); + +/** + * class for OtherHashAlgAndValue ASN.1 object + * @name KJUR.asn1.cades.OtherHashAlgAndValue + * @class class for OtherHashAlgAndValue ASN.1 object + * @param {Array} params associative array of parameters + * @extends KJUR.asn1.ASN1Object + * @since jsrsasign 4.7.0 asn1cades 1.0.0 + * @description + *
    + * OtherHashAlgAndValue ::= SEQUENCE {
    + *    hashAlgorithm   AlgorithmIdentifier,
    + *    hashValue       OtherHashValue }
    + * OtherHashValue ::= OCTET STRING
    + * 
    + */ +KJUR.asn1.cades.OtherHashAlgAndValue = function(params) { + KJUR.asn1.cades.OtherHashAlgAndValue.superclass.constructor.call(this); + var nA = KJUR.asn1; + var nX = KJUR.asn1.x509; + this.dAlg = null; + this.dHash = null; + + this.getEncodedHex = function() { + var seq = new nA.DERSequence({array: [this.dAlg, this.dHash]}); + this.hTLV = seq.getEncodedHex(); + return this.hTLV; + }; + + if (typeof params != "undefined") { + if (typeof params.alg == "string" && + typeof params.hash == "string") { + this.dAlg = new nX.AlgorithmIdentifier({name: params.alg}); + this.dHash = new nA.DEROctetString({hex: params.hash}); + } + } +}; +YAHOO.lang.extend(KJUR.asn1.cades.OtherHashAlgAndValue, KJUR.asn1.ASN1Object); + +/** + * class for RFC 5126 CAdES SignatureTimeStamp attribute + * @name KJUR.asn1.cades.SignatureTimeStamp + * @class class for RFC 5126 CAdES SignatureTimeStamp attribute + * @param {Array} params associative array of parameters + * @extends KJUR.asn1.cms.Attribute + * @since jsrsasign 4.7.0 asn1cades 1.0.0 + * @description + *
    + * id-aa-signatureTimeStampToken OBJECT IDENTIFIER ::=
    + *    1.2.840.113549.1.9.16.2.14
    + * SignatureTimeStampToken ::= TimeStampToken
    + * 
    + */ +KJUR.asn1.cades.SignatureTimeStamp = function(params) { + KJUR.asn1.cades.SignatureTimeStamp.superclass.constructor.call(this); + this.attrTypeOid = "1.2.840.113549.1.9.16.2.14"; + this.tstHex = null; + var nA = KJUR.asn1; + + if (typeof params != "undefined") { + if (typeof params.res != "undefined") { + if (typeof params.res == "string" && + params.res.match(/^[0-9A-Fa-f]+$/)) { + } else if (params.res instanceof KJUR.asn1.ASN1Object) { + } else { + throw "res param shall be ASN1Object or hex string"; + } + } + if (typeof params.tst != "undefined") { + if (typeof params.tst == "string" && + params.tst.match(/^[0-9A-Fa-f]+$/)) { + var d = new nA.ASN1Object(); + this.tstHex = params.tst; + d.hTLV = this.tstHex; + d.getEncodedHex(); + this.valueList = [d]; + } else if (params.tst instanceof KJUR.asn1.ASN1Object) { + } else { + throw "tst param shall be ASN1Object or hex string"; + } + } + } +}; +YAHOO.lang.extend(KJUR.asn1.cades.SignatureTimeStamp, + KJUR.asn1.cms.Attribute); + +/** + * class for RFC 5126 CAdES CompleteCertificateRefs attribute + * @name KJUR.asn1.cades.CompleteCertificateRefs + * @class class for RFC 5126 CAdES CompleteCertificateRefs attribute + * @param {Array} params associative array of parameters + * @extends KJUR.asn1.cms.Attribute + * @since jsrsasign 4.7.0 asn1cades 1.0.0 + * @description + *
    + * id-aa-ets-certificateRefs OBJECT IDENTIFIER = 
    + *    1.2.840.113549.1.9.16.2.21
    + * CompleteCertificateRefs ::=  SEQUENCE OF OtherCertID
    + * 
    + * @example + * o = new KJUR.asn1.cades.CompleteCertificateRefs([certPEM1,certPEM2]); + */ +KJUR.asn1.cades.CompleteCertificateRefs = function(params) { + KJUR.asn1.cades.CompleteCertificateRefs.superclass.constructor.call(this); + this.attrTypeOid = "1.2.840.113549.1.9.16.2.21"; + var nA = KJUR.asn1; + var nD = KJUR.asn1.cades; + + /** + * set value by array + * @name setByArray + * @memberOf KJUR.asn1.cades.CompleteCertificateRefs + * @function + * @param {Array} a array of {@link KJUR.asn1.cades.OtherCertID} argument + * @return unspecified + * @description + */ + this.setByArray = function(a) { + this.valueList = []; + for (var i = 0; i < a.length; i++) { + var o = new nD.OtherCertID(a[i]); + this.valueList.push(o); + } + }; + + if (typeof params != "undefined") { + if (typeof params == "object" && + typeof params.length == "number") { + this.setByArray(params); + } + } +}; +YAHOO.lang.extend(KJUR.asn1.cades.CompleteCertificateRefs, + KJUR.asn1.cms.Attribute); + +/** + * class for OtherCertID ASN.1 object + * @name KJUR.asn1.cades.OtherCertID + * @class class for OtherCertID ASN.1 object + * @param {Array} params associative array of parameters + * @extends KJUR.asn1.ASN1Object + * @since jsrsasign 4.7.0 asn1cades 1.0.0 + * @description + *
    + * OtherCertID ::= SEQUENCE {
    + *    otherCertHash    OtherHash,
    + *    issuerSerial     IssuerSerial OPTIONAL }
    + * 
    + * @example + * o = new KJUR.asn1.cades.OtherCertID(certPEM); + * o = new KJUR.asn1.cades.OtherCertID({cert:certPEM, hasis: false}); + */ +KJUR.asn1.cades.OtherCertID = function(params) { + KJUR.asn1.cades.OtherCertID.superclass.constructor.call(this); + var nA = KJUR.asn1; + var nC = KJUR.asn1.cms; + var nD = KJUR.asn1.cades; + this.hasIssuerSerial = true; + this.dOtherCertHash = null; + this.dIssuerSerial = null; + + /** + * set value by PEM string of certificate + * @name setByCertPEM + * @memberOf KJUR.asn1.cades.OtherCertID + * @function + * @param {String} certPEM PEM string of certificate + * @return unspecified + * @description + * This method will set value by a PEM string of a certificate. + * This will add IssuerAndSerialNumber by default + * which depends on hasIssuerSerial flag. + */ + this.setByCertPEM = function(certPEM) { + this.dOtherCertHash = new nD.OtherHash(certPEM); + if (this.hasIssuerSerial) + this.dIssuerSerial = new nC.IssuerAndSerialNumber(certPEM); + }; + + this.getEncodedHex = function() { + if (this.hTLV != null) return this.hTLV; + if (this.dOtherCertHash == null) + throw "otherCertHash not set"; + var a = [this.dOtherCertHash]; + if (this.dIssuerSerial != null) + a.push(this.dIssuerSerial); + var seq = new nA.DERSequence({array: a}); + this.hTLV = seq.getEncodedHex(); + return this.hTLV; + }; + + if (typeof params != "undefined") { + if (typeof params == "string" && + params.indexOf("-----BEGIN ") != -1) { + this.setByCertPEM(params); + } + if (typeof params == "object") { + if (params.hasis === false) + this.hasIssuerSerial = false; + if (typeof params.cert == "string") + this.setByCertPEM(params.cert); + } + } +}; +YAHOO.lang.extend(KJUR.asn1.cades.OtherCertID, KJUR.asn1.ASN1Object); + +/** + * class for OtherHash ASN.1 object + * @name KJUR.asn1.cades.OtherHash + * @class class for OtherHash ASN.1 object + * @param {Array} params associative array of parameters + * @extends KJUR.asn1.ASN1Object + * @since jsrsasign 4.7.0 asn1cades 1.0.0 + * @description + *
    + * OtherHash ::= CHOICE {
    + *    sha1Hash   OtherHashValue,  -- This contains a SHA-1 hash
    + *    otherHash  OtherHashAlgAndValue}
    + * OtherHashValue ::= OCTET STRING
    + * 
    + * @example + * o = new KJUR.asn1.cades.OtherHash("1234"); + * o = new KJUR.asn1.cades.OtherHash(certPEMStr); // default alg=sha256 + * o = new KJUR.asn1.cades.OtherHash({alg: 'sha256', hash: '1234'}); + * o = new KJUR.asn1.cades.OtherHash({alg: 'sha256', cert: certPEM}); + * o = new KJUR.asn1.cades.OtherHash({cert: certPEM}); + */ +KJUR.asn1.cades.OtherHash = function(params) { + KJUR.asn1.cades.OtherHash.superclass.constructor.call(this); + var nA = KJUR.asn1; + var nD = KJUR.asn1.cades; + this.alg = 'sha256'; + this.dOtherHash = null; + + /** + * set value by PEM string of certificate + * @name setByCertPEM + * @memberOf KJUR.asn1.cades.OtherHash + * @function + * @param {String} certPEM PEM string of certificate + * @return unspecified + * @description + * This method will set value by a PEM string of a certificate. + * An algorithm used to hash certificate data will + * be defined by 'alg' property and 'sha256' is default. + */ + this.setByCertPEM = function(certPEM) { + if (certPEM.indexOf("-----BEGIN ") == -1) + throw "certPEM not to seem PEM format"; + var hex = X509.pemToHex(certPEM); + var hash = KJUR.crypto.Util.hashHex(hex, this.alg); + this.dOtherHash = + new nD.OtherHashAlgAndValue({alg: this.alg, hash: hash}); + }; + + this.getEncodedHex = function() { + if (this.dOtherHash == null) + throw "OtherHash not set"; + return this.dOtherHash.getEncodedHex(); + }; + + if (typeof params != "undefined") { + if (typeof params == "string") { + if (params.indexOf("-----BEGIN ") != -1) { + this.setByCertPEM(params); + } else if (params.match(/^[0-9A-Fa-f]+$/)) { + this.dOtherHash = new nA.DEROctetString({hex: params}); + } else { + throw "unsupported string value for params"; + } + } else if (typeof params == "object") { + if (typeof params.cert == "string") { + if (typeof params.alg == "string") + this.alg = params.alg; + this.setByCertPEM(params.cert); + } else { + this.dOtherHash = new nD.OtherHashAlgAndValue(params); + } + } + } +}; +YAHOO.lang.extend(KJUR.asn1.cades.OtherHash, KJUR.asn1.ASN1Object); + + +// == BEGIN UTILITIES ===================================================== + +/** + * CAdES utiliteis class + * @name KJUR.asn1.cades.CAdESUtil + * @class CAdES utilities class + * @since jsrsasign 4.7.0 asn1cades 1.0.0 + */ +KJUR.asn1.cades.CAdESUtil = new function() { +}; +/* + * + */ +KJUR.asn1.cades.CAdESUtil.addSigTS = function(dCMS, siIdx, sigTSHex) { +}; +/** + * parse CMS SignedData to add unsigned attributes + * @name parseSignedDataForAddingUnsigned + * @memberOf KJUR.asn1.cades.CAdESUtil + * @function + * @param {String} hex hexadecimal string of ContentInfo of CMS SignedData + * @return {Object} associative array of parsed data + * @description + * This method will parse a hexadecimal string of + * ContentInfo with CMS SignedData to add a attribute + * to unsigned attributes field in a signerInfo field. + * Parsed result will be an associative array which has + * following properties: + * + * @example + * info = KJUR.asn1.cades.CAdESUtil.parseSignedDataForAddingUnsigned(beshex); + * sd = info.obj; + */ +KJUR.asn1.cades.CAdESUtil.parseSignedDataForAddingUnsigned = function(hex) { + var nA = KJUR.asn1; + var nC = KJUR.asn1.cms; + var nU = KJUR.asn1.cades.CAdESUtil; + var r = {}; + + // 1. not oid signed-data then error + if (ASN1HEX.getDecendantHexTLVByNthList(hex, 0, [0]) != + "06092a864886f70d010702") + throw "hex is not CMS SignedData"; + + var iSD = ASN1HEX.getDecendantIndexByNthList(hex, 0, [1, 0]); + var aSDChildIdx = ASN1HEX.getPosArrayOfChildren_AtObj(hex, iSD); + if (aSDChildIdx.length < 4) + throw "num of SignedData elem shall be 4 at least"; + + // 2. HEXs of SignedData children + // 2.1. SignedData.CMSVersion + var iVersion = aSDChildIdx.shift(); + r.version = ASN1HEX.getHexOfTLV_AtObj(hex, iVersion); + + // 2.2. SignedData.DigestAlgorithms + var iAlgs = aSDChildIdx.shift(); + r.algs = ASN1HEX.getHexOfTLV_AtObj(hex, iAlgs); + + // 2.3. SignedData.EncapContentInfo + var iEncapContent = aSDChildIdx.shift(); + r.encapcontent = ASN1HEX.getHexOfTLV_AtObj(hex, iEncapContent); + + // 2.4. [0]Certs + r.certs = null; + r.revs = null; + r.si = []; + + var iNext = aSDChildIdx.shift(); + if (hex.substr(iNext, 2) == "a0") { + r.certs = ASN1HEX.getHexOfTLV_AtObj(hex, iNext); + iNext = aSDChildIdx.shift(); + } + + // 2.5. [1]Revs + if (hex.substr(iNext, 2) == "a1") { + r.revs = ASN1HEX.getHexOfTLV_AtObj(hex, iNext); + iNext = aSDChildIdx.shift(); + } + + // 2.6. SignerInfos + var iSignerInfos = iNext; + if (hex.substr(iSignerInfos, 2) != "31") + throw "Can't find signerInfos"; + + var aSIIndex = ASN1HEX.getPosArrayOfChildren_AtObj(hex, iSignerInfos); + //alert(aSIIndex.join("-")); + + for (var i = 0; i < aSIIndex.length; i++) { + var iSI = aSIIndex[i]; + var pSI = nU.parseSignerInfoForAddingUnsigned(hex, iSI, i); + r.si[i] = pSI; + } + + // x. obj(SignedData) + var tmp = null; + r.obj = new nC.SignedData(); + + tmp = new nA.ASN1Object(); + tmp.hTLV = r.version; + r.obj.dCMSVersion = tmp; + + tmp = new nA.ASN1Object(); + tmp.hTLV = r.algs; + r.obj.dDigestAlgs = tmp; + + tmp = new nA.ASN1Object(); + tmp.hTLV = r.encapcontent; + r.obj.dEncapContentInfo = tmp; + + tmp = new nA.ASN1Object(); + tmp.hTLV = r.certs; + r.obj.dCerts = tmp; + + r.obj.signerInfoList = []; + for (var i = 0; i < r.si.length; i++) { + r.obj.signerInfoList.push(r.si[i].obj); + } + + return r; +}; + +/** + * parse SignerInfo to add unsigned attributes + * @name parseSignerInfoForAddingUnsigned + * @memberOf KJUR.asn1.cades.CAdESUtil + * @function + * @param {String} hex hexadecimal string of SignerInfo + * @return {Object} associative array of parsed data + * @description + * This method will parse a hexadecimal string of + * SignerInfo to add a attribute + * to unsigned attributes field in a signerInfo field. + * Parsed result will be an associative array which has + * following properties: + * + * NOTE: Parsing of unsigned attributes will be provided in the + * future version. That's way this version provides support + * for CAdES-T and not for CAdES-C. + */ +KJUR.asn1.cades.CAdESUtil.parseSignerInfoForAddingUnsigned = + function(hex, iSI, nth) { + var nA = KJUR.asn1; + var nC = KJUR.asn1.cms; + var r = {}; + var aSIChildIdx = ASN1HEX.getPosArrayOfChildren_AtObj(hex, iSI); + //alert(aSIChildIdx.join("=")); + + if (aSIChildIdx.length != 6) + throw "not supported items for SignerInfo (!=6)"; + + // 1. SignerInfo.CMSVersion + var iVersion = aSIChildIdx.shift(); + r.version = ASN1HEX.getHexOfTLV_AtObj(hex, iVersion); + + // 2. SignerIdentifier(IssuerAndSerialNumber) + var iIdentifier = aSIChildIdx.shift(); + r.si = ASN1HEX.getHexOfTLV_AtObj(hex, iIdentifier); + + // 3. DigestAlgorithm + var iDigestAlg = aSIChildIdx.shift(); + r.digalg = ASN1HEX.getHexOfTLV_AtObj(hex, iDigestAlg); + + // 4. SignedAttrs + var iSignedAttrs = aSIChildIdx.shift(); + r.sattrs = ASN1HEX.getHexOfTLV_AtObj(hex, iSignedAttrs); + + // 5. SigAlg + var iSigAlg = aSIChildIdx.shift(); + r.sigalg = ASN1HEX.getHexOfTLV_AtObj(hex, iSigAlg); + + // 6. Signature + var iSig = aSIChildIdx.shift(); + r.sig = ASN1HEX.getHexOfTLV_AtObj(hex, iSig); + r.sigval = ASN1HEX.getHexOfV_AtObj(hex, iSig); + + // 7. obj(SignerInfo) + var tmp = null; + r.obj = new nC.SignerInfo(); + + tmp = new nA.ASN1Object(); + tmp.hTLV = r.version; + r.obj.dCMSVersion = tmp; + + tmp = new nA.ASN1Object(); + tmp.hTLV = r.si; + r.obj.dSignerIdentifier = tmp; + + tmp = new nA.ASN1Object(); + tmp.hTLV = r.digalg; + r.obj.dDigestAlgorithm = tmp; + + tmp = new nA.ASN1Object(); + tmp.hTLV = r.sattrs; + r.obj.dSignedAttrs = tmp; + + tmp = new nA.ASN1Object(); + tmp.hTLV = r.sigalg; + r.obj.dSigAlg = tmp; + + tmp = new nA.ASN1Object(); + tmp.hTLV = r.sig; + r.obj.dSig = tmp; + + r.obj.dUnsignedAttrs = new nC.AttributeList(); + + return r; +}; + diff --git a/asn1cades-1.0.min.js b/asn1cades-1.0.min.js new file mode 100755 index 00000000..38683876 --- /dev/null +++ b/asn1cades-1.0.min.js @@ -0,0 +1,3 @@ +/*! asn1cades-1.0.0.js (c) 2013-2014 Kenji Urushima | kjur.github.com/jsrsasign/license + */ +if(typeof KJUR=="undefined"||!KJUR){KJUR={}}if(typeof KJUR.asn1=="undefined"||!KJUR.asn1){KJUR.asn1={}}if(typeof KJUR.asn1.cades=="undefined"||!KJUR.asn1.cades){KJUR.asn1.cades={}}KJUR.asn1.cades.SignaturePolicyIdentifier=function(e){KJUR.asn1.cades.SignaturePolicyIdentifier.superclass.constructor.call(this);this.attrTypeOid="1.2.840.113549.1.9.16.2.15";var b=KJUR.asn1;var d=KJUR.asn1.cades;if(typeof e!="undefined"){if(typeof e.oid=="string"&&typeof e.hash=="object"){var f=new b.DERObjectIdentifier({oid:e.oid});var a=new d.OtherHashAlgAndValue(e.hash);var c=new b.DERSequence({array:[f,a]});this.valueList=[c]}}};YAHOO.lang.extend(KJUR.asn1.cades.SignaturePolicyIdentifier,KJUR.asn1.cms.Attribute);KJUR.asn1.cades.OtherHashAlgAndValue=function(b){KJUR.asn1.cades.OtherHashAlgAndValue.superclass.constructor.call(this);var a=KJUR.asn1;var c=KJUR.asn1.x509;this.dAlg=null;this.dHash=null;this.getEncodedHex=function(){var d=new a.DERSequence({array:[this.dAlg,this.dHash]});this.hTLV=d.getEncodedHex();return this.hTLV};if(typeof b!="undefined"){if(typeof b.alg=="string"&&typeof b.hash=="string"){this.dAlg=new c.AlgorithmIdentifier({name:b.alg});this.dHash=new a.DEROctetString({hex:b.hash})}}};YAHOO.lang.extend(KJUR.asn1.cades.OtherHashAlgAndValue,KJUR.asn1.ASN1Object);KJUR.asn1.cades.SignatureTimeStamp=function(c){KJUR.asn1.cades.SignatureTimeStamp.superclass.constructor.call(this);this.attrTypeOid="1.2.840.113549.1.9.16.2.14";this.tstHex=null;var a=KJUR.asn1;if(typeof c!="undefined"){if(typeof c.res!="undefined"){if(typeof c.res=="string"&&c.res.match(/^[0-9A-Fa-f]+$/)){}else{if(c.res instanceof KJUR.asn1.ASN1Object){}else{throw"res param shall be ASN1Object or hex string"}}}if(typeof c.tst!="undefined"){if(typeof c.tst=="string"&&c.tst.match(/^[0-9A-Fa-f]+$/)){var b=new a.ASN1Object();this.tstHex=c.tst;b.hTLV=this.tstHex;b.getEncodedHex();this.valueList=[b]}else{if(c.tst instanceof KJUR.asn1.ASN1Object){}else{throw"tst param shall be ASN1Object or hex string"}}}}};YAHOO.lang.extend(KJUR.asn1.cades.SignatureTimeStamp,KJUR.asn1.cms.Attribute);KJUR.asn1.cades.CompleteCertificateRefs=function(c){KJUR.asn1.cades.CompleteCertificateRefs.superclass.constructor.call(this);this.attrTypeOid="1.2.840.113549.1.9.16.2.21";var a=KJUR.asn1;var b=KJUR.asn1.cades;this.setByArray=function(d){this.valueList=[];for(var e=0;eMIT License */ @@ -63,6 +63,8 @@ if (typeof KJUR.asn1 == "undefined" || !KJUR.asn1) KJUR.asn1 = {}; *
  • {@link KJUR.asn1.cms.ContentType}
  • *
  • {@link KJUR.asn1.cms.MessageDigest}
  • *
  • {@link KJUR.asn1.cms.SigningTime}
  • + *
  • {@link KJUR.asn1.cms.SigningCertificate}
  • + *
  • {@link KJUR.asn1.cms.SigningCertificateV2}
  • * * NOTE: Please ignore method summary and document of this namespace. * This caused by a bug of jsdoc2. @@ -390,6 +392,7 @@ YAHOO.lang.extend(KJUR.asn1.cms.SigningCertificateV2, KJUR.asn1.cms.Attribute); * {issuer: {str: '/C=US/O=T1'}, serial {int: 3}}); * // specify by PEM certificate * o = new KJUR.asn1.cms.IssuerAndSerialNumber({cert: certPEM}); + * o = new KJUR.asn1.cms.IssuerAndSerialNumber(certPEM); // since 1.0.3 */ KJUR.asn1.cms.IssuerAndSerialNumber = function(params) { KJUR.asn1.cms.IssuerAndSerialNumber.superclass.constructor.call(this); @@ -420,6 +423,10 @@ KJUR.asn1.cms.IssuerAndSerialNumber = function(params) { }; if (typeof params != "undefined") { + if (typeof params == "string" && + params.indexOf("-----BEGIN ") != -1) { + this.setByCertPEM(params); + } if (params.issuer && params.serial) { if (params.issuer instanceof KJUR.asn1.x509.X500Name) { this.dIssuer = params.issuer; @@ -610,14 +617,27 @@ KJUR.asn1.cms.SignerInfo = function(params) { this.dSig = new nA.DEROctetString({hex: sigValHex}); }; + /* + * @since asn1cms 1.0.3 + */ + this.addUnsigned = function(attr) { + this.hTLV = null; + this.dUnsignedAttrs.hTLV = null; + this.dUnsignedAttrs.add(attr); + }; + this.getEncodedHex = function() { - if (this.dSignedAttrs.length() == 0) { + //alert("sattrs.hTLV=" + this.dSignedAttrs.hTLV); + if (this.dSignedAttrs instanceof KJUR.asn1.cms.AttributeList && + this.dSignedAttrs.length() == 0) { throw "SignedAttrs length = 0 (empty)"; } - var sa = new nA.DERTaggedObject({obj: this.dSignedAttrs, tag: 'a0', explicit: false}); + var sa = new nA.DERTaggedObject({obj: this.dSignedAttrs, + tag: 'a0', explicit: false}); var ua = null;; if (this.dUnsignedAttrs.length() > 0) { - ua = new nA.DERTaggedObject({obj: this.dUnsignedAttrs, tag: 'a1', explicit: false}); + ua = new nA.DERTaggedObject({obj: this.dUnsignedAttrs, + tag: 'a1', explicit: false}); } var items = [ @@ -808,8 +828,10 @@ KJUR.asn1.cms.SignedData = function(params) { var nX = KJUR.asn1.x509; this.dCMSVersion = new nA.DERInteger({'int': 1}); + this.dDigestAlgs = null; this.digestAlgNameList = []; this.dEncapContentInfo = new nC.EncapsulatedContentInfo(); + this.dCerts = null; this.certificateList = []; this.crlList = []; this.signerInfoList = [new nC.SignerInfo()]; @@ -824,27 +846,32 @@ KJUR.asn1.cms.SignedData = function(params) { this.getEncodedHex = function() { if (typeof this.hTLV == "string") return this.hTLV; - var digestAlgList = []; - for (var i = 0; i < this.digestAlgNameList.length; i++) { - var o = new nX.AlgorithmIdentifier({name: this.digestAlgNameList[i]}); - digestAlgList.push(o); + if (this.dDigestAlgs == null) { + var digestAlgList = []; + for (var i = 0; i < this.digestAlgNameList.length; i++) { + var name = this.digestAlgNameList[i]; + var o = new nX.AlgorithmIdentifier({name: name}); + digestAlgList.push(o); + } + this.dDigestAlgs = new nA.DERSet({array: digestAlgList}); } - var dDigestAlgs = new nA.DERSet({array: digestAlgList}); - var dSignerInfos = new nA.DERSet({array: this.signerInfoList}); - var a = [this.dCMSVersion, - dDigestAlgs, + this.dDigestAlgs, this.dEncapContentInfo]; - if (this.certificateList.length > 0) { - var o1 = new nA.DERSet({array: this.certificateList}); - var o2 = new nA.DERTaggedObject({obj: o1, - tag: 'a0', - explicit: false}); - a.push(o2); + if (this.dCerts == null) { + if (this.certificateList.length > 0) { + var o1 = new nA.DERSet({array: this.certificateList}); + this.dCerts + = new nA.DERTaggedObject({obj: o1, + tag: 'a0', + explicit: false}); + } } + if (this.dCerts != null) a.push(this.dCerts); + var dSignerInfos = new nA.DERSet({array: this.signerInfoList}); a.push(dSignerInfos); var seq = new nA.DERSequence({array: a}); @@ -855,11 +882,11 @@ KJUR.asn1.cms.SignedData = function(params) { this.getContentInfo = function() { this.getEncodedHex(); var ci = new nC.ContentInfo({type: 'signed-data', obj: this}); - return ci; + return ci; }; this.getContentInfoEncodedHex = function() { - var ci = this.getContentInfo(); + var ci = this.getContentInfo(); var ciHex = ci.getEncodedHex(); return ciHex; }; @@ -897,6 +924,7 @@ KJUR.asn1.cms.CMSUtil = new function() { * hashAlg: 'sha256', * sAttr: { * SigningTime: {} + * SigningCertificateV2: {array: [certPEM]}, * }, * signerCert: certPEM, * sigAlg: 'SHA256withRSA', @@ -906,6 +934,7 @@ KJUR.asn1.cms.CMSUtil = new function() { */ KJUR.asn1.cms.CMSUtil.newSignedData = function(param) { var nC = KJUR.asn1.cms; + var nE = KJUR.asn1.cades; var sd = new nC.SignedData(); sd.dEncapContentInfo.setContentValue(param.content); @@ -927,8 +956,21 @@ KJUR.asn1.cms.CMSUtil.newSignedData = function(param) { hashAlg: siParam.hashAlg}); for (attrName in siParam.sAttr) { + var attrParam = siParam.sAttr[attrName]; if (attrName == "SigningTime") { - var attr = new nC.SigningTime(siParam.sAttr[attrName]); + var attr = new nC.SigningTime(attrParam); + si.dSignedAttrs.add(attr); + } + if (attrName == "SigningCertificate") { + var attr = new nC.SigningCertificate(attrParam); + si.dSignedAttrs.add(attr); + } + if (attrName == "SigningCertificateV2") { + var attr = new nC.SigningCertificateV2(attrParam); + si.dSignedAttrs.add(attr); + } + if (attrName == "SignaturePolicyIdentifier") { + var attr = new nE.SignaturePolicyIdentifier(attrParam); si.dSignedAttrs.add(attr); } } diff --git a/asn1cms-1.0.min.js b/asn1cms-1.0.min.js index ffb15772..eae464f1 100755 --- a/asn1cms-1.0.min.js +++ b/asn1cms-1.0.min.js @@ -1,3 +1,3 @@ -/*! asn1cms-1.0.1.js (c) 2013-2014 Kenji Urushima | kjur.github.com/jsrsasign/license +/*! asn1cms-1.0.2.js (c) 2013-2014 Kenji Urushima | kjur.github.com/jsrsasign/license */ -if(typeof KJUR=="undefined"||!KJUR){KJUR={}}if(typeof KJUR.asn1=="undefined"||!KJUR.asn1){KJUR.asn1={}}if(typeof KJUR.asn1.cms=="undefined"||!KJUR.asn1.cms){KJUR.asn1.cms={}}KJUR.asn1.cms.Attribute=function(b){KJUR.asn1.cms.Attribute.superclass.constructor.call(this);var a=[];this.getEncodedHex=function(){var f,e,c;f=new KJUR.asn1.DERObjectIdentifier({oid:this.attrTypeOid});e=new KJUR.asn1.DERSet({array:this.valueList});try{e.getEncodedHex()}catch(d){throw"fail valueSet.getEncodedHex in Attribute(1)/"+d}c=new KJUR.asn1.DERSequence({array:[f,e]});try{this.hTLV=c.getEncodedHex()}catch(d){throw"failed seq.getEncodedHex in Attribute(2)/"+d}return this.hTLV}};YAHOO.lang.extend(KJUR.asn1.cms.Attribute,KJUR.asn1.ASN1Object);KJUR.asn1.cms.ContentType=function(b){KJUR.asn1.cms.ContentType.superclass.constructor.call(this);this.attrTypeOid="1.2.840.113549.1.9.3";var a=null;if(typeof b!="undefined"){var a=new KJUR.asn1.DERObjectIdentifier(b);this.valueList=[a]}};YAHOO.lang.extend(KJUR.asn1.cms.ContentType,KJUR.asn1.cms.Attribute);KJUR.asn1.cms.MessageDigest=function(e){KJUR.asn1.cms.MessageDigest.superclass.constructor.call(this);this.attrTypeOid="1.2.840.113549.1.9.4";if(typeof e!="undefined"){if(e.eciObj instanceof KJUR.asn1.cms.EncapsulatedContentInfo&&typeof e.hashAlg=="string"){var b=e.eciObj.eContentValueHex;var a=e.hashAlg;var c=KJUR.crypto.Util.hashHex(b,a);var d=new KJUR.asn1.DEROctetString({hex:c});d.getEncodedHex();this.valueList=[d]}else{var d=new KJUR.asn1.DEROctetString(e);d.getEncodedHex();this.valueList=[d]}}};YAHOO.lang.extend(KJUR.asn1.cms.MessageDigest,KJUR.asn1.cms.Attribute);KJUR.asn1.cms.SigningTime=function(c){KJUR.asn1.cms.SigningTime.superclass.constructor.call(this);this.attrTypeOid="1.2.840.113549.1.9.5";if(typeof c!="undefined"){var a=new KJUR.asn1.x509.Time(c);try{a.getEncodedHex()}catch(b){throw"SigningTime.getEncodedHex() failed/"+b}this.valueList=[a]}};YAHOO.lang.extend(KJUR.asn1.cms.SigningTime,KJUR.asn1.cms.Attribute);KJUR.asn1.cms.SigningCertificate=function(d){KJUR.asn1.cms.SigningCertificate.superclass.constructor.call(this);this.attrTypeOid="1.2.840.113549.1.9.16.2.12";var a=KJUR.asn1;var c=KJUR.asn1.cms;var b=KJUR.crypto;this.setCerts=function(l){var j=[];for(var h=0;h0){h=new a.DERTaggedObject({obj:this.dUnsignedAttrs,tag:"a1",explicit:false})}var g=[this.dCMSVersion,this.dSignerIdentifier,this.dDigestAlgorithm,e,this.dSigAlg,this.dSig,];if(h!=null){g.push(h)}var f=new a.DERSequence({array:g});this.hTLV=f.getEncodedHex();return this.hTLV}};YAHOO.lang.extend(KJUR.asn1.cms.SignerInfo,KJUR.asn1.ASN1Object);KJUR.asn1.cms.EncapsulatedContentInfo=function(c){KJUR.asn1.cms.EncapsulatedContentInfo.superclass.constructor.call(this);var a=KJUR.asn1;var b=KJUR.asn1.cms;var d=KJUR.asn1.x509;this.dEContentType=new a.DERObjectIdentifier({name:"data"});this.dEContent=null;this.isDetached=false;this.eContentValueHex=null;this.setContentType=function(e){if(e.match(/^[0-2][.][0-9.]+$/)){this.dEContentType=new a.DERObjectIdentifier({oid:e})}else{this.dEContentType=new a.DERObjectIdentifier({name:e})}};this.setContentValue=function(e){if(typeof e!="undefined"){if(typeof e.hex=="string"){this.eContentValueHex=e.hex}else{if(typeof e.str=="string"){this.eContentValueHex=utf8tohex(e.str)}}}};this.setContentValueHex=function(e){this.eContentValueHex=e};this.setContentValueStr=function(e){this.eContentValueHex=utf8tohex(e)};this.getEncodedHex=function(){if(typeof this.eContentValueHex!="string"){throw"eContentValue not yet set"}var g=new a.DEROctetString({hex:this.eContentValueHex});this.dEContent=new a.DERTaggedObject({obj:g,tag:"a0",explicit:true});var e=[this.dEContentType];if(!this.isDetached){e.push(this.dEContent)}var f=new a.DERSequence({array:e});this.hTLV=f.getEncodedHex();return this.hTLV}};YAHOO.lang.extend(KJUR.asn1.cms.EncapsulatedContentInfo,KJUR.asn1.ASN1Object);KJUR.asn1.cms.ContentInfo=function(c){KJUR.asn1.cms.ContentInfo.superclass.constructor.call(this);var a=KJUR.asn1;var b=KJUR.asn1.cms;var d=KJUR.asn1.x509;this.dContentType=null;this.dContent=null;this.setContentType=function(e){if(typeof e=="string"){this.dContentType=d.OID.name2obj(e)}};this.getEncodedHex=function(){var f=new a.DERTaggedObject({obj:this.dContent,tag:"a0",explicit:true});var e=new a.DERSequence({array:[this.dContentType,f]});this.hTLV=e.getEncodedHex();return this.hTLV};if(typeof c!="undefined"){if(c.type){this.setContentType(c.type)}if(c.obj&&c.obj instanceof a.ASN1Object){this.dContent=c.obj}}};YAHOO.lang.extend(KJUR.asn1.cms.ContentInfo,KJUR.asn1.ASN1Object);KJUR.asn1.cms.SignedData=function(c){KJUR.asn1.cms.SignedData.superclass.constructor.call(this);var a=KJUR.asn1;var b=KJUR.asn1.cms;var d=KJUR.asn1.x509;this.dCMSVersion=new a.DERInteger({"int":1});this.digestAlgNameList=[];this.dEncapContentInfo=new b.EncapsulatedContentInfo();this.certificateList=[];this.crlList=[];this.signerInfoList=[new b.SignerInfo()];this.addCertificatesByPEM=function(e){var f=KEYUTIL.getHexFromPEM(e);var g=new a.ASN1Object();g.hTLV=f;this.certificateList.push(g)};this.getEncodedHex=function(){if(typeof this.hTLV=="string"){return this.hTLV}var m=[];for(var j=0;j0){var g=new a.DERSet({array:this.certificateList});var f=new a.DERTaggedObject({obj:g,tag:"a0",explicit:false});k.push(f)}k.push(n);var l=new a.DERSequence({array:k});this.hTLV=l.getEncodedHex();return this.hTLV};this.getContentInfo=function(){this.getEncodedHex();var e=new b.ContentInfo({type:"signed-data",obj:this});return e};this.getContentInfoEncodedHex=function(){var e=this.getContentInfo();var f=e.getEncodedHex();return f};this.getPEM=function(){var e=this.getContentInfoEncodedHex();var f=a.ASN1Util.getPEMStringFromHex(e,"CMS");return f}};YAHOO.lang.extend(KJUR.asn1.cms.SignedData,KJUR.asn1.ASN1Object);KJUR.asn1.cms.CMSUtil=new function(){};KJUR.asn1.cms.CMSUtil.newSignedData=function(g){var f=KJUR.asn1.cms;var e=new f.SignedData();e.dEncapContentInfo.setContentValue(g.content);if(typeof g.certs=="object"){for(var c=0;c0){h=new a.DERTaggedObject({obj:this.dUnsignedAttrs,tag:"a1",explicit:false})}var g=[this.dCMSVersion,this.dSignerIdentifier,this.dDigestAlgorithm,e,this.dSigAlg,this.dSig,];if(h!=null){g.push(h)}var f=new a.DERSequence({array:g});this.hTLV=f.getEncodedHex();return this.hTLV}};YAHOO.lang.extend(KJUR.asn1.cms.SignerInfo,KJUR.asn1.ASN1Object);KJUR.asn1.cms.EncapsulatedContentInfo=function(c){KJUR.asn1.cms.EncapsulatedContentInfo.superclass.constructor.call(this);var a=KJUR.asn1;var b=KJUR.asn1.cms;var d=KJUR.asn1.x509;this.dEContentType=new a.DERObjectIdentifier({name:"data"});this.dEContent=null;this.isDetached=false;this.eContentValueHex=null;this.setContentType=function(e){if(e.match(/^[0-2][.][0-9.]+$/)){this.dEContentType=new a.DERObjectIdentifier({oid:e})}else{this.dEContentType=new a.DERObjectIdentifier({name:e})}};this.setContentValue=function(e){if(typeof e!="undefined"){if(typeof e.hex=="string"){this.eContentValueHex=e.hex}else{if(typeof e.str=="string"){this.eContentValueHex=utf8tohex(e.str)}}}};this.setContentValueHex=function(e){this.eContentValueHex=e};this.setContentValueStr=function(e){this.eContentValueHex=utf8tohex(e)};this.getEncodedHex=function(){if(typeof this.eContentValueHex!="string"){throw"eContentValue not yet set"}var g=new a.DEROctetString({hex:this.eContentValueHex});this.dEContent=new a.DERTaggedObject({obj:g,tag:"a0",explicit:true});var e=[this.dEContentType];if(!this.isDetached){e.push(this.dEContent)}var f=new a.DERSequence({array:e});this.hTLV=f.getEncodedHex();return this.hTLV}};YAHOO.lang.extend(KJUR.asn1.cms.EncapsulatedContentInfo,KJUR.asn1.ASN1Object);KJUR.asn1.cms.ContentInfo=function(c){KJUR.asn1.cms.ContentInfo.superclass.constructor.call(this);var a=KJUR.asn1;var b=KJUR.asn1.cms;var d=KJUR.asn1.x509;this.dContentType=null;this.dContent=null;this.setContentType=function(e){if(typeof e=="string"){this.dContentType=d.OID.name2obj(e)}};this.getEncodedHex=function(){var f=new a.DERTaggedObject({obj:this.dContent,tag:"a0",explicit:true});var e=new a.DERSequence({array:[this.dContentType,f]});this.hTLV=e.getEncodedHex();return this.hTLV};if(typeof c!="undefined"){if(c.type){this.setContentType(c.type)}if(c.obj&&c.obj instanceof a.ASN1Object){this.dContent=c.obj}}};YAHOO.lang.extend(KJUR.asn1.cms.ContentInfo,KJUR.asn1.ASN1Object);KJUR.asn1.cms.SignedData=function(c){KJUR.asn1.cms.SignedData.superclass.constructor.call(this);var a=KJUR.asn1;var b=KJUR.asn1.cms;var d=KJUR.asn1.x509;this.dCMSVersion=new a.DERInteger({"int":1});this.dDigestAlgs=null;this.digestAlgNameList=[];this.dEncapContentInfo=new b.EncapsulatedContentInfo();this.dCerts=null;this.certificateList=[];this.crlList=[];this.signerInfoList=[new b.SignerInfo()];this.addCertificatesByPEM=function(e){var f=KEYUTIL.getHexFromPEM(e);var g=new a.ASN1Object();g.hTLV=f;this.certificateList.push(g)};this.getEncodedHex=function(){if(typeof this.hTLV=="string"){return this.hTLV}if(this.dDigestAlgs==null){var k=[];for(var j=0;j0){var l=new a.DERSet({array:this.certificateList});this.dCerts=new a.DERTaggedObject({obj:l,tag:"a0",explicit:false})}}if(this.dCerts!=null){e.push(this.dCerts)}var g=new a.DERSet({array:this.signerInfoList});e.push(g);var f=new a.DERSequence({array:e});this.hTLV=f.getEncodedHex();return this.hTLV};this.getContentInfo=function(){this.getEncodedHex();var e=new b.ContentInfo({type:"signed-data",obj:this});return e};this.getContentInfoEncodedHex=function(){var e=this.getContentInfo();var f=e.getEncodedHex();return f};this.getPEM=function(){var e=this.getContentInfoEncodedHex();var f=a.ASN1Util.getPEMStringFromHex(e,"CMS");return f}};YAHOO.lang.extend(KJUR.asn1.cms.SignedData,KJUR.asn1.ASN1Object);KJUR.asn1.cms.CMSUtil=new function(){};KJUR.asn1.cms.CMSUtil.newSignedData=function(a){var h=KJUR.asn1.cms;var g=KJUR.asn1.cades;var f=new h.SignedData();f.dEncapContentInfo.setContentValue(a.content);if(typeof a.certs=="object"){for(var b=0;bMIT License */ @@ -150,7 +150,7 @@ KJUR.asn1.tsp.MessageImprint = function(params) { this.getEncodedHex = function() { if (typeof this.hTLV == "string") return this.hTLV; var seq = - new nA.DERSequence({array: [this.dHashAlg, this.dHashValue]}); + new nA.DERSequence({array: [this.dHashAlg, this.dHashValue]}); return seq.getEncodedHex(); }; @@ -585,7 +585,101 @@ KJUR.asn1.tsp.PKIFailureInfo.valueList = { systemFailure: 25 }; -// --- END OF RFC 2510 CMP ------------------------------------------------- +// --- END OF RFC 2510 CMP ------------------------------------------- + +/** + * abstract class for TimeStampToken generator + * @name KJUR.asn1.tsp.AbstractTSAAdapter + * @class abstract class for TimeStampToken generator + * @param {Array} params associative array of parameters + * @since jsrsasign 4.7.0 asn1tsp 1.0.1 + * @description + */ +KJUR.asn1.tsp.AbstractTSAAdapter = function(params) { + this.getTSTHex = function(msgHex, hashAlg) { + throw "not implemented yet"; + }; +}; + +/** + * class for simple TimeStampToken generator + * @name KJUR.asn1.tsp.SimpleTSAAdapter + * @class class for simple TimeStampToken generator + * @param {Array} params associative array of parameters + * @since jsrsasign 4.7.0 asn1tsp 1.0.1 + * @description + */ +KJUR.asn1.tsp.SimpleTSAAdapter = function(initParams) { + KJUR.asn1.tsp.SimpleTSAAdapter.superclass.constructor.call(this); + this.params = null; + this.serial = 0; + + this.getTSTHex = function(msgHex, hashAlg) { + // messageImprint + var hashHex = KJUR.crypto.Util.hashHex(msgHex, hashAlg); + this.params.tstInfo.messageImprint = + {hashAlg: hashAlg, hashValue: hashHex}; + + // serial + this.params.tstInfo.serialNumber = {'int': this.serial++}; + + // nonce + var nonceValue = Math.floor(Math.random() * 1000000000); + this.params.tstInfo.nonce = {'int': nonceValue}; + + var obj = + KJUR.asn1.tsp.TSPUtil.newTimeStampToken(this.params); + return obj.getContentInfoEncodedHex(); + }; + + if (typeof initParams != "undefined") { + this.params = initParams; + } +}; +YAHOO.lang.extend(KJUR.asn1.tsp.SimpleTSAAdapter, + KJUR.asn1.tsp.AbstractTSAAdapter); + +/** + * class for fixed TimeStampToken generator + * @name KJUR.asn1.tsp.FixedTSAAdapter + * @class class for fixed TimeStampToken generator + * @param {Array} params associative array of parameters + * @since jsrsasign 4.7.0 asn1tsp 1.0.1 + * @description + * This class generates fixed TimeStampToken except messageImprint + * for testing purpose. + * General TSA generates TimeStampToken which varies following + * fields: + *
      + *
    • genTime
    • + *
    • serialNumber
    • + *
    • nonce
    • + *
    + * Those values are provided by initial parameters. + */ +KJUR.asn1.tsp.FixedTSAAdapter = function(initParams) { + KJUR.asn1.tsp.FixedTSAAdapter.superclass.constructor.call(this); + this.params = null; + + this.getTSTHex = function(msgHex, hashAlg) { + // fixed serialNumber + // fixed nonce + var hashHex = KJUR.crypto.Util.hashHex(msgHex, hashAlg); + this.params.tstInfo.messageImprint = + {hashAlg: hashAlg, hashValue: hashHex}; + var obj = + KJUR.asn1.tsp.TSPUtil.newTimeStampToken(this.params); + return obj.getContentInfoEncodedHex(); + }; + + if (typeof initParams != "undefined") { + this.params = initParams; + } +}; +YAHOO.lang.extend(KJUR.asn1.tsp.FixedTSAAdapter, + KJUR.asn1.tsp.AbstractTSAAdapter); + +// --- TSP utilities ------------------------------------------------- /** * TSP utiliteis class diff --git a/asn1tsp-1.0.min.js b/asn1tsp-1.0.min.js index f31f96e2..9b4e8294 100755 --- a/asn1tsp-1.0.min.js +++ b/asn1tsp-1.0.min.js @@ -1,3 +1,3 @@ -/*! asn1tsp-1.0.0.js (c) 2014 Kenji Urushima | kjur.github.com/jsrsasign/license +/*! asn1tsp-1.0.1.js (c) 2014 Kenji Urushima | kjur.github.com/jsrsasign/license */ -if(typeof KJUR=="undefined"||!KJUR){KJUR={}}if(typeof KJUR.asn1=="undefined"||!KJUR.asn1){KJUR.asn1={}}if(typeof KJUR.asn1.tsp=="undefined"||!KJUR.asn1.tsp){KJUR.asn1.tsp={}}KJUR.asn1.tsp.Accuracy=function(b){KJUR.asn1.tsp.Accuracy.superclass.constructor.call(this);var a=KJUR.asn1;this.seconds=null;this.millis=null;this.micros=null;this.getEncodedHex=function(){var e=null;var g=null;var i=null;var c=[];if(this.seconds!=null){e=new a.DERInteger({"int":this.seconds});c.push(e)}if(this.millis!=null){var h=new a.DERInteger({"int":this.millis});g=new a.DERTaggedObject({obj:h,tag:"80",explicit:false});c.push(g)}if(this.micros!=null){var f=new a.DERInteger({"int":this.micros});i=new a.DERTaggedObject({obj:f,tag:"81",explicit:false});c.push(i)}var d=new a.DERSequence({array:c});this.hTLV=d.getEncodedHex();return this.hTLV};if(typeof b!="undefined"){if(typeof b.seconds=="number"){this.seconds=b.seconds}if(typeof b.millis=="number"){this.millis=b.millis}if(typeof b.micros=="number"){this.micros=b.micros}}};YAHOO.lang.extend(KJUR.asn1.tsp.Accuracy,KJUR.asn1.ASN1Object);KJUR.asn1.tsp.MessageImprint=function(b){KJUR.asn1.tsp.MessageImprint.superclass.constructor.call(this);var a=KJUR.asn1;var c=KJUR.asn1.x509;this.dHashAlg=null;this.dHashValue=null;this.getEncodedHex=function(){if(typeof this.hTLV=="string"){return this.hTLV}var d=new a.DERSequence({array:[this.dHashAlg,this.dHashValue]});return d.getEncodedHex()};if(typeof b!="undefined"){if(typeof b.hashAlg=="string"){this.dHashAlg=new c.AlgorithmIdentifier({name:b.hashAlg})}if(typeof b.hashValue=="string"){this.dHashValue=new a.DEROctetString({hex:b.hashValue})}}};YAHOO.lang.extend(KJUR.asn1.tsp.MessageImprint,KJUR.asn1.ASN1Object);KJUR.asn1.tsp.TimeStampReq=function(c){KJUR.asn1.tsp.TimeStampReq.superclass.constructor.call(this);var a=KJUR.asn1;var b=KJUR.asn1.tsp;this.dVersion=new a.DERInteger({"int":1});this.dMessageImprint=null;this.dPolicy=null;this.dNonce=null;this.certReq=true;this.setMessageImprint=function(d){if(d instanceof KJUR.asn1.tsp.MessageImprint){this.dMessageImprint=d;return}if(typeof d=="object"){this.dMessageImprint=new b.MessageImprint(d)}};this.getEncodedHex=function(){if(this.dMessageImprint==null){throw"messageImprint shall be specified"}var d=[this.dVersion,this.dMessageImprint];if(this.dPolicy!=null){d.push(this.dPolicy)}if(this.dNonce!=null){d.push(this.dNonce)}if(this.certReq){d.push(new a.DERBoolean())}var e=new a.DERSequence({array:d});this.hTLV=e.getEncodedHex();return this.hTLV};if(typeof c!="undefined"){if(typeof c.mi=="object"){this.setMessageImprint(c.mi)}if(typeof c.policy=="object"){this.dPolicy=new a.DERObjectIdentifier(c.policy)}if(typeof c.nonce=="object"){this.dNonce=new a.DERInteger(c.nonce)}if(typeof c.certreq=="boolean"){this.certReq=c.certreq}}};YAHOO.lang.extend(KJUR.asn1.tsp.TimeStampReq,KJUR.asn1.ASN1Object);KJUR.asn1.tsp.TSTInfo=function(c){KJUR.asn1.tsp.TSTInfo.superclass.constructor.call(this);var a=KJUR.asn1;var d=KJUR.asn1.x509;var b=KJUR.asn1.tsp;this.dVersion=new a.DERInteger({"int":1});this.dPolicy=null;this.dMessageImprint=null;this.dSerialNumber=null;this.dGenTime=null;this.dAccuracy=null;this.dOrdering=null;this.dNonce=null;this.dTsa=null;this.getEncodedHex=function(){var e=[this.dVersion];if(this.dPolicy==null){throw"policy shall be specified."}e.push(this.dPolicy);if(this.dMessageImprint==null){throw"messageImprint shall be specified."}e.push(this.dMessageImprint);if(this.dSerialNumber==null){throw"serialNumber shall be specified."}e.push(this.dSerialNumber);if(this.dGenTime==null){throw"genTime shall be specified."}e.push(this.dGenTime);if(this.dAccuracy!=null){e.push(this.dAccuracy)}if(this.dOrdering!=null){e.push(this.dOrdering)}if(this.dNonce!=null){e.push(this.dNonce)}if(this.dTsa!=null){e.push(this.dTsa)}var f=new a.DERSequence({array:e});this.hTLV=f.getEncodedHex();return this.hTLV};if(typeof c!="undefined"){if(typeof c.policy=="string"){if(!c.policy.match(/^[0-9.]+$/)){throw"policy shall be oid like 0.1.4.134"}this.dPolicy=new a.DERObjectIdentifier({oid:c.policy})}if(typeof c.messageImprint!="undefined"){this.dMessageImprint=new b.MessageImprint(c.messageImprint)}if(typeof c.serialNumber!="undefined"){this.dSerialNumber=new a.DERInteger(c.serialNumber)}if(typeof c.genTime!="undefined"){this.dGenTime=new a.DERGeneralizedTime(c.genTime)}if(typeof c.accuracy!="undefind"){this.dAccuracy=new b.Accuracy(c.accuracy)}if(typeof c.ordering!="undefined"&&c.ordering==true){this.dOrdering=new a.DERBoolean()}if(typeof c.nonce!="undefined"){this.dNonce=new a.DERInteger(c.nonce)}if(typeof c.tsa!="undefined"){this.dTsa=new d.X500Name(c.tsa)}}};YAHOO.lang.extend(KJUR.asn1.tsp.TSTInfo,KJUR.asn1.ASN1Object);KJUR.asn1.tsp.TimeStampResp=function(c){KJUR.asn1.tsp.TimeStampResp.superclass.constructor.call(this);var a=KJUR.asn1;var b=KJUR.asn1.tsp;this.dStatus=null;this.dTST=null;this.getEncodedHex=function(){if(this.dStatus==null){throw"status shall be specified"}var d=[this.dStatus];if(this.dTST!=null){d.push(this.dTST)}var e=new a.DERSequence({array:d});this.hTLV=e.getEncodedHex();return this.hTLV};if(typeof c!="undefined"){if(typeof c.status=="object"){this.dStatus=new b.PKIStatusInfo(c.status)}if(typeof c.tst!="undefined"&&c.tst instanceof KJUR.asn1.ASN1Object){this.dTST=c.tst.getContentInfo()}}};YAHOO.lang.extend(KJUR.asn1.tsp.TimeStampResp,KJUR.asn1.ASN1Object);KJUR.asn1.tsp.PKIStatusInfo=function(c){KJUR.asn1.tsp.PKIStatusInfo.superclass.constructor.call(this);var a=KJUR.asn1;var b=KJUR.asn1.tsp;this.dStatus=null;this.dStatusString=null;this.dFailureInfo=null;this.getEncodedHex=function(){if(this.dStatus==null){throw"status shall be specified"}var d=[this.dStatus];if(this.dStatusString!=null){d.push(this.dStatusString)}if(this.dFailureInfo!=null){d.push(this.dFailureInfo)}var e=new a.DERSequence({array:d});this.hTLV=e.getEncodedHex();return this.hTLV};if(typeof c!="undefined"){if(typeof c.status=="object"){this.dStatus=new b.PKIStatus(c.status)}if(typeof c.statstr=="object"){this.dStatusString=new b.PKIFreeText({array:c.statstr})}if(typeof c.failinfo=="object"){this.dFailureInfo=new b.PKIFailureInfo(c.failinfo)}}};YAHOO.lang.extend(KJUR.asn1.tsp.PKIStatusInfo,KJUR.asn1.ASN1Object);KJUR.asn1.tsp.PKIStatus=function(e){KJUR.asn1.tsp.PKIStatus.superclass.constructor.call(this);var a=KJUR.asn1;var b=KJUR.asn1.tsp;var d=null;this.getEncodedHex=function(){this.hTLV=this.dStatus.getEncodedHex();return this.hTLV};if(typeof e!="undefined"){if(typeof e.name!="undefined"){var c=b.PKIStatus.valueList;if(typeof c[e.name]=="undefined"){throw"name undefined: "+e.name}this.dStatus=new a.DERInteger({"int":c[e.name]})}else{this.dStatus=new a.DERInteger(e)}}};YAHOO.lang.extend(KJUR.asn1.tsp.PKIStatus,KJUR.asn1.ASN1Object);KJUR.asn1.tsp.PKIStatus.valueList={granted:0,grantedWithMods:1,rejection:2,waiting:3,revocationWarning:4,revocationNotification:5};KJUR.asn1.tsp.PKIFreeText=function(b){KJUR.asn1.tsp.PKIFreeText.superclass.constructor.call(this);var a=KJUR.asn1;this.textList=[];this.getEncodedHex=function(){var c=[];for(var e=0;e - + jsrsasign - RSA Signing and Verification in JavaScript @@ -18,7 +18,7 @@ Fork Me on GitHub

    jsrsasign

    -

    opensource free pure JavaScript cryptographic library supports RSA/RSAPSS/ECDSA/DSA signing/validation, ASN.1, PKCS#1/5/8 private/public key, X.509 certificate, CRL, CMS SignedData and TimeStamp

    +

    opensource free pure JavaScript cryptographic library supports RSA/RSAPSS/ECDSA/DSA signing/validation, ASN.1, PKCS#1/5/8 private/public key, X.509 certificate, CRL, CMS SignedData, TimeStamp and CAdES

    Download this project as a .zip file @@ -41,21 +41,31 @@

    opensource free pure JavaScript cryptographic library s

    FEATURES

    The 'jsrsasign' library provides following features in pure JavaScript.

    NEWS

    +
    2014-Jun-08: +
    Release 4.7.0 is now available. +
      +
    • RFC 5126 CAdES Long Term Signature support
    • +
    • Demo for CAdES BES/EPES/T is here. +
    +
    2014-May-26: -
    Release 4.6.0 is now available. +
    Release 4.6.0 is now available.
    • RFC 3161 Time Stamp support
    • Demo for time stamp request diff --git a/jsrsasign-4.7.0-all-min.js b/jsrsasign-4.7.0-all-min.js new file mode 100644 index 00000000..2047345f --- /dev/null +++ b/jsrsasign-4.7.0-all-min.js @@ -0,0 +1,258 @@ +/* + * jsrsasign 4.2.2 (c) 2010-2014 Kenji Urushima | kjur.github.com/jsrsasign/license + */ +/* +yahoo-min.js +Copyright (c) 2011, Yahoo! Inc. All rights reserved. +Code licensed under the BSD License: +http://developer.yahoo.com/yui/license.html +version: 2.9.0 +*/ +if(typeof YAHOO=="undefined"||!YAHOO){var YAHOO={};}YAHOO.namespace=function(){var b=arguments,g=null,e,c,f;for(e=0;e":">",'"':""","'":"'","/":"/","`":"`"},d=["toString","valueOf"],e={isArray:function(j){return a.toString.apply(j)===c;},isBoolean:function(j){return typeof j==="boolean";},isFunction:function(j){return(typeof j==="function")||a.toString.apply(j)===h;},isNull:function(j){return j===null;},isNumber:function(j){return typeof j==="number"&&isFinite(j);},isObject:function(j){return(j&&(typeof j==="object"||f.isFunction(j)))||false;},isString:function(j){return typeof j==="string";},isUndefined:function(j){return typeof j==="undefined";},_IEEnumFix:(YAHOO.env.ua.ie)?function(l,k){var j,n,m;for(j=0;j"'\/`]/g,function(k){return g[k];});},extend:function(m,n,l){if(!n||!m){throw new Error("extend failed, please check that "+"all dependencies are included.");}var k=function(){},j;k.prototype=n.prototype;m.prototype=new k();m.prototype.constructor=m;m.superclass=n.prototype;if(n.prototype.constructor==a.constructor){n.prototype.constructor=n;}if(l){for(j in l){if(f.hasOwnProperty(l,j)){m.prototype[j]=l[j];}}f._IEEnumFix(m.prototype,l);}},augmentObject:function(n,m){if(!m||!n){throw new Error("Absorb failed, verify dependencies.");}var j=arguments,l,o,k=j[2];if(k&&k!==true){for(l=2;l0)?f.dump(j[l],p-1):t);}else{r.push(j[l]);}r.push(q);}if(r.length>1){r.pop();}r.push("]");}else{r.push("{");for(l in j){if(f.hasOwnProperty(j,l)){r.push(l+m);if(f.isObject(j[l])){r.push((p>0)?f.dump(j[l],p-1):t);}else{r.push(j[l]);}r.push(q);}}if(r.length>1){r.pop();}r.push("}");}return r.join("");},substitute:function(x,y,E,l){var D,C,B,G,t,u,F=[],p,z=x.length,A="dump",r=" ",q="{",m="}",n,w;for(;;){D=x.lastIndexOf(q,z);if(D<0){break;}C=x.indexOf(m,D);if(D+1>C){break;}p=x.substring(D+1,C);G=p;u=null;B=G.indexOf(r);if(B>-1){u=G.substring(B+1);G=G.substring(0,B);}t=y[G];if(E){t=E(G,t,u);}if(f.isObject(t)){if(f.isArray(t)){t=f.dump(t,parseInt(u,10));}else{u=u||"";n=u.indexOf(A);if(n>-1){u=u.substring(4);}w=t.toString();if(w===i||n>-1){t=f.dump(t,parseInt(u,10));}else{t=w;}}}else{if(!f.isString(t)&&!f.isNumber(t)){t="~-"+F.length+"-~";F[F.length]=p;}}x=x.substring(0,D)+t+x.substring(C+1);if(l===false){z=D-1;}}for(D=F.length-1;D>=0;D=D-1){x=x.replace(new RegExp("~-"+D+"-~"),"{"+F[D]+"}","g");}return x;},trim:function(j){try{return j.replace(/^\s+|\s+$/g,"");}catch(k){return j; +}},merge:function(){var n={},k=arguments,j=k.length,m;for(m=0;m>>2]>>>(24-(r%4)*8))&255;q[(n+r)>>>2]|=o<<(24-((n+r)%4)*8)}}else{for(var r=0;r>>2]=p[r>>>2]}}this.sigBytes+=s;return this},clamp:function(){var o=this.words;var n=this.sigBytes;o[n>>>2]&=4294967295<<(32-(n%4)*8);o.length=e.ceil(n/4)},clone:function(){var n=j.clone.call(this);n.words=this.words.slice(0);return n},random:function(p){var o=[];for(var n=0;n>>2]>>>(24-(n%4)*8))&255;q.push((s>>>4).toString(16));q.push((s&15).toString(16))}return q.join("")},parse:function(p){var n=p.length;var q=[];for(var o=0;o>>3]|=parseInt(p.substr(o,2),16)<<(24-(o%8)*4)}return new l.init(q,n/2)}};var d=m.Latin1={stringify:function(q){var r=q.words;var p=q.sigBytes;var n=[];for(var o=0;o>>2]>>>(24-(o%4)*8))&255;n.push(String.fromCharCode(s))}return n.join("")},parse:function(p){var n=p.length;var q=[];for(var o=0;o>>2]|=(p.charCodeAt(o)&255)<<(24-(o%4)*8)}return new l.init(q,n)}};var c=m.Utf8={stringify:function(n){try{return decodeURIComponent(escape(d.stringify(n)))}catch(o){throw new Error("Malformed UTF-8 data")}},parse:function(n){return d.parse(unescape(encodeURIComponent(n)))}};var i=b.BufferedBlockAlgorithm=j.extend({reset:function(){this._data=new l.init();this._nDataBytes=0},_append:function(n){if(typeof n=="string"){n=c.parse(n)}this._data.concat(n);this._nDataBytes+=n.sigBytes},_process:function(w){var q=this._data;var x=q.words;var n=q.sigBytes;var t=this.blockSize;var v=t*4;var u=n/v;if(w){u=e.ceil(u)}else{u=e.max((u|0)-this._minBufferSize,0)}var s=u*t;var r=e.min(s*4,n);if(s){for(var p=0;pe&&(b=a.finalize(b));b.clamp();for(var f=this._oKey=b.clone(),g=this._iKey=b.clone(),h=f.words,j=g.words,d=0;db;){var d;a:{d=l;for(var w=k.sqrt(d),r=2;r<=w;r++)if(!(d%r)){d=!1;break a}d=!0}d&&(8>b&&(s[b]=u(k.pow(l,0.5))),t[b]=u(k.pow(l,1/3)),b++);l++}var n=[],h=h.SHA256=j.extend({_doReset:function(){this._hash=new v.init(s.slice(0))},_doProcessBlock:function(q,h){for(var a=this._hash.words,c=a[0],d=a[1],b=a[2],k=a[3],f=a[4],g=a[5],j=a[6],l=a[7],e=0;64>e;e++){if(16>e)n[e]= +q[h+e]|0;else{var m=n[e-15],p=n[e-2];n[e]=((m<<25|m>>>7)^(m<<14|m>>>18)^m>>>3)+n[e-7]+((p<<15|p>>>17)^(p<<13|p>>>19)^p>>>10)+n[e-16]}m=l+((f<<26|f>>>6)^(f<<21|f>>>11)^(f<<7|f>>>25))+(f&g^~f&j)+t[e]+n[e];p=((c<<30|c>>>2)^(c<<19|c>>>13)^(c<<10|c>>>22))+(c&d^c&b^d&b);l=j;j=g;g=f;f=k+m|0;k=b;b=d;d=c;c=m+p|0}a[0]=a[0]+c|0;a[1]=a[1]+d|0;a[2]=a[2]+b|0;a[3]=a[3]+k|0;a[4]=a[4]+f|0;a[5]=a[5]+g|0;a[6]=a[6]+j|0;a[7]=a[7]+l|0},_doFinalize:function(){var d=this._data,b=d.words,a=8*this._nDataBytes,c=8*d.sigBytes; +b[c>>>5]|=128<<24-c%32;b[(c+64>>>9<<4)+14]=k.floor(a/4294967296);b[(c+64>>>9<<4)+15]=a;d.sigBytes=4*b.length;this._process();return this._hash},clone:function(){var b=j.clone.call(this);b._hash=this._hash.clone();return b}});g.SHA256=j._createHelper(h);g.HmacSHA256=j._createHmacHelper(h)})(Math); +/* +CryptoJS v3.1.2 sha224-min.js +code.google.com/p/crypto-js +(c) 2009-2013 by Jeff Mott. All rights reserved. +code.google.com/p/crypto-js/wiki/License +*/ +(function(){var b=CryptoJS,d=b.lib.WordArray,a=b.algo,c=a.SHA256,a=a.SHA224=c.extend({_doReset:function(){this._hash=new d.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var a=c._doFinalize.call(this);a.sigBytes-=4;return a}});b.SHA224=c._createHelper(a);b.HmacSHA224=c._createHmacHelper(a)})(); +/* +CryptoJS v3.1.2 sha512-min.js +code.google.com/p/crypto-js +(c) 2009-2013 by Jeff Mott. All rights reserved. +code.google.com/p/crypto-js/wiki/License +*/ +(function(){function a(){return d.create.apply(d,arguments)}for(var n=CryptoJS,r=n.lib.Hasher,e=n.x64,d=e.Word,T=e.WordArray,e=n.algo,ea=[a(1116352408,3609767458),a(1899447441,602891725),a(3049323471,3964484399),a(3921009573,2173295548),a(961987163,4081628472),a(1508970993,3053834265),a(2453635748,2937671579),a(2870763221,3664609560),a(3624381080,2734883394),a(310598401,1164996542),a(607225278,1323610764),a(1426881987,3590304994),a(1925078388,4068182383),a(2162078206,991336113),a(2614888103,633803317), +a(3248222580,3479774868),a(3835390401,2666613458),a(4022224774,944711139),a(264347078,2341262773),a(604807628,2007800933),a(770255983,1495990901),a(1249150122,1856431235),a(1555081692,3175218132),a(1996064986,2198950837),a(2554220882,3999719339),a(2821834349,766784016),a(2952996808,2566594879),a(3210313671,3203337956),a(3336571891,1034457026),a(3584528711,2466948901),a(113926993,3758326383),a(338241895,168717936),a(666307205,1188179964),a(773529912,1546045734),a(1294757372,1522805485),a(1396182291, +2643833823),a(1695183700,2343527390),a(1986661051,1014477480),a(2177026350,1206759142),a(2456956037,344077627),a(2730485921,1290863460),a(2820302411,3158454273),a(3259730800,3505952657),a(3345764771,106217008),a(3516065817,3606008344),a(3600352804,1432725776),a(4094571909,1467031594),a(275423344,851169720),a(430227734,3100823752),a(506948616,1363258195),a(659060556,3750685593),a(883997877,3785050280),a(958139571,3318307427),a(1322822218,3812723403),a(1537002063,2003034995),a(1747873779,3602036899), +a(1955562222,1575990012),a(2024104815,1125592928),a(2227730452,2716904306),a(2361852424,442776044),a(2428436474,593698344),a(2756734187,3733110249),a(3204031479,2999351573),a(3329325298,3815920427),a(3391569614,3928383900),a(3515267271,566280711),a(3940187606,3454069534),a(4118630271,4000239992),a(116418474,1914138554),a(174292421,2731055270),a(289380356,3203993006),a(460393269,320620315),a(685471733,587496836),a(852142971,1086792851),a(1017036298,365543100),a(1126000580,2618297676),a(1288033470, +3409855158),a(1501505948,4234509866),a(1607167915,987167468),a(1816402316,1246189591)],v=[],w=0;80>w;w++)v[w]=a();e=e.SHA512=r.extend({_doReset:function(){this._hash=new T.init([new d.init(1779033703,4089235720),new d.init(3144134277,2227873595),new d.init(1013904242,4271175723),new d.init(2773480762,1595750129),new d.init(1359893119,2917565137),new d.init(2600822924,725511199),new d.init(528734635,4215389547),new d.init(1541459225,327033209)])},_doProcessBlock:function(a,d){for(var f=this._hash.words, +F=f[0],e=f[1],n=f[2],r=f[3],G=f[4],H=f[5],I=f[6],f=f[7],w=F.high,J=F.low,X=e.high,K=e.low,Y=n.high,L=n.low,Z=r.high,M=r.low,$=G.high,N=G.low,aa=H.high,O=H.low,ba=I.high,P=I.low,ca=f.high,Q=f.low,k=w,g=J,z=X,x=K,A=Y,y=L,U=Z,B=M,l=$,h=N,R=aa,C=O,S=ba,D=P,V=ca,E=Q,m=0;80>m;m++){var s=v[m];if(16>m)var j=s.high=a[d+2*m]|0,b=s.low=a[d+2*m+1]|0;else{var j=v[m-15],b=j.high,p=j.low,j=(b>>>1|p<<31)^(b>>>8|p<<24)^b>>>7,p=(p>>>1|b<<31)^(p>>>8|b<<24)^(p>>>7|b<<25),u=v[m-2],b=u.high,c=u.low,u=(b>>>19|c<<13)^(b<< +3|c>>>29)^b>>>6,c=(c>>>19|b<<13)^(c<<3|b>>>29)^(c>>>6|b<<26),b=v[m-7],W=b.high,t=v[m-16],q=t.high,t=t.low,b=p+b.low,j=j+W+(b>>>0

      >>0?1:0),b=b+c,j=j+u+(b>>>0>>0?1:0),b=b+t,j=j+q+(b>>>0>>0?1:0);s.high=j;s.low=b}var W=l&R^~l&S,t=h&C^~h&D,s=k&z^k&A^z&A,T=g&x^g&y^x&y,p=(k>>>28|g<<4)^(k<<30|g>>>2)^(k<<25|g>>>7),u=(g>>>28|k<<4)^(g<<30|k>>>2)^(g<<25|k>>>7),c=ea[m],fa=c.high,da=c.low,c=E+((h>>>14|l<<18)^(h>>>18|l<<14)^(h<<23|l>>>9)),q=V+((l>>>14|h<<18)^(l>>>18|h<<14)^(l<<23|h>>>9))+(c>>>0>>0?1: +0),c=c+t,q=q+W+(c>>>0>>0?1:0),c=c+da,q=q+fa+(c>>>0>>0?1:0),c=c+b,q=q+j+(c>>>0>>0?1:0),b=u+T,s=p+s+(b>>>0>>0?1:0),V=S,E=D,S=R,D=C,R=l,C=h,h=B+c|0,l=U+q+(h>>>0>>0?1:0)|0,U=A,B=y,A=z,y=x,z=k,x=g,g=c+b|0,k=q+s+(g>>>0>>0?1:0)|0}J=F.low=J+g;F.high=w+k+(J>>>0>>0?1:0);K=e.low=K+x;e.high=X+z+(K>>>0>>0?1:0);L=n.low=L+y;n.high=Y+A+(L>>>0>>0?1:0);M=r.low=M+B;r.high=Z+U+(M>>>0>>0?1:0);N=G.low=N+h;G.high=$+l+(N>>>0>>0?1:0);O=H.low=O+C;H.high=aa+R+(O>>>0>>0?1:0);P=I.low=P+D; +I.high=ba+S+(P>>>0>>0?1:0);Q=f.low=Q+E;f.high=ca+V+(Q>>>0>>0?1:0)},_doFinalize:function(){var a=this._data,d=a.words,f=8*this._nDataBytes,e=8*a.sigBytes;d[e>>>5]|=128<<24-e%32;d[(e+128>>>10<<5)+30]=Math.floor(f/4294967296);d[(e+128>>>10<<5)+31]=f;a.sigBytes=4*d.length;this._process();return this._hash.toX32()},clone:function(){var a=r.clone.call(this);a._hash=this._hash.clone();return a},blockSize:32});n.SHA512=r._createHelper(e);n.HmacSHA512=r._createHmacHelper(e)})(); +/* +CryptoJS v3.1.2 sha384-min.js +code.google.com/p/crypto-js +(c) 2009-2013 by Jeff Mott. All rights reserved. +code.google.com/p/crypto-js/wiki/License +*/ +(function(){var c=CryptoJS,a=c.x64,b=a.Word,e=a.WordArray,a=c.algo,d=a.SHA512,a=a.SHA384=d.extend({_doReset:function(){this._hash=new e.init([new b.init(3418070365,3238371032),new b.init(1654270250,914150663),new b.init(2438529370,812702999),new b.init(355462360,4144912697),new b.init(1731405415,4290775857),new b.init(2394180231,1750603025),new b.init(3675008525,1694076839),new b.init(1203062813,3204075428)])},_doFinalize:function(){var a=d._doFinalize.call(this);a.sigBytes-=16;return a}});c.SHA384= +d._createHelper(a);c.HmacSHA384=d._createHmacHelper(a)})(); +/* +CryptoJS v3.1.2 md5-min.js +code.google.com/p/crypto-js +(c) 2009-2013 by Jeff Mott. All rights reserved. +code.google.com/p/crypto-js/wiki/License +*/ +(function(E){function h(a,f,g,j,p,h,k){a=a+(f&g|~f&j)+p+k;return(a<>>32-h)+f}function k(a,f,g,j,p,h,k){a=a+(f&j|g&~j)+p+k;return(a<>>32-h)+f}function l(a,f,g,j,h,k,l){a=a+(f^g^j)+h+l;return(a<>>32-k)+f}function n(a,f,g,j,h,k,l){a=a+(g^(f|~j))+h+l;return(a<>>32-k)+f}for(var r=CryptoJS,q=r.lib,F=q.WordArray,s=q.Hasher,q=r.algo,a=[],t=0;64>t;t++)a[t]=4294967296*E.abs(E.sin(t+1))|0;q=q.MD5=s.extend({_doReset:function(){this._hash=new F.init([1732584193,4023233417,2562383102,271733878])}, +_doProcessBlock:function(m,f){for(var g=0;16>g;g++){var j=f+g,p=m[j];m[j]=(p<<8|p>>>24)&16711935|(p<<24|p>>>8)&4278255360}var g=this._hash.words,j=m[f+0],p=m[f+1],q=m[f+2],r=m[f+3],s=m[f+4],t=m[f+5],u=m[f+6],v=m[f+7],w=m[f+8],x=m[f+9],y=m[f+10],z=m[f+11],A=m[f+12],B=m[f+13],C=m[f+14],D=m[f+15],b=g[0],c=g[1],d=g[2],e=g[3],b=h(b,c,d,e,j,7,a[0]),e=h(e,b,c,d,p,12,a[1]),d=h(d,e,b,c,q,17,a[2]),c=h(c,d,e,b,r,22,a[3]),b=h(b,c,d,e,s,7,a[4]),e=h(e,b,c,d,t,12,a[5]),d=h(d,e,b,c,u,17,a[6]),c=h(c,d,e,b,v,22,a[7]), +b=h(b,c,d,e,w,7,a[8]),e=h(e,b,c,d,x,12,a[9]),d=h(d,e,b,c,y,17,a[10]),c=h(c,d,e,b,z,22,a[11]),b=h(b,c,d,e,A,7,a[12]),e=h(e,b,c,d,B,12,a[13]),d=h(d,e,b,c,C,17,a[14]),c=h(c,d,e,b,D,22,a[15]),b=k(b,c,d,e,p,5,a[16]),e=k(e,b,c,d,u,9,a[17]),d=k(d,e,b,c,z,14,a[18]),c=k(c,d,e,b,j,20,a[19]),b=k(b,c,d,e,t,5,a[20]),e=k(e,b,c,d,y,9,a[21]),d=k(d,e,b,c,D,14,a[22]),c=k(c,d,e,b,s,20,a[23]),b=k(b,c,d,e,x,5,a[24]),e=k(e,b,c,d,C,9,a[25]),d=k(d,e,b,c,r,14,a[26]),c=k(c,d,e,b,w,20,a[27]),b=k(b,c,d,e,B,5,a[28]),e=k(e,b, +c,d,q,9,a[29]),d=k(d,e,b,c,v,14,a[30]),c=k(c,d,e,b,A,20,a[31]),b=l(b,c,d,e,t,4,a[32]),e=l(e,b,c,d,w,11,a[33]),d=l(d,e,b,c,z,16,a[34]),c=l(c,d,e,b,C,23,a[35]),b=l(b,c,d,e,p,4,a[36]),e=l(e,b,c,d,s,11,a[37]),d=l(d,e,b,c,v,16,a[38]),c=l(c,d,e,b,y,23,a[39]),b=l(b,c,d,e,B,4,a[40]),e=l(e,b,c,d,j,11,a[41]),d=l(d,e,b,c,r,16,a[42]),c=l(c,d,e,b,u,23,a[43]),b=l(b,c,d,e,x,4,a[44]),e=l(e,b,c,d,A,11,a[45]),d=l(d,e,b,c,D,16,a[46]),c=l(c,d,e,b,q,23,a[47]),b=n(b,c,d,e,j,6,a[48]),e=n(e,b,c,d,v,10,a[49]),d=n(d,e,b,c, +C,15,a[50]),c=n(c,d,e,b,t,21,a[51]),b=n(b,c,d,e,A,6,a[52]),e=n(e,b,c,d,r,10,a[53]),d=n(d,e,b,c,y,15,a[54]),c=n(c,d,e,b,p,21,a[55]),b=n(b,c,d,e,w,6,a[56]),e=n(e,b,c,d,D,10,a[57]),d=n(d,e,b,c,u,15,a[58]),c=n(c,d,e,b,B,21,a[59]),b=n(b,c,d,e,s,6,a[60]),e=n(e,b,c,d,z,10,a[61]),d=n(d,e,b,c,q,15,a[62]),c=n(c,d,e,b,x,21,a[63]);g[0]=g[0]+b|0;g[1]=g[1]+c|0;g[2]=g[2]+d|0;g[3]=g[3]+e|0},_doFinalize:function(){var a=this._data,f=a.words,g=8*this._nDataBytes,j=8*a.sigBytes;f[j>>>5]|=128<<24-j%32;var h=E.floor(g/ +4294967296);f[(j+64>>>9<<4)+15]=(h<<8|h>>>24)&16711935|(h<<24|h>>>8)&4278255360;f[(j+64>>>9<<4)+14]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360;a.sigBytes=4*(f.length+1);this._process();a=this._hash;f=a.words;for(g=0;4>g;g++)j=f[g],f[g]=(j<<8|j>>>24)&16711935|(j<<24|j>>>8)&4278255360;return a},clone:function(){var a=s.clone.call(this);a._hash=this._hash.clone();return a}});r.MD5=s._createHelper(q);r.HmacMD5=s._createHmacHelper(q)})(Math); +/* +CryptoJS v3.1.2 enc-base64-min.js +code.google.com/p/crypto-js +(c) 2009-2013 by Jeff Mott. All rights reserved. +code.google.com/p/crypto-js/wiki/License +*/ +(function(){var h=CryptoJS,j=h.lib.WordArray;h.enc.Base64={stringify:function(b){var e=b.words,f=b.sigBytes,c=this._map;b.clamp();b=[];for(var a=0;a>>2]>>>24-8*(a%4)&255)<<16|(e[a+1>>>2]>>>24-8*((a+1)%4)&255)<<8|e[a+2>>>2]>>>24-8*((a+2)%4)&255,g=0;4>g&&a+0.75*g>>6*(3-g)&63));if(e=c.charAt(64))for(;b.length%4;)b.push(e);return b.join("")},parse:function(b){var e=b.length,f=this._map,c=f.charAt(64);c&&(c=b.indexOf(c),-1!=c&&(e=c));for(var c=[],a=0,d=0;d< +e;d++)if(d%4){var g=f.indexOf(b.charAt(d-1))<<2*(d%4),h=f.indexOf(b.charAt(d))>>>6-2*(d%4);c[a>>>2]|=(g|h)<<24-8*(a%4);a++}return j.create(c,a)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}})(); +/* +CryptoJS v3.1.2 cipher-core-min.js +code.google.com/p/crypto-js +(c) 2009-2013 by Jeff Mott. All rights reserved. +code.google.com/p/crypto-js/wiki/License +*/ +CryptoJS.lib.Cipher||function(u){var g=CryptoJS,f=g.lib,k=f.Base,l=f.WordArray,q=f.BufferedBlockAlgorithm,r=g.enc.Base64,v=g.algo.EvpKDF,n=f.Cipher=q.extend({cfg:k.extend(),createEncryptor:function(a,b){return this.create(this._ENC_XFORM_MODE,a,b)},createDecryptor:function(a,b){return this.create(this._DEC_XFORM_MODE,a,b)},init:function(a,b,c){this.cfg=this.cfg.extend(c);this._xformMode=a;this._key=b;this.reset()},reset:function(){q.reset.call(this);this._doReset()},process:function(a){this._append(a); +return this._process()},finalize:function(a){a&&this._append(a);return this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(a){return{encrypt:function(b,c,d){return("string"==typeof c?s:j).encrypt(a,b,c,d)},decrypt:function(b,c,d){return("string"==typeof c?s:j).decrypt(a,b,c,d)}}}});f.StreamCipher=n.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var m=g.mode={},t=function(a,b,c){var d=this._iv;d?this._iv=u:d=this._prevBlock;for(var e= +0;e>>2]&255}};f.BlockCipher=n.extend({cfg:n.cfg.extend({mode:m,padding:h}),reset:function(){n.reset.call(this);var a=this.cfg,b=a.iv,a=a.mode;if(this._xformMode==this._ENC_XFORM_MODE)var c=a.createEncryptor;else c=a.createDecryptor,this._minBufferSize=1; +this._mode=c.call(a,this,b&&b.words)},_doProcessBlock:function(a,b){this._mode.processBlock(a,b)},_doFinalize:function(){var a=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){a.pad(this._data,this.blockSize);var b=this._process(!0)}else b=this._process(!0),a.unpad(b);return b},blockSize:4});var p=f.CipherParams=k.extend({init:function(a){this.mixIn(a)},toString:function(a){return(a||this.formatter).stringify(this)}}),m=(g.format={}).OpenSSL={stringify:function(a){var b=a.ciphertext;a=a.salt; +return(a?l.create([1398893684,1701076831]).concat(a).concat(b):b).toString(r)},parse:function(a){a=r.parse(a);var b=a.words;if(1398893684==b[0]&&1701076831==b[1]){var c=l.create(b.slice(2,4));b.splice(0,4);a.sigBytes-=16}return p.create({ciphertext:a,salt:c})}},j=f.SerializableCipher=k.extend({cfg:k.extend({format:m}),encrypt:function(a,b,c,d){d=this.cfg.extend(d);var e=a.createEncryptor(c,d);b=e.finalize(b);e=e.cfg;return p.create({ciphertext:b,key:c,iv:e.iv,algorithm:a,mode:e.mode,padding:e.padding, +blockSize:a.blockSize,formatter:d.format})},decrypt:function(a,b,c,d){d=this.cfg.extend(d);b=this._parse(b,d.format);return a.createDecryptor(c,d).finalize(b.ciphertext)},_parse:function(a,b){return"string"==typeof a?b.parse(a,this):a}}),g=(g.kdf={}).OpenSSL={execute:function(a,b,c,d){d||(d=l.random(8));a=v.create({keySize:b+c}).compute(a,d);c=l.create(a.words.slice(b),4*c);a.sigBytes=4*b;return p.create({key:a,iv:c,salt:d})}},s=f.PasswordBasedCipher=j.extend({cfg:j.cfg.extend({kdf:g}),encrypt:function(a, +b,c,d){d=this.cfg.extend(d);c=d.kdf.execute(c,a.keySize,a.ivSize);d.iv=c.iv;a=j.encrypt.call(this,a,b,c.key,d);a.mixIn(c);return a},decrypt:function(a,b,c,d){d=this.cfg.extend(d);b=this._parse(b,d.format);c=d.kdf.execute(c,a.keySize,a.ivSize,b.salt);d.iv=c.iv;return j.decrypt.call(this,a,b,c.key,d)}})}(); +/* +CryptoJS v3.1.2 aes-min.js +code.google.com/p/crypto-js +(c) 2009-2013 by Jeff Mott. All rights reserved. +code.google.com/p/crypto-js/wiki/License +*/ +(function(){for(var q=CryptoJS,x=q.lib.BlockCipher,r=q.algo,j=[],y=[],z=[],A=[],B=[],C=[],s=[],u=[],v=[],w=[],g=[],k=0;256>k;k++)g[k]=128>k?k<<1:k<<1^283;for(var n=0,l=0,k=0;256>k;k++){var f=l^l<<1^l<<2^l<<3^l<<4,f=f>>>8^f&255^99;j[n]=f;y[f]=n;var t=g[n],D=g[t],E=g[D],b=257*g[f]^16843008*f;z[n]=b<<24|b>>>8;A[n]=b<<16|b>>>16;B[n]=b<<8|b>>>24;C[n]=b;b=16843009*E^65537*D^257*t^16843008*n;s[f]=b<<24|b>>>8;u[f]=b<<16|b>>>16;v[f]=b<<8|b>>>24;w[f]=b;n?(n=t^g[g[g[E^t]]],l^=g[g[l]]):n=l=1}var F=[0,1,2,4,8, +16,32,64,128,27,54],r=r.AES=x.extend({_doReset:function(){for(var c=this._key,e=c.words,a=c.sigBytes/4,c=4*((this._nRounds=a+6)+1),b=this._keySchedule=[],h=0;h>>24]<<24|j[d>>>16&255]<<16|j[d>>>8&255]<<8|j[d&255]):(d=d<<8|d>>>24,d=j[d>>>24]<<24|j[d>>>16&255]<<16|j[d>>>8&255]<<8|j[d&255],d^=F[h/a|0]<<24);b[h]=b[h-a]^d}e=this._invKeySchedule=[];for(a=0;aa||4>=h?d:s[j[d>>>24]]^u[j[d>>>16&255]]^v[j[d>>> +8&255]]^w[j[d&255]]},encryptBlock:function(c,e){this._doCryptBlock(c,e,this._keySchedule,z,A,B,C,j)},decryptBlock:function(c,e){var a=c[e+1];c[e+1]=c[e+3];c[e+3]=a;this._doCryptBlock(c,e,this._invKeySchedule,s,u,v,w,y);a=c[e+1];c[e+1]=c[e+3];c[e+3]=a},_doCryptBlock:function(c,e,a,b,h,d,j,m){for(var n=this._nRounds,f=c[e]^a[0],g=c[e+1]^a[1],k=c[e+2]^a[2],p=c[e+3]^a[3],l=4,t=1;t>>24]^h[g>>>16&255]^d[k>>>8&255]^j[p&255]^a[l++],r=b[g>>>24]^h[k>>>16&255]^d[p>>>8&255]^j[f&255]^a[l++],s= +b[k>>>24]^h[p>>>16&255]^d[f>>>8&255]^j[g&255]^a[l++],p=b[p>>>24]^h[f>>>16&255]^d[g>>>8&255]^j[k&255]^a[l++],f=q,g=r,k=s;q=(m[f>>>24]<<24|m[g>>>16&255]<<16|m[k>>>8&255]<<8|m[p&255])^a[l++];r=(m[g>>>24]<<24|m[k>>>16&255]<<16|m[p>>>8&255]<<8|m[f&255])^a[l++];s=(m[k>>>24]<<24|m[p>>>16&255]<<16|m[f>>>8&255]<<8|m[g&255])^a[l++];p=(m[p>>>24]<<24|m[f>>>16&255]<<16|m[g>>>8&255]<<8|m[k&255])^a[l++];c[e]=q;c[e+1]=r;c[e+2]=s;c[e+3]=p},keySize:8});q.AES=x._createHelper(r)})(); +/* +CryptoJS v3.1.2 tripledes-min.js +code.google.com/p/crypto-js +(c) 2009-2013 by Jeff Mott. All rights reserved. +code.google.com/p/crypto-js/wiki/License +*/ +(function(){function j(b,c){var a=(this._lBlock>>>b^this._rBlock)&c;this._rBlock^=a;this._lBlock^=a<>>b^this._lBlock)&c;this._lBlock^=a;this._rBlock^=a<a;a++){var f=q[a]-1;c[a]=b[f>>>5]>>>31-f%32&1}b=this._subKeys=[];for(f=0;16>f;f++){for(var d=b[f]=[],e=r[f],a=0;24>a;a++)d[a/6|0]|=c[(p[a]-1+e)%28]<<31-a%6,d[4+(a/6|0)]|=c[28+(p[a+24]-1+e)%28]<<31-a%6;d[0]=d[0]<<1|d[0]>>>31;for(a=1;7>a;a++)d[a]>>>= +4*(a-1)+3;d[7]=d[7]<<5|d[7]>>>27}c=this._invSubKeys=[];for(a=0;16>a;a++)c[a]=b[15-a]},encryptBlock:function(b,c){this._doCryptBlock(b,c,this._subKeys)},decryptBlock:function(b,c){this._doCryptBlock(b,c,this._invSubKeys)},_doCryptBlock:function(b,c,a){this._lBlock=b[c];this._rBlock=b[c+1];j.call(this,4,252645135);j.call(this,16,65535);l.call(this,2,858993459);l.call(this,8,16711935);j.call(this,1,1431655765);for(var f=0;16>f;f++){for(var d=a[f],e=this._lBlock,h=this._rBlock,g=0,k=0;8>k;k++)g|=s[k][((h^ +d[k])&t[k])>>>0];this._lBlock=h;this._rBlock=e^g}a=this._lBlock;this._lBlock=this._rBlock;this._rBlock=a;j.call(this,1,1431655765);l.call(this,8,16711935);l.call(this,2,858993459);j.call(this,16,65535);j.call(this,4,252645135);b[c]=this._lBlock;b[c+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});h.DES=e._createHelper(m);g=g.TripleDES=e.extend({_doReset:function(){var b=this._key.words;this._des1=m.createEncryptor(n.create(b.slice(0,2)));this._des2=m.createEncryptor(n.create(b.slice(2,4)));this._des3= +m.createEncryptor(n.create(b.slice(4,6)))},encryptBlock:function(b,c){this._des1.encryptBlock(b,c);this._des2.decryptBlock(b,c);this._des3.encryptBlock(b,c)},decryptBlock:function(b,c){this._des3.decryptBlock(b,c);this._des2.encryptBlock(b,c);this._des1.decryptBlock(b,c)},keySize:6,ivSize:2,blockSize:2});h.TripleDES=e._createHelper(g)})(); +/* +CryptoJS v3.1.2 sha1-min.js +code.google.com/p/crypto-js +(c) 2009-2013 by Jeff Mott. All rights reserved. +code.google.com/p/crypto-js/wiki/License +*/ +(function(){var k=CryptoJS,b=k.lib,m=b.WordArray,l=b.Hasher,d=[],b=k.algo.SHA1=l.extend({_doReset:function(){this._hash=new m.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(n,p){for(var a=this._hash.words,e=a[0],f=a[1],h=a[2],j=a[3],b=a[4],c=0;80>c;c++){if(16>c)d[c]=n[p+c]|0;else{var g=d[c-3]^d[c-8]^d[c-14]^d[c-16];d[c]=g<<1|g>>>31}g=(e<<5|e>>>27)+b+d[c];g=20>c?g+((f&h|~f&j)+1518500249):40>c?g+((f^h^j)+1859775393):60>c?g+((f&h|f&j|h&j)-1894007588):g+((f^h^ +j)-899497514);b=j;j=h;h=f<<30|f>>>2;f=e;e=g}a[0]=a[0]+e|0;a[1]=a[1]+f|0;a[2]=a[2]+h|0;a[3]=a[3]+j|0;a[4]=a[4]+b|0},_doFinalize:function(){var b=this._data,d=b.words,a=8*this._nDataBytes,e=8*b.sigBytes;d[e>>>5]|=128<<24-e%32;d[(e+64>>>9<<4)+14]=Math.floor(a/4294967296);d[(e+64>>>9<<4)+15]=a;b.sigBytes=4*d.length;this._process();return this._hash},clone:function(){var b=l.clone.call(this);b._hash=this._hash.clone();return b}});k.SHA1=l._createHelper(b);k.HmacSHA1=l._createHmacHelper(b)})(); +/* +CryptoJS v3.1.2 ripemd160-min.js +code.google.com/p/crypto-js +(c) 2009-2013 by Jeff Mott. All rights reserved. +code.google.com/p/crypto-js/wiki/License +*/ +/* + +(c) 2012 by Cedric Mesnil. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +(function(){var q=CryptoJS,d=q.lib,n=d.WordArray,p=d.Hasher,d=q.algo,x=n.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),y=n.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),z=n.create([11,14,15,12, +5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),A=n.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),B=n.create([0,1518500249,1859775393,2400959708,2840853838]),C=n.create([1352829926,1548603684,1836072691, +2053994217,0]),d=d.RIPEMD160=p.extend({_doReset:function(){this._hash=n.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,v){for(var b=0;16>b;b++){var c=v+b,f=e[c];e[c]=(f<<8|f>>>24)&16711935|(f<<24|f>>>8)&4278255360}var c=this._hash.words,f=B.words,d=C.words,n=x.words,q=y.words,p=z.words,w=A.words,t,g,h,j,r,u,k,l,m,s;u=t=c[0];k=g=c[1];l=h=c[2];m=j=c[3];s=r=c[4];for(var a,b=0;80>b;b+=1)a=t+e[v+n[b]]|0,a=16>b?a+((g^h^j)+f[0]):32>b?a+((g&h|~g&j)+f[1]):48>b? +a+(((g|~h)^j)+f[2]):64>b?a+((g&j|h&~j)+f[3]):a+((g^(h|~j))+f[4]),a|=0,a=a<>>32-p[b],a=a+r|0,t=r,r=j,j=h<<10|h>>>22,h=g,g=a,a=u+e[v+q[b]]|0,a=16>b?a+((k^(l|~m))+d[0]):32>b?a+((k&m|l&~m)+d[1]):48>b?a+(((k|~l)^m)+d[2]):64>b?a+((k&l|~k&m)+d[3]):a+((k^l^m)+d[4]),a|=0,a=a<>>32-w[b],a=a+s|0,u=s,s=m,m=l<<10|l>>>22,l=k,k=a;a=c[1]+h+m|0;c[1]=c[2]+j+s|0;c[2]=c[3]+r+u|0;c[3]=c[4]+t+k|0;c[4]=c[0]+g+l|0;c[0]=a},_doFinalize:function(){var e=this._data,d=e.words,b=8*this._nDataBytes,c=8*e.sigBytes; +d[c>>>5]|=128<<24-c%32;d[(c+64>>>9<<4)+14]=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360;e.sigBytes=4*(d.length+1);this._process();e=this._hash;d=e.words;for(b=0;5>b;b++)c=d[b],d[b]=(c<<8|c>>>24)&16711935|(c<<24|c>>>8)&4278255360;return e},clone:function(){var d=p.clone.call(this);d._hash=this._hash.clone();return d}});q.RIPEMD160=p._createHelper(d);q.HmacRIPEMD160=p._createHmacHelper(d)})(Math); +/* +CryptoJS v3.1.2 pbkdf2-min.js +code.google.com/p/crypto-js +(c) 2009-2013 by Jeff Mott. All rights reserved. +code.google.com/p/crypto-js/wiki/License +*/ +(function(){var b=CryptoJS,a=b.lib,d=a.Base,m=a.WordArray,a=b.algo,q=a.HMAC,l=a.PBKDF2=d.extend({cfg:d.extend({keySize:4,hasher:a.SHA1,iterations:1}),init:function(a){this.cfg=this.cfg.extend(a)},compute:function(a,b){for(var c=this.cfg,f=q.create(c.hasher,a),g=m.create(),d=m.create([1]),l=g.words,r=d.words,n=c.keySize,c=c.iterations;l.length>6)+b64map.charAt(e&63)}if(b+1==d.length){e=parseInt(d.substring(b,b+1),16);a+=b64map.charAt(e<<2)}else{if(b+2==d.length){e=parseInt(d.substring(b,b+2),16);a+=b64map.charAt(e>>2)+b64map.charAt((e&3)<<4)}}if(b64pad){while((a.length&3)>0){a+=b64pad}}return a}function b64tohex(f){var d="";var e;var b=0;var c;var a;for(e=0;e>2);c=a&3;b=1}else{if(b==1){d+=int2char((c<<2)|(a>>4));c=a&15;b=2}else{if(b==2){d+=int2char(c);d+=int2char(a>>2);c=a&3;b=3}else{d+=int2char((c<<2)|(a>>4));d+=int2char(a&15);b=0}}}}if(b==1){d+=int2char(c<<2)}return d}function b64toBA(e){var d=b64tohex(e);var c;var b=new Array();for(c=0;2*c=0){var d=a*this[f++]+b[e]+h;h=Math.floor(d/67108864);b[e++]=d&67108863}return h}function am2(f,q,r,e,o,a){var k=q&32767,p=q>>15;while(--a>=0){var d=this[f]&32767;var g=this[f++]>>15;var b=p*d+g*k;d=k*d+((b&32767)<<15)+r[e]+(o&1073741823);o=(d>>>30)+(b>>>15)+p*g+(o>>>30);r[e++]=d&1073741823}return o}function am3(f,q,r,e,o,a){var k=q&16383,p=q>>14;while(--a>=0){var d=this[f]&16383;var g=this[f++]>>14;var b=p*d+g*k;d=k*d+((b&16383)<<14)+r[e]+o;o=(d>>28)+(b>>14)+p*g;r[e++]=d&268435455}return o}if(j_lm&&(navigator.appName=="Microsoft Internet Explorer")){BigInteger.prototype.am=am2;dbits=30}else{if(j_lm&&(navigator.appName!="Netscape")){BigInteger.prototype.am=am1;dbits=26}else{BigInteger.prototype.am=am3;dbits=28}}BigInteger.prototype.DB=dbits;BigInteger.prototype.DM=((1<=0;--a){b[a]=this[a]}b.t=this.t;b.s=this.s}function bnpFromInt(a){this.t=1;this.s=(a<0)?-1:0;if(a>0){this[0]=a}else{if(a<-1){this[0]=a+this.DV}else{this.t=0}}}function nbv(a){var b=nbi();b.fromInt(a);return b}function bnpFromString(h,c){var e;if(c==16){e=4}else{if(c==8){e=3}else{if(c==256){e=8}else{if(c==2){e=1}else{if(c==32){e=5}else{if(c==4){e=2}else{this.fromRadix(h,c);return}}}}}}this.t=0;this.s=0;var g=h.length,d=false,f=0;while(--g>=0){var a=(e==8)?h[g]&255:intAt(h,g);if(a<0){if(h.charAt(g)=="-"){d=true}continue}d=false;if(f==0){this[this.t++]=a}else{if(f+e>this.DB){this[this.t-1]|=(a&((1<<(this.DB-f))-1))<>(this.DB-f))}else{this[this.t-1]|=a<=this.DB){f-=this.DB}}if(e==8&&(h[0]&128)!=0){this.s=-1;if(f>0){this[this.t-1]|=((1<<(this.DB-f))-1)<0&&this[this.t-1]==a){--this.t}}function bnToString(c){if(this.s<0){return"-"+this.negate().toString(c)}var e;if(c==16){e=4}else{if(c==8){e=3}else{if(c==2){e=1}else{if(c==32){e=5}else{if(c==4){e=2}else{return this.toRadix(c)}}}}}var g=(1<0){if(j>j)>0){a=true;h=int2char(l)}while(f>=0){if(j>(j+=this.DB-e)}else{l=(this[f]>>(j-=e))&g;if(j<=0){j+=this.DB;--f}}if(l>0){a=true}if(a){h+=int2char(l)}}}return a?h:"0"}function bnNegate(){var a=nbi();BigInteger.ZERO.subTo(this,a);return a}function bnAbs(){return(this.s<0)?this.negate():this}function bnCompareTo(b){var d=this.s-b.s;if(d!=0){return d}var c=this.t;d=c-b.t;if(d!=0){return(this.s<0)?-d:d}while(--c>=0){if((d=this[c]-b[c])!=0){return d}}return 0}function nbits(a){var c=1,b;if((b=a>>>16)!=0){a=b;c+=16}if((b=a>>8)!=0){a=b;c+=8}if((b=a>>4)!=0){a=b;c+=4}if((b=a>>2)!=0){a=b;c+=2}if((b=a>>1)!=0){a=b;c+=1}return c}function bnBitLength(){if(this.t<=0){return 0}return this.DB*(this.t-1)+nbits(this[this.t-1]^(this.s&this.DM))}function bnpDLShiftTo(c,b){var a;for(a=this.t-1;a>=0;--a){b[a+c]=this[a]}for(a=c-1;a>=0;--a){b[a]=0}b.t=this.t+c;b.s=this.s}function bnpDRShiftTo(c,b){for(var a=c;a=0;--d){e[d+f+1]=(this[d]>>a)|h;h=(this[d]&g)<=0;--d){e[d]=0}e[f]=h;e.t=this.t+f+1;e.s=this.s;e.clamp()}function bnpRShiftTo(g,d){d.s=this.s;var e=Math.floor(g/this.DB);if(e>=this.t){d.t=0;return}var b=g%this.DB;var a=this.DB-b;var f=(1<>b;for(var c=e+1;c>b}if(b>0){d[this.t-e-1]|=(this.s&f)<>=this.DB}if(d.t>=this.DB}g+=this.s}else{g+=this.s;while(e>=this.DB}g-=d.s}f.s=(g<0)?-1:0;if(g<-1){f[e++]=this.DV+g}else{if(g>0){f[e++]=g}}f.t=e;f.clamp()}function bnpMultiplyTo(c,e){var b=this.abs(),f=c.abs();var d=b.t;e.t=d+f.t;while(--d>=0){e[d]=0}for(d=0;d=0){d[b]=0}for(b=0;b=a.DV){d[b+a.t]-=a.DV;d[b+a.t+1]=1}}if(d.t>0){d[d.t-1]+=a.am(b,a[b],d,2*b,0,1)}d.s=0;d.clamp()}function bnpDivRemTo(n,h,g){var w=n.abs();if(w.t<=0){return}var k=this.abs();if(k.t0){w.lShiftTo(v,d);k.lShiftTo(v,g)}else{w.copyTo(d);k.copyTo(g)}var p=d.t;var b=d[p-1];if(b==0){return}var o=b*(1<1)?d[p-2]>>this.F2:0);var A=this.FV/o,z=(1<=0){g[g.t++]=1;g.subTo(f,g)}BigInteger.ONE.dlShiftTo(p,f);f.subTo(d,d);while(d.t=0){var c=(g[--u]==b)?this.DM:Math.floor(g[u]*A+(g[u-1]+x)*z);if((g[u]+=d.am(0,c,g,s,0,p))0){g.rShiftTo(v,g)}if(a<0){BigInteger.ZERO.subTo(g,g)}}function bnMod(b){var c=nbi();this.abs().divRemTo(b,null,c);if(this.s<0&&c.compareTo(BigInteger.ZERO)>0){b.subTo(c,c)}return c}function Classic(a){this.m=a}function cConvert(a){if(a.s<0||a.compareTo(this.m)>=0){return a.mod(this.m)}else{return a}}function cRevert(a){return a}function cReduce(a){a.divRemTo(this.m,null,a)}function cMulTo(a,c,b){a.multiplyTo(c,b);this.reduce(b)}function cSqrTo(a,b){a.squareTo(b);this.reduce(b)}Classic.prototype.convert=cConvert;Classic.prototype.revert=cRevert;Classic.prototype.reduce=cReduce;Classic.prototype.mulTo=cMulTo;Classic.prototype.sqrTo=cSqrTo;function bnpInvDigit(){if(this.t<1){return 0}var a=this[0];if((a&1)==0){return 0}var b=a&3;b=(b*(2-(a&15)*b))&15;b=(b*(2-(a&255)*b))&255;b=(b*(2-(((a&65535)*b)&65535)))&65535;b=(b*(2-a*b%this.DV))%this.DV;return(b>0)?this.DV-b:-b}function Montgomery(a){this.m=a;this.mp=a.invDigit();this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<<(a.DB-15))-1;this.mt2=2*a.t}function montConvert(a){var b=nbi();a.abs().dlShiftTo(this.m.t,b);b.divRemTo(this.m,null,b);if(a.s<0&&b.compareTo(BigInteger.ZERO)>0){this.m.subTo(b,b)}return b}function montRevert(a){var b=nbi();a.copyTo(b);this.reduce(b);return b}function montReduce(a){while(a.t<=this.mt2){a[a.t++]=0}for(var c=0;c>15)*this.mpl)&this.um)<<15))&a.DM;b=c+this.m.t;a[b]+=this.m.am(0,d,a,c,0,this.m.t);while(a[b]>=a.DV){a[b]-=a.DV;a[++b]++}}a.clamp();a.drShiftTo(this.m.t,a);if(a.compareTo(this.m)>=0){a.subTo(this.m,a)}}function montSqrTo(a,b){a.squareTo(b);this.reduce(b)}function montMulTo(a,c,b){a.multiplyTo(c,b);this.reduce(b)}Montgomery.prototype.convert=montConvert;Montgomery.prototype.revert=montRevert;Montgomery.prototype.reduce=montReduce;Montgomery.prototype.mulTo=montMulTo;Montgomery.prototype.sqrTo=montSqrTo;function bnpIsEven(){return((this.t>0)?(this[0]&1):this.s)==0}function bnpExp(h,j){if(h>4294967295||h<1){return BigInteger.ONE}var f=nbi(),a=nbi(),d=j.convert(this),c=nbits(h)-1;d.copyTo(f);while(--c>=0){j.sqrTo(f,a);if((h&(1<0){j.mulTo(a,d,f)}else{var b=f;f=a;a=b}}return j.revert(f)}function bnModPowInt(b,a){var c;if(b<256||a.isEven()){c=new Classic(a)}else{c=new Montgomery(a)}return this.exp(b,c)}BigInteger.prototype.copyTo=bnpCopyTo;BigInteger.prototype.fromInt=bnpFromInt;BigInteger.prototype.fromString=bnpFromString;BigInteger.prototype.clamp=bnpClamp;BigInteger.prototype.dlShiftTo=bnpDLShiftTo;BigInteger.prototype.drShiftTo=bnpDRShiftTo;BigInteger.prototype.lShiftTo=bnpLShiftTo;BigInteger.prototype.rShiftTo=bnpRShiftTo;BigInteger.prototype.subTo=bnpSubTo;BigInteger.prototype.multiplyTo=bnpMultiplyTo;BigInteger.prototype.squareTo=bnpSquareTo;BigInteger.prototype.divRemTo=bnpDivRemTo;BigInteger.prototype.invDigit=bnpInvDigit;BigInteger.prototype.isEven=bnpIsEven;BigInteger.prototype.exp=bnpExp;BigInteger.prototype.toString=bnToString;BigInteger.prototype.negate=bnNegate;BigInteger.prototype.abs=bnAbs;BigInteger.prototype.compareTo=bnCompareTo;BigInteger.prototype.bitLength=bnBitLength;BigInteger.prototype.mod=bnMod;BigInteger.prototype.modPowInt=bnModPowInt;BigInteger.ZERO=nbv(0);BigInteger.ONE=nbv(1); +/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ + */ +function bnClone(){var a=nbi();this.copyTo(a);return a}function bnIntValue(){if(this.s<0){if(this.t==1){return this[0]-this.DV}else{if(this.t==0){return -1}}}else{if(this.t==1){return this[0]}else{if(this.t==0){return 0}}}return((this[1]&((1<<(32-this.DB))-1))<>24}function bnShortValue(){return(this.t==0)?this.s:(this[0]<<16)>>16}function bnpChunkSize(a){return Math.floor(Math.LN2*this.DB/Math.log(a))}function bnSigNum(){if(this.s<0){return -1}else{if(this.t<=0||(this.t==1&&this[0]<=0)){return 0}else{return 1}}}function bnpToRadix(c){if(c==null){c=10}if(this.signum()==0||c<2||c>36){return"0"}var f=this.chunkSize(c);var e=Math.pow(c,f);var i=nbv(e),j=nbi(),h=nbi(),g="";this.divRemTo(i,j,h);while(j.signum()>0){g=(e+h.intValue()).toString(c).substr(1)+g;j.divRemTo(i,j,h)}return h.intValue().toString(c)+g}function bnpFromRadix(m,h){this.fromInt(0);if(h==null){h=10}var f=this.chunkSize(h);var g=Math.pow(h,f),e=false,a=0,l=0;for(var c=0;c=f){this.dMultiply(g);this.dAddOffset(l,0);a=0;l=0}}if(a>0){this.dMultiply(Math.pow(h,a));this.dAddOffset(l,0)}if(e){BigInteger.ZERO.subTo(this,this)}}function bnpFromNumber(f,e,h){if("number"==typeof e){if(f<2){this.fromInt(1)}else{this.fromNumber(f,h);if(!this.testBit(f-1)){this.bitwiseTo(BigInteger.ONE.shiftLeft(f-1),op_or,this)}if(this.isEven()){this.dAddOffset(1,0)}while(!this.isProbablePrime(e)){this.dAddOffset(2,0);if(this.bitLength()>f){this.subTo(BigInteger.ONE.shiftLeft(f-1),this)}}}}else{var d=new Array(),g=f&7;d.length=(f>>3)+1;e.nextBytes(d);if(g>0){d[0]&=((1<0){if(e>e)!=(this.s&this.DM)>>e){c[a++]=f|(this.s<<(this.DB-e))}while(b>=0){if(e<8){f=(this[b]&((1<>(e+=this.DB-8)}else{f=(this[b]>>(e-=8))&255;if(e<=0){e+=this.DB;--b}}if((f&128)!=0){f|=-256}if(a==0&&(this.s&128)!=(f&128)){++a}if(a>0||f!=this.s){c[a++]=f}}}return c}function bnEquals(b){return(this.compareTo(b)==0)}function bnMin(b){return(this.compareTo(b)<0)?this:b}function bnMax(b){return(this.compareTo(b)>0)?this:b}function bnpBitwiseTo(c,h,e){var d,g,b=Math.min(c.t,this.t);for(d=0;d>=16;b+=16}if((a&255)==0){a>>=8;b+=8}if((a&15)==0){a>>=4;b+=4}if((a&3)==0){a>>=2;b+=2}if((a&1)==0){++b}return b}function bnGetLowestSetBit(){for(var a=0;a=this.t){return(this.s!=0)}return((this[a]&(1<<(b%this.DB)))!=0)}function bnpChangeBit(c,b){var a=BigInteger.ONE.shiftLeft(c);this.bitwiseTo(a,b,a);return a}function bnSetBit(a){return this.changeBit(a,op_or)}function bnClearBit(a){return this.changeBit(a,op_andnot)}function bnFlipBit(a){return this.changeBit(a,op_xor)}function bnpAddTo(d,f){var e=0,g=0,b=Math.min(d.t,this.t);while(e>=this.DB}if(d.t>=this.DB}g+=this.s}else{g+=this.s;while(e>=this.DB}g+=d.s}f.s=(g<0)?-1:0;if(g>0){f[e++]=g}else{if(g<-1){f[e++]=this.DV+g}}f.t=e;f.clamp()}function bnAdd(b){var c=nbi();this.addTo(b,c);return c}function bnSubtract(b){var c=nbi();this.subTo(b,c);return c}function bnMultiply(b){var c=nbi();this.multiplyTo(b,c);return c}function bnSquare(){var a=nbi();this.squareTo(a);return a}function bnDivide(b){var c=nbi();this.divRemTo(b,c,null);return c}function bnRemainder(b){var c=nbi();this.divRemTo(b,null,c);return c}function bnDivideAndRemainder(b){var d=nbi(),c=nbi();this.divRemTo(b,d,c);return new Array(d,c)}function bnpDMultiply(a){this[this.t]=this.am(0,a-1,this,0,0,this.t);++this.t;this.clamp()}function bnpDAddOffset(b,a){if(b==0){return}while(this.t<=a){this[this.t++]=0}this[a]+=b;while(this[a]>=this.DV){this[a]-=this.DV;if(++a>=this.t){this[this.t++]=0}++this[a]}}function NullExp(){}function nNop(a){return a}function nMulTo(a,c,b){a.multiplyTo(c,b)}function nSqrTo(a,b){a.squareTo(b)}NullExp.prototype.convert=nNop;NullExp.prototype.revert=nNop;NullExp.prototype.mulTo=nMulTo;NullExp.prototype.sqrTo=nSqrTo;function bnPow(a){return this.exp(a,new NullExp())}function bnpMultiplyLowerTo(b,f,e){var d=Math.min(this.t+b.t,f);e.s=0;e.t=d;while(d>0){e[--d]=0}var c;for(c=e.t-this.t;d=0){d[c]=0}for(c=Math.max(e-this.t,0);c2*this.m.t){return a.mod(this.m)}else{if(a.compareTo(this.m)<0){return a}else{var b=nbi();a.copyTo(b);this.reduce(b);return b}}}function barrettRevert(a){return a}function barrettReduce(a){a.drShiftTo(this.m.t-1,this.r2);if(a.t>this.m.t+1){a.t=this.m.t+1;a.clamp()}this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);while(a.compareTo(this.r2)<0){a.dAddOffset(1,this.m.t+1)}a.subTo(this.r2,a);while(a.compareTo(this.m)>=0){a.subTo(this.m,a)}}function barrettSqrTo(a,b){a.squareTo(b);this.reduce(b)}function barrettMulTo(a,c,b){a.multiplyTo(c,b);this.reduce(b)}Barrett.prototype.convert=barrettConvert;Barrett.prototype.revert=barrettRevert;Barrett.prototype.reduce=barrettReduce;Barrett.prototype.mulTo=barrettMulTo;Barrett.prototype.sqrTo=barrettSqrTo;function bnModPow(q,f){var o=q.bitLength(),h,b=nbv(1),v;if(o<=0){return b}else{if(o<18){h=1}else{if(o<48){h=3}else{if(o<144){h=4}else{if(o<768){h=5}else{h=6}}}}}if(o<8){v=new Classic(f)}else{if(f.isEven()){v=new Barrett(f)}else{v=new Montgomery(f)}}var p=new Array(),d=3,s=h-1,a=(1<1){var A=nbi();v.sqrTo(p[1],A);while(d<=a){p[d]=nbi();v.mulTo(A,p[d-2],p[d]);d+=2}}var l=q.t-1,x,u=true,c=nbi(),y;o=nbits(q[l])-1;while(l>=0){if(o>=s){x=(q[l]>>(o-s))&a}else{x=(q[l]&((1<<(o+1))-1))<<(s-o);if(l>0){x|=q[l-1]>>(this.DB+o-s)}}d=h;while((x&1)==0){x>>=1;--d}if((o-=d)<0){o+=this.DB;--l}if(u){p[x].copyTo(b);u=false}else{while(d>1){v.sqrTo(b,c);v.sqrTo(c,b);d-=2}if(d>0){v.sqrTo(b,c)}else{y=b;b=c;c=y}v.mulTo(c,p[x],b)}while(l>=0&&(q[l]&(1<0){b.rShiftTo(f,b);h.rShiftTo(f,h)}while(b.signum()>0){if((d=b.getLowestSetBit())>0){b.rShiftTo(d,b)}if((d=h.getLowestSetBit())>0){h.rShiftTo(d,h)}if(b.compareTo(h)>=0){b.subTo(h,b);b.rShiftTo(1,b)}else{h.subTo(b,h);h.rShiftTo(1,h)}}if(f>0){h.lShiftTo(f,h)}return h}function bnpModInt(e){if(e<=0){return 0}var c=this.DV%e,b=(this.s<0)?e-1:0;if(this.t>0){if(c==0){b=this[0]%e}else{for(var a=this.t-1;a>=0;--a){b=(c*b+this[a])%e}}}return b}function bnModInverse(f){var j=f.isEven();if((this.isEven()&&j)||f.signum()==0){return BigInteger.ZERO}var i=f.clone(),h=this.clone();var g=nbv(1),e=nbv(0),l=nbv(0),k=nbv(1);while(i.signum()!=0){while(i.isEven()){i.rShiftTo(1,i);if(j){if(!g.isEven()||!e.isEven()){g.addTo(this,g);e.subTo(f,e)}g.rShiftTo(1,g)}else{if(!e.isEven()){e.subTo(f,e)}}e.rShiftTo(1,e)}while(h.isEven()){h.rShiftTo(1,h);if(j){if(!l.isEven()||!k.isEven()){l.addTo(this,l);k.subTo(f,k)}l.rShiftTo(1,l)}else{if(!k.isEven()){k.subTo(f,k)}}k.rShiftTo(1,k)}if(i.compareTo(h)>=0){i.subTo(h,i);if(j){g.subTo(l,g)}e.subTo(k,e)}else{h.subTo(i,h);if(j){l.subTo(g,l)}k.subTo(e,k)}}if(h.compareTo(BigInteger.ONE)!=0){return BigInteger.ZERO}if(k.compareTo(f)>=0){return k.subtract(f)}if(k.signum()<0){k.addTo(f,k)}else{return k}if(k.signum()<0){return k.add(f)}else{return k}}var lowprimes=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997];var lplim=(1<<26)/lowprimes[lowprimes.length-1];function bnIsProbablePrime(e){var d,b=this.abs();if(b.t==1&&b[0]<=lowprimes[lowprimes.length-1]){for(d=0;d>1;if(f>lowprimes.length){f=lowprimes.length}var b=nbi();for(var e=0;e>8)&255;rng_pool[rng_pptr++]^=(a>>16)&255;rng_pool[rng_pptr++]^=(a>>24)&255;if(rng_pptr>=rng_psize){rng_pptr-=rng_psize}}function rng_seed_time(){rng_seed_int(new Date().getTime())}if(rng_pool==null){rng_pool=new Array();rng_pptr=0;var t;if(navigator.appName=="Netscape"&&navigator.appVersion<"5"&&window.crypto){var z=window.crypto.random(32);for(t=0;t>>8;rng_pool[rng_pptr++]=t&255}rng_pptr=0;rng_seed_time()}function rng_get_byte(){if(rng_state==null){rng_seed_time();rng_state=prng_newstate();rng_state.init(rng_pool);for(rng_pptr=0;rng_pptr=0&&h>0){var f=e.charCodeAt(d--);if(f<128){g[--h]=f}else{if((f>127)&&(f<2048)){g[--h]=(f&63)|128;g[--h]=(f>>6)|192}else{g[--h]=(f&63)|128;g[--h]=((f>>6)&63)|128;g[--h]=(f>>12)|224}}}g[--h]=0;var b=new SecureRandom();var a=new Array();while(h>2){a[0]=0;while(a[0]==0){b.nextBytes(a)}g[--h]=a[0]}g[--h]=2;g[--h]=0;return new BigInteger(g)}function oaep_mgf1_arr(c,a,e){var b="",d=0;while(b.length>24,(d&16711680)>>16,(d&65280)>>8,d&255])));d+=1}return b}var SHA1_SIZE=20;function oaep_pad(l,a,c){if(l.length+2*SHA1_SIZE+2>a){throw"Message too long for RSA"}var h="",d;for(d=0;d0&&a.length>0){this.n=parseBigInt(b,16);this.e=parseInt(a,16)}else{alert("Invalid RSA public key")}}}function RSADoPublic(a){return a.modPowInt(this.e,this.n)}function RSAEncrypt(d){var a=pkcs1pad2(d,(this.n.bitLength()+7)>>3);if(a==null){return null}var e=this.doPublic(a);if(e==null){return null}var b=e.toString(16);if((b.length&1)==0){return b}else{return"0"+b}}function RSAEncryptOAEP(e,d){var a=oaep_pad(e,(this.n.bitLength()+7)>>3,d);if(a==null){return null}var f=this.doPublic(a);if(f==null){return null}var b=f.toString(16);if((b.length&1)==0){return b}else{return"0"+b}}RSAKey.prototype.doPublic=RSADoPublic;RSAKey.prototype.setPublic=RSASetPublic;RSAKey.prototype.encrypt=RSAEncrypt;RSAKey.prototype.encryptOAEP=RSAEncryptOAEP;RSAKey.prototype.type="RSA"; +/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ + */ +function pkcs1unpad2(g,j){var a=g.toByteArray();var f=0;while(f=a.length){return null}}var e="";while(++f191)&&(h<224)){e+=String.fromCharCode(((h&31)<<6)|(a[f+1]&63));++f}else{e+=String.fromCharCode(((h&15)<<12)|((a[f+1]&63)<<6)|(a[f+2]&63));f+=2}}}return e}function oaep_mgf1_str(c,a,e){var b="",d=0;while(b.length>24,(d&16711680)>>16,(d&65280)>>8,d&255]));d+=1}return b}var SHA1_SIZE=20;function oaep_unpad(l,b,e){l=l.toByteArray();var f;for(f=0;f0&&a.length>0){this.n=parseBigInt(c,16);this.e=parseInt(a,16);this.d=parseBigInt(b,16)}else{alert("Invalid RSA private key")}}}function RSASetPrivateEx(g,d,e,c,b,a,h,f){this.isPrivate=true;if(g==null){throw"RSASetPrivateEx N == null"}if(d==null){throw"RSASetPrivateEx E == null"}if(g.length==0){throw"RSASetPrivateEx N.length == 0"}if(d.length==0){throw"RSASetPrivateEx E.length == 0"}if(g!=null&&d!=null&&g.length>0&&d.length>0){this.n=parseBigInt(g,16);this.e=parseInt(d,16);this.d=parseBigInt(e,16);this.p=parseBigInt(c,16);this.q=parseBigInt(b,16);this.dmp1=parseBigInt(a,16);this.dmq1=parseBigInt(h,16);this.coeff=parseBigInt(f,16)}else{alert("Invalid RSA private key in RSASetPrivateEx")}}function RSAGenerate(b,i){var a=new SecureRandom();var f=b>>1;this.e=parseInt(i,16);var c=new BigInteger(i,16);for(;;){for(;;){this.p=new BigInteger(b-f,1,a);if(this.p.subtract(BigInteger.ONE).gcd(c).compareTo(BigInteger.ONE)==0&&this.p.isProbablePrime(10)){break}}for(;;){this.q=new BigInteger(f,1,a);if(this.q.subtract(BigInteger.ONE).gcd(c).compareTo(BigInteger.ONE)==0&&this.q.isProbablePrime(10)){break}}if(this.p.compareTo(this.q)<=0){var h=this.p;this.p=this.q;this.q=h}var g=this.p.subtract(BigInteger.ONE);var d=this.q.subtract(BigInteger.ONE);var e=g.multiply(d);if(e.gcd(c).compareTo(BigInteger.ONE)==0){this.n=this.p.multiply(this.q);this.d=c.modInverse(e);this.dmp1=this.d.mod(g);this.dmq1=this.d.mod(d);this.coeff=this.q.modInverse(this.p);break}}}function RSADoPrivate(a){if(this.p==null||this.q==null){return a.modPow(this.d,this.n)}var c=a.mod(this.p).modPow(this.dmp1,this.p);var b=a.mod(this.q).modPow(this.dmq1,this.q);while(c.compareTo(b)<0){c=c.add(this.p)}return c.subtract(b).multiply(this.coeff).mod(this.p).multiply(this.q).add(b)}function RSADecrypt(b){var d=parseBigInt(b,16);var a=this.doPrivate(d);if(a==null){return null}return pkcs1unpad2(a,(this.n.bitLength()+7)>>3)}function RSADecryptOAEP(d,b){var e=parseBigInt(d,16);var a=this.doPrivate(e);if(a==null){return null}return oaep_unpad(a,(this.n.bitLength()+7)>>3,b)}RSAKey.prototype.doPrivate=RSADoPrivate;RSAKey.prototype.setPrivate=RSASetPrivate;RSAKey.prototype.setPrivateEx=RSASetPrivateEx;RSAKey.prototype.generate=RSAGenerate;RSAKey.prototype.decrypt=RSADecrypt;RSAKey.prototype.decryptOAEP=RSADecryptOAEP; +/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ + */ +function ECFieldElementFp(b,a){this.x=a;this.q=b}function feFpEquals(a){if(a==this){return true}return(this.q.equals(a.q)&&this.x.equals(a.x))}function feFpToBigInteger(){return this.x}function feFpNegate(){return new ECFieldElementFp(this.q,this.x.negate().mod(this.q))}function feFpAdd(a){return new ECFieldElementFp(this.q,this.x.add(a.toBigInteger()).mod(this.q))}function feFpSubtract(a){return new ECFieldElementFp(this.q,this.x.subtract(a.toBigInteger()).mod(this.q))}function feFpMultiply(a){return new ECFieldElementFp(this.q,this.x.multiply(a.toBigInteger()).mod(this.q))}function feFpSquare(){return new ECFieldElementFp(this.q,this.x.square().mod(this.q))}function feFpDivide(a){return new ECFieldElementFp(this.q,this.x.multiply(a.toBigInteger().modInverse(this.q)).mod(this.q))}ECFieldElementFp.prototype.equals=feFpEquals;ECFieldElementFp.prototype.toBigInteger=feFpToBigInteger;ECFieldElementFp.prototype.negate=feFpNegate;ECFieldElementFp.prototype.add=feFpAdd;ECFieldElementFp.prototype.subtract=feFpSubtract;ECFieldElementFp.prototype.multiply=feFpMultiply;ECFieldElementFp.prototype.square=feFpSquare;ECFieldElementFp.prototype.divide=feFpDivide;function ECPointFp(c,a,d,b){this.curve=c;this.x=a;this.y=d;if(b==null){this.z=BigInteger.ONE}else{this.z=b}this.zinv=null}function pointFpGetX(){if(this.zinv==null){this.zinv=this.z.modInverse(this.curve.q)}return this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))}function pointFpGetY(){if(this.zinv==null){this.zinv=this.z.modInverse(this.curve.q)}return this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))}function pointFpEquals(a){if(a==this){return true}if(this.isInfinity()){return a.isInfinity()}if(a.isInfinity()){return this.isInfinity()}var c,b;c=a.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(a.z)).mod(this.curve.q);if(!c.equals(BigInteger.ZERO)){return false}b=a.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(a.z)).mod(this.curve.q);return b.equals(BigInteger.ZERO)}function pointFpIsInfinity(){if((this.x==null)&&(this.y==null)){return true}return this.z.equals(BigInteger.ZERO)&&!this.y.toBigInteger().equals(BigInteger.ZERO)}function pointFpNegate(){return new ECPointFp(this.curve,this.x,this.y.negate(),this.z)}function pointFpAdd(l){if(this.isInfinity()){return l}if(l.isInfinity()){return this}var p=l.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(l.z)).mod(this.curve.q);var o=l.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(l.z)).mod(this.curve.q);if(BigInteger.ZERO.equals(o)){if(BigInteger.ZERO.equals(p)){return this.twice()}return this.curve.getInfinity()}var j=new BigInteger("3");var e=this.x.toBigInteger();var n=this.y.toBigInteger();var c=l.x.toBigInteger();var k=l.y.toBigInteger();var m=o.square();var i=m.multiply(o);var d=e.multiply(m);var g=p.square().multiply(this.z);var a=g.subtract(d.shiftLeft(1)).multiply(l.z).subtract(i).multiply(o).mod(this.curve.q);var h=d.multiply(j).multiply(p).subtract(n.multiply(i)).subtract(g.multiply(p)).multiply(l.z).add(p.multiply(i)).mod(this.curve.q);var f=i.multiply(this.z).multiply(l.z).mod(this.curve.q);return new ECPointFp(this.curve,this.curve.fromBigInteger(a),this.curve.fromBigInteger(h),f)}function pointFpTwice(){if(this.isInfinity()){return this}if(this.y.toBigInteger().signum()==0){return this.curve.getInfinity()}var g=new BigInteger("3");var c=this.x.toBigInteger();var h=this.y.toBigInteger();var e=h.multiply(this.z);var j=e.multiply(h).mod(this.curve.q);var i=this.curve.a.toBigInteger();var k=c.square().multiply(g);if(!BigInteger.ZERO.equals(i)){k=k.add(this.z.square().multiply(i))}k=k.mod(this.curve.q);var b=k.square().subtract(c.shiftLeft(3).multiply(j)).shiftLeft(1).multiply(e).mod(this.curve.q);var f=k.multiply(g).multiply(c).subtract(j.shiftLeft(1)).shiftLeft(2).multiply(j).subtract(k.square().multiply(k)).mod(this.curve.q);var d=e.square().multiply(e).shiftLeft(3).mod(this.curve.q);return new ECPointFp(this.curve,this.curve.fromBigInteger(b),this.curve.fromBigInteger(f),d)}function pointFpMultiply(b){if(this.isInfinity()){return this}if(b.signum()==0){return this.curve.getInfinity()}var g=b;var f=g.multiply(new BigInteger("3"));var l=this.negate();var d=this;var c;for(c=f.bitLength()-2;c>0;--c){d=d.twice();var a=f.testBit(c);var j=g.testBit(c);if(a!=j){d=d.add(a?this:l)}}return d}function pointFpMultiplyTwo(c,a,b){var d;if(c.bitLength()>b.bitLength()){d=c.bitLength()-1}else{d=b.bitLength()-1}var f=this.curve.getInfinity();var e=this.add(a);while(d>=0){f=f.twice();if(c.testBit(d)){if(b.testBit(d)){f=f.add(e)}else{f=f.add(this)}}else{if(b.testBit(d)){f=f.add(a)}}--d}return f}ECPointFp.prototype.getX=pointFpGetX;ECPointFp.prototype.getY=pointFpGetY;ECPointFp.prototype.equals=pointFpEquals;ECPointFp.prototype.isInfinity=pointFpIsInfinity;ECPointFp.prototype.negate=pointFpNegate;ECPointFp.prototype.add=pointFpAdd;ECPointFp.prototype.twice=pointFpTwice;ECPointFp.prototype.multiply=pointFpMultiply;ECPointFp.prototype.multiplyTwo=pointFpMultiplyTwo;function ECCurveFp(e,d,c){this.q=e;this.a=this.fromBigInteger(d);this.b=this.fromBigInteger(c);this.infinity=new ECPointFp(this,null,null)}function curveFpGetQ(){return this.q}function curveFpGetA(){return this.a}function curveFpGetB(){return this.b}function curveFpEquals(a){if(a==this){return true}return(this.q.equals(a.q)&&this.a.equals(a.a)&&this.b.equals(a.b))}function curveFpGetInfinity(){return this.infinity}function curveFpFromBigInteger(a){return new ECFieldElementFp(this.q,a)}function curveFpDecodePointHex(d){switch(parseInt(d.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:return null;case 4:case 6:case 7:var a=(d.length-2)/2;var c=d.substr(2,a);var b=d.substr(a+2,a);return new ECPointFp(this,this.fromBigInteger(new BigInteger(c,16)),this.fromBigInteger(new BigInteger(b,16)));default:return null}}ECCurveFp.prototype.getQ=curveFpGetQ;ECCurveFp.prototype.getA=curveFpGetA;ECCurveFp.prototype.getB=curveFpGetB;ECCurveFp.prototype.equals=curveFpEquals;ECCurveFp.prototype.getInfinity=curveFpGetInfinity;ECCurveFp.prototype.fromBigInteger=curveFpFromBigInteger;ECCurveFp.prototype.decodePointHex=curveFpDecodePointHex; +/*! (c) Stefan Thomas | https://github.com/bitcoinjs/bitcoinjs-lib + */ +ECFieldElementFp.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)};ECPointFp.prototype.getEncoded=function(c){var d=function(h,f){var g=h.toByteArrayUnsigned();if(fg.length){g.unshift(0)}}return g};var a=this.getX().toBigInteger();var e=this.getY().toBigInteger();var b=d(a,32);if(c){if(e.isEven()){b.unshift(2)}else{b.unshift(3)}}else{b.unshift(4);b=b.concat(d(e,32))}return b};ECPointFp.decodeFrom=function(g,c){var f=c[0];var e=c.length-1;var d=c.slice(1,1+e/2);var b=c.slice(1+e/2,1+e);d.unshift(0);b.unshift(0);var a=new BigInteger(d);var h=new BigInteger(b);return new ECPointFp(g,g.fromBigInteger(a),g.fromBigInteger(h))};ECPointFp.decodeFromHex=function(g,c){var f=c.substr(0,2);var e=c.length-2;var d=c.substr(2,e/2);var b=c.substr(2+e/2,e/2);var a=new BigInteger(d,16);var h=new BigInteger(b,16);return new ECPointFp(g,g.fromBigInteger(a),g.fromBigInteger(h))};ECPointFp.prototype.add2D=function(c){if(this.isInfinity()){return c}if(c.isInfinity()){return this}if(this.x.equals(c.x)){if(this.y.equals(c.y)){return this.twice()}return this.curve.getInfinity()}var g=c.x.subtract(this.x);var e=c.y.subtract(this.y);var a=e.divide(g);var d=a.square().subtract(this.x).subtract(c.x);var f=a.multiply(this.x.subtract(d)).subtract(this.y);return new ECPointFp(this.curve,d,f)};ECPointFp.prototype.twice2D=function(){if(this.isInfinity()){return this}if(this.y.toBigInteger().signum()==0){return this.curve.getInfinity()}var b=this.curve.fromBigInteger(BigInteger.valueOf(2));var e=this.curve.fromBigInteger(BigInteger.valueOf(3));var a=this.x.square().multiply(e).add(this.curve.a).divide(this.y.multiply(b));var c=a.square().subtract(this.x.multiply(b));var d=a.multiply(this.x.subtract(c)).subtract(this.y);return new ECPointFp(this.curve,c,d)};ECPointFp.prototype.multiply2D=function(b){if(this.isInfinity()){return this}if(b.signum()==0){return this.curve.getInfinity()}var g=b;var f=g.multiply(new BigInteger("3"));var l=this.negate();var d=this;var c;for(c=f.bitLength()-2;c>0;--c){d=d.twice();var a=f.testBit(c);var j=g.testBit(c);if(a!=j){d=d.add2D(a?this:l)}}return d};ECPointFp.prototype.isOnCurve=function(){var d=this.getX().toBigInteger();var i=this.getY().toBigInteger();var f=this.curve.getA().toBigInteger();var c=this.curve.getB().toBigInteger();var h=this.curve.getQ();var e=i.multiply(i).mod(h);var g=d.multiply(d).multiply(d).add(f.multiply(d)).add(c).mod(h);return e.equals(g)};ECPointFp.prototype.toString=function(){return"("+this.getX().toBigInteger().toString()+","+this.getY().toBigInteger().toString()+")"};ECPointFp.prototype.validate=function(){var c=this.curve.getQ();if(this.isInfinity()){throw new Error("Point is at infinity.")}var a=this.getX().toBigInteger();var b=this.getY().toBigInteger();if(a.compareTo(BigInteger.ONE)<0||a.compareTo(c.subtract(BigInteger.ONE))>0){throw new Error("x coordinate out of bounds")}if(b.compareTo(BigInteger.ONE)<0||b.compareTo(c.subtract(BigInteger.ONE))>0){throw new Error("y coordinate out of bounds")}if(!this.isOnCurve()){throw new Error("Point is not on the curve.")}if(this.multiply(c).isInfinity()){throw new Error("Point is not a scalar multiple of G.")}return true}; +/*! asn1-1.0.6.js (c) 2013 Kenji Urushima | kjur.github.com/jsrsasign/license + */ +if(typeof KJUR=="undefined"||!KJUR){KJUR={}}if(typeof KJUR.asn1=="undefined"||!KJUR.asn1){KJUR.asn1={}}KJUR.asn1.ASN1Util=new function(){this.integerToByteHex=function(a){var b=a.toString(16);if((b.length%2)==1){b="0"+b}return b};this.bigIntToMinTwosComplementsHex=function(j){var f=j.toString(16);if(f.substr(0,1)!="-"){if(f.length%2==1){f="0"+f}else{if(!f.match(/^[0-7]/)){f="00"+f}}}else{var a=f.substr(1);var e=a.length;if(e%2==1){e+=1}else{if(!f.match(/^[0-7]/)){e+=2}}var g="";for(var d=0;d15){throw"ASN.1 length too long to represent by 8x: n = "+i.toString(16)}var f=128+g;return f.toString(16)+h}};this.getEncodedHex=function(){if(this.hTLV==null||this.isModified){this.hV=this.getFreshValueHex();this.hL=this.getLengthHexFromValue();this.hTLV=this.hT+this.hL+this.hV;this.isModified=false}return this.hTLV};this.getValueHex=function(){this.getEncodedHex();return this.hV};this.getFreshValueHex=function(){return""}};KJUR.asn1.DERAbstractString=function(c){KJUR.asn1.DERAbstractString.superclass.constructor.call(this);var b=null;var a=null;this.getString=function(){return this.s};this.setString=function(d){this.hTLV=null;this.isModified=true;this.s=d;this.hV=stohex(this.s)};this.setStringHex=function(d){this.hTLV=null;this.isModified=true;this.s=null;this.hV=d};this.getFreshValueHex=function(){return this.hV};if(typeof c!="undefined"){if(typeof c=="string"){this.setString(c)}else{if(typeof c.str!="undefined"){this.setString(c.str)}else{if(typeof c.hex!="undefined"){this.setStringHex(c.hex)}}}}};YAHOO.lang.extend(KJUR.asn1.DERAbstractString,KJUR.asn1.ASN1Object);KJUR.asn1.DERAbstractTime=function(c){KJUR.asn1.DERAbstractTime.superclass.constructor.call(this);var b=null;var a=null;this.localDateToUTC=function(f){utc=f.getTime()+(f.getTimezoneOffset()*60000);var e=new Date(utc);return e};this.formatDate=function(m,o,e){var g=this.zeroPadding;var n=this.localDateToUTC(m);var p=String(n.getFullYear());if(o=="utc"){p=p.substr(2,2)}var l=g(String(n.getMonth()+1),2);var q=g(String(n.getDate()),2);var h=g(String(n.getHours()),2);var i=g(String(n.getMinutes()),2);var j=g(String(n.getSeconds()),2);var r=p+l+q+h+i+j;if(e===true){var f=n.getMilliseconds();if(f!=0){var k=g(String(f),3);k=k.replace(/[0]+$/,"");r=r+"."+k}}return r+"Z"};this.zeroPadding=function(e,d){if(e.length>=d){return e}return new Array(d-e.length+1).join("0")+e};this.getString=function(){return this.s};this.setString=function(d){this.hTLV=null;this.isModified=true;this.s=d;this.hV=stohex(d)};this.setByDateValue=function(h,j,e,d,f,g){var i=new Date(Date.UTC(h,j-1,e,d,f,g,0));this.setByDate(i)};this.getFreshValueHex=function(){return this.hV}};YAHOO.lang.extend(KJUR.asn1.DERAbstractTime,KJUR.asn1.ASN1Object);KJUR.asn1.DERAbstractStructured=function(b){KJUR.asn1.DERAbstractString.superclass.constructor.call(this);var a=null;this.setByASN1ObjectArray=function(c){this.hTLV=null;this.isModified=true;this.asn1Array=c};this.appendASN1Object=function(c){this.hTLV=null;this.isModified=true;this.asn1Array.push(c)};this.asn1Array=new Array();if(typeof b!="undefined"){if(typeof b.array!="undefined"){this.asn1Array=b.array}}};YAHOO.lang.extend(KJUR.asn1.DERAbstractStructured,KJUR.asn1.ASN1Object);KJUR.asn1.DERBoolean=function(){KJUR.asn1.DERBoolean.superclass.constructor.call(this);this.hT="01";this.hTLV="0101ff"};YAHOO.lang.extend(KJUR.asn1.DERBoolean,KJUR.asn1.ASN1Object);KJUR.asn1.DERInteger=function(a){KJUR.asn1.DERInteger.superclass.constructor.call(this);this.hT="02";this.setByBigInteger=function(b){this.hTLV=null;this.isModified=true;this.hV=KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(b)};this.setByInteger=function(c){var b=new BigInteger(String(c),10);this.setByBigInteger(b)};this.setValueHex=function(b){this.hV=b};this.getFreshValueHex=function(){return this.hV};if(typeof a!="undefined"){if(typeof a.bigint!="undefined"){this.setByBigInteger(a.bigint)}else{if(typeof a["int"]!="undefined"){this.setByInteger(a["int"])}else{if(typeof a=="number"){this.setByInteger(a)}else{if(typeof a.hex!="undefined"){this.setValueHex(a.hex)}}}}}};YAHOO.lang.extend(KJUR.asn1.DERInteger,KJUR.asn1.ASN1Object);KJUR.asn1.DERBitString=function(a){KJUR.asn1.DERBitString.superclass.constructor.call(this);this.hT="03";this.setHexValueIncludingUnusedBits=function(b){this.hTLV=null;this.isModified=true;this.hV=b};this.setUnusedBitsAndHexValue=function(b,d){if(b<0||7=(b*2))){break}if(d>=200){break}c.push(e);g=e;d++}return c};this.getNthChildIndex_AtObj=function(d,b,e){var c=this.getPosArrayOfChildren_AtObj(d,b);return c[e]};this.getDecendantIndexByNthList=function(e,d,c){if(c.length==0){return d}var f=c.shift();var b=this.getPosArrayOfChildren_AtObj(e,d);return this.getDecendantIndexByNthList(e,b[f],c)};this.getDecendantHexTLVByNthList=function(d,c,b){var a=this.getDecendantIndexByNthList(d,c,b);return this.getHexOfTLV_AtObj(d,a)};this.getDecendantHexVByNthList=function(d,c,b){var a=this.getDecendantIndexByNthList(d,c,b);return this.getHexOfV_AtObj(d,a)}};ASN1HEX.getVbyList=function(d,c,b,e){var a=this.getDecendantIndexByNthList(d,c,b);if(a===undefined){throw"can't find nthList object"}if(e!==undefined){if(d.substr(a,2)!=e){throw"checking tag doesn't match: "+d.substr(a,2)+"!="+e}}return this.getHexOfV_AtObj(d,a)};ASN1HEX.hextooidstr=function(e){var h=function(b,a){if(b.length>=a){return b}return new Array(a-b.length+1).join("0")+b};var l=[];var o=e.substr(0,2);var f=parseInt(o,16);l[0]=new String(Math.floor(f/40));l[1]=new String(f%40);var m=e.substr(2);var k=[];for(var g=0;g0){n=n+"."+j.join(".")}return n}; +/*! asn1x509-1.0.9.js (c) 2013-2014 Kenji Urushima | kjur.github.com/jsrsasign/license + */ +if(typeof KJUR=="undefined"||!KJUR){KJUR={}}if(typeof KJUR.asn1=="undefined"||!KJUR.asn1){KJUR.asn1={}}if(typeof KJUR.asn1.x509=="undefined"||!KJUR.asn1.x509){KJUR.asn1.x509={}}KJUR.asn1.x509.Certificate=function(g){KJUR.asn1.x509.Certificate.superclass.constructor.call(this);var b=null;var d=null;var f=null;var c=null;var a=null;var e=null;this.setRsaPrvKeyByPEMandPass=function(i,k){var h=PKCS5PKEY.getDecryptedKeyHex(i,k);var j=new RSAKey();j.readPrivateKeyFromASN1HexString(h);this.prvKey=j};this.sign=function(){this.asn1SignatureAlg=this.asn1TBSCert.asn1SignatureAlg;sig=new KJUR.crypto.Signature({alg:"SHA1withRSA"});sig.init(this.prvKey);sig.updateHex(this.asn1TBSCert.getEncodedHex());this.hexSig=sig.sign();this.asn1Sig=new KJUR.asn1.DERBitString({hex:"00"+this.hexSig});var h=new KJUR.asn1.DERSequence({array:[this.asn1TBSCert,this.asn1SignatureAlg,this.asn1Sig]});this.hTLV=h.getEncodedHex();this.isModified=false};this.setSignatureHex=function(h){this.asn1SignatureAlg=this.asn1TBSCert.asn1SignatureAlg;this.hexSig=h;this.asn1Sig=new KJUR.asn1.DERBitString({hex:"00"+this.hexSig});var i=new KJUR.asn1.DERSequence({array:[this.asn1TBSCert,this.asn1SignatureAlg,this.asn1Sig]});this.hTLV=i.getEncodedHex();this.isModified=false};this.getEncodedHex=function(){if(this.isModified==false&&this.hTLV!=null){return this.hTLV}throw"not signed yet"};this.getPEMString=function(){var j=this.getEncodedHex();var h=CryptoJS.enc.Hex.parse(j);var i=CryptoJS.enc.Base64.stringify(h);var k=i.replace(/(.{64})/g,"$1\r\n");return"-----BEGIN CERTIFICATE-----\r\n"+k+"\r\n-----END CERTIFICATE-----\r\n"};if(typeof g!="undefined"){if(typeof g.tbscertobj!="undefined"){this.asn1TBSCert=g.tbscertobj}if(typeof g.prvkeyobj!="undefined"){this.prvKey=g.prvkeyobj}else{if(typeof g.rsaprvkey!="undefined"){this.prvKey=g.rsaprvkey}else{if((typeof g.rsaprvpem!="undefined")&&(typeof g.rsaprvpas!="undefined")){this.setRsaPrvKeyByPEMandPass(g.rsaprvpem,g.rsaprvpas)}}}}};YAHOO.lang.extend(KJUR.asn1.x509.Certificate,KJUR.asn1.ASN1Object);KJUR.asn1.x509.TBSCertificate=function(a){KJUR.asn1.x509.TBSCertificate.superclass.constructor.call(this);this._initialize=function(){this.asn1Array=new Array();this.asn1Version=new KJUR.asn1.DERTaggedObject({obj:new KJUR.asn1.DERInteger({"int":2})});this.asn1SerialNumber=null;this.asn1SignatureAlg=null;this.asn1Issuer=null;this.asn1NotBefore=null;this.asn1NotAfter=null;this.asn1Subject=null;this.asn1SubjPKey=null;this.extensionsArray=new Array()};this.setSerialNumberByParam=function(b){this.asn1SerialNumber=new KJUR.asn1.DERInteger(b)};this.setSignatureAlgByParam=function(b){this.asn1SignatureAlg=new KJUR.asn1.x509.AlgorithmIdentifier(b)};this.setIssuerByParam=function(b){this.asn1Issuer=new KJUR.asn1.x509.X500Name(b)};this.setNotBeforeByParam=function(b){this.asn1NotBefore=new KJUR.asn1.x509.Time(b)};this.setNotAfterByParam=function(b){this.asn1NotAfter=new KJUR.asn1.x509.Time(b)};this.setSubjectByParam=function(b){this.asn1Subject=new KJUR.asn1.x509.X500Name(b)};this.setSubjectPublicKeyByParam=function(b){this.asn1SubjPKey=new KJUR.asn1.x509.SubjectPublicKeyInfo(b)};this.setSubjectPublicKeyByGetKey=function(c){var b=KEYUTIL.getKey(c);this.asn1SubjPKey=new KJUR.asn1.x509.SubjectPublicKeyInfo(b)};this.appendExtension=function(b){this.extensionsArray.push(b)};this.appendExtensionByName=function(d,b){if(d.toLowerCase()=="basicconstraints"){var c=new KJUR.asn1.x509.BasicConstraints(b);this.appendExtension(c)}else{if(d.toLowerCase()=="keyusage"){var c=new KJUR.asn1.x509.KeyUsage(b);this.appendExtension(c)}else{if(d.toLowerCase()=="crldistributionpoints"){var c=new KJUR.asn1.x509.CRLDistributionPoints(b);this.appendExtension(c)}else{if(d.toLowerCase()=="extkeyusage"){var c=new KJUR.asn1.x509.ExtKeyUsage(b);this.appendExtension(c)}else{if(d.toLowerCase()=="authoritykeyidentifier"){var c=new KJUR.asn1.x509.AuthorityKeyIdentifier(b);this.appendExtension(c)}else{throw"unsupported extension name: "+d}}}}}};this.getEncodedHex=function(){if(this.asn1NotBefore==null||this.asn1NotAfter==null){throw"notBefore and/or notAfter not set"}var c=new KJUR.asn1.DERSequence({array:[this.asn1NotBefore,this.asn1NotAfter]});this.asn1Array=new Array();this.asn1Array.push(this.asn1Version);this.asn1Array.push(this.asn1SerialNumber);this.asn1Array.push(this.asn1SignatureAlg);this.asn1Array.push(this.asn1Issuer);this.asn1Array.push(c);this.asn1Array.push(this.asn1Subject);this.asn1Array.push(this.asn1SubjPKey);if(this.extensionsArray.length>0){var d=new KJUR.asn1.DERSequence({array:this.extensionsArray});var b=new KJUR.asn1.DERTaggedObject({explicit:true,tag:"a3",obj:d});this.asn1Array.push(b)}var e=new KJUR.asn1.DERSequence({array:this.asn1Array});this.hTLV=e.getEncodedHex();this.isModified=false;return this.hTLV};this._initialize()};YAHOO.lang.extend(KJUR.asn1.x509.TBSCertificate,KJUR.asn1.ASN1Object);KJUR.asn1.x509.Extension=function(b){KJUR.asn1.x509.Extension.superclass.constructor.call(this);var a=null;this.getEncodedHex=function(){var f=new KJUR.asn1.DERObjectIdentifier({oid:this.oid});var e=new KJUR.asn1.DEROctetString({hex:this.getExtnValueHex()});var d=new Array();d.push(f);if(this.critical){d.push(new KJUR.asn1.DERBoolean())}d.push(e);var c=new KJUR.asn1.DERSequence({array:d});return c.getEncodedHex()};this.critical=false;if(typeof b!="undefined"){if(typeof b.critical!="undefined"){this.critical=b.critical}}};YAHOO.lang.extend(KJUR.asn1.x509.Extension,KJUR.asn1.ASN1Object);KJUR.asn1.x509.KeyUsage=function(a){KJUR.asn1.x509.KeyUsage.superclass.constructor.call(this,a);this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()};this.oid="2.5.29.15";if(typeof a!="undefined"){if(typeof a.bin!="undefined"){this.asn1ExtnValue=new KJUR.asn1.DERBitString(a)}}};YAHOO.lang.extend(KJUR.asn1.x509.KeyUsage,KJUR.asn1.x509.Extension);KJUR.asn1.x509.BasicConstraints=function(c){KJUR.asn1.x509.BasicConstraints.superclass.constructor.call(this,c);var a=false;var b=-1;this.getExtnValueHex=function(){var e=new Array();if(this.cA){e.push(new KJUR.asn1.DERBoolean())}if(this.pathLen>-1){e.push(new KJUR.asn1.DERInteger({"int":this.pathLen}))}var d=new KJUR.asn1.DERSequence({array:e});this.asn1ExtnValue=d;return this.asn1ExtnValue.getEncodedHex()};this.oid="2.5.29.19";this.cA=false;this.pathLen=-1;if(typeof c!="undefined"){if(typeof c.cA!="undefined"){this.cA=c.cA}if(typeof c.pathLen!="undefined"){this.pathLen=c.pathLen}}};YAHOO.lang.extend(KJUR.asn1.x509.BasicConstraints,KJUR.asn1.x509.Extension);KJUR.asn1.x509.CRLDistributionPoints=function(a){KJUR.asn1.x509.CRLDistributionPoints.superclass.constructor.call(this,a);this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()};this.setByDPArray=function(b){this.asn1ExtnValue=new KJUR.asn1.DERSequence({array:b})};this.setByOneURI=function(e){var b=new KJUR.asn1.x509.GeneralNames([{uri:e}]);var d=new KJUR.asn1.x509.DistributionPointName(b);var c=new KJUR.asn1.x509.DistributionPoint({dpobj:d});this.setByDPArray([c])};this.oid="2.5.29.31";if(typeof a!="undefined"){if(typeof a.array!="undefined"){this.setByDPArray(a.array)}else{if(typeof a.uri!="undefined"){this.setByOneURI(a.uri)}}}};YAHOO.lang.extend(KJUR.asn1.x509.CRLDistributionPoints,KJUR.asn1.x509.Extension);KJUR.asn1.x509.ExtKeyUsage=function(a){KJUR.asn1.x509.ExtKeyUsage.superclass.constructor.call(this,a);this.setPurposeArray=function(b){this.asn1ExtnValue=new KJUR.asn1.DERSequence();for(var c=0;c0){var c=new KJUR.asn1.DERSequence({array:this.aRevokedCert});this.asn1Array.push(c)}var d=new KJUR.asn1.DERSequence({array:this.asn1Array});this.hTLV=d.getEncodedHex();this.isModified=false;return this.hTLV};this._initialize=function(){this.asn1Version=null;this.asn1SignatureAlg=null;this.asn1Issuer=null;this.asn1ThisUpdate=null;this.asn1NextUpdate=null;this.aRevokedCert=new Array()};this._initialize()};YAHOO.lang.extend(KJUR.asn1.x509.TBSCertList,KJUR.asn1.ASN1Object);KJUR.asn1.x509.CRLEntry=function(c){KJUR.asn1.x509.CRLEntry.superclass.constructor.call(this);var b=null;var a=null;this.setCertSerial=function(d){this.sn=new KJUR.asn1.DERInteger(d)};this.setRevocationDate=function(d){this.time=new KJUR.asn1.x509.Time(d)};this.getEncodedHex=function(){var d=new KJUR.asn1.DERSequence({array:[this.sn,this.time]});this.TLV=d.getEncodedHex();return this.TLV};if(typeof c!="undefined"){if(typeof c.time!="undefined"){this.setRevocationDate(c.time)}if(typeof c.sn!="undefined"){this.setCertSerial(c.sn)}}};YAHOO.lang.extend(KJUR.asn1.x509.CRLEntry,KJUR.asn1.ASN1Object);KJUR.asn1.x509.X500Name=function(b){KJUR.asn1.x509.X500Name.superclass.constructor.call(this);this.asn1Array=new Array();this.setByString=function(c){var d=c.split("/");d.shift();for(var e=0;e0){h=new a.DERTaggedObject({obj:this.dUnsignedAttrs,tag:"a1",explicit:false})}var g=[this.dCMSVersion,this.dSignerIdentifier,this.dDigestAlgorithm,e,this.dSigAlg,this.dSig,];if(h!=null){g.push(h)}var f=new a.DERSequence({array:g});this.hTLV=f.getEncodedHex();return this.hTLV}};YAHOO.lang.extend(KJUR.asn1.cms.SignerInfo,KJUR.asn1.ASN1Object);KJUR.asn1.cms.EncapsulatedContentInfo=function(c){KJUR.asn1.cms.EncapsulatedContentInfo.superclass.constructor.call(this);var a=KJUR.asn1;var b=KJUR.asn1.cms;var d=KJUR.asn1.x509;this.dEContentType=new a.DERObjectIdentifier({name:"data"});this.dEContent=null;this.isDetached=false;this.eContentValueHex=null;this.setContentType=function(e){if(e.match(/^[0-2][.][0-9.]+$/)){this.dEContentType=new a.DERObjectIdentifier({oid:e})}else{this.dEContentType=new a.DERObjectIdentifier({name:e})}};this.setContentValue=function(e){if(typeof e!="undefined"){if(typeof e.hex=="string"){this.eContentValueHex=e.hex}else{if(typeof e.str=="string"){this.eContentValueHex=utf8tohex(e.str)}}}};this.setContentValueHex=function(e){this.eContentValueHex=e};this.setContentValueStr=function(e){this.eContentValueHex=utf8tohex(e)};this.getEncodedHex=function(){if(typeof this.eContentValueHex!="string"){throw"eContentValue not yet set"}var g=new a.DEROctetString({hex:this.eContentValueHex});this.dEContent=new a.DERTaggedObject({obj:g,tag:"a0",explicit:true});var e=[this.dEContentType];if(!this.isDetached){e.push(this.dEContent)}var f=new a.DERSequence({array:e});this.hTLV=f.getEncodedHex();return this.hTLV}};YAHOO.lang.extend(KJUR.asn1.cms.EncapsulatedContentInfo,KJUR.asn1.ASN1Object);KJUR.asn1.cms.ContentInfo=function(c){KJUR.asn1.cms.ContentInfo.superclass.constructor.call(this);var a=KJUR.asn1;var b=KJUR.asn1.cms;var d=KJUR.asn1.x509;this.dContentType=null;this.dContent=null;this.setContentType=function(e){if(typeof e=="string"){this.dContentType=d.OID.name2obj(e)}};this.getEncodedHex=function(){var f=new a.DERTaggedObject({obj:this.dContent,tag:"a0",explicit:true});var e=new a.DERSequence({array:[this.dContentType,f]});this.hTLV=e.getEncodedHex();return this.hTLV};if(typeof c!="undefined"){if(c.type){this.setContentType(c.type)}if(c.obj&&c.obj instanceof a.ASN1Object){this.dContent=c.obj}}};YAHOO.lang.extend(KJUR.asn1.cms.ContentInfo,KJUR.asn1.ASN1Object);KJUR.asn1.cms.SignedData=function(c){KJUR.asn1.cms.SignedData.superclass.constructor.call(this);var a=KJUR.asn1;var b=KJUR.asn1.cms;var d=KJUR.asn1.x509;this.dCMSVersion=new a.DERInteger({"int":1});this.dDigestAlgs=null;this.digestAlgNameList=[];this.dEncapContentInfo=new b.EncapsulatedContentInfo();this.dCerts=null;this.certificateList=[];this.crlList=[];this.signerInfoList=[new b.SignerInfo()];this.addCertificatesByPEM=function(e){var f=KEYUTIL.getHexFromPEM(e);var g=new a.ASN1Object();g.hTLV=f;this.certificateList.push(g)};this.getEncodedHex=function(){if(typeof this.hTLV=="string"){return this.hTLV}if(this.dDigestAlgs==null){var k=[];for(var j=0;j0){var l=new a.DERSet({array:this.certificateList});this.dCerts=new a.DERTaggedObject({obj:l,tag:"a0",explicit:false})}}if(this.dCerts!=null){e.push(this.dCerts)}var g=new a.DERSet({array:this.signerInfoList});e.push(g);var f=new a.DERSequence({array:e});this.hTLV=f.getEncodedHex();return this.hTLV};this.getContentInfo=function(){this.getEncodedHex();var e=new b.ContentInfo({type:"signed-data",obj:this});return e};this.getContentInfoEncodedHex=function(){var e=this.getContentInfo();var f=e.getEncodedHex();return f};this.getPEM=function(){var e=this.getContentInfoEncodedHex();var f=a.ASN1Util.getPEMStringFromHex(e,"CMS");return f}};YAHOO.lang.extend(KJUR.asn1.cms.SignedData,KJUR.asn1.ASN1Object);KJUR.asn1.cms.CMSUtil=new function(){};KJUR.asn1.cms.CMSUtil.newSignedData=function(a){var h=KJUR.asn1.cms;var g=KJUR.asn1.cades;var f=new h.SignedData();f.dEncapContentInfo.setContentValue(a.content);if(typeof a.certs=="object"){for(var b=0;bd){throw"key is too short for SigAlg: keylen="+j+","+a}var b="0001";var k="00"+c;var g="";var l=d-b.length-k.length;for(var f=0;f=0;--p){q=q.twice2D();q.z=BigInteger.ONE;if(o.testBit(p)){if(n.testBit(p)){q=q.add2D(t)}else{q=q.add2D(s)}}else{if(n.testBit(p)){q=q.add2D(r)}}}return q}this.getBigRandom=function(i){return new BigInteger(i.bitLength(),a).mod(i.subtract(BigInteger.ONE)).add(BigInteger.ONE)};this.setNamedCurve=function(i){this.ecparams=KJUR.crypto.ECParameterDB.getByName(i);this.prvKeyHex=null;this.pubKeyHex=null;this.curveName=i};this.setPrivateKeyHex=function(i){this.isPrivate=true;this.prvKeyHex=i};this.setPublicKeyHex=function(i){this.isPublic=true;this.pubKeyHex=i};this.generateKeyPairHex=function(){var k=this.ecparams.n;var n=this.getBigRandom(k);var l=this.ecparams.G.multiply(n);var q=l.getX().toBigInteger();var o=l.getY().toBigInteger();var i=this.ecparams.keylen/4;var m=("0000000000"+n.toString(16)).slice(-i);var r=("0000000000"+q.toString(16)).slice(-i);var p=("0000000000"+o.toString(16)).slice(-i);var j="04"+r+p;this.setPrivateKeyHex(m);this.setPublicKeyHex(j);return{ecprvhex:m,ecpubhex:j}};this.signWithMessageHash=function(i){return this.signHex(i,this.prvKeyHex)};this.signHex=function(o,j){var t=new BigInteger(j,16);var l=this.ecparams.n;var q=new BigInteger(o,16);do{var m=this.getBigRandom(l);var u=this.ecparams.G;var p=u.multiply(m);var i=p.getX().toBigInteger().mod(l)}while(i.compareTo(BigInteger.ZERO)<=0);var v=m.modInverse(l).multiply(q.add(t.multiply(i))).mod(l);return KJUR.crypto.ECDSA.biRSSigToASN1Sig(i,v)};this.sign=function(m,u){var q=u;var j=this.ecparams.n;var p=BigInteger.fromByteArrayUnsigned(m);do{var l=this.getBigRandom(j);var t=this.ecparams.G;var o=t.multiply(l);var i=o.getX().toBigInteger().mod(j)}while(i.compareTo(BigInteger.ZERO)<=0);var v=l.modInverse(j).multiply(p.add(q.multiply(i))).mod(j);return this.serializeSig(i,v)};this.verifyWithMessageHash=function(j,i){return this.verifyHex(j,i,this.pubKeyHex)};this.verifyHex=function(m,i,p){var l,j;var o=KJUR.crypto.ECDSA.parseSigHex(i);l=o.r;j=o.s;var k;k=ECPointFp.decodeFromHex(this.ecparams.curve,p);var n=new BigInteger(m,16);return this.verifyRaw(n,l,j,k)};this.verify=function(o,p,j){var l,i;if(Bitcoin.Util.isArray(p)){var n=this.parseSig(p);l=n.r;i=n.s}else{if("object"===typeof p&&p.r&&p.s){l=p.r;i=p.s}else{throw"Invalid value for signature"}}var k;if(j instanceof ECPointFp){k=j}else{if(Bitcoin.Util.isArray(j)){k=ECPointFp.decodeFrom(this.ecparams.curve,j)}else{throw"Invalid format for pubkey value, must be byte array or ECPointFp"}}var m=BigInteger.fromByteArrayUnsigned(o);return this.verifyRaw(m,l,i,k)};this.verifyRaw=function(o,i,w,m){var l=this.ecparams.n;var u=this.ecparams.G;if(i.compareTo(BigInteger.ONE)<0||i.compareTo(l)>=0){return false}if(w.compareTo(BigInteger.ONE)<0||w.compareTo(l)>=0){return false}var p=w.modInverse(l);var k=o.multiply(p).mod(l);var j=i.multiply(p).mod(l);var q=u.multiply(k).add(m.multiply(j));var t=q.getX().toBigInteger().mod(l);return t.equals(i)};this.serializeSig=function(k,j){var l=k.toByteArraySigned();var i=j.toByteArraySigned();var m=[];m.push(2);m.push(l.length);m=m.concat(l);m.push(2);m.push(i.length);m=m.concat(i);m.unshift(m.length);m.unshift(48);return m};this.parseSig=function(n){var m;if(n[0]!=48){throw new Error("Signature not a valid DERSequence")}m=2;if(n[m]!=2){throw new Error("First element in signature must be a DERInteger")}var l=n.slice(m+2,m+2+n[m+1]);m+=2+n[m+1];if(n[m]!=2){throw new Error("Second element in signature must be a DERInteger")}var i=n.slice(m+2,m+2+n[m+1]);m+=2+n[m+1];var k=BigInteger.fromByteArrayUnsigned(l);var j=BigInteger.fromByteArrayUnsigned(i);return{r:k,s:j}};this.parseSigCompact=function(m){if(m.length!==65){throw"Signature has the wrong length"}var j=m[0]-27;if(j<0||j>7){throw"Invalid signature type"}var o=this.ecparams.n;var l=BigInteger.fromByteArrayUnsigned(m.slice(1,33)).mod(o);var k=BigInteger.fromByteArrayUnsigned(m.slice(33,65)).mod(o);return{r:l,s:k,i:j}};if(h!==undefined){if(h.curve!==undefined){this.curveName=h.curve}}if(this.curveName===undefined){this.curveName=e}this.setNamedCurve(this.curveName);if(h!==undefined){if(h.prv!==undefined){this.setPrivateKeyHex(h.prv)}if(h.pub!==undefined){this.setPublicKeyHex(h.pub)}}};KJUR.crypto.ECDSA.parseSigHex=function(a){var b=KJUR.crypto.ECDSA.parseSigHexInHexRS(a);var d=new BigInteger(b.r,16);var c=new BigInteger(b.s,16);return{r:d,s:c}};KJUR.crypto.ECDSA.parseSigHexInHexRS=function(c){if(c.substr(0,2)!="30"){throw"signature is not a ASN.1 sequence"}var b=ASN1HEX.getPosArrayOfChildren_AtObj(c,0);if(b.length!=2){throw"number of signature ASN.1 sequence elements seem wrong"}var g=b[0];var f=b[1];if(c.substr(g,2)!="02"){throw"1st item of sequene of signature is not ASN.1 integer"}if(c.substr(f,2)!="02"){throw"2nd item of sequene of signature is not ASN.1 integer"}var e=ASN1HEX.getHexOfV_AtObj(c,g);var d=ASN1HEX.getHexOfV_AtObj(c,f);return{r:e,s:d}};KJUR.crypto.ECDSA.asn1SigToConcatSig=function(c){var d=KJUR.crypto.ECDSA.parseSigHexInHexRS(c);var b=d.r;var a=d.s;if(b.substr(0,2)=="00"&&(((b.length/2)*8)%(16*8))==8){b=b.substr(2)}if(a.substr(0,2)=="00"&&(((a.length/2)*8)%(16*8))==8){a=a.substr(2)}if((((b.length/2)*8)%(16*8))!=0){throw"unknown ECDSA sig r length error"}if((((a.length/2)*8)%(16*8))!=0){throw"unknown ECDSA sig s length error"}return b+a};KJUR.crypto.ECDSA.concatSigToASN1Sig=function(a){if((((a.length/2)*8)%(16*8))!=0){throw"unknown ECDSA concatinated r-s sig length error"}var c=a.substr(0,a.length/2);var b=a.substr(a.length/2);return KJUR.crypto.ECDSA.hexRSSigToASN1Sig(c,b)};KJUR.crypto.ECDSA.hexRSSigToASN1Sig=function(b,a){var d=new BigInteger(b,16);var c=new BigInteger(a,16);return KJUR.crypto.ECDSA.biRSSigToASN1Sig(d,c)};KJUR.crypto.ECDSA.biRSSigToASN1Sig=function(e,c){var b=new KJUR.asn1.DERInteger({bigint:e});var a=new KJUR.asn1.DERInteger({bigint:c});var d=new KJUR.asn1.DERSequence({array:[b,a]});return d.getEncodedHex()}; +/*! ecparam-1.0.0.js (c) 2013 Kenji Urushima | kjur.github.com/jsrsasign/license + */ +if(typeof KJUR=="undefined"||!KJUR){KJUR={}}if(typeof KJUR.crypto=="undefined"||!KJUR.crypto){KJUR.crypto={}}KJUR.crypto.ECParameterDB=new function(){var b={};var c={};function a(d){return new BigInteger(d,16)}this.getByName=function(e){var d=e;if(typeof c[d]!="undefined"){d=c[e]}if(typeof b[d]!="undefined"){return b[d]}throw"unregistered EC curve name: "+d};this.regist=function(A,l,o,g,m,e,j,f,k,u,d,x){b[A]={};var s=a(o);var z=a(g);var y=a(m);var t=a(e);var w=a(j);var r=new ECCurveFp(s,z,y);var q=r.decodePointHex("04"+f+k);b[A]["name"]=A;b[A]["keylen"]=l;b[A]["curve"]=r;b[A]["G"]=q;b[A]["n"]=t;b[A]["h"]=w;b[A]["oid"]=d;b[A]["info"]=x;for(var v=0;v0||K.compareTo(u)>0||BigInteger.ZERO.compareTo(J)>0||J.compareTo(u)>0){throw"invalid DSA signature"}var I=J.modInverse(u);var A=D.multiply(I).mod(u);var v=K.multiply(I).mod(u);var F=G.modPow(A,z).multiply(H.modPow(v,z)).mod(z).mod(u);return F.compareTo(K)==0};this.parseASN1Signature=function(u){try{var y=new BigInteger(ASN1HEX.getVbyList(u,0,[0],"02"),16);var v=new BigInteger(ASN1HEX.getVbyList(u,0,[1],"02"),16);return[y,v]}catch(w){throw"malformed DSA signature"}};function d(E,w,B,v,u,C){var z=KJUR.crypto.Util.hashString(w,E.toLowerCase());var z=z.substr(0,u.bitLength()/4);var A=new BigInteger(z,16);var y=n(BigInteger.ONE.add(BigInteger.ONE),u.subtract(BigInteger.ONE));var F=(B.modPow(y,v)).mod(u);var D=(y.modInverse(u).multiply(A.add(C.multiply(F)))).mod(u);var G=new Array();G[0]=F;G[1]=D;return G}function r(v){var u=openpgp.config.config.prefer_hash_algorithm;switch(Math.round(v.bitLength()/8)){case 20:if(u!=2&&u>11&&u!=10&&u<8){return 2}return u;case 28:if(u>11&&u<8){return 11}return u;case 32:if(u>10&&u<8){return 8}return u;default:util.print_debug("DSA select hash algorithm: returning null for an unknown length of q");return null}}this.select_hash_algorithm=r;function m(I,K,J,B,z,u,F,G){var C=KJUR.crypto.Util.hashString(B,I.toLowerCase());var C=C.substr(0,u.bitLength()/4);var D=new BigInteger(C,16);if(BigInteger.ZERO.compareTo(K)>0||K.compareTo(u)>0||BigInteger.ZERO.compareTo(J)>0||J.compareTo(u)>0){util.print_error("invalid DSA Signature");return null}var H=J.modInverse(u);var A=D.multiply(H).mod(u);var v=K.multiply(H).mod(u);var E=F.modPow(A,z).multiply(G.modPow(v,z)).mod(z).mod(u);return E.compareTo(K)==0}function a(z){var A=new BigInteger(z,primeCenterie);var y=j(q,512);var u=t(p,q,z);var v;do{v=new BigInteger(q.bitCount(),rand)}while(x.compareTo(BigInteger.ZERO)!=1&&x.compareTo(q)!=-1);var w=g.modPow(x,p);return{x:v,q:A,p:y,g:u,y:w}}function j(y,z,w){if(z%64!=0){return false}var u;var v;do{u=w(bitcount,true);v=u.subtract(BigInteger.ONE);u=u.subtract(v.remainder(y))}while(!u.isProbablePrime(primeCenterie)||u.bitLength()!=l);return u}function t(B,z,A,w){var u=B.subtract(BigInteger.ONE);var y=u.divide(z);var v;do{v=w(A)}while(v.compareTo(u)!=-1&&v.compareTo(BigInteger.ONE)!=1);return v.modPow(y,B)}function o(w,y,u){var v;do{v=u(y,false)}while(v.compareTo(w)!=-1&&v.compareTo(BigInteger.ZERO)!=1);return v}function i(v,w){k=o(v);var u=g.modPow(k,w).mod(v);return u}function h(B,w,y,v,z,u){var A=B(v);s=(w.modInverse(z).multiply(A.add(u.multiply(y)))).mod(z);return s}this.sign=d;this.verify=m;function n(w,u){if(u.compareTo(w)<=0){return}var v=u.subtract(w);var y=e(v.bitLength());while(y>v){y=e(v.bitLength())}return w.add(y)}function e(w){if(w<0){return null}var u=Math.floor((w+7)/8);var v=c(u);if(w%8>0){v=String.fromCharCode((Math.pow(2,w%8)-1)&v.charCodeAt(0))+v.substring(1)}return new BigInteger(f(v),16)}function c(w){var u="";for(var v=0;v=s*2){break}}var x={};x.keyhex=v.substr(0,g[o]["keylen"]*2);x.ivhex=v.substr(g[o]["keylen"]*2,g[o]["ivlen"]*2);return x};var a=function(n,t,p,u){var q=CryptoJS.enc.Base64.parse(n);var o=CryptoJS.enc.Hex.stringify(q);var s=g[t]["proc"];var r=s(o,p,u);return r};var f=function(n,q,o,s){var p=g[q]["eproc"];var r=p(n,o,s);return r};return{version:"1.0.5",getHexFromPEM:function(o,r){var p=o;if(p.indexOf("BEGIN "+r)==-1){throw"can't find PEM header: "+r}p=p.replace("-----BEGIN "+r+"-----","");p=p.replace("-----END "+r+"-----","");var q=p.replace(/\s+/g,"");var n=b64tohex(q);return n},getDecryptedKeyHexByKeyIV:function(o,r,q,p){var n=b(r);return n(o,q,p)},parsePKCS5PEM:function(n){return l(n)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(o,n,p){return h(o,n,p)},decryptKeyB64:function(n,p,o,q){return a(n,p,o,q)},getDecryptedKeyHex:function(w,v){var o=l(w);var r=o.type;var p=o.cipher;var n=o.ivsalt;var q=o.data;var u=h(p,v,n);var t=u.keyhex;var s=a(q,p,t,n);return s},getRSAKeyFromEncryptedPKCS5PEM:function(p,o){var q=this.getDecryptedKeyHex(p,o);var n=new RSAKey();n.readPrivateKeyFromASN1HexString(q);return n},getEryptedPKCS5PEMFromPrvKeyHex:function(q,x,r,p){var n="";if(typeof r=="undefined"||r==null){r="AES-256-CBC"}if(typeof g[r]=="undefined"){throw"PKCS5PKEY unsupported algorithm: "+r}if(typeof p=="undefined"||p==null){var t=g[r]["ivlen"];var s=k(t);p=s.toUpperCase()}var w=h(r,x,p);var v=w.keyhex;var u=f(q,r,v,p);var o=u.replace(/(.{64})/g,"$1\r\n");var n="-----BEGIN RSA PRIVATE KEY-----\r\n";n+="Proc-Type: 4,ENCRYPTED\r\n";n+="DEK-Info: "+r+","+p+"\r\n";n+="\r\n";n+=o;n+="\r\n-----END RSA PRIVATE KEY-----\r\n";return n},getEryptedPKCS5PEMFromRSAKey:function(C,D,o,s){var A=new KJUR.asn1.DERInteger({"int":0});var v=new KJUR.asn1.DERInteger({bigint:C.n});var z=new KJUR.asn1.DERInteger({"int":C.e});var B=new KJUR.asn1.DERInteger({bigint:C.d});var t=new KJUR.asn1.DERInteger({bigint:C.p});var r=new KJUR.asn1.DERInteger({bigint:C.q});var y=new KJUR.asn1.DERInteger({bigint:C.dmp1});var u=new KJUR.asn1.DERInteger({bigint:C.dmq1});var x=new KJUR.asn1.DERInteger({bigint:C.coeff});var E=new KJUR.asn1.DERSequence({array:[A,v,z,B,t,r,y,u,x]});var w=E.getEncodedHex();return this.getEryptedPKCS5PEMFromPrvKeyHex(w,D,o,s)},newEncryptedPKCS5PEM:function(n,o,r,s){if(typeof o=="undefined"||o==null){o=1024}if(typeof r=="undefined"||r==null){r="10001"}var p=new RSAKey();p.generate(o,r);var q=null;if(typeof s=="undefined"||s==null){q=this.getEncryptedPKCS5PEMFromRSAKey(pkey,n)}else{q=this.getEncryptedPKCS5PEMFromRSAKey(pkey,n,s)}return q},getRSAKeyFromPlainPKCS8PEM:function(p){if(p.match(/ENCRYPTED/)){throw"pem shall be not ENCRYPTED"}var o=this.getHexFromPEM(p,"PRIVATE KEY");var n=this.getRSAKeyFromPlainPKCS8Hex(o);return n},getRSAKeyFromPlainPKCS8Hex:function(q){var p=ASN1HEX.getPosArrayOfChildren_AtObj(q,0);if(p.length!=3){throw"outer DERSequence shall have 3 elements: "+p.length}var o=ASN1HEX.getHexOfTLV_AtObj(q,p[1]);if(o!="300d06092a864886f70d0101010500"){throw"PKCS8 AlgorithmIdentifier is not rsaEnc: "+o}var o=ASN1HEX.getHexOfTLV_AtObj(q,p[1]);var r=ASN1HEX.getHexOfTLV_AtObj(q,p[2]);var s=ASN1HEX.getHexOfV_AtObj(r,0);var n=new RSAKey();n.readPrivateKeyFromASN1HexString(s);return n},parseHexOfEncryptedPKCS8:function(u){var q={};var p=ASN1HEX.getPosArrayOfChildren_AtObj(u,0);if(p.length!=2){throw"malformed format: SEQUENCE(0).items != 2: "+p.length}q.ciphertext=ASN1HEX.getHexOfV_AtObj(u,p[1]);var w=ASN1HEX.getPosArrayOfChildren_AtObj(u,p[0]);if(w.length!=2){throw"malformed format: SEQUENCE(0.0).items != 2: "+w.length}if(ASN1HEX.getHexOfV_AtObj(u,w[0])!="2a864886f70d01050d"){throw"this only supports pkcs5PBES2"}var n=ASN1HEX.getPosArrayOfChildren_AtObj(u,w[1]);if(w.length!=2){throw"malformed format: SEQUENCE(0.0.1).items != 2: "+n.length}var o=ASN1HEX.getPosArrayOfChildren_AtObj(u,n[1]);if(o.length!=2){throw"malformed format: SEQUENCE(0.0.1.1).items != 2: "+o.length}if(ASN1HEX.getHexOfV_AtObj(u,o[0])!="2a864886f70d0307"){throw"this only supports TripleDES"}q.encryptionSchemeAlg="TripleDES";q.encryptionSchemeIV=ASN1HEX.getHexOfV_AtObj(u,o[1]);var r=ASN1HEX.getPosArrayOfChildren_AtObj(u,n[0]);if(r.length!=2){throw"malformed format: SEQUENCE(0.0.1.0).items != 2: "+r.length}if(ASN1HEX.getHexOfV_AtObj(u,r[0])!="2a864886f70d01050c"){throw"this only supports pkcs5PBKDF2"}var v=ASN1HEX.getPosArrayOfChildren_AtObj(u,r[1]);if(v.length<2){throw"malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+v.length}q.pbkdf2Salt=ASN1HEX.getHexOfV_AtObj(u,v[0]);var s=ASN1HEX.getHexOfV_AtObj(u,v[1]);try{q.pbkdf2Iter=parseInt(s,16)}catch(t){throw"malformed format pbkdf2Iter: "+s}return q},getPBKDF2KeyHexFromParam:function(s,n){var r=CryptoJS.enc.Hex.parse(s.pbkdf2Salt);var o=s.pbkdf2Iter;var q=CryptoJS.PBKDF2(n,r,{keySize:192/32,iterations:o});var p=CryptoJS.enc.Hex.stringify(q);return p},getPlainPKCS8HexFromEncryptedPKCS8PEM:function(v,w){var p=this.getHexFromPEM(v,"ENCRYPTED PRIVATE KEY");var n=this.parseHexOfEncryptedPKCS8(p);var s=PKCS5PKEY.getPBKDF2KeyHexFromParam(n,w);var t={};t.ciphertext=CryptoJS.enc.Hex.parse(n.ciphertext);var r=CryptoJS.enc.Hex.parse(s);var q=CryptoJS.enc.Hex.parse(n.encryptionSchemeIV);var u=CryptoJS.TripleDES.decrypt(t,r,{iv:q});var o=CryptoJS.enc.Hex.stringify(u);return o},getRSAKeyFromEncryptedPKCS8PEM:function(q,p){var o=this.getPlainPKCS8HexFromEncryptedPKCS8PEM(q,p);var n=this.getRSAKeyFromPlainPKCS8Hex(o);return n},getKeyFromEncryptedPKCS8PEM:function(q,o){var n=this.getPlainPKCS8HexFromEncryptedPKCS8PEM(q,o);var p=this.getKeyFromPlainPrivatePKCS8Hex(n);return p},parsePlainPrivatePKCS8Hex:function(q){var o={};o.algparam=null;if(q.substr(0,2)!="30"){throw"malformed plain PKCS8 private key(code:001)"}var p=ASN1HEX.getPosArrayOfChildren_AtObj(q,0);if(p.length!=3){throw"malformed plain PKCS8 private key(code:002)"}if(q.substr(p[1],2)!="30"){throw"malformed PKCS8 private key(code:003)"}var n=ASN1HEX.getPosArrayOfChildren_AtObj(q,p[1]);if(n.length!=2){throw"malformed PKCS8 private key(code:004)"}if(q.substr(n[0],2)!="06"){throw"malformed PKCS8 private key(code:005)"}o.algoid=ASN1HEX.getHexOfV_AtObj(q,n[0]);if(q.substr(n[1],2)=="06"){o.algparam=ASN1HEX.getHexOfV_AtObj(q,n[1])}if(q.substr(p[2],2)!="04"){throw"malformed PKCS8 private key(code:006)"}o.keyidx=ASN1HEX.getStartPosOfV_AtObj(q,p[2]);return o},getKeyFromPlainPrivatePKCS8PEM:function(o){var n=this.getHexFromPEM(o,"PRIVATE KEY");var p=this.getKeyFromPlainPrivatePKCS8Hex(n);return p},getKeyFromPlainPrivatePKCS8Hex:function(n){var p=this.parsePlainPrivatePKCS8Hex(n);if(p.algoid=="2a864886f70d010101"){this.parsePrivateRawRSAKeyHexAtObj(n,p);var o=p.key;var q=new RSAKey();q.setPrivateEx(o.n,o.e,o.d,o.p,o.q,o.dp,o.dq,o.co);return q}else{if(p.algoid=="2a8648ce3d0201"){this.parsePrivateRawECKeyHexAtObj(n,p);if(KJUR.crypto.OID.oidhex2name[p.algparam]===undefined){throw"KJUR.crypto.OID.oidhex2name undefined: "+p.algparam}var r=KJUR.crypto.OID.oidhex2name[p.algparam];var q=new KJUR.crypto.ECDSA({curve:r,prv:p.key});return q}else{throw"unsupported private key algorithm"}}},getRSAKeyFromPublicPKCS8PEM:function(o){var p=this.getHexFromPEM(o,"PUBLIC KEY");var n=this.getRSAKeyFromPublicPKCS8Hex(p);return n},getKeyFromPublicPKCS8PEM:function(o){var p=this.getHexFromPEM(o,"PUBLIC KEY");var n=this.getKeyFromPublicPKCS8Hex(p);return n},getKeyFromPublicPKCS8Hex:function(o){var n=this.parsePublicPKCS8Hex(o);if(n.algoid=="2a864886f70d010101"){var r=this.parsePublicRawRSAKeyHex(n.key);var p=new RSAKey();p.setPublic(r.n,r.e);return p}else{if(n.algoid=="2a8648ce3d0201"){if(KJUR.crypto.OID.oidhex2name[n.algparam]===undefined){throw"KJUR.crypto.OID.oidhex2name undefined: "+n.algparam}var q=KJUR.crypto.OID.oidhex2name[n.algparam];var p=new KJUR.crypto.ECDSA({curve:q,pub:n.key});return p}else{throw"unsupported public key algorithm"}}},parsePublicRawRSAKeyHex:function(p){var n={};if(p.substr(0,2)!="30"){throw"malformed RSA key(code:001)"}var o=ASN1HEX.getPosArrayOfChildren_AtObj(p,0);if(o.length!=2){throw"malformed RSA key(code:002)"}if(p.substr(o[0],2)!="02"){throw"malformed RSA key(code:003)"}n.n=ASN1HEX.getHexOfV_AtObj(p,o[0]);if(p.substr(o[1],2)!="02"){throw"malformed RSA key(code:004)"}n.e=ASN1HEX.getHexOfV_AtObj(p,o[1]);return n},parsePrivateRawRSAKeyHexAtObj:function(o,q){var p=q.keyidx;if(o.substr(p,2)!="30"){throw"malformed RSA private key(code:001)"}var n=ASN1HEX.getPosArrayOfChildren_AtObj(o,p);if(n.length!=9){throw"malformed RSA private key(code:002)"}q.key={};q.key.n=ASN1HEX.getHexOfV_AtObj(o,n[1]);q.key.e=ASN1HEX.getHexOfV_AtObj(o,n[2]);q.key.d=ASN1HEX.getHexOfV_AtObj(o,n[3]);q.key.p=ASN1HEX.getHexOfV_AtObj(o,n[4]);q.key.q=ASN1HEX.getHexOfV_AtObj(o,n[5]);q.key.dp=ASN1HEX.getHexOfV_AtObj(o,n[6]);q.key.dq=ASN1HEX.getHexOfV_AtObj(o,n[7]);q.key.co=ASN1HEX.getHexOfV_AtObj(o,n[8])},parsePrivateRawECKeyHexAtObj:function(o,q){var p=q.keyidx;if(o.substr(p,2)!="30"){throw"malformed ECC private key(code:001)"}var n=ASN1HEX.getPosArrayOfChildren_AtObj(o,p);if(n.length!=3){throw"malformed ECC private key(code:002)"}if(o.substr(n[1],2)!="04"){throw"malformed ECC private key(code:003)"}q.key=ASN1HEX.getHexOfV_AtObj(o,n[1])},parsePublicPKCS8Hex:function(q){var o={};o.algparam=null;var p=ASN1HEX.getPosArrayOfChildren_AtObj(q,0);if(p.length!=2){throw"outer DERSequence shall have 2 elements: "+p.length}var r=p[0];if(q.substr(r,2)!="30"){throw"malformed PKCS8 public key(code:001)"}var n=ASN1HEX.getPosArrayOfChildren_AtObj(q,r);if(n.length!=2){throw"malformed PKCS8 public key(code:002)"}if(q.substr(n[0],2)!="06"){throw"malformed PKCS8 public key(code:003)"}o.algoid=ASN1HEX.getHexOfV_AtObj(q,n[0]);if(q.substr(n[1],2)=="06"){o.algparam=ASN1HEX.getHexOfV_AtObj(q,n[1])}if(q.substr(p[1],2)!="03"){throw"malformed PKCS8 public key(code:004)"}o.key=ASN1HEX.getHexOfV_AtObj(q,p[1]).substr(2);return o},getRSAKeyFromPublicPKCS8Hex:function(r){var q=ASN1HEX.getPosArrayOfChildren_AtObj(r,0);if(q.length!=2){throw"outer DERSequence shall have 2 elements: "+q.length}var p=ASN1HEX.getHexOfTLV_AtObj(r,q[0]);if(p!="300d06092a864886f70d0101010500"){throw"PKCS8 AlgorithmId is not rsaEncryption"}if(r.substr(q[1],2)!="03"){throw"PKCS8 Public Key is not BITSTRING encapslated."}var t=ASN1HEX.getStartPosOfV_AtObj(r,q[1])+2;if(r.substr(t,2)!="30"){throw"PKCS8 Public Key is not SEQUENCE."}var n=ASN1HEX.getPosArrayOfChildren_AtObj(r,t);if(n.length!=2){throw"inner DERSequence shall have 2 elements: "+n.length}if(r.substr(n[0],2)!="02"){throw"N is not ASN.1 INTEGER"}if(r.substr(n[1],2)!="02"){throw"E is not ASN.1 INTEGER"}var u=ASN1HEX.getHexOfV_AtObj(r,n[0]);var s=ASN1HEX.getHexOfV_AtObj(r,n[1]);var o=new RSAKey();o.setPublic(u,s);return o},}}(); +/*! keyutil-1.0.7.js (c) 2013-2014 Kenji Urushima | kjur.github.com/jsrsasign/license + */ +var KEYUTIL=function(){var d=function(p,r,q){return k(CryptoJS.AES,p,r,q)};var e=function(p,r,q){return k(CryptoJS.TripleDES,p,r,q)};var a=function(p,r,q){return k(CryptoJS.DES,p,r,q)};var k=function(s,x,u,q){var r=CryptoJS.enc.Hex.parse(x);var w=CryptoJS.enc.Hex.parse(u);var p=CryptoJS.enc.Hex.parse(q);var t={};t.key=w;t.iv=p;t.ciphertext=r;var v=s.decrypt(t,w,{iv:p});return CryptoJS.enc.Hex.stringify(v)};var l=function(p,r,q){return g(CryptoJS.AES,p,r,q)};var o=function(p,r,q){return g(CryptoJS.TripleDES,p,r,q)};var f=function(p,r,q){return g(CryptoJS.DES,p,r,q)};var g=function(t,y,v,q){var s=CryptoJS.enc.Hex.parse(y);var x=CryptoJS.enc.Hex.parse(v);var p=CryptoJS.enc.Hex.parse(q);var w=t.encrypt(s,x,{iv:p});var r=CryptoJS.enc.Hex.parse(w.toString());var u=CryptoJS.enc.Base64.stringify(r);return u};var i={"AES-256-CBC":{proc:d,eproc:l,keylen:32,ivlen:16},"AES-192-CBC":{proc:d,eproc:l,keylen:24,ivlen:16},"AES-128-CBC":{proc:d,eproc:l,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:e,eproc:o,keylen:24,ivlen:8},"DES-CBC":{proc:a,eproc:f,keylen:8,ivlen:8}};var c=function(p){return i[p]["proc"]};var m=function(p){var r=CryptoJS.lib.WordArray.random(p);var q=CryptoJS.enc.Hex.stringify(r);return q};var n=function(t){var u={};if(t.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"))){u.cipher=RegExp.$1;u.ivsalt=RegExp.$2}if(t.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"))){u.type=RegExp.$1}var r=-1;var v=0;if(t.indexOf("\r\n\r\n")!=-1){r=t.indexOf("\r\n\r\n");v=2}if(t.indexOf("\n\n")!=-1){r=t.indexOf("\n\n");v=1}var q=t.indexOf("-----END");if(r!=-1&&q!=-1){var p=t.substring(r+v*2,q-v);p=p.replace(/\s+/g,"");u.data=p}return u};var j=function(q,y,p){var v=p.substring(0,16);var t=CryptoJS.enc.Hex.parse(v);var r=CryptoJS.enc.Utf8.parse(y);var u=i[q]["keylen"]+i[q]["ivlen"];var x="";var w=null;for(;;){var s=CryptoJS.algo.MD5.create();if(w!=null){s.update(w)}s.update(r);s.update(t);w=s.finalize();x=x+CryptoJS.enc.Hex.stringify(w);if(x.length>=u*2){break}}var z={};z.keyhex=x.substr(0,i[q]["keylen"]*2);z.ivhex=x.substr(i[q]["keylen"]*2,i[q]["ivlen"]*2);return z};var b=function(p,v,r,w){var s=CryptoJS.enc.Base64.parse(p);var q=CryptoJS.enc.Hex.stringify(s);var u=i[v]["proc"];var t=u(q,r,w);return t};var h=function(p,s,q,u){var r=i[s]["eproc"];var t=r(p,q,u);return t};return{version:"1.0.0",getHexFromPEM:function(q,u){var r=q;if(r.indexOf("-----BEGIN ")==-1){throw"can't find PEM header: "+u}if(typeof u=="string"&&u!=""){r=r.replace("-----BEGIN "+u+"-----","");r=r.replace("-----END "+u+"-----","")}else{r=r.replace(/-----BEGIN [^-]+-----/,"");r=r.replace(/-----END [^-]+-----/,"")}var t=r.replace(/\s+/g,"");var p=b64tohex(t);return p},getDecryptedKeyHexByKeyIV:function(q,t,s,r){var p=c(t);return p(q,s,r)},parsePKCS5PEM:function(p){return n(p)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(q,p,r){return j(q,p,r)},decryptKeyB64:function(p,r,q,s){return b(p,r,q,s)},getDecryptedKeyHex:function(y,x){var q=n(y);var t=q.type;var r=q.cipher;var p=q.ivsalt;var s=q.data;var w=j(r,x,p);var v=w.keyhex;var u=b(s,r,v,p);return u},getRSAKeyFromEncryptedPKCS5PEM:function(r,q){var s=this.getDecryptedKeyHex(r,q);var p=new RSAKey();p.readPrivateKeyFromASN1HexString(s);return p},getEncryptedPKCS5PEMFromPrvKeyHex:function(x,s,A,t,r){var p="";if(typeof t=="undefined"||t==null){t="AES-256-CBC"}if(typeof i[t]=="undefined"){throw"KEYUTIL unsupported algorithm: "+t}if(typeof r=="undefined"||r==null){var v=i[t]["ivlen"];var u=m(v);r=u.toUpperCase()}var z=j(t,A,r);var y=z.keyhex;var w=h(s,t,y,r);var q=w.replace(/(.{64})/g,"$1\r\n");var p="-----BEGIN "+x+" PRIVATE KEY-----\r\n";p+="Proc-Type: 4,ENCRYPTED\r\n";p+="DEK-Info: "+t+","+r+"\r\n";p+="\r\n";p+=q;p+="\r\n-----END "+x+" PRIVATE KEY-----\r\n";return p},getEncryptedPKCS5PEMFromRSAKey:function(D,E,r,t){var B=new KJUR.asn1.DERInteger({"int":0});var w=new KJUR.asn1.DERInteger({bigint:D.n});var A=new KJUR.asn1.DERInteger({"int":D.e});var C=new KJUR.asn1.DERInteger({bigint:D.d});var u=new KJUR.asn1.DERInteger({bigint:D.p});var s=new KJUR.asn1.DERInteger({bigint:D.q});var z=new KJUR.asn1.DERInteger({bigint:D.dmp1});var v=new KJUR.asn1.DERInteger({bigint:D.dmq1});var y=new KJUR.asn1.DERInteger({bigint:D.coeff});var F=new KJUR.asn1.DERSequence({array:[B,w,A,C,u,s,z,v,y]});var x=F.getEncodedHex();return this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",x,E,r,t)},newEncryptedPKCS5PEM:function(p,q,t,u){if(typeof q=="undefined"||q==null){q=1024}if(typeof t=="undefined"||t==null){t="10001"}var r=new RSAKey();r.generate(q,t);var s=null;if(typeof u=="undefined"||u==null){s=this.getEncryptedPKCS5PEMFromRSAKey(r,p)}else{s=this.getEncryptedPKCS5PEMFromRSAKey(r,p,u)}return s},getRSAKeyFromPlainPKCS8PEM:function(r){if(r.match(/ENCRYPTED/)){throw"pem shall be not ENCRYPTED"}var q=this.getHexFromPEM(r,"PRIVATE KEY");var p=this.getRSAKeyFromPlainPKCS8Hex(q);return p},getRSAKeyFromPlainPKCS8Hex:function(s){var r=ASN1HEX.getPosArrayOfChildren_AtObj(s,0);if(r.length!=3){throw"outer DERSequence shall have 3 elements: "+r.length}var q=ASN1HEX.getHexOfTLV_AtObj(s,r[1]);if(q!="300d06092a864886f70d0101010500"){throw"PKCS8 AlgorithmIdentifier is not rsaEnc: "+q}var q=ASN1HEX.getHexOfTLV_AtObj(s,r[1]);var t=ASN1HEX.getHexOfTLV_AtObj(s,r[2]);var u=ASN1HEX.getHexOfV_AtObj(t,0);var p=new RSAKey();p.readPrivateKeyFromASN1HexString(u);return p},parseHexOfEncryptedPKCS8:function(w){var s={};var r=ASN1HEX.getPosArrayOfChildren_AtObj(w,0);if(r.length!=2){throw"malformed format: SEQUENCE(0).items != 2: "+r.length}s.ciphertext=ASN1HEX.getHexOfV_AtObj(w,r[1]);var y=ASN1HEX.getPosArrayOfChildren_AtObj(w,r[0]);if(y.length!=2){throw"malformed format: SEQUENCE(0.0).items != 2: "+y.length}if(ASN1HEX.getHexOfV_AtObj(w,y[0])!="2a864886f70d01050d"){throw"this only supports pkcs5PBES2"}var p=ASN1HEX.getPosArrayOfChildren_AtObj(w,y[1]);if(y.length!=2){throw"malformed format: SEQUENCE(0.0.1).items != 2: "+p.length}var q=ASN1HEX.getPosArrayOfChildren_AtObj(w,p[1]);if(q.length!=2){throw"malformed format: SEQUENCE(0.0.1.1).items != 2: "+q.length}if(ASN1HEX.getHexOfV_AtObj(w,q[0])!="2a864886f70d0307"){throw"this only supports TripleDES"}s.encryptionSchemeAlg="TripleDES";s.encryptionSchemeIV=ASN1HEX.getHexOfV_AtObj(w,q[1]);var t=ASN1HEX.getPosArrayOfChildren_AtObj(w,p[0]);if(t.length!=2){throw"malformed format: SEQUENCE(0.0.1.0).items != 2: "+t.length}if(ASN1HEX.getHexOfV_AtObj(w,t[0])!="2a864886f70d01050c"){throw"this only supports pkcs5PBKDF2"}var x=ASN1HEX.getPosArrayOfChildren_AtObj(w,t[1]);if(x.length<2){throw"malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+x.length}s.pbkdf2Salt=ASN1HEX.getHexOfV_AtObj(w,x[0]);var u=ASN1HEX.getHexOfV_AtObj(w,x[1]);try{s.pbkdf2Iter=parseInt(u,16)}catch(v){throw"malformed format pbkdf2Iter: "+u}return s},getPBKDF2KeyHexFromParam:function(u,p){var t=CryptoJS.enc.Hex.parse(u.pbkdf2Salt);var q=u.pbkdf2Iter;var s=CryptoJS.PBKDF2(p,t,{keySize:192/32,iterations:q});var r=CryptoJS.enc.Hex.stringify(s);return r},getPlainPKCS8HexFromEncryptedPKCS8PEM:function(x,y){var r=this.getHexFromPEM(x,"ENCRYPTED PRIVATE KEY");var p=this.parseHexOfEncryptedPKCS8(r);var u=KEYUTIL.getPBKDF2KeyHexFromParam(p,y);var v={};v.ciphertext=CryptoJS.enc.Hex.parse(p.ciphertext);var t=CryptoJS.enc.Hex.parse(u);var s=CryptoJS.enc.Hex.parse(p.encryptionSchemeIV);var w=CryptoJS.TripleDES.decrypt(v,t,{iv:s});var q=CryptoJS.enc.Hex.stringify(w);return q},getRSAKeyFromEncryptedPKCS8PEM:function(s,r){var q=this.getPlainPKCS8HexFromEncryptedPKCS8PEM(s,r);var p=this.getRSAKeyFromPlainPKCS8Hex(q);return p},getKeyFromEncryptedPKCS8PEM:function(s,q){var p=this.getPlainPKCS8HexFromEncryptedPKCS8PEM(s,q);var r=this.getKeyFromPlainPrivatePKCS8Hex(p);return r},parsePlainPrivatePKCS8Hex:function(s){var q={};q.algparam=null;if(s.substr(0,2)!="30"){throw"malformed plain PKCS8 private key(code:001)"}var r=ASN1HEX.getPosArrayOfChildren_AtObj(s,0);if(r.length!=3){throw"malformed plain PKCS8 private key(code:002)"}if(s.substr(r[1],2)!="30"){throw"malformed PKCS8 private key(code:003)"}var p=ASN1HEX.getPosArrayOfChildren_AtObj(s,r[1]);if(p.length!=2){throw"malformed PKCS8 private key(code:004)"}if(s.substr(p[0],2)!="06"){throw"malformed PKCS8 private key(code:005)"}q.algoid=ASN1HEX.getHexOfV_AtObj(s,p[0]);if(s.substr(p[1],2)=="06"){q.algparam=ASN1HEX.getHexOfV_AtObj(s,p[1])}if(s.substr(r[2],2)!="04"){throw"malformed PKCS8 private key(code:006)"}q.keyidx=ASN1HEX.getStartPosOfV_AtObj(s,r[2]);return q},getKeyFromPlainPrivatePKCS8PEM:function(q){var p=this.getHexFromPEM(q,"PRIVATE KEY");var r=this.getKeyFromPlainPrivatePKCS8Hex(p);return r},getKeyFromPlainPrivatePKCS8Hex:function(p){var w=this.parsePlainPrivatePKCS8Hex(p);if(w.algoid=="2a864886f70d010101"){this.parsePrivateRawRSAKeyHexAtObj(p,w);var u=w.key;var z=new RSAKey();z.setPrivateEx(u.n,u.e,u.d,u.p,u.q,u.dp,u.dq,u.co);return z}else{if(w.algoid=="2a8648ce3d0201"){this.parsePrivateRawECKeyHexAtObj(p,w);if(KJUR.crypto.OID.oidhex2name[w.algparam]===undefined){throw"KJUR.crypto.OID.oidhex2name undefined: "+w.algparam}var v=KJUR.crypto.OID.oidhex2name[w.algparam];var z=new KJUR.crypto.ECDSA({curve:v});z.setPublicKeyHex(w.pubkey);z.setPrivateKeyHex(w.key);z.isPublic=false;return z}else{if(w.algoid=="2a8648ce380401"){var t=ASN1HEX.getVbyList(p,0,[1,1,0],"02");var s=ASN1HEX.getVbyList(p,0,[1,1,1],"02");var y=ASN1HEX.getVbyList(p,0,[1,1,2],"02");var B=ASN1HEX.getVbyList(p,0,[2,0],"02");var r=new BigInteger(t,16);var q=new BigInteger(s,16);var x=new BigInteger(y,16);var A=new BigInteger(B,16);var z=new KJUR.crypto.DSA();z.setPrivate(r,q,x,null,A);return z}else{throw"unsupported private key algorithm"}}}},getRSAKeyFromPublicPKCS8PEM:function(q){var r=this.getHexFromPEM(q,"PUBLIC KEY");var p=this.getRSAKeyFromPublicPKCS8Hex(r);return p},getKeyFromPublicPKCS8PEM:function(q){var r=this.getHexFromPEM(q,"PUBLIC KEY");var p=this.getKeyFromPublicPKCS8Hex(r);return p},getKeyFromPublicPKCS8Hex:function(q){var p=this.parsePublicPKCS8Hex(q);if(p.algoid=="2a864886f70d010101"){var u=this.parsePublicRawRSAKeyHex(p.key);var r=new RSAKey();r.setPublic(u.n,u.e);return r}else{if(p.algoid=="2a8648ce3d0201"){if(KJUR.crypto.OID.oidhex2name[p.algparam]===undefined){throw"KJUR.crypto.OID.oidhex2name undefined: "+p.algparam}var s=KJUR.crypto.OID.oidhex2name[p.algparam];var r=new KJUR.crypto.ECDSA({curve:s,pub:p.key});return r}else{if(p.algoid=="2a8648ce380401"){var t=p.algparam;var v=ASN1HEX.getHexOfV_AtObj(p.key,0);var r=new KJUR.crypto.DSA();r.setPublic(new BigInteger(t.p,16),new BigInteger(t.q,16),new BigInteger(t.g,16),new BigInteger(v,16));return r}else{throw"unsupported public key algorithm"}}}},parsePublicRawRSAKeyHex:function(r){var p={};if(r.substr(0,2)!="30"){throw"malformed RSA key(code:001)"}var q=ASN1HEX.getPosArrayOfChildren_AtObj(r,0);if(q.length!=2){throw"malformed RSA key(code:002)"}if(r.substr(q[0],2)!="02"){throw"malformed RSA key(code:003)"}p.n=ASN1HEX.getHexOfV_AtObj(r,q[0]);if(r.substr(q[1],2)!="02"){throw"malformed RSA key(code:004)"}p.e=ASN1HEX.getHexOfV_AtObj(r,q[1]);return p},parsePrivateRawRSAKeyHexAtObj:function(q,s){var r=s.keyidx;if(q.substr(r,2)!="30"){throw"malformed RSA private key(code:001)"}var p=ASN1HEX.getPosArrayOfChildren_AtObj(q,r);if(p.length!=9){throw"malformed RSA private key(code:002)"}s.key={};s.key.n=ASN1HEX.getHexOfV_AtObj(q,p[1]);s.key.e=ASN1HEX.getHexOfV_AtObj(q,p[2]);s.key.d=ASN1HEX.getHexOfV_AtObj(q,p[3]);s.key.p=ASN1HEX.getHexOfV_AtObj(q,p[4]);s.key.q=ASN1HEX.getHexOfV_AtObj(q,p[5]);s.key.dp=ASN1HEX.getHexOfV_AtObj(q,p[6]);s.key.dq=ASN1HEX.getHexOfV_AtObj(q,p[7]);s.key.co=ASN1HEX.getHexOfV_AtObj(q,p[8])},parsePrivateRawECKeyHexAtObj:function(p,t){var q=t.keyidx;var r=ASN1HEX.getVbyList(p,q,[1],"04");var s=ASN1HEX.getVbyList(p,q,[2,0],"03").substr(2);t.key=r;t.pubkey=s},parsePublicPKCS8Hex:function(s){var q={};q.algparam=null;var r=ASN1HEX.getPosArrayOfChildren_AtObj(s,0);if(r.length!=2){throw"outer DERSequence shall have 2 elements: "+r.length}var t=r[0];if(s.substr(t,2)!="30"){throw"malformed PKCS8 public key(code:001)"}var p=ASN1HEX.getPosArrayOfChildren_AtObj(s,t);if(p.length!=2){throw"malformed PKCS8 public key(code:002)"}if(s.substr(p[0],2)!="06"){throw"malformed PKCS8 public key(code:003)"}q.algoid=ASN1HEX.getHexOfV_AtObj(s,p[0]);if(s.substr(p[1],2)=="06"){q.algparam=ASN1HEX.getHexOfV_AtObj(s,p[1])}else{if(s.substr(p[1],2)=="30"){q.algparam={};q.algparam.p=ASN1HEX.getVbyList(s,p[1],[0],"02");q.algparam.q=ASN1HEX.getVbyList(s,p[1],[1],"02");q.algparam.g=ASN1HEX.getVbyList(s,p[1],[2],"02")}}if(s.substr(r[1],2)!="03"){throw"malformed PKCS8 public key(code:004)"}q.key=ASN1HEX.getHexOfV_AtObj(s,r[1]).substr(2);return q},getRSAKeyFromPublicPKCS8Hex:function(t){var s=ASN1HEX.getPosArrayOfChildren_AtObj(t,0);if(s.length!=2){throw"outer DERSequence shall have 2 elements: "+s.length}var r=ASN1HEX.getHexOfTLV_AtObj(t,s[0]);if(r!="300d06092a864886f70d0101010500"){throw"PKCS8 AlgorithmId is not rsaEncryption"}if(t.substr(s[1],2)!="03"){throw"PKCS8 Public Key is not BITSTRING encapslated."}var v=ASN1HEX.getStartPosOfV_AtObj(t,s[1])+2;if(t.substr(v,2)!="30"){throw"PKCS8 Public Key is not SEQUENCE."}var p=ASN1HEX.getPosArrayOfChildren_AtObj(t,v);if(p.length!=2){throw"inner DERSequence shall have 2 elements: "+p.length}if(t.substr(p[0],2)!="02"){throw"N is not ASN.1 INTEGER"}if(t.substr(p[1],2)!="02"){throw"E is not ASN.1 INTEGER"}var w=ASN1HEX.getHexOfV_AtObj(t,p[0]);var u=ASN1HEX.getHexOfV_AtObj(t,p[1]);var q=new RSAKey();q.setPublic(w,u);return q},}}();KEYUTIL.getKey=function(c,o,i){if(typeof RSAKey!="undefined"&&c instanceof RSAKey){return c}if(typeof KJUR.crypto.ECDSA!="undefined"&&c instanceof KJUR.crypto.ECDSA){return c}if(typeof KJUR.crypto.DSA!="undefined"&&c instanceof KJUR.crypto.DSA){return c}if(c.xy!==undefined&&c.curve!==undefined){return new KJUR.crypto.ECDSA({prv:c.xy,curve:c.curve})}if(c.n!==undefined&&c.e!==undefined&&c.d!==undefined&&c.p!==undefined&&c.q!==undefined&&c.dp!==undefined&&c.dq!==undefined&&c.co!==undefined){var n=new RSAKey();n.setPrivateEx(c.n,c.e,c.d,c.p,c.q,c.dp,c.dq,c.co);return n}if(c.p!==undefined&&c.q!==undefined&&c.g!==undefined&&c.y!==undefined&&c.x!==undefined){var n=new KJUR.crypto.DSA();n.setPrivate(c.p,c.q,c.g,c.y,c.x);return n}if(c.d!==undefined&&c.curve!==undefined){return new KJUR.crypto.ECDSA({pub:c.d,curve:c.curve})}if(c.n!==undefined&&c.e){var n=new RSAKey();n.setPublic(c.n,c.e);return n}if(c.p!==undefined&&c.q!==undefined&&c.g!==undefined&&c.y!==undefined&&c.x===undefined){var n=new KJUR.crypto.DSA();n.setPublic(c.p,c.q,c.g,c.y);return n}if(c.indexOf("-END CERTIFICATE-",0)!=-1||c.indexOf("-END X509 CERTIFICATE-",0)!=-1||c.indexOf("-END TRUSTED CERTIFICATE-",0)!=-1){return X509.getPublicKeyFromCertPEM(c)}if(i==="pkcs8pub"){return KEYUTIL.getKeyFromPublicPKCS8Hex(c)}if(c.indexOf("-END PUBLIC KEY-")!=-1){return KEYUTIL.getKeyFromPublicPKCS8PEM(c)}if(i==="pkcs5prv"){var n=new RSAKey();n.readPrivateKeyFromASN1HexString(c);return n}if(i==="pkcs5prv"){var n=new RSAKey();n.readPrivateKeyFromASN1HexString(c);return n}if(c.indexOf("-END RSA PRIVATE KEY-")!=-1&&c.indexOf("4,ENCRYPTED")==-1){var n=new RSAKey();n.readPrivateKeyFromPEMString(c);return n}if(c.indexOf("-END DSA PRIVATE KEY-")!=-1&&c.indexOf("4,ENCRYPTED")==-1){var m=this.getHexFromPEM(c,"DSA PRIVATE KEY");var b=ASN1HEX.getVbyList(m,0,[1],"02");var a=ASN1HEX.getVbyList(m,0,[2],"02");var e=ASN1HEX.getVbyList(m,0,[3],"02");var k=ASN1HEX.getVbyList(m,0,[4],"02");var l=ASN1HEX.getVbyList(m,0,[5],"02");var n=new KJUR.crypto.DSA();n.setPrivate(new BigInteger(b,16),new BigInteger(a,16),new BigInteger(e,16),new BigInteger(k,16),new BigInteger(l,16));return n}if(c.indexOf("-END PRIVATE KEY-")!=-1){return KEYUTIL.getKeyFromPlainPrivatePKCS8PEM(c)}if(c.indexOf("-END RSA PRIVATE KEY-")!=-1&&c.indexOf("4,ENCRYPTED")!=-1){return KEYUTIL.getRSAKeyFromEncryptedPKCS5PEM(c,o)}if(c.indexOf("-END EC PRIVATE KEY-")!=-1&&c.indexOf("4,ENCRYPTED")!=-1){var m=KEYUTIL.getDecryptedKeyHex(c,o);var n=ASN1HEX.getVbyList(m,0,[1],"04");var j=ASN1HEX.getVbyList(m,0,[2,0],"06");var d=ASN1HEX.getVbyList(m,0,[3,0],"03").substr(2);var h="";if(KJUR.crypto.OID.oidhex2name[j]!==undefined){h=KJUR.crypto.OID.oidhex2name[j]}else{throw"undefined OID(hex) in KJUR.crypto.OID: "+j}var f=new KJUR.crypto.ECDSA({name:h});f.setPublicKeyHex(d);f.setPrivateKeyHex(n);f.isPublic=false;return f}if(c.indexOf("-END DSA PRIVATE KEY-")!=-1&&c.indexOf("4,ENCRYPTED")!=-1){var m=KEYUTIL.getDecryptedKeyHex(c,o);var b=ASN1HEX.getVbyList(m,0,[1],"02");var a=ASN1HEX.getVbyList(m,0,[2],"02");var e=ASN1HEX.getVbyList(m,0,[3],"02");var k=ASN1HEX.getVbyList(m,0,[4],"02");var l=ASN1HEX.getVbyList(m,0,[5],"02");var n=new KJUR.crypto.DSA();n.setPrivate(new BigInteger(b,16),new BigInteger(a,16),new BigInteger(e,16),new BigInteger(k,16),new BigInteger(l,16));return n}if(c.indexOf("-END ENCRYPTED PRIVATE KEY-")!=-1){return KEYUTIL.getKeyFromEncryptedPKCS8PEM(c,o)}throw"not supported argument"};KEYUTIL.generateKeypair=function(a,c){if(a=="RSA"){var b=c;var h=new RSAKey();h.generate(b,"10001");h.isPrivate=true;h.isPublic=true;var f=new RSAKey();var e=h.n.toString(16);var i=h.e.toString(16);f.setPublic(e,i);f.isPrivate=false;f.isPublic=true;var k={};k.prvKeyObj=h;k.pubKeyObj=f;return k}else{if(a=="EC"){var d=c;var g=new KJUR.crypto.ECDSA({curve:d});var j=g.generateKeyPairHex();var h=new KJUR.crypto.ECDSA({curve:d});h.setPrivateKeyHex(j.ecprvhex);h.isPrivate=true;h.isPublic=false;var f=new KJUR.crypto.ECDSA({curve:d});f.setPublicKeyHex(j.ecpubhex);f.isPrivate=false;f.isPublic=true;var k={};k.prvKeyObj=h;k.pubKeyObj=f;return k}else{throw"unknown algorithm: "+a}}};KEYUTIL.getPEM=function(a,r,o,g,j){var v=KJUR.asn1;var u=KJUR.crypto;function p(s){var w=KJUR.asn1.ASN1Util.newObject({seq:[{"int":0},{"int":{bigint:s.n}},{"int":s.e},{"int":{bigint:s.d}},{"int":{bigint:s.p}},{"int":{bigint:s.q}},{"int":{bigint:s.dmp1}},{"int":{bigint:s.dmq1}},{"int":{bigint:s.coeff}}]});return w}function q(w){var s=KJUR.asn1.ASN1Util.newObject({seq:[{"int":1},{octstr:{hex:w.prvKeyHex}},{tag:["a0",true,{oid:{name:w.curveName}}]},{tag:["a1",true,{bitstr:{hex:"00"+w.pubKeyHex}}]}]});return s}function n(s){var w=KJUR.asn1.ASN1Util.newObject({seq:[{"int":0},{"int":{bigint:s.p}},{"int":{bigint:s.q}},{"int":{bigint:s.g}},{"int":{bigint:s.y}},{"int":{bigint:s.x}}]});return w}if(((typeof RSAKey!="undefined"&&a instanceof RSAKey)||(typeof u.DSA!="undefined"&&a instanceof u.DSA)||(typeof u.ECDSA!="undefined"&&a instanceof u.ECDSA))&&a.isPublic==true&&(r===undefined||r=="PKCS8PUB")){var t=new KJUR.asn1.x509.SubjectPublicKeyInfo(a);var m=t.getEncodedHex();return v.ASN1Util.getPEMStringFromHex(m,"PUBLIC KEY")}if(r=="PKCS1PRV"&&typeof RSAKey!="undefined"&&a instanceof RSAKey&&(o===undefined||o==null)&&a.isPrivate==true){var t=p(a);var m=t.getEncodedHex();return v.ASN1Util.getPEMStringFromHex(m,"RSA PRIVATE KEY")}if(r=="PKCS1PRV"&&typeof RSAKey!="undefined"&&a instanceof KJUR.crypto.ECDSA&&(o===undefined||o==null)&&a.isPrivate==true){var f=new KJUR.asn1.DERObjectIdentifier({name:a.curveName});var l=f.getEncodedHex();var e=q(a);var k=e.getEncodedHex();var i="";i+=v.ASN1Util.getPEMStringFromHex(l,"EC PARAMETERS");i+=v.ASN1Util.getPEMStringFromHex(k,"EC PRIVATE KEY");return i}if(r=="PKCS1PRV"&&typeof KJUR.crypto.DSA!="undefined"&&a instanceof KJUR.crypto.DSA&&(o===undefined||o==null)&&a.isPrivate==true){var t=n(a);var m=t.getEncodedHex();return v.ASN1Util.getPEMStringFromHex(m,"DSA PRIVATE KEY")}if(r=="PKCS5PRV"&&typeof RSAKey!="undefined"&&a instanceof RSAKey&&(o!==undefined&&o!=null)&&a.isPrivate==true){var t=p(a);var m=t.getEncodedHex();if(g===undefined){g="DES-EDE3-CBC"}return this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",m,o,g)}if(r=="PKCS5PRV"&&typeof KJUR.crypto.ECDSA!="undefined"&&a instanceof KJUR.crypto.ECDSA&&(o!==undefined&&o!=null)&&a.isPrivate==true){var t=q(a);var m=t.getEncodedHex();if(g===undefined){g="DES-EDE3-CBC"}return this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",m,o,g)}if(r=="PKCS5PRV"&&typeof KJUR.crypto.DSA!="undefined"&&a instanceof KJUR.crypto.DSA&&(o!==undefined&&o!=null)&&a.isPrivate==true){var t=n(a);var m=t.getEncodedHex();if(g===undefined){g="DES-EDE3-CBC"}return this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",m,o,g)}var h=function(w,s){var y=b(w,s);var x=new KJUR.asn1.ASN1Util.newObject({seq:[{seq:[{oid:{name:"pkcs5PBES2"}},{seq:[{seq:[{oid:{name:"pkcs5PBKDF2"}},{seq:[{octstr:{hex:y.pbkdf2Salt}},{"int":y.pbkdf2Iter}]}]},{seq:[{oid:{name:"des-EDE3-CBC"}},{octstr:{hex:y.encryptionSchemeIV}}]}]}]},{octstr:{hex:y.ciphertext}}]});return x.getEncodedHex()};var b=function(D,E){var x=100;var C=CryptoJS.lib.WordArray.random(8);var B="DES-EDE3-CBC";var s=CryptoJS.lib.WordArray.random(8);var y=CryptoJS.PBKDF2(E,C,{keySize:192/32,iterations:x});var z=CryptoJS.enc.Hex.parse(D);var A=CryptoJS.TripleDES.encrypt(z,y,{iv:s})+"";var w={};w.ciphertext=A;w.pbkdf2Salt=CryptoJS.enc.Hex.stringify(C);w.pbkdf2Iter=x;w.encryptionSchemeAlg=B;w.encryptionSchemeIV=CryptoJS.enc.Hex.stringify(s);return w};if(r=="PKCS8PRV"&&typeof RSAKey!="undefined"&&a instanceof RSAKey&&a.isPrivate==true){var d=p(a);var c=d.getEncodedHex();var t=KJUR.asn1.ASN1Util.newObject({seq:[{"int":0},{seq:[{oid:{name:"rsaEncryption"}},{"null":true}]},{octstr:{hex:c}}]});var m=t.getEncodedHex();if(o===undefined||o==null){return v.ASN1Util.getPEMStringFromHex(m,"PRIVATE KEY")}else{var k=h(m,o);return v.ASN1Util.getPEMStringFromHex(k,"ENCRYPTED PRIVATE KEY")}}if(r=="PKCS8PRV"&&typeof KJUR.crypto.ECDSA!="undefined"&&a instanceof KJUR.crypto.ECDSA&&a.isPrivate==true){var d=new KJUR.asn1.ASN1Util.newObject({seq:[{"int":1},{octstr:{hex:a.prvKeyHex}},{tag:["a1",true,{bitstr:{hex:"00"+a.pubKeyHex}}]}]});var c=d.getEncodedHex();var t=KJUR.asn1.ASN1Util.newObject({seq:[{"int":0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:a.curveName}}]},{octstr:{hex:c}}]});var m=t.getEncodedHex();if(o===undefined||o==null){return v.ASN1Util.getPEMStringFromHex(m,"PRIVATE KEY")}else{var k=h(m,o);return v.ASN1Util.getPEMStringFromHex(k,"ENCRYPTED PRIVATE KEY")}}if(r=="PKCS8PRV"&&typeof KJUR.crypto.DSA!="undefined"&&a instanceof KJUR.crypto.DSA&&a.isPrivate==true){var d=new KJUR.asn1.DERInteger({bigint:a.x});var c=d.getEncodedHex();var t=KJUR.asn1.ASN1Util.newObject({seq:[{"int":0},{seq:[{oid:{name:"dsa"}},{seq:[{"int":{bigint:a.p}},{"int":{bigint:a.q}},{"int":{bigint:a.g}}]}]},{octstr:{hex:c}}]});var m=t.getEncodedHex();if(o===undefined||o==null){return v.ASN1Util.getPEMStringFromHex(m,"PRIVATE KEY")}else{var k=h(m,o);return v.ASN1Util.getPEMStringFromHex(k,"ENCRYPTED PRIVATE KEY")}}throw"unsupported object nor format"};KEYUTIL.getKeyFromCSRPEM=function(b){var a=KEYUTIL.getHexFromPEM(b,"CERTIFICATE REQUEST");var c=KEYUTIL.getKeyFromCSRHex(a);return c};KEYUTIL.getKeyFromCSRHex=function(a){var c=KEYUTIL.parseCSRHex(a);var b=KEYUTIL.getKey(c.p8pubkeyhex,null,"pkcs8pub");return b};KEYUTIL.parseCSRHex=function(c){var b={};var e=c;if(e.substr(0,2)!="30"){throw"malformed CSR(code:001)"}var d=ASN1HEX.getPosArrayOfChildren_AtObj(e,0);if(d.length<1){throw"malformed CSR(code:002)"}if(e.substr(d[0],2)!="30"){throw"malformed CSR(code:003)"}var a=ASN1HEX.getPosArrayOfChildren_AtObj(e,d[0]);if(a.length<3){throw"malformed CSR(code:004)"}b.p8pubkeyhex=ASN1HEX.getHexOfTLV_AtObj(e,a[2]);return b}; +/*! rsapem-1.1.js (c) 2012 Kenji Urushima | kjur.github.com/jsrsasign/license + */ +function _rsapem_pemToBase64(b){var a=b;a=a.replace("-----BEGIN RSA PRIVATE KEY-----","");a=a.replace("-----END RSA PRIVATE KEY-----","");a=a.replace(/[ \n]+/g,"");return a}function _rsapem_getPosArrayOfChildrenFromHex(d){var j=new Array();var k=ASN1HEX.getStartPosOfV_AtObj(d,0);var f=ASN1HEX.getPosOfNextSibling_AtObj(d,k);var h=ASN1HEX.getPosOfNextSibling_AtObj(d,f);var b=ASN1HEX.getPosOfNextSibling_AtObj(d,h);var l=ASN1HEX.getPosOfNextSibling_AtObj(d,b);var e=ASN1HEX.getPosOfNextSibling_AtObj(d,l);var g=ASN1HEX.getPosOfNextSibling_AtObj(d,e);var c=ASN1HEX.getPosOfNextSibling_AtObj(d,g);var i=ASN1HEX.getPosOfNextSibling_AtObj(d,c);j.push(k,f,h,b,l,e,g,c,i);return j}function _rsapem_getHexValueArrayOfChildrenFromHex(i){var o=_rsapem_getPosArrayOfChildrenFromHex(i);var r=ASN1HEX.getHexOfV_AtObj(i,o[0]);var f=ASN1HEX.getHexOfV_AtObj(i,o[1]);var j=ASN1HEX.getHexOfV_AtObj(i,o[2]);var k=ASN1HEX.getHexOfV_AtObj(i,o[3]);var c=ASN1HEX.getHexOfV_AtObj(i,o[4]);var b=ASN1HEX.getHexOfV_AtObj(i,o[5]);var h=ASN1HEX.getHexOfV_AtObj(i,o[6]);var g=ASN1HEX.getHexOfV_AtObj(i,o[7]);var l=ASN1HEX.getHexOfV_AtObj(i,o[8]);var m=new Array();m.push(r,f,j,k,c,b,h,g,l);return m}function _rsapem_readPrivateKeyFromASN1HexString(c){var b=_rsapem_getHexValueArrayOfChildrenFromHex(c);this.setPrivateEx(b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8])}function _rsapem_readPrivateKeyFromPEMString(e){var c=_rsapem_pemToBase64(e);var d=b64tohex(c);var b=_rsapem_getHexValueArrayOfChildrenFromHex(d);this.setPrivateEx(b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8])}RSAKey.prototype.readPrivateKeyFromPEMString=_rsapem_readPrivateKeyFromPEMString;RSAKey.prototype.readPrivateKeyFromASN1HexString=_rsapem_readPrivateKeyFromASN1HexString; +/*! rsasign-1.2.7.js (c) 2012 Kenji Urushima | kjur.github.com/jsrsasign/license + */ +var _RE_HEXDECONLY=new RegExp("");_RE_HEXDECONLY.compile("[^0-9a-f]","gi");function _rsasign_getHexPaddedDigestInfoForString(d,e,a){var b=function(f){return KJUR.crypto.Util.hashString(f,a)};var c=b(d);return KJUR.crypto.Util.getPaddedDigestInfoHex(c,a,e)}function _zeroPaddingOfSignature(e,d){var c="";var a=d/4-e.length;for(var b=0;b>24,(d&16711680)>>16,(d&65280)>>8,d&255]))));d+=1}return b}function _rsasign_signStringPSS(e,a,d){var c=function(f){return KJUR.crypto.Util.hashHex(f,a)};var b=c(rstrtohex(e));if(d===undefined){d=-1}return this.signWithMessageHashPSS(b,a,d)}function _rsasign_signWithMessageHashPSS(l,a,k){var b=hextorstr(l);var g=b.length;var m=this.n.bitLength()-1;var c=Math.ceil(m/8);var d;var o=function(i){return KJUR.crypto.Util.hashHex(i,a)};if(k===-1||k===undefined){k=g}else{if(k===-2){k=c-g-2}else{if(k<-2){throw"invalid salt length"}}}if(c<(g+k+2)){throw"data too long"}var f="";if(k>0){f=new Array(k);new SecureRandom().nextBytes(f);f=String.fromCharCode.apply(String,f)}var n=hextorstr(o(rstrtohex("\x00\x00\x00\x00\x00\x00\x00\x00"+b+f)));var j=[];for(d=0;d>(8*c-m))&255;q[0]&=~p;for(d=0;dthis.n.bitLength()){return 0}var i=this.doPublic(b);var e=i.toString(16).replace(/^1f+00/,"");var g=_rsasign_getAlgNameAndHashFromHexDisgestInfo(e);if(g.length==0){return false}var d=g[0];var h=g[1];var a=function(k){return KJUR.crypto.Util.hashString(k,d)};var c=a(f);return(h==c)}function _rsasign_verifyWithMessageHash(e,a){a=a.replace(_RE_HEXDECONLY,"");a=a.replace(/[ \n]+/g,"");var b=parseBigInt(a,16);if(b.bitLength()>this.n.bitLength()){return 0}var h=this.doPublic(b);var g=h.toString(16).replace(/^1f+00/,"");var c=_rsasign_getAlgNameAndHashFromHexDisgestInfo(g);if(c.length==0){return false}var d=c[0];var f=c[1];return(f==e)}function _rsasign_verifyStringPSS(c,b,a,f){var e=function(g){return KJUR.crypto.Util.hashHex(g,a)};var d=e(rstrtohex(c));if(f===undefined){f=-1}return this.verifyWithMessageHashPSS(d,b,a,f)}function _rsasign_verifyWithMessageHashPSS(f,s,l,c){var k=new BigInteger(s,16);if(k.bitLength()>this.n.bitLength()){return false}var r=function(i){return KJUR.crypto.Util.hashHex(i,l)};var j=hextorstr(f);var h=j.length;var g=this.n.bitLength()-1;var m=Math.ceil(g/8);var q;if(c===-1||c===undefined){c=h}else{if(c===-2){c=m-h-2}else{if(c<-2){throw"invalid salt length"}}}if(m<(h+c+2)){throw"data too long"}var a=this.doPublic(k).toByteArray();for(q=0;q>(8*m-g))&255;if((d.charCodeAt(0)&p)!==0){throw"bits beyond keysize not zero"}var n=pss_mgf1_str(e,d.length,r);var o=[];for(q=0;q0){var d=new KJUR.asn1.DERSequence({array:this.extensionsArray});var b=new KJUR.asn1.DERTaggedObject({explicit:true,tag:"a3",obj:d});this.asn1Array.push(b)}var e=new KJUR.asn1.DERSequence({array:this.asn1Array});this.hTLV=e.getEncodedHex();this.isModified=false;return this.hTLV};this._initialize()};YAHOO.lang.extend(KJUR.asn1.x509.TBSCertificate,KJUR.asn1.ASN1Object);KJUR.asn1.x509.Extension=function(b){KJUR.asn1.x509.Extension.superclass.constructor.call(this);var a=null;this.getEncodedHex=function(){var f=new KJUR.asn1.DERObjectIdentifier({oid:this.oid});var e=new KJUR.asn1.DEROctetString({hex:this.getExtnValueHex()});var d=new Array();d.push(f);if(this.critical){d.push(new KJUR.asn1.DERBoolean())}d.push(e);var c=new KJUR.asn1.DERSequence({array:d});return c.getEncodedHex()};this.critical=false;if(typeof b!="undefined"){if(typeof b.critical!="undefined"){this.critical=b.critical}}};YAHOO.lang.extend(KJUR.asn1.x509.Extension,KJUR.asn1.ASN1Object);KJUR.asn1.x509.KeyUsage=function(a){KJUR.asn1.x509.KeyUsage.superclass.constructor.call(this,a);this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()};this.oid="2.5.29.15";if(typeof a!="undefined"){if(typeof a.bin!="undefined"){this.asn1ExtnValue=new KJUR.asn1.DERBitString(a)}}};YAHOO.lang.extend(KJUR.asn1.x509.KeyUsage,KJUR.asn1.x509.Extension);KJUR.asn1.x509.BasicConstraints=function(c){KJUR.asn1.x509.BasicConstraints.superclass.constructor.call(this,c);var a=false;var b=-1;this.getExtnValueHex=function(){var e=new Array();if(this.cA){e.push(new KJUR.asn1.DERBoolean())}if(this.pathLen>-1){e.push(new KJUR.asn1.DERInteger({"int":this.pathLen}))}var d=new KJUR.asn1.DERSequence({array:e});this.asn1ExtnValue=d;return this.asn1ExtnValue.getEncodedHex()};this.oid="2.5.29.19";this.cA=false;this.pathLen=-1;if(typeof c!="undefined"){if(typeof c.cA!="undefined"){this.cA=c.cA}if(typeof c.pathLen!="undefined"){this.pathLen=c.pathLen}}};YAHOO.lang.extend(KJUR.asn1.x509.BasicConstraints,KJUR.asn1.x509.Extension);KJUR.asn1.x509.CRLDistributionPoints=function(a){KJUR.asn1.x509.CRLDistributionPoints.superclass.constructor.call(this,a);this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()};this.setByDPArray=function(b){this.asn1ExtnValue=new KJUR.asn1.DERSequence({array:b})};this.setByOneURI=function(e){var b=new KJUR.asn1.x509.GeneralNames([{uri:e}]);var d=new KJUR.asn1.x509.DistributionPointName(b);var c=new KJUR.asn1.x509.DistributionPoint({dpobj:d});this.setByDPArray([c])};this.oid="2.5.29.31";if(typeof a!="undefined"){if(typeof a.array!="undefined"){this.setByDPArray(a.array)}else{if(typeof a.uri!="undefined"){this.setByOneURI(a.uri)}}}};YAHOO.lang.extend(KJUR.asn1.x509.CRLDistributionPoints,KJUR.asn1.x509.Extension);KJUR.asn1.x509.ExtKeyUsage=function(a){KJUR.asn1.x509.ExtKeyUsage.superclass.constructor.call(this,a);this.setPurposeArray=function(b){this.asn1ExtnValue=new KJUR.asn1.DERSequence();for(var c=0;c0){var c=new KJUR.asn1.DERSequence({array:this.aRevokedCert});this.asn1Array.push(c)}var d=new KJUR.asn1.DERSequence({array:this.asn1Array});this.hTLV=d.getEncodedHex();this.isModified=false;return this.hTLV};this._initialize=function(){this.asn1Version=null;this.asn1SignatureAlg=null;this.asn1Issuer=null;this.asn1ThisUpdate=null;this.asn1NextUpdate=null;this.aRevokedCert=new Array()};this._initialize()};YAHOO.lang.extend(KJUR.asn1.x509.TBSCertList,KJUR.asn1.ASN1Object);KJUR.asn1.x509.CRLEntry=function(c){KJUR.asn1.x509.CRLEntry.superclass.constructor.call(this);var b=null;var a=null;this.setCertSerial=function(d){this.sn=new KJUR.asn1.DERInteger(d)};this.setRevocationDate=function(d){this.time=new KJUR.asn1.x509.Time(d)};this.getEncodedHex=function(){var d=new KJUR.asn1.DERSequence({array:[this.sn,this.time]});this.TLV=d.getEncodedHex();return this.TLV};if(typeof c!="undefined"){if(typeof c.time!="undefined"){this.setRevocationDate(c.time)}if(typeof c.sn!="undefined"){this.setCertSerial(c.sn)}}};YAHOO.lang.extend(KJUR.asn1.x509.CRLEntry,KJUR.asn1.ASN1Object);KJUR.asn1.x509.X500Name=function(b){KJUR.asn1.x509.X500Name.superclass.constructor.call(this);this.asn1Array=new Array();this.setByString=function(c){var d=c.split("/");d.shift();for(var e=0;e0){h=new a.DERTaggedObject({obj:this.dUnsignedAttrs,tag:"a1",explicit:false})}var g=[this.dCMSVersion,this.dSignerIdentifier,this.dDigestAlgorithm,e,this.dSigAlg,this.dSig,];if(h!=null){g.push(h)}var f=new a.DERSequence({array:g});this.hTLV=f.getEncodedHex();return this.hTLV}};YAHOO.lang.extend(KJUR.asn1.cms.SignerInfo,KJUR.asn1.ASN1Object);KJUR.asn1.cms.EncapsulatedContentInfo=function(c){KJUR.asn1.cms.EncapsulatedContentInfo.superclass.constructor.call(this);var a=KJUR.asn1;var b=KJUR.asn1.cms;var d=KJUR.asn1.x509;this.dEContentType=new a.DERObjectIdentifier({name:"data"});this.dEContent=null;this.isDetached=false;this.eContentValueHex=null;this.setContentType=function(e){if(e.match(/^[0-2][.][0-9.]+$/)){this.dEContentType=new a.DERObjectIdentifier({oid:e})}else{this.dEContentType=new a.DERObjectIdentifier({name:e})}};this.setContentValue=function(e){if(typeof e!="undefined"){if(typeof e.hex=="string"){this.eContentValueHex=e.hex}else{if(typeof e.str=="string"){this.eContentValueHex=utf8tohex(e.str)}}}};this.setContentValueHex=function(e){this.eContentValueHex=e};this.setContentValueStr=function(e){this.eContentValueHex=utf8tohex(e)};this.getEncodedHex=function(){if(typeof this.eContentValueHex!="string"){throw"eContentValue not yet set"}var g=new a.DEROctetString({hex:this.eContentValueHex});this.dEContent=new a.DERTaggedObject({obj:g,tag:"a0",explicit:true});var e=[this.dEContentType];if(!this.isDetached){e.push(this.dEContent)}var f=new a.DERSequence({array:e});this.hTLV=f.getEncodedHex();return this.hTLV}};YAHOO.lang.extend(KJUR.asn1.cms.EncapsulatedContentInfo,KJUR.asn1.ASN1Object);KJUR.asn1.cms.ContentInfo=function(c){KJUR.asn1.cms.ContentInfo.superclass.constructor.call(this);var a=KJUR.asn1;var b=KJUR.asn1.cms;var d=KJUR.asn1.x509;this.dContentType=null;this.dContent=null;this.setContentType=function(e){if(typeof e=="string"){this.dContentType=d.OID.name2obj(e)}};this.getEncodedHex=function(){var f=new a.DERTaggedObject({obj:this.dContent,tag:"a0",explicit:true});var e=new a.DERSequence({array:[this.dContentType,f]});this.hTLV=e.getEncodedHex();return this.hTLV};if(typeof c!="undefined"){if(c.type){this.setContentType(c.type)}if(c.obj&&c.obj instanceof a.ASN1Object){this.dContent=c.obj}}};YAHOO.lang.extend(KJUR.asn1.cms.ContentInfo,KJUR.asn1.ASN1Object);KJUR.asn1.cms.SignedData=function(c){KJUR.asn1.cms.SignedData.superclass.constructor.call(this);var a=KJUR.asn1;var b=KJUR.asn1.cms;var d=KJUR.asn1.x509;this.dCMSVersion=new a.DERInteger({"int":1});this.digestAlgNameList=[];this.dEncapContentInfo=new b.EncapsulatedContentInfo();this.certificateList=[];this.crlList=[];this.signerInfoList=[new b.SignerInfo()];this.addCertificatesByPEM=function(e){var f=KEYUTIL.getHexFromPEM(e);var g=new a.ASN1Object();g.hTLV=f;this.certificateList.push(g)};this.getEncodedHex=function(){if(typeof this.hTLV=="string"){return this.hTLV}var m=[];for(var j=0;j0){var g=new a.DERSet({array:this.certificateList});var f=new a.DERTaggedObject({obj:g,tag:"a0",explicit:false});k.push(f)}k.push(n);var l=new a.DERSequence({array:k});this.hTLV=l.getEncodedHex();return this.hTLV};this.getContentInfo=function(){this.getEncodedHex();var e=new b.ContentInfo({type:"signed-data",obj:this});return e};this.getContentInfoEncodedHex=function(){var e=this.getContentInfo();var f=e.getEncodedHex();return f};this.getPEM=function(){var e=this.getContentInfoEncodedHex();var f=a.ASN1Util.getPEMStringFromHex(e,"CMS");return f}};YAHOO.lang.extend(KJUR.asn1.cms.SignedData,KJUR.asn1.ASN1Object);KJUR.asn1.cms.CMSUtil=new function(){};KJUR.asn1.cms.CMSUtil.newSignedData=function(g){var f=KJUR.asn1.cms;var e=new f.SignedData();e.dEncapContentInfo.setContentValue(g.content);if(typeof g.certs=="object"){for(var c=0;c0){h=new a.DERTaggedObject({obj:this.dUnsignedAttrs,tag:"a1",explicit:false})}var g=[this.dCMSVersion,this.dSignerIdentifier,this.dDigestAlgorithm,e,this.dSigAlg,this.dSig,];if(h!=null){g.push(h)}var f=new a.DERSequence({array:g});this.hTLV=f.getEncodedHex();return this.hTLV}};YAHOO.lang.extend(KJUR.asn1.cms.SignerInfo,KJUR.asn1.ASN1Object);KJUR.asn1.cms.EncapsulatedContentInfo=function(c){KJUR.asn1.cms.EncapsulatedContentInfo.superclass.constructor.call(this);var a=KJUR.asn1;var b=KJUR.asn1.cms;var d=KJUR.asn1.x509;this.dEContentType=new a.DERObjectIdentifier({name:"data"});this.dEContent=null;this.isDetached=false;this.eContentValueHex=null;this.setContentType=function(e){if(e.match(/^[0-2][.][0-9.]+$/)){this.dEContentType=new a.DERObjectIdentifier({oid:e})}else{this.dEContentType=new a.DERObjectIdentifier({name:e})}};this.setContentValue=function(e){if(typeof e!="undefined"){if(typeof e.hex=="string"){this.eContentValueHex=e.hex}else{if(typeof e.str=="string"){this.eContentValueHex=utf8tohex(e.str)}}}};this.setContentValueHex=function(e){this.eContentValueHex=e};this.setContentValueStr=function(e){this.eContentValueHex=utf8tohex(e)};this.getEncodedHex=function(){if(typeof this.eContentValueHex!="string"){throw"eContentValue not yet set"}var g=new a.DEROctetString({hex:this.eContentValueHex});this.dEContent=new a.DERTaggedObject({obj:g,tag:"a0",explicit:true});var e=[this.dEContentType];if(!this.isDetached){e.push(this.dEContent)}var f=new a.DERSequence({array:e});this.hTLV=f.getEncodedHex();return this.hTLV}};YAHOO.lang.extend(KJUR.asn1.cms.EncapsulatedContentInfo,KJUR.asn1.ASN1Object);KJUR.asn1.cms.ContentInfo=function(c){KJUR.asn1.cms.ContentInfo.superclass.constructor.call(this);var a=KJUR.asn1;var b=KJUR.asn1.cms;var d=KJUR.asn1.x509;this.dContentType=null;this.dContent=null;this.setContentType=function(e){if(typeof e=="string"){this.dContentType=d.OID.name2obj(e)}};this.getEncodedHex=function(){var f=new a.DERTaggedObject({obj:this.dContent,tag:"a0",explicit:true});var e=new a.DERSequence({array:[this.dContentType,f]});this.hTLV=e.getEncodedHex();return this.hTLV};if(typeof c!="undefined"){if(c.type){this.setContentType(c.type)}if(c.obj&&c.obj instanceof a.ASN1Object){this.dContent=c.obj}}};YAHOO.lang.extend(KJUR.asn1.cms.ContentInfo,KJUR.asn1.ASN1Object);KJUR.asn1.cms.SignedData=function(c){KJUR.asn1.cms.SignedData.superclass.constructor.call(this);var a=KJUR.asn1;var b=KJUR.asn1.cms;var d=KJUR.asn1.x509;this.dCMSVersion=new a.DERInteger({"int":1});this.dDigestAlgs=null;this.digestAlgNameList=[];this.dEncapContentInfo=new b.EncapsulatedContentInfo();this.dCerts=null;this.certificateList=[];this.crlList=[];this.signerInfoList=[new b.SignerInfo()];this.addCertificatesByPEM=function(e){var f=KEYUTIL.getHexFromPEM(e);var g=new a.ASN1Object();g.hTLV=f;this.certificateList.push(g)};this.getEncodedHex=function(){if(typeof this.hTLV=="string"){return this.hTLV}if(this.dDigestAlgs==null){var k=[];for(var j=0;j0){var l=new a.DERSet({array:this.certificateList});this.dCerts=new a.DERTaggedObject({obj:l,tag:"a0",explicit:false})}}if(this.dCerts!=null){e.push(this.dCerts)}var g=new a.DERSet({array:this.signerInfoList});e.push(g);var f=new a.DERSequence({array:e});this.hTLV=f.getEncodedHex();return this.hTLV};this.getContentInfo=function(){this.getEncodedHex();var e=new b.ContentInfo({type:"signed-data",obj:this});return e};this.getContentInfoEncodedHex=function(){var e=this.getContentInfo();var f=e.getEncodedHex();return f};this.getPEM=function(){var e=this.getContentInfoEncodedHex();var f=a.ASN1Util.getPEMStringFromHex(e,"CMS");return f}};YAHOO.lang.extend(KJUR.asn1.cms.SignedData,KJUR.asn1.ASN1Object);KJUR.asn1.cms.CMSUtil=new function(){};KJUR.asn1.cms.CMSUtil.newSignedData=function(a){var h=KJUR.asn1.cms;var g=KJUR.asn1.cades;var f=new h.SignedData();f.dEncapContentInfo.setContentValue(a.content);if(typeof a.certs=="object"){for(var b=0;b + + + +QUnit for ASN1 Encoder Class 'asn1cades.js' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

      +
      test markup
      +
      +QUnit TEST +asn1 | +asn1x509 | +asn1cms | +asn1tsp | +APIDOCS | +
      + + + diff --git a/test/qunit-do-asn1cms.html b/test/qunit-do-asn1cms.html index b425f5ba..3ec0701c 100755 --- a/test/qunit-do-asn1cms.html +++ b/test/qunit-do-asn1cms.html @@ -30,6 +30,7 @@ + diff --git a/test/qunit-do-asn1tsp.html b/test/qunit-do-asn1tsp.html index 8abdf22a..703824b8 100755 --- a/test/qunit-do-asn1tsp.html +++ b/test/qunit-do-asn1tsp.html @@ -256,6 +256,63 @@ equal(j3.certreq, true, "certreq=true"); }); +test("FixedTSAAdapter", function() { + var tstaaa = "308205c006092a864886f70d010702a08205b1308205ad020101310f300d06096086480165030402010500308193060b2a864886f70d0109100104a08183048180307e02010106042a0304053031300d0609608648016503040201050004209834876dcfb05cb167a5c24953eba58c4ac89b1adf57f28f2f9d09af107ee8f0020103181332303133313233313233353935392e3132335a3004800201f40101ff020103301c310b3009060355040613025553310d300b060355040a0c0454535031a082031530820311308201f9a00302010202014d300d06092a864886f70d0101050500301b310b3009060355040613025553310c300a060355040a0c03434131301e170d3133303530313233353935395a170d3233303530313233353935395a301c310b3009060355040613025553310d300b06035504030c045453413130820122300d06092a864886f70d01010105000382010f003082010a0282010100df74eaa8b47779e5260ed1d2f3da85de9e0c3fb59faadd998e3de56632e38c2183bf0afd7093653438ae29ba0e0e05224f865d3d66ce88c01f0dc0f394ec40d380c39c414601ffa40d088d49ed99b6a0bb6e721cf3e2921bfa8e19021569acb851cafaa2f0e4ca43b91f19fb394eec269f533fd1f4247f3331003a6338a3607f4bb2ea537abad8dd4eb3ca28551035d73afd3cbc11e4e7404c1496c4f62c05c27c42b14e7e519519630f3b52ed27e0b3c54bd053f2d508bc07e745720458285adca6c55a6759419972ac5c346ee5047f460ddff4346ae06475b0d1fc44b63db80a4c97648dcfeb11e3344f1bce51fec7b9434e86bb405443750f9baec44d564b0203010001a35f305d300c0603551d130101ff04023000300b0603551d0f0404030206c030160603551d250101ff040c300a06082b0601050507030830280603551d1f0421301f301da01ba0198617687474703a2f2f746573742e636f6d2f6361312e63726c300d06092a864886f70d010105050003820101004d926e469e2162dcf2aa6da7c254df26a475898c5dacb424535717930885d40badd80f95ca0011b33c7f98d91f1f0ab39af1c1a51e61573a52727bf9675de66874fcb1254bc02a8853a7ab06fab25521df08488d88a368b9045f1a087766f2a77c1347c9bc1b9daa411cdba21aead15203f8045b47df86c0a437f9575008eebc32eab53b54ef3054e9d225875d8fc327fec7a02c61272203dcd60ba384e7dd0af09af6cf8bbce5b88ceef896bcf7993cd1d234cd5f7bef3029b3fceb826d2e3fd5ae095cb1700b6946a5ca1d87b3b80f4338f2bacd5fca11163cedd3e8a31c04c5e36fa6a7c4be6af583b9ab1d612536372f585a84170c4c02d0c9312216fd52318201e6308201e20201013020301b310b3009060355040613025553310c300a060355040a0c0343413102014d300d06096086480165030402010500a08198301806092a864886f70d010903310b06092a864886f70d010701302f06092a864886f70d01090431220420b0a206fa135a194d64514e496c143afc3b4284a07303e6df26c482a14c81b124304b060b2a864886f70d010910020c313c303a3038041439c9062cec9d6c9f2a54326729032a5843054f9e3020301b310b3009060355040613025553310c300a060355040a0c0343413102014d300d06092a864886f70d01010b05000482010091db4eb9666c15ed9f9a0fb2c517c570641c15ea91d347af174814b85b5fc6abcda415d123a905feac79a5be881eca157296d5d5a87c563ae7982fe8db52b10c635ccf54e534c2351a356a26294a4c3dcaaddb67154ba8033645c13660670ca27c07eef9ee062d49983c30ebaa7c03034be684af80bd08532f45a8d17c9857d5190e57ab41f90238e176f5afc0b40c848ec9f365d39501289e787d28a8428518c9a3e5e6eba89c196ed95cf82c88f4b4cdb7c11894285a120941a92a61e250ef45a4345eefc2f696b16318c3c6d9d0ceebedb95389d5228cd24532c210ab96fd2737f171c08cd48199de9ee7b55dd0a3b1d8610ee9c40d50c2958fc2f8025ed3"; + + var tstbbb = "308205c006092a864886f70d010702a08205b1308205ad020101310f300d06096086480165030402010500308193060b2a864886f70d0109100104a08183048180307e02010106042a0304053031300d0609608648016503040201050004203e744b9dc39389baf0c5a0660589b8402f3dbb49b89b3e75f2c9355852a3c677020103181332303133313233313233353935392e3132335a3004800201f40101ff020103301c310b3009060355040613025553310d300b060355040a0c0454535031a082031530820311308201f9a00302010202014d300d06092a864886f70d0101050500301b310b3009060355040613025553310c300a060355040a0c03434131301e170d3133303530313233353935395a170d3233303530313233353935395a301c310b3009060355040613025553310d300b06035504030c045453413130820122300d06092a864886f70d01010105000382010f003082010a0282010100df74eaa8b47779e5260ed1d2f3da85de9e0c3fb59faadd998e3de56632e38c2183bf0afd7093653438ae29ba0e0e05224f865d3d66ce88c01f0dc0f394ec40d380c39c414601ffa40d088d49ed99b6a0bb6e721cf3e2921bfa8e19021569acb851cafaa2f0e4ca43b91f19fb394eec269f533fd1f4247f3331003a6338a3607f4bb2ea537abad8dd4eb3ca28551035d73afd3cbc11e4e7404c1496c4f62c05c27c42b14e7e519519630f3b52ed27e0b3c54bd053f2d508bc07e745720458285adca6c55a6759419972ac5c346ee5047f460ddff4346ae06475b0d1fc44b63db80a4c97648dcfeb11e3344f1bce51fec7b9434e86bb405443750f9baec44d564b0203010001a35f305d300c0603551d130101ff04023000300b0603551d0f0404030206c030160603551d250101ff040c300a06082b0601050507030830280603551d1f0421301f301da01ba0198617687474703a2f2f746573742e636f6d2f6361312e63726c300d06092a864886f70d010105050003820101004d926e469e2162dcf2aa6da7c254df26a475898c5dacb424535717930885d40badd80f95ca0011b33c7f98d91f1f0ab39af1c1a51e61573a52727bf9675de66874fcb1254bc02a8853a7ab06fab25521df08488d88a368b9045f1a087766f2a77c1347c9bc1b9daa411cdba21aead15203f8045b47df86c0a437f9575008eebc32eab53b54ef3054e9d225875d8fc327fec7a02c61272203dcd60ba384e7dd0af09af6cf8bbce5b88ceef896bcf7993cd1d234cd5f7bef3029b3fceb826d2e3fd5ae095cb1700b6946a5ca1d87b3b80f4338f2bacd5fca11163cedd3e8a31c04c5e36fa6a7c4be6af583b9ab1d612536372f585a84170c4c02d0c9312216fd52318201e6308201e20201013020301b310b3009060355040613025553310c300a060355040a0c0343413102014d300d06096086480165030402010500a08198301806092a864886f70d010903310b06092a864886f70d010701302f06092a864886f70d01090431220420e9ab1694a8a686650f0e1df0b880753084489100dfd12fdb42ed96ad702d38ca304b060b2a864886f70d010910020c313c303a3038041439c9062cec9d6c9f2a54326729032a5843054f9e3020301b310b3009060355040613025553310c300a060355040a0c0343413102014d300d06092a864886f70d01010b0500048201007496e3825115891a1f451d40a9968783e8d92210f985e2498170130b2bdf9cee69721f5600066374a5edba8673b9c23176551e70bfe7f9e0ca0f569c25402108e77bafa41d824c73ee45253a64d5c93adf0513f6fadfb69992f344a379de3a292d23056b642a6e0970559f7881f8660eaa2f9670b77328f1b882ce78e0ace222a3004444751b518ef82befc19e39c928cbbd97cb53dc80415163c3a99e3f504ea41a8cda75a0b5ebcbece174a03816344c9caa4c298d23c7352d7f1dda56495bd1a865ff60fbb098a21ecd3d08d916840ad40e5c0dbb66927f84a678c7d4565beef4f623a521b53f3ea97c4155d1a0802656edaa50b07c6704d544fbc5fd43e1"; + + var tsa = new KJUR.asn1.tsp.FixedTSAAdapter({ + tstInfo: { + policy: '1.2.3.4.5', + messageImprint: {}, + serialNumber: {'int': 3}, + genTime: {str: '20131231235959.123Z', millis: true}, + accuracy: {millis: 500}, + ordering: true, + nonce: {'int': 3}, + tsa: {'str': '/C=US/O=TSP1'} + }, + certs: [sZ4_CERPEM], + signerCert: sZ4_CERPEM, + hashAlg: 'sha256', + signerPrvKey: sZ4_PRVP8PPEM, + sigAlg: 'SHA256withRSA' + }); + + expect(4); + equal(tsa.getTSTHex('616161', 'sha256'), tstaaa, 'aaa 1'); + equal(tsa.getTSTHex('616161', 'sha256'), tstaaa, 'aaa 2'); + equal(tsa.getTSTHex('626262', 'sha256'), tstbbb, 'bbb 1'); + equal(tsa.getTSTHex('626262', 'sha256'), tstbbb, 'bbb 2'); +}); + +test("SimpleTSAAdapter", function() { + var tsa = new KJUR.asn1.tsp.SimpleTSAAdapter({ + tstInfo: { + policy: '1.2.3.4.5', + messageImprint: {}, + serialNumber: {'int': 3}, + genTime: {millis: true}, + accuracy: {millis: 500}, + ordering: true, + nonce: {'int': 3}, + tsa: {'str': '/C=US/O=TSP1'} + }, + certs: [sZ4_CERPEM], + signerCert: sZ4_CERPEM, + hashAlg: 'sha256', + signerPrvKey: sZ4_PRVP8PPEM, + sigAlg: 'SHA256withRSA' + }); + + expect(4); + equal(tsa.getTSTHex('616161', 'sha256').substr(0, 2), '30', 'aaa 1'); + equal(tsa.getTSTHex('616161', 'sha256').substr(0, 2), '30', 'aaa 2'); + equal(tsa.getTSTHex('626262', 'sha256').substr(0, 2), '30', 'bbb 1'); + equal(tsa.getTSTHex('626262', 'sha256').substr(0, 2), '30', 'bbb 2'); +}); + + }); --> diff --git a/tool_cades.html b/tool_cades.html new file mode 100755 index 00000000..fd944810 --- /dev/null +++ b/tool_cades.html @@ -0,0 +1,351 @@ + + + + + + + + + +CAdES Generator + + + + + + +
      +
      +

      CAdES Generator

      +

      RFC 5126 CAdES Long Term Signature Generator by pure JavaScript

      +TOP | +DOWNLOADS | +TUTORIALS | +API REFERENCE | +DEMOS | +
      +
      + + +
      +
      + + +This tool can generate CAdES-BES/EPES signature and then +convert it to CAdES-T by adding SignatureTimeStamp.
      +NOTE: Currently jsrsasign supports CAdES-BES, EPES and T formats. + +
      + +

      (Step1) Generate CAdES-BES or EPES

      + + + + + + + + + + + + + + +
      +Message to be signed (i.e. eContent):
      + +
      SignerInfo
      Signer's Private Key (PEM):
      + +
      Signer's Certificate (PEM):
      + +
      SignerInfo Attributes
      +SigningTime +, +SigningCertificate(V1) +, +SigningCertificateV2 + +
      +Signature
      Policy
      (for EPES)
      + +
      +policy OID: + +
      +hash alg: + +
      +hash value: + +
      + + + + +
      RESULT:
      + + +

      (Step2)Parse CAdES-BES/EPES for adding SigTS

      +Parse above CAdES-BES/EPES signature and +and get the signature value of signerInfo. +
      + +
      +
      signature value of the first SignerInfo
      + +
      + +

      (Step3)Get TimeStampToken

      +Get TimeStampToken for above signature value. +You can get it from trusted time stamp authority or +use sample TSA using jsrsasign. +
      + +
      +
      TimeStampToken for the signature value in SignerInfo
      + + +

      (Step4)Convert CAdES-BES/EPES to CAdES-T

      + +You can convert it to CAdES-T signature +by adding SignatureTimeStamp attribute with the above signature time stamp. +
      + +
      +
      CAdES-T signature as the result
      +
      + +
      + + + +
      +
      + + + + + + diff --git a/x509-1.1.js b/x509-1.1.js index 9d6a8f5d..a1a70664 100644 --- a/x509-1.1.js +++ b/x509-1.1.js @@ -349,7 +349,7 @@ X509.getPublicKeyInfoPropOfCertPEM = function(sCertPEM) { } // 5. Public Key Hex - if (hCert.substr(a3[1], 02) != "03") + if (hCert.substr(a3[1], 2) != "03") throw "malformed X.509 certificate PEM (code:006)"; // not bitstring var unusedBitAndKeyHex = ASN1HEX.getHexOfV_AtObj(hCert, a3[1]);