From 7f2142fb160c36b38c4cf4d7483536ddacfa9e6c Mon Sep 17 00:00:00 2001 From: Kenji Urushima Date: Tue, 29 Nov 2016 23:20:48 +0900 Subject: [PATCH] 6.2.3 release --- ChangeLog.txt | 12 +- api/files.html | 8 +- api/index.html | 16 + api/symbols/ASN1HEX.html | 4 + api/symbols/Base64x.html | 4 + api/symbols/KEYUTIL.html | 4 + api/symbols/KJUR.asn1.ASN1Object.html | 34 +- api/symbols/KJUR.asn1.ASN1Util.html | 4 + api/symbols/KJUR.asn1.DERAbstractString.html | 36 +- .../KJUR.asn1.DERAbstractStructured.html | 26 +- api/symbols/KJUR.asn1.DERAbstractTime.html | 36 +- api/symbols/KJUR.asn1.DERBitString.html | 79 +- api/symbols/KJUR.asn1.DERBoolean.html | 13 + api/symbols/KJUR.asn1.DEREnumerated.html | 48 +- api/symbols/KJUR.asn1.DERGeneralizedTime.html | 23 +- api/symbols/KJUR.asn1.DERIA5String.html | 13 + api/symbols/KJUR.asn1.DERInteger.html | 26 +- api/symbols/KJUR.asn1.DERNull.html | 13 + api/symbols/KJUR.asn1.DERNumericString.html | 13 + .../KJUR.asn1.DERObjectIdentifier.html | 50 +- api/symbols/KJUR.asn1.DEROctetString.html | 13 + api/symbols/KJUR.asn1.DERPrintableString.html | 13 + api/symbols/KJUR.asn1.DERSequence.html | 13 + api/symbols/KJUR.asn1.DERSet.html | 13 + api/symbols/KJUR.asn1.DERTaggedObject.html | 16 +- api/symbols/KJUR.asn1.DERTeletexString.html | 13 + api/symbols/KJUR.asn1.DERUTCTime.html | 33 +- api/symbols/KJUR.asn1.DERUTF8String.html | 13 + api/symbols/KJUR.asn1.cades.CAdESUtil.html | 4 + ...UR.asn1.cades.CompleteCertificateRefs.html | 6 +- api/symbols/KJUR.asn1.cades.OtherCertID.html | 6 +- api/symbols/KJUR.asn1.cades.OtherHash.html | 6 +- .../KJUR.asn1.cades.OtherHashAlgAndValue.html | 13 + ....asn1.cades.SignaturePolicyIdentifier.html | 13 + .../KJUR.asn1.cades.SignatureTimeStamp.html | 13 + api/symbols/KJUR.asn1.cades.html | 4 + api/symbols/KJUR.asn1.cms.Attribute.html | 13 + api/symbols/KJUR.asn1.cms.AttributeList.html | 13 + api/symbols/KJUR.asn1.cms.CMSUtil.html | 4 + api/symbols/KJUR.asn1.cms.ContentInfo.html | 13 + api/symbols/KJUR.asn1.cms.ContentType.html | 13 + ...KJUR.asn1.cms.EncapsulatedContentInfo.html | 13 + .../KJUR.asn1.cms.IssuerAndSerialNumber.html | 13 + api/symbols/KJUR.asn1.cms.MessageDigest.html | 13 + api/symbols/KJUR.asn1.cms.SignedData.html | 13 + api/symbols/KJUR.asn1.cms.SignerInfo.html | 13 + .../KJUR.asn1.cms.SigningCertificate.html | 13 + .../KJUR.asn1.cms.SigningCertificateV2.html | 13 + api/symbols/KJUR.asn1.cms.SigningTime.html | 13 + api/symbols/KJUR.asn1.cms.html | 4 + api/symbols/KJUR.asn1.csr.CSRUtil.html | 15 + .../KJUR.asn1.csr.CertificationRequest.html | 34 +- ...JUR.asn1.csr.CertificationRequestInfo.html | 118 +- api/symbols/KJUR.asn1.csr.html | 4 + api/symbols/KJUR.asn1.html | 4 + api/symbols/KJUR.asn1.ocsp.CertID.html | 6 +- api/symbols/KJUR.asn1.ocsp.OCSPRequest.html | 13 + api/symbols/KJUR.asn1.ocsp.OCSPUtil.html | 4 + api/symbols/KJUR.asn1.ocsp.Request.html | 13 + api/symbols/KJUR.asn1.ocsp.TBSRequest.html | 6 +- api/symbols/KJUR.asn1.ocsp.html | 4 + .../KJUR.asn1.tsp.AbstractTSAAdapter.html | 4 + api/symbols/KJUR.asn1.tsp.Accuracy.html | 13 + .../KJUR.asn1.tsp.FixedTSAAdapter.html | 4 + api/symbols/KJUR.asn1.tsp.MessageImprint.html | 13 + api/symbols/KJUR.asn1.tsp.PKIFailureInfo.html | 13 + api/symbols/KJUR.asn1.tsp.PKIFreeText.html | 13 + api/symbols/KJUR.asn1.tsp.PKIStatus.html | 13 + api/symbols/KJUR.asn1.tsp.PKIStatusInfo.html | 13 + .../KJUR.asn1.tsp.SimpleTSAAdapter.html | 4 + api/symbols/KJUR.asn1.tsp.TSPUtil.html | 4 + api/symbols/KJUR.asn1.tsp.TSTInfo.html | 13 + api/symbols/KJUR.asn1.tsp.TimeStampReq.html | 13 + api/symbols/KJUR.asn1.tsp.TimeStampResp.html | 13 + api/symbols/KJUR.asn1.tsp.html | 4 + .../KJUR.asn1.x509.AlgorithmIdentifier.html | 13 + .../KJUR.asn1.x509.AttributeTypeAndValue.html | 13 + .../KJUR.asn1.x509.AuthorityInfoAccess.html | 24 +- ...KJUR.asn1.x509.AuthorityKeyIdentifier.html | 37 +- .../KJUR.asn1.x509.BasicConstraints.html | 13 + api/symbols/KJUR.asn1.x509.CRL.html | 6 +- .../KJUR.asn1.x509.CRLDistributionPoints.html | 13 + api/symbols/KJUR.asn1.x509.CRLEntry.html | 6 +- api/symbols/KJUR.asn1.x509.Certificate.html | 6 +- .../KJUR.asn1.x509.DistributionPoint.html | 4 + .../KJUR.asn1.x509.DistributionPointName.html | 4 + api/symbols/KJUR.asn1.x509.ExtKeyUsage.html | 26 +- api/symbols/KJUR.asn1.x509.Extension.html | 111 + api/symbols/KJUR.asn1.x509.GeneralName.html | 39 +- api/symbols/KJUR.asn1.x509.GeneralNames.html | 4 + api/symbols/KJUR.asn1.x509.IssuerAltName.html | 607 ++ api/symbols/KJUR.asn1.x509.KeyUsage.html | 13 + api/symbols/KJUR.asn1.x509.OID.html | 4 + api/symbols/KJUR.asn1.x509.RDN.html | 6 +- .../KJUR.asn1.x509.SubjectAltName.html | 607 ++ .../KJUR.asn1.x509.SubjectPublicKeyInfo.html | 6 +- api/symbols/KJUR.asn1.x509.TBSCertList.html | 6 +- .../KJUR.asn1.x509.TBSCertificate.html | 109 +- api/symbols/KJUR.asn1.x509.Time.html | 13 + api/symbols/KJUR.asn1.x509.X500Name.html | 6 +- api/symbols/KJUR.asn1.x509.X509Util.html | 4 + api/symbols/KJUR.asn1.x509.html | 55 +- api/symbols/KJUR.crypto.Cipher.html | 4 + api/symbols/KJUR.crypto.DSA.html | 4 + api/symbols/KJUR.crypto.ECDSA.html | 4 + api/symbols/KJUR.crypto.ECParameterDB.html | 4 + api/symbols/KJUR.crypto.Mac.html | 4 + api/symbols/KJUR.crypto.MessageDigest.html | 4 + api/symbols/KJUR.crypto.OID.html | 4 + api/symbols/KJUR.crypto.Signature.html | 4 + api/symbols/KJUR.crypto.Util.html | 4 + api/symbols/KJUR.crypto.html | 4 + api/symbols/KJUR.html | 4 + api/symbols/KJUR.jws.IntDate.html | 4 + api/symbols/KJUR.jws.JWS.html | 4 + api/symbols/KJUR.jws.JWSJS.html | 4 + api/symbols/KJUR.jws.html | 4 + api/symbols/KJUR.lang.String.html | 4 + api/symbols/PKCS5PKEY.html | 4 + api/symbols/RSAKey.html | 4 + api/symbols/X509.html | 4 + api/symbols/global__.html | 4 + api/symbols/src/asn1-1.0.js.html | 1467 ++--- api/symbols/src/asn1csr-1.0.js.html | 394 +- api/symbols/src/asn1x509-1.0.js.html | 5052 +++++++++-------- asn1-1.0.js | 107 +- asn1csr-1.0.js | 110 +- asn1x509-1.0.js | 324 +- bower.json | 2 +- jsrsasign-latest-all-min.js | 10 +- min/asn1csr-1.0.min.js | 4 +- min/asn1x509-1.0.min.js | 4 +- npm/lib/jsrsasign.js | 10 +- npm/package.json | 2 +- test/qunit-do-asn1csr.html | 49 + test/qunit-do-asn1x509-newcrt.html | 39 + test/qunit-do-asn1x509.html | 31 +- 137 files changed, 6798 insertions(+), 3818 deletions(-) create mode 100644 api/symbols/KJUR.asn1.x509.IssuerAltName.html create mode 100644 api/symbols/KJUR.asn1.x509.SubjectAltName.html diff --git a/ChangeLog.txt b/ChangeLog.txt index 47463a46..5e969fad 100755 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,11 +1,21 @@ ChangeLog for jsrsasign -* Changes from 6.2.2 to next version +* Changes from 6.2.2 to 6.2.3 + - asn1x509 1.0.18 to 1.0.19 + - GeneralName and GeneralNames class supports dn and ldapdn parameters + - SubjectAltName and IssuerAltName extension added + - Extension.appendByNameToArray method added + - asn1csr 1.0.1 to 1.0.2 + - CertificationRequestInfo.appendExtensionByName method added + - CertificationRequestInfo extensionRequest encoding critical bugfix + - CSRUtil.newCSRPEM "ext" parameter for extensionRequest supported - sample_node - datasing and dataverify script added - base64x - API document update + - asn1 + - API document update * Changes from 6.2.1 to 6.2.2 (2016-Nov-19) - x509 1.1.9 to 1.1.10 diff --git a/api/files.html b/api/files.html index b44887fb..1d03a7fb 100644 --- a/api/files.html +++ b/api/files.html @@ -366,12 +366,16 @@

Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -496,7 +500,7 @@

    asn1csr-1.0.js

    Version:
    -
    1.0.1 (2016-Oct-15)
    +
    1.0.2 (2016-Nov-26)
    @@ -572,7 +576,7 @@

    asn1x509-1.0.js

    Version:
    -
    1.0.18 (2016-Nov-19)
    +
    1.0.19 (2016-Nov-26)
    diff --git a/api/index.html b/api/index.html index 3f6a292a..631fe669 100644 --- a/api/index.html +++ b/api/index.html @@ -366,12 +366,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -968,6 +972,12 @@

    KJUR.asn1.x509.GeneralNam
    +
    +

    KJUR.asn1.x509.IssuerAltName

    + IssuerAltName ASN.1 structure class +
    +
    +

    KJUR.asn1.x509.KeyUsage

    KeyUsage ASN.1 structure class @@ -986,6 +996,12 @@

    KJUR.asn1.x509.RDN


    +
    +

    KJUR.asn1.x509.SubjectAltName

    + SubjectAltName ASN.1 structure class +
    +
    +

    KJUR.asn1.x509.SubjectPublicKeyInfo

    SubjectPublicKeyInfo ASN.1 structure class diff --git a/api/symbols/ASN1HEX.html b/api/symbols/ASN1HEX.html index 4abc91b0..710be5dc 100644 --- a/api/symbols/ASN1HEX.html +++ b/api/symbols/ASN1HEX.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • diff --git a/api/symbols/Base64x.html b/api/symbols/Base64x.html index 72aa7628..98e3f998 100644 --- a/api/symbols/Base64x.html +++ b/api/symbols/Base64x.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • diff --git a/api/symbols/KEYUTIL.html b/api/symbols/KEYUTIL.html index f32466c6..36f0013e 100644 --- a/api/symbols/KEYUTIL.html +++ b/api/symbols/KEYUTIL.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • diff --git a/api/symbols/KJUR.asn1.ASN1Object.html b/api/symbols/KJUR.asn1.ASN1Object.html index 08e02ebe..c8cfe4af 100644 --- a/api/symbols/KJUR.asn1.ASN1Object.html +++ b/api/symbols/KJUR.asn1.ASN1Object.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -560,27 +564,27 @@

    - <static>   +   -
    KJUR.asn1.ASN1Object.getEncodedHex() +
    get hexadecimal string of ASN.1 TLV bytes
    - <static>   +   -
    KJUR.asn1.ASN1Object.getLengthHexFromValue() +
    get hexadecimal ASN.1 TLV length(L) bytes from TLV value(V)
    - <static>   +   -
    KJUR.asn1.ASN1Object.getValueHex() +
    get hexadecimal string of ASN.1 TLV value(V) bytes
    @@ -750,11 +754,11 @@

    Method Detail

    - -
    <static> + +
    {String} - KJUR.asn1.ASN1Object.getEncodedHex() + getEncodedHex()
    @@ -782,11 +786,11 @@


    - -
    <static> + +
    {String} - KJUR.asn1.ASN1Object.getLengthHexFromValue() + getLengthHexFromValue()
    @@ -814,11 +818,11 @@


    - -
    <static> + +
    {String} - KJUR.asn1.ASN1Object.getValueHex() + getValueHex()
    diff --git a/api/symbols/KJUR.asn1.ASN1Util.html b/api/symbols/KJUR.asn1.ASN1Util.html index 5158654c..0a33c0f7 100644 --- a/api/symbols/KJUR.asn1.ASN1Util.html +++ b/api/symbols/KJUR.asn1.ASN1Util.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • diff --git a/api/symbols/KJUR.asn1.DERAbstractString.html b/api/symbols/KJUR.asn1.DERAbstractString.html index aa4c1eb4..865bd04b 100644 --- a/api/symbols/KJUR.asn1.DERAbstractString.html +++ b/api/symbols/KJUR.asn1.DERAbstractString.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -533,27 +537,27 @@

    - <static>   +   -
    KJUR.asn1.DERAbstractString.getString() +
    get string value of this string object
    - <static>   +   -
    KJUR.asn1.DERAbstractString.setString(newS) +
    setString(newS)
    set value by a string
    - <static>   +   -
    KJUR.asn1.DERAbstractString.setStringHex(newHexString) +
    setStringHex(newHexString)
    set value by a hexadecimal string
    @@ -565,7 +569,7 @@

    - +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    @@ -657,11 +661,11 @@

    Method Detail

    - -
    <static> + +
    {String} - KJUR.asn1.DERAbstractString.getString() + getString()
    @@ -689,11 +693,11 @@


    - -
    <static> + +
    - KJUR.asn1.DERAbstractString.setString(newS) + setString(newS)
    @@ -725,11 +729,11 @@


    - -
    <static> + +
    - KJUR.asn1.DERAbstractString.setStringHex(newHexString) + setStringHex(newHexString)
    diff --git a/api/symbols/KJUR.asn1.DERAbstractStructured.html b/api/symbols/KJUR.asn1.DERAbstractStructured.html index fec57c18..807648bc 100644 --- a/api/symbols/KJUR.asn1.DERAbstractStructured.html +++ b/api/symbols/KJUR.asn1.DERAbstractStructured.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -526,18 +530,18 @@

    - <static>   +   -
    KJUR.asn1.DERAbstractStructured.appendASN1Object(asn1Object) +
    appendASN1Object(asn1Object)
    append an ASN1Object to internal array
    - <static>   +   -
    KJUR.asn1.DERAbstractStructured.setByASN1ObjectArray(asn1ObjectArray) +
    setByASN1ObjectArray(asn1ObjectArray)
    set value by array of ASN1Object
    @@ -549,7 +553,7 @@

    - +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    @@ -630,11 +634,11 @@

    Method Detail

    - -
    <static> + +
    - KJUR.asn1.DERAbstractStructured.appendASN1Object(asn1Object) + appendASN1Object(asn1Object)
    @@ -666,11 +670,11 @@


    - -
    <static> + +
    - KJUR.asn1.DERAbstractStructured.setByASN1ObjectArray(asn1ObjectArray) + setByASN1ObjectArray(asn1ObjectArray)
    diff --git a/api/symbols/KJUR.asn1.DERAbstractTime.html b/api/symbols/KJUR.asn1.DERAbstractTime.html index 9af6974d..493d5e8e 100644 --- a/api/symbols/KJUR.asn1.DERAbstractTime.html +++ b/api/symbols/KJUR.asn1.DERAbstractTime.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -503,27 +507,27 @@

    - <static>   +   -
    KJUR.asn1.DERAbstractTime.getString() +
    get string value of this string object
    - <static>   +   -
    KJUR.asn1.DERAbstractTime.setByDateValue(year, month, day, hour, min, sec) +
    setByDateValue(year, month, day, hour, min, sec)
    set value by a Date object
    - <static>   +   -
    KJUR.asn1.DERAbstractTime.setString(newS) +
    setString(newS)
    set value by a string
    @@ -535,7 +539,7 @@

    - +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    @@ -600,11 +604,11 @@

    Method Detail

    - -
    <static> + +
    {String} - KJUR.asn1.DERAbstractTime.getString() + getString()
    @@ -632,11 +636,11 @@


    - -
    <static> + +
    - KJUR.asn1.DERAbstractTime.setByDateValue(year, month, day, hour, min, sec) + setByDateValue(year, month, day, hour, min, sec)
    @@ -698,11 +702,11 @@


    - -
    <static> + +
    - KJUR.asn1.DERAbstractTime.setString(newS) + setString(newS)
    diff --git a/api/symbols/KJUR.asn1.DERBitString.html b/api/symbols/KJUR.asn1.DERBitString.html index d000b59c..390d77a3 100644 --- a/api/symbols/KJUR.asn1.DERBitString.html +++ b/api/symbols/KJUR.asn1.DERBitString.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -511,45 +515,45 @@

    KJUR.asn1.DERBitString.newFalseArray(nLength)
    -
    generate an array of false with specified length +
    generate an array of falses with specified length
    This static method may be useful to initialize boolean array.
    - <static>   +   -
    KJUR.asn1.DERBitString.setByBinaryString(binaryString) +
    setByBinaryString(binaryString)
    -
    set ASN.1 DER BitString by binary string +
    set ASN.1 DER BitString by binary string
    Its unused bits will be calculated automatically by length of 'binaryValue'.
    - <static>   +   -
    KJUR.asn1.DERBitString.setByBooleanArray(booleanArray) +
    setByBooleanArray(booleanArray)
    -
    set ASN.1 TLV value(V) by an array of boolean -NOTE: Trailing falses will be ignored.
    +
    set ASN.1 TLV value(V) by an array of boolean
    +NOTE: Trailing falses will be ignored in the ASN.1 DER Object.
    - <static>   +   -
    KJUR.asn1.DERBitString.setHexValueIncludingUnusedBits(newHexStringIncludingUnusedBits) +
    setHexValueIncludingUnusedBits(newHexStringIncludingUnusedBits)
    set ASN.1 value(V) by a hexadecimal string including unused bits
    - <static>   +   -
    KJUR.asn1.DERBitString.setUnusedBitsAndHexValue(unusedBits, hValue) +
    setUnusedBitsAndHexValue(unusedBits, hValue)
    set ASN.1 value(V) by unused bit and hexadecimal string of value
    @@ -561,7 +565,7 @@

    - +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    @@ -648,7 +652,7 @@

    - generate an array of false with specified length + generate an array of falses with specified length
    This static method may be useful to initialize boolean array. @@ -656,6 +660,11 @@

    +
    o = new KJUR.asn1.DERBitString();
    +o.newFalseArray(3) → [false, false, false]
    + + +
    Parameters:
    @@ -675,7 +684,7 @@

    Returns:
    -
    {array} array of boolean faluse
    +
    {array} array of boolean falses
    @@ -684,15 +693,15 @@


    - -
    <static> + +
    - KJUR.asn1.DERBitString.setByBinaryString(binaryString) + setByBinaryString(binaryString)
    - set ASN.1 DER BitString by binary string + set ASN.1 DER BitString by binary string
    Its unused bits will be calculated automatically by length of 'binaryValue'.
    NOTE: Trailing zeros '0' will be ignored. @@ -702,6 +711,11 @@

    +
    o = new KJUR.asn1.DERBitString();
    +o.setByBooleanArray("01011");
    + + +
    Parameters:
    @@ -723,22 +737,27 @@


    - -
    <static> + +
    - KJUR.asn1.DERBitString.setByBooleanArray(booleanArray) + setByBooleanArray(booleanArray)
    - set ASN.1 TLV value(V) by an array of boolean -NOTE: Trailing falses will be ignored. + set ASN.1 TLV value(V) by an array of boolean
    +NOTE: Trailing falses will be ignored in the ASN.1 DER Object.
    +
    o = new KJUR.asn1.DERBitString();
    +o.setByBooleanArray([false, true, false, true, true]);
    + + +
    Parameters:
    @@ -760,11 +779,11 @@


    - -
    <static> + +
    - KJUR.asn1.DERBitString.setHexValueIncludingUnusedBits(newHexStringIncludingUnusedBits) + setHexValueIncludingUnusedBits(newHexStringIncludingUnusedBits)
    @@ -796,11 +815,11 @@


    - -
    <static> + +
    - KJUR.asn1.DERBitString.setUnusedBitsAndHexValue(unusedBits, hValue) + setUnusedBitsAndHexValue(unusedBits, hValue)
    diff --git a/api/symbols/KJUR.asn1.DERBoolean.html b/api/symbols/KJUR.asn1.DERBoolean.html index bb71dd2a..cfd4da40 100644 --- a/api/symbols/KJUR.asn1.DERBoolean.html +++ b/api/symbols/KJUR.asn1.DERBoolean.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -490,6 +494,15 @@

    + + + + +
    +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + diff --git a/api/symbols/KJUR.asn1.DEREnumerated.html b/api/symbols/KJUR.asn1.DEREnumerated.html index d19d75b0..9951ea8a 100644 --- a/api/symbols/KJUR.asn1.DEREnumerated.html +++ b/api/symbols/KJUR.asn1.DEREnumerated.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -510,27 +514,27 @@

    - <static>   +   -
    KJUR.asn1.DEREnumerated.setByBigInteger(bigIntegerValue) +
    setByBigInteger(bigIntegerValue)
    set value by Tom Wu's BigInteger object
    - <static>   +   -
    KJUR.asn1.DEREnumerated.setByInteger(integer) +
    setByInteger(integer)
    set value by integer value
    - <static>   +   -
    KJUR.asn1.DEREnumerated.setValueHex(hexadecimal) +
    setValueHex(hexadecimal)
    set value by integer value
    @@ -545,7 +549,7 @@

    - +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    @@ -578,6 +582,12 @@

    +
    new KJUR.asn1.DEREnumerated(123);
    +new KJUR.asn1.DEREnumerated({int: 123});
    +new KJUR.asn1.DEREnumerated({hex: '1fad'});
    + + + @@ -599,11 +609,11 @@

    Method Detail

    - -
    <static> + +
    - KJUR.asn1.DEREnumerated.setByBigInteger(bigIntegerValue) + setByBigInteger(bigIntegerValue)
    @@ -635,11 +645,11 @@


    - -
    <static> + +
    - KJUR.asn1.DEREnumerated.setByInteger(integer) + setByInteger(integer)
    @@ -671,11 +681,11 @@


    - -
    <static> + +
    - KJUR.asn1.DEREnumerated.setValueHex(hexadecimal) + setValueHex(hexadecimal)
    @@ -689,12 +699,6 @@

    -
    new KJUR.asn1.DEREnumerated(123);
    -new KJUR.asn1.DEREnumerated({int: 123});
    -new KJUR.asn1.DEREnumerated({hex: '1fad'});
    - - -
    Parameters:
    diff --git a/api/symbols/KJUR.asn1.DERGeneralizedTime.html b/api/symbols/KJUR.asn1.DERGeneralizedTime.html index f1c35635..7141d7f2 100644 --- a/api/symbols/KJUR.asn1.DERGeneralizedTime.html +++ b/api/symbols/KJUR.asn1.DERGeneralizedTime.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -530,9 +534,9 @@

    - <static>   +   -
    KJUR.asn1.DERGeneralizedTime.setByDate(dateObject) +
    setByDate(dateObject)
    set value by a Date object
    @@ -544,7 +548,7 @@

    - +
    Methods borrowed from class KJUR.asn1.DERAbstractTime:
    getString, setByDateValue, setString
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    @@ -639,11 +643,11 @@

    Method Detail

    - -
    <static> + +
    - KJUR.asn1.DERGeneralizedTime.setByDate(dateObject) + setByDate(dateObject)
    @@ -655,9 +659,10 @@

    When you specify UTC time, use 'Date.UTC' method like this:
    -var o = new DERUTCTime(); -var date = new Date(Date.UTC(2015, 0, 31, 23, 59, 59, 0)); #2015JAN31 23:59:59 -o.setByDate(date);
    +o1 = new DERUTCTime(); +o1.setByDate(date); + +date = new Date(Date.UTC(2015, 0, 31, 23, 59, 59, 0)); #2015JAN31 23:59:59 diff --git a/api/symbols/KJUR.asn1.DERIA5String.html b/api/symbols/KJUR.asn1.DERIA5String.html index 31bbced3..c348e003 100644 --- a/api/symbols/KJUR.asn1.DERIA5String.html +++ b/api/symbols/KJUR.asn1.DERIA5String.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -490,6 +494,15 @@

    + + + + +
    +
    Methods borrowed from class KJUR.asn1.DERAbstractString:
    getString, setString, setStringHex
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + diff --git a/api/symbols/KJUR.asn1.DERInteger.html b/api/symbols/KJUR.asn1.DERInteger.html index 683b302d..6751742d 100644 --- a/api/symbols/KJUR.asn1.DERInteger.html +++ b/api/symbols/KJUR.asn1.DERInteger.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -511,9 +515,9 @@

    - <static>   +   -
    KJUR.asn1.DERInteger.setByBigInteger(bigIntegerValue) +
    setByBigInteger(bigIntegerValue)
    set value by Tom Wu's BigInteger object
    @@ -529,9 +533,9 @@

    - <static>   +   -
    KJUR.asn1.DERInteger.setValueHex(hexadecimal) +
    setValueHex(hexadecimal)
    set value by integer value
    @@ -546,7 +550,7 @@

    - +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    @@ -601,11 +605,11 @@

    Method Detail

    - -
    <static> + +
    - KJUR.asn1.DERInteger.setByBigInteger(bigIntegerValue) + setByBigInteger(bigIntegerValue)
    @@ -673,11 +677,11 @@


    - -
    <static> + +
    - KJUR.asn1.DERInteger.setValueHex(hexadecimal) + setValueHex(hexadecimal)
    diff --git a/api/symbols/KJUR.asn1.DERNull.html b/api/symbols/KJUR.asn1.DERNull.html index 73c6a70a..4cdfe12a 100644 --- a/api/symbols/KJUR.asn1.DERNull.html +++ b/api/symbols/KJUR.asn1.DERNull.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -490,6 +494,15 @@

    + + + + +
    +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + diff --git a/api/symbols/KJUR.asn1.DERNumericString.html b/api/symbols/KJUR.asn1.DERNumericString.html index 782db2e3..76c87f2f 100644 --- a/api/symbols/KJUR.asn1.DERNumericString.html +++ b/api/symbols/KJUR.asn1.DERNumericString.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -490,6 +494,15 @@

    + + + + +
    +
    Methods borrowed from class KJUR.asn1.DERAbstractString:
    getString, setString, setStringHex
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + diff --git a/api/symbols/KJUR.asn1.DERObjectIdentifier.html b/api/symbols/KJUR.asn1.DERObjectIdentifier.html index ec08492c..6276367a 100644 --- a/api/symbols/KJUR.asn1.DERObjectIdentifier.html +++ b/api/symbols/KJUR.asn1.DERObjectIdentifier.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -507,18 +511,18 @@

    - <static>   +   -
    KJUR.asn1.DERObjectIdentifier.setValueHex(newHexString) +
    setValueHex(newHexString)
    set value by a hexadecimal string
    - <static>   +   -
    KJUR.asn1.DERObjectIdentifier.setValueName(oidName) +
    setValueName(oidName)
    set value by a OID name OID name shall be defined in 'KJUR.asn1.x509.OID.name2oidList'.
    @@ -526,11 +530,11 @@

    - <static>   +   -
    KJUR.asn1.DERObjectIdentifier.setValueOidString(oidString) +
    setValueOidString(oidString)
    -
    set value by a OID string
    +
    set value by a OID string
    @@ -540,7 +544,7 @@

    - +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    @@ -605,11 +609,11 @@

    Method Detail

    - -
    <static> + +
    - KJUR.asn1.DERObjectIdentifier.setValueHex(newHexString) + setValueHex(newHexString)
    @@ -641,11 +645,11 @@


    - -
    <static> + +
    - KJUR.asn1.DERObjectIdentifier.setValueName(oidName) + setValueName(oidName)
    @@ -658,6 +662,11 @@

    +
    o = new KJUR.asn1.DERObjectIdentifier();
    +o.setValueName("serverAuth");
    + + +
    Parameters:
    @@ -685,21 +694,26 @@


    - -
    <static> + +
    - KJUR.asn1.DERObjectIdentifier.setValueOidString(oidString) + setValueOidString(oidString)
    - set value by a OID string + set value by a OID string
    +
    o = new KJUR.asn1.DERObjectIdentifier();
    +o.setValueOidString("2.5.4.13");
    + + +
    Parameters:
    diff --git a/api/symbols/KJUR.asn1.DEROctetString.html b/api/symbols/KJUR.asn1.DEROctetString.html index dc975131..11e14a0e 100644 --- a/api/symbols/KJUR.asn1.DEROctetString.html +++ b/api/symbols/KJUR.asn1.DEROctetString.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -490,6 +494,15 @@

    + + + + +
    +
    Methods borrowed from class KJUR.asn1.DERAbstractString:
    getString, setString, setStringHex
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + diff --git a/api/symbols/KJUR.asn1.DERPrintableString.html b/api/symbols/KJUR.asn1.DERPrintableString.html index 3876a24f..b046341e 100644 --- a/api/symbols/KJUR.asn1.DERPrintableString.html +++ b/api/symbols/KJUR.asn1.DERPrintableString.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -490,6 +494,15 @@

    + + + + +
    +
    Methods borrowed from class KJUR.asn1.DERAbstractString:
    getString, setString, setStringHex
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + diff --git a/api/symbols/KJUR.asn1.DERSequence.html b/api/symbols/KJUR.asn1.DERSequence.html index 6f0a4da1..826b19e4 100644 --- a/api/symbols/KJUR.asn1.DERSequence.html +++ b/api/symbols/KJUR.asn1.DERSequence.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -496,6 +500,15 @@

    + + + + +
    +
    Methods borrowed from class KJUR.asn1.DERAbstractStructured:
    appendASN1Object, setByASN1ObjectArray
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + diff --git a/api/symbols/KJUR.asn1.DERSet.html b/api/symbols/KJUR.asn1.DERSet.html index da9de10b..d36c878a 100644 --- a/api/symbols/KJUR.asn1.DERSet.html +++ b/api/symbols/KJUR.asn1.DERSet.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -495,6 +499,15 @@

    + + + + +
    +
    Methods borrowed from class KJUR.asn1.DERAbstractStructured:
    appendASN1Object, setByASN1ObjectArray
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + diff --git a/api/symbols/KJUR.asn1.DERTaggedObject.html b/api/symbols/KJUR.asn1.DERTaggedObject.html index 9c0829d3..ee9d34f8 100644 --- a/api/symbols/KJUR.asn1.DERTaggedObject.html +++ b/api/symbols/KJUR.asn1.DERTaggedObject.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -504,9 +508,9 @@

    - <static>   +   -
    KJUR.asn1.DERTaggedObject.setString(isExplicitFlag, tagNoHex, asn1Object) +
    setString(isExplicitFlag, tagNoHex, asn1Object)
    set value by an ASN1Object
    @@ -518,7 +522,7 @@

    - +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    @@ -583,11 +587,11 @@

    Method Detail

    - -
    <static> + +
    - KJUR.asn1.DERTaggedObject.setString(isExplicitFlag, tagNoHex, asn1Object) + setString(isExplicitFlag, tagNoHex, asn1Object)
    diff --git a/api/symbols/KJUR.asn1.DERTeletexString.html b/api/symbols/KJUR.asn1.DERTeletexString.html index f2098932..f0195098 100644 --- a/api/symbols/KJUR.asn1.DERTeletexString.html +++ b/api/symbols/KJUR.asn1.DERTeletexString.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -490,6 +494,15 @@

    + + + + +
    +
    Methods borrowed from class KJUR.asn1.DERAbstractString:
    getString, setString, setStringHex
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + diff --git a/api/symbols/KJUR.asn1.DERUTCTime.html b/api/symbols/KJUR.asn1.DERUTCTime.html index 9d9dae3f..5276c513 100644 --- a/api/symbols/KJUR.asn1.DERUTCTime.html +++ b/api/symbols/KJUR.asn1.DERUTCTime.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -507,11 +511,11 @@

    - <static>   +   -
    KJUR.asn1.DERUTCTime.setByDate(dateObject) +
    setByDate(dateObject)
    -
    set value by a Date object
    +
    set value by a Date object
    @@ -521,7 +525,7 @@

    - +
    Methods borrowed from class KJUR.asn1.DERAbstractTime:
    getString, setByDateValue, setString
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    @@ -556,12 +560,12 @@

    EXAMPLES

    -
    var d1 = new KJUR.asn1.DERUTCTime();
    +				
    d1 = new KJUR.asn1.DERUTCTime();
     d1.setString('130430125959Z');
     
    -var d2 = new KJUR.asn1.DERUTCTime({'str': '130430125959Z'});
    -var d3 = new KJUR.asn1.DERUTCTime({'date': new Date(Date.UTC(2015, 0, 31, 0, 0, 0, 0))});
    -var d4 = new KJUR.asn1.DERUTCTime('130430125959Z');
    +d2 = new KJUR.asn1.DERUTCTime({'str': '130430125959Z'}); +d3 = new KJUR.asn1.DERUTCTime({'date': new Date(Date.UTC(2015, 0, 31, 0, 0, 0, 0))}); +d4 = new KJUR.asn1.DERUTCTime('130430125959Z');
    @@ -597,21 +601,26 @@

    EXAMPLES

    Method Detail
    - -
    <static> + +
    - KJUR.asn1.DERUTCTime.setByDate(dateObject) + setByDate(dateObject)
    - set value by a Date object + set value by a Date object
    +
    o = new KJUR.asn1.DERUTCTime();
    +o.setByDate(new Date("2016/12/31"));
    + + +
    Parameters:
    diff --git a/api/symbols/KJUR.asn1.DERUTF8String.html b/api/symbols/KJUR.asn1.DERUTF8String.html index ce5f75eb..82c86561 100644 --- a/api/symbols/KJUR.asn1.DERUTF8String.html +++ b/api/symbols/KJUR.asn1.DERUTF8String.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -490,6 +494,15 @@

    + + + + +
    +
    Methods borrowed from class KJUR.asn1.DERAbstractString:
    getString, setString, setStringHex
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + diff --git a/api/symbols/KJUR.asn1.cades.CAdESUtil.html b/api/symbols/KJUR.asn1.cades.CAdESUtil.html index 23ad6328..d15b04c3 100644 --- a/api/symbols/KJUR.asn1.cades.CAdESUtil.html +++ b/api/symbols/KJUR.asn1.cades.CAdESUtil.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • diff --git a/api/symbols/KJUR.asn1.cades.CompleteCertificateRefs.html b/api/symbols/KJUR.asn1.cades.CompleteCertificateRefs.html index 0810c955..b2d0f3e1 100644 --- a/api/symbols/KJUR.asn1.cades.CompleteCertificateRefs.html +++ b/api/symbols/KJUR.asn1.cades.CompleteCertificateRefs.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -522,7 +526,7 @@

    - +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    diff --git a/api/symbols/KJUR.asn1.cades.OtherCertID.html b/api/symbols/KJUR.asn1.cades.OtherCertID.html index 0a84f487..ed42b97f 100644 --- a/api/symbols/KJUR.asn1.cades.OtherCertID.html +++ b/api/symbols/KJUR.asn1.cades.OtherCertID.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -522,7 +526,7 @@

    - +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    diff --git a/api/symbols/KJUR.asn1.cades.OtherHash.html b/api/symbols/KJUR.asn1.cades.OtherHash.html index 7504fccf..0c6c05a8 100644 --- a/api/symbols/KJUR.asn1.cades.OtherHash.html +++ b/api/symbols/KJUR.asn1.cades.OtherHash.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -523,7 +527,7 @@

    - +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    diff --git a/api/symbols/KJUR.asn1.cades.OtherHashAlgAndValue.html b/api/symbols/KJUR.asn1.cades.OtherHashAlgAndValue.html index 8e30b409..9ad6077a 100644 --- a/api/symbols/KJUR.asn1.cades.OtherHashAlgAndValue.html +++ b/api/symbols/KJUR.asn1.cades.OtherHashAlgAndValue.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -495,6 +499,15 @@

    + + + + +
    +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + diff --git a/api/symbols/KJUR.asn1.cades.SignaturePolicyIdentifier.html b/api/symbols/KJUR.asn1.cades.SignaturePolicyIdentifier.html index f255d6bf..ab396e51 100644 --- a/api/symbols/KJUR.asn1.cades.SignaturePolicyIdentifier.html +++ b/api/symbols/KJUR.asn1.cades.SignaturePolicyIdentifier.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -499,6 +503,15 @@

    + + + + +
    +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + diff --git a/api/symbols/KJUR.asn1.cades.SignatureTimeStamp.html b/api/symbols/KJUR.asn1.cades.SignatureTimeStamp.html index 3559dbb5..6c55508f 100644 --- a/api/symbols/KJUR.asn1.cades.SignatureTimeStamp.html +++ b/api/symbols/KJUR.asn1.cades.SignatureTimeStamp.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -494,6 +498,15 @@

    + + + + +
    +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + diff --git a/api/symbols/KJUR.asn1.cades.html b/api/symbols/KJUR.asn1.cades.html index 246cbb28..2290559e 100644 --- a/api/symbols/KJUR.asn1.cades.html +++ b/api/symbols/KJUR.asn1.cades.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • diff --git a/api/symbols/KJUR.asn1.cms.Attribute.html b/api/symbols/KJUR.asn1.cms.Attribute.html index 09f45abd..e179644e 100644 --- a/api/symbols/KJUR.asn1.cms.Attribute.html +++ b/api/symbols/KJUR.asn1.cms.Attribute.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -496,6 +500,15 @@

    + + + + +
    +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + diff --git a/api/symbols/KJUR.asn1.cms.AttributeList.html b/api/symbols/KJUR.asn1.cms.AttributeList.html index ca840e3e..880e689c 100644 --- a/api/symbols/KJUR.asn1.cms.AttributeList.html +++ b/api/symbols/KJUR.asn1.cms.AttributeList.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -495,6 +499,15 @@

    + + + + +
    +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + diff --git a/api/symbols/KJUR.asn1.cms.CMSUtil.html b/api/symbols/KJUR.asn1.cms.CMSUtil.html index 8088327e..998a4701 100644 --- a/api/symbols/KJUR.asn1.cms.CMSUtil.html +++ b/api/symbols/KJUR.asn1.cms.CMSUtil.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • diff --git a/api/symbols/KJUR.asn1.cms.ContentInfo.html b/api/symbols/KJUR.asn1.cms.ContentInfo.html index b3998229..289f70f5 100644 --- a/api/symbols/KJUR.asn1.cms.ContentInfo.html +++ b/api/symbols/KJUR.asn1.cms.ContentInfo.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -495,6 +499,15 @@

    + + + + +
    +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + diff --git a/api/symbols/KJUR.asn1.cms.ContentType.html b/api/symbols/KJUR.asn1.cms.ContentType.html index 2e0b8e0c..93952a97 100644 --- a/api/symbols/KJUR.asn1.cms.ContentType.html +++ b/api/symbols/KJUR.asn1.cms.ContentType.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -496,6 +500,15 @@

    + + + + +
    +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + diff --git a/api/symbols/KJUR.asn1.cms.EncapsulatedContentInfo.html b/api/symbols/KJUR.asn1.cms.EncapsulatedContentInfo.html index 908abc78..43e7caf7 100644 --- a/api/symbols/KJUR.asn1.cms.EncapsulatedContentInfo.html +++ b/api/symbols/KJUR.asn1.cms.EncapsulatedContentInfo.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -495,6 +499,15 @@

    + + + + +
    +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + diff --git a/api/symbols/KJUR.asn1.cms.IssuerAndSerialNumber.html b/api/symbols/KJUR.asn1.cms.IssuerAndSerialNumber.html index 3f7dd5fb..58d687c5 100644 --- a/api/symbols/KJUR.asn1.cms.IssuerAndSerialNumber.html +++ b/api/symbols/KJUR.asn1.cms.IssuerAndSerialNumber.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -495,6 +499,15 @@

    + + + + +
    +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + diff --git a/api/symbols/KJUR.asn1.cms.MessageDigest.html b/api/symbols/KJUR.asn1.cms.MessageDigest.html index 9dee19c7..625b0fd3 100644 --- a/api/symbols/KJUR.asn1.cms.MessageDigest.html +++ b/api/symbols/KJUR.asn1.cms.MessageDigest.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -496,6 +500,15 @@

    + + + + +
    +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + diff --git a/api/symbols/KJUR.asn1.cms.SignedData.html b/api/symbols/KJUR.asn1.cms.SignedData.html index 0926286b..e7f23e47 100644 --- a/api/symbols/KJUR.asn1.cms.SignedData.html +++ b/api/symbols/KJUR.asn1.cms.SignedData.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -503,6 +507,15 @@

    + + + + +
    +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + diff --git a/api/symbols/KJUR.asn1.cms.SignerInfo.html b/api/symbols/KJUR.asn1.cms.SignerInfo.html index f79408b5..33337470 100644 --- a/api/symbols/KJUR.asn1.cms.SignerInfo.html +++ b/api/symbols/KJUR.asn1.cms.SignerInfo.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -536,6 +540,15 @@

    + + + + +
    +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + diff --git a/api/symbols/KJUR.asn1.cms.SigningCertificate.html b/api/symbols/KJUR.asn1.cms.SigningCertificate.html index 76d1427e..97eb6711 100644 --- a/api/symbols/KJUR.asn1.cms.SigningCertificate.html +++ b/api/symbols/KJUR.asn1.cms.SigningCertificate.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -504,6 +508,15 @@

    + + + + +
    +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + diff --git a/api/symbols/KJUR.asn1.cms.SigningCertificateV2.html b/api/symbols/KJUR.asn1.cms.SigningCertificateV2.html index aaa0b90e..2d64e92e 100644 --- a/api/symbols/KJUR.asn1.cms.SigningCertificateV2.html +++ b/api/symbols/KJUR.asn1.cms.SigningCertificateV2.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -508,6 +512,15 @@

    + + + + +
    +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + diff --git a/api/symbols/KJUR.asn1.cms.SigningTime.html b/api/symbols/KJUR.asn1.cms.SigningTime.html index 69a5a58c..dd37cbcb 100644 --- a/api/symbols/KJUR.asn1.cms.SigningTime.html +++ b/api/symbols/KJUR.asn1.cms.SigningTime.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -499,6 +503,15 @@

    + + + + +
    +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + diff --git a/api/symbols/KJUR.asn1.cms.html b/api/symbols/KJUR.asn1.cms.html index e8bc8853..53dc2b6e 100644 --- a/api/symbols/KJUR.asn1.cms.html +++ b/api/symbols/KJUR.asn1.cms.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • diff --git a/api/symbols/KJUR.asn1.csr.CSRUtil.html b/api/symbols/KJUR.asn1.csr.CSRUtil.html index 36671295..db43a031 100644 --- a/api/symbols/KJUR.asn1.csr.CSRUtil.html +++ b/api/symbols/KJUR.asn1.csr.CSRUtil.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -681,6 +685,17 @@

    sbjpubkey: kp.pubKeyObj, sigalg: "SHA256withRSA", sbjprvkey: kp.prvKeyObj +}); + +// 4) by private/public key PEM with extension +pem = KJUR.asn1.csr.CSRUtil.newCSRPEM({ + subject: {str: '/C=US/O=Test/CN=example.com'}, + ext: [ + {subjectAltName: {array: [{dns: 'example.net'}]} + ], + sbjpubkey: pubKeyPEM, + sigalg: "SHA256withRSA", + sbjprvkey: prvKeyPEM }); diff --git a/api/symbols/KJUR.asn1.csr.CertificationRequest.html b/api/symbols/KJUR.asn1.csr.CertificationRequest.html index d2c85c3d..617da7d3 100644 --- a/api/symbols/KJUR.asn1.csr.CertificationRequest.html +++ b/api/symbols/KJUR.asn1.csr.CertificationRequest.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -503,21 +507,21 @@

    - <static>   +   -
    KJUR.asn1.csr.CertificationRequest.getPEMString() + -
    get PEM formatted certificate signing request (CSR/PKCS#10) +
    get PEM formatted certificate signing request (CSR/PKCS#10)
    This method is to a get CSR PEM string after signed.
    - <static>   +   -
    KJUR.asn1.csr.CertificationRequest.sign() +
    sign()
    -
    sign CertificationRequest and set signature value internally +
    sign CertificationRequest and set signature value internally
    This method self-signs CertificateRequestInfo with a subject's private key and set signature value internally.
    @@ -529,7 +533,7 @@

    - +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    @@ -613,15 +617,15 @@

    Method Detail

    - -
    <static> + +
    - KJUR.asn1.csr.CertificationRequest.getPEMString() + getPEMString()
    - get PEM formatted certificate signing request (CSR/PKCS#10) + get PEM formatted certificate signing request (CSR/PKCS#10)
    This method is to a get CSR PEM string after signed.
    @@ -657,15 +661,15 @@


    - -
    <static> + +
    - KJUR.asn1.csr.CertificationRequest.sign() + sign()
    - sign CertificationRequest and set signature value internally + sign CertificationRequest and set signature value internally
    This method self-signs CertificateRequestInfo with a subject's private key and set signature value internally.
    diff --git a/api/symbols/KJUR.asn1.csr.CertificationRequestInfo.html b/api/symbols/KJUR.asn1.csr.CertificationRequestInfo.html index 500aa666..71ff2f94 100644 --- a/api/symbols/KJUR.asn1.csr.CertificationRequestInfo.html +++ b/api/symbols/KJUR.asn1.csr.CertificationRequestInfo.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -469,7 +473,10 @@

    KJUR.asn1.csr.CertificationRequestInfo(params)

    ASN.1 CertificationRequestInfo structure class -
    +
    +// -- DEFINITION OF ASN.1 SYNTAX --
    +// CertificationRequestInfo ::= SEQUENCE {
    +//   version       INTEGER { v1(0) } (v1,.
    @@ -503,9 +510,19 @@

    - <static>   +   -
    KJUR.asn1.csr.CertificationRequestInfo.setSubjectByParam(x500NameParam) +
    appendExtensionByName(name, extParams) +
    +
    append X.509v3 extension to this object by name and parameters +
    + + + + +   + +
    setSubjectByParam(x500NameParam)
    set subject name field by parameter
    @@ -513,9 +530,9 @@

    - <static>   +   -
    KJUR.asn1.csr.CertificationRequestInfo.setSubjectPublicKeyByGetKey(keyParam) +
    set subject public key info by RSA/ECDSA/DSA key parameter
    @@ -528,7 +545,7 @@

    - +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    @@ -548,6 +565,14 @@

    ASN.1 CertificationRequestInfo structure class +
    +// -- DEFINITION OF ASN.1 SYNTAX --
    +// CertificationRequestInfo ::= SEQUENCE {
    +//   version       INTEGER { v1(0) } (v1,...),
    +//   subject       Name,
    +//   subjectPKInfo SubjectPublicKeyInfo{{ PKInfoAlgorithms }},
    +//   attributes    [0] Attributes{{ CRIAttributes }} }
    +

    @@ -556,14 +581,7 @@

    csri = new KJUR.asn1.csr.CertificationRequestInfo();
     csri.setSubjectByParam({'str': '/C=US/O=Test/CN=example.com'});
    -csri.setSubjectPublicKeyByGetKey(pubKeyObj);
    -
    -// -- DEFINITION OF ASN.1 SYNTAX --
    -// CertificationRequestInfo ::= SEQUENCE {
    -//   version       INTEGER { v1(0) } (v1,...),
    -//   subject       Name,
    -//   subjectPKInfo SubjectPublicKeyInfo{{ PKInfoAlgorithms }},
    -//   attributes    [0] Attributes{{ CRIAttributes }} }
    +csri.setSubjectPublicKeyByGetKey(pubKeyObj); @@ -604,11 +622,71 @@

    Method Detail

    - -
    <static> + +
    + + + appendExtensionByName(name, extParams) + +
    +
    + append X.509v3 extension to this object by name and parameters + + + +
    + + + +
    var o = new KJUR.asn1.csr.CertificationRequestInfo();
    +o.appendExtensionByName('BasicConstraints', {'cA':true, 'critical': true});
    +o.appendExtensionByName('KeyUsage', {'bin':'11'});
    +o.appendExtensionByName('CRLDistributionPoints', {uri: 'http://aaa.com/a.crl'});
    +o.appendExtensionByName('ExtKeyUsage', {array: [{name: 'clientAuth'}]});
    +o.appendExtensionByName('AuthorityKeyIdentifier', {kid: '1234ab..'});
    +o.appendExtensionByName('AuthorityInfoAccess', {array: [{accessMethod:{oid:...},accessLocation:{uri:...}}]});
    + + + + +
    +
    Parameters:
    + +
    + {name} name + +
    +
    name of X.509v3 Extension object
    + +
    + {Array} extParams + +
    +
    parameters as argument of Extension constructor.
    + +
    + + + + + + + +
    +
    See:
    + +
    KJUR.asn1.x509.Extension
    + +
    + + +
    + + +
    - KJUR.asn1.csr.CertificationRequestInfo.setSubjectByParam(x500NameParam) + setSubjectByParam(x500NameParam)
    @@ -652,11 +730,11 @@


    - -
    <static> + +
    - KJUR.asn1.csr.CertificationRequestInfo.setSubjectPublicKeyByGetKey(keyParam) + setSubjectPublicKeyByGetKey(keyParam)
    diff --git a/api/symbols/KJUR.asn1.csr.html b/api/symbols/KJUR.asn1.csr.html index 60493562..3b5d582c 100644 --- a/api/symbols/KJUR.asn1.csr.html +++ b/api/symbols/KJUR.asn1.csr.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • diff --git a/api/symbols/KJUR.asn1.html b/api/symbols/KJUR.asn1.html index 60b40b82..d4cc1319 100644 --- a/api/symbols/KJUR.asn1.html +++ b/api/symbols/KJUR.asn1.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • diff --git a/api/symbols/KJUR.asn1.ocsp.CertID.html b/api/symbols/KJUR.asn1.ocsp.CertID.html index 8a707476..311d3d67 100644 --- a/api/symbols/KJUR.asn1.ocsp.CertID.html +++ b/api/symbols/KJUR.asn1.ocsp.CertID.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -527,7 +531,7 @@

    - +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    diff --git a/api/symbols/KJUR.asn1.ocsp.OCSPRequest.html b/api/symbols/KJUR.asn1.ocsp.OCSPRequest.html index 0953704d..26d4fbe9 100644 --- a/api/symbols/KJUR.asn1.ocsp.OCSPRequest.html +++ b/api/symbols/KJUR.asn1.ocsp.OCSPRequest.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -491,6 +495,15 @@

    + + + + +
    +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + diff --git a/api/symbols/KJUR.asn1.ocsp.OCSPUtil.html b/api/symbols/KJUR.asn1.ocsp.OCSPUtil.html index cfd0baf3..98980507 100644 --- a/api/symbols/KJUR.asn1.ocsp.OCSPUtil.html +++ b/api/symbols/KJUR.asn1.ocsp.OCSPUtil.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • diff --git a/api/symbols/KJUR.asn1.ocsp.Request.html b/api/symbols/KJUR.asn1.ocsp.Request.html index b9f43da8..e922f351 100644 --- a/api/symbols/KJUR.asn1.ocsp.Request.html +++ b/api/symbols/KJUR.asn1.ocsp.Request.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -491,6 +495,15 @@

    + + + + +
    +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + diff --git a/api/symbols/KJUR.asn1.ocsp.TBSRequest.html b/api/symbols/KJUR.asn1.ocsp.TBSRequest.html index 31b0127a..4413d6f3 100644 --- a/api/symbols/KJUR.asn1.ocsp.TBSRequest.html +++ b/api/symbols/KJUR.asn1.ocsp.TBSRequest.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -518,7 +522,7 @@

    - +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    diff --git a/api/symbols/KJUR.asn1.ocsp.html b/api/symbols/KJUR.asn1.ocsp.html index d94f1b26..5c940b63 100644 --- a/api/symbols/KJUR.asn1.ocsp.html +++ b/api/symbols/KJUR.asn1.ocsp.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • diff --git a/api/symbols/KJUR.asn1.tsp.AbstractTSAAdapter.html b/api/symbols/KJUR.asn1.tsp.AbstractTSAAdapter.html index 2ba7c88d..47f33c7f 100644 --- a/api/symbols/KJUR.asn1.tsp.AbstractTSAAdapter.html +++ b/api/symbols/KJUR.asn1.tsp.AbstractTSAAdapter.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • diff --git a/api/symbols/KJUR.asn1.tsp.Accuracy.html b/api/symbols/KJUR.asn1.tsp.Accuracy.html index 4822dbdf..80c31a85 100644 --- a/api/symbols/KJUR.asn1.tsp.Accuracy.html +++ b/api/symbols/KJUR.asn1.tsp.Accuracy.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -493,6 +497,15 @@

    + + + + +
    +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + diff --git a/api/symbols/KJUR.asn1.tsp.FixedTSAAdapter.html b/api/symbols/KJUR.asn1.tsp.FixedTSAAdapter.html index 7ceb29c1..25cd8611 100644 --- a/api/symbols/KJUR.asn1.tsp.FixedTSAAdapter.html +++ b/api/symbols/KJUR.asn1.tsp.FixedTSAAdapter.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • diff --git a/api/symbols/KJUR.asn1.tsp.MessageImprint.html b/api/symbols/KJUR.asn1.tsp.MessageImprint.html index 81141d30..46d0a99b 100644 --- a/api/symbols/KJUR.asn1.tsp.MessageImprint.html +++ b/api/symbols/KJUR.asn1.tsp.MessageImprint.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -494,6 +498,15 @@

    + + + + +
    +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + diff --git a/api/symbols/KJUR.asn1.tsp.PKIFailureInfo.html b/api/symbols/KJUR.asn1.tsp.PKIFailureInfo.html index 8752ee62..9190a901 100644 --- a/api/symbols/KJUR.asn1.tsp.PKIFailureInfo.html +++ b/api/symbols/KJUR.asn1.tsp.PKIFailureInfo.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -500,6 +504,15 @@

    + + + + +
    +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + diff --git a/api/symbols/KJUR.asn1.tsp.PKIFreeText.html b/api/symbols/KJUR.asn1.tsp.PKIFreeText.html index 3ea529c8..ca70876e 100644 --- a/api/symbols/KJUR.asn1.tsp.PKIFreeText.html +++ b/api/symbols/KJUR.asn1.tsp.PKIFreeText.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -492,6 +496,15 @@

    + + + + +
    +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + diff --git a/api/symbols/KJUR.asn1.tsp.PKIStatus.html b/api/symbols/KJUR.asn1.tsp.PKIStatus.html index e156c415..b2e25c72 100644 --- a/api/symbols/KJUR.asn1.tsp.PKIStatus.html +++ b/api/symbols/KJUR.asn1.tsp.PKIStatus.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -498,6 +502,15 @@

    + + + + +
    +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + diff --git a/api/symbols/KJUR.asn1.tsp.PKIStatusInfo.html b/api/symbols/KJUR.asn1.tsp.PKIStatusInfo.html index fe8efdb8..d74375eb 100644 --- a/api/symbols/KJUR.asn1.tsp.PKIStatusInfo.html +++ b/api/symbols/KJUR.asn1.tsp.PKIStatusInfo.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -495,6 +499,15 @@

    + + + + +
    +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + diff --git a/api/symbols/KJUR.asn1.tsp.SimpleTSAAdapter.html b/api/symbols/KJUR.asn1.tsp.SimpleTSAAdapter.html index 0482c687..e0601e71 100644 --- a/api/symbols/KJUR.asn1.tsp.SimpleTSAAdapter.html +++ b/api/symbols/KJUR.asn1.tsp.SimpleTSAAdapter.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • diff --git a/api/symbols/KJUR.asn1.tsp.TSPUtil.html b/api/symbols/KJUR.asn1.tsp.TSPUtil.html index 90c684bc..9183388b 100644 --- a/api/symbols/KJUR.asn1.tsp.TSPUtil.html +++ b/api/symbols/KJUR.asn1.tsp.TSPUtil.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • diff --git a/api/symbols/KJUR.asn1.tsp.TSTInfo.html b/api/symbols/KJUR.asn1.tsp.TSTInfo.html index f292d5ef..b42db05a 100644 --- a/api/symbols/KJUR.asn1.tsp.TSTInfo.html +++ b/api/symbols/KJUR.asn1.tsp.TSTInfo.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -502,6 +506,15 @@

    + + + + +
    +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + diff --git a/api/symbols/KJUR.asn1.tsp.TimeStampReq.html b/api/symbols/KJUR.asn1.tsp.TimeStampReq.html index 8f5f64e3..338826d3 100644 --- a/api/symbols/KJUR.asn1.tsp.TimeStampReq.html +++ b/api/symbols/KJUR.asn1.tsp.TimeStampReq.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -498,6 +502,15 @@

    + + + + +
    +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + diff --git a/api/symbols/KJUR.asn1.tsp.TimeStampResp.html b/api/symbols/KJUR.asn1.tsp.TimeStampResp.html index 9b42c428..18a018ac 100644 --- a/api/symbols/KJUR.asn1.tsp.TimeStampResp.html +++ b/api/symbols/KJUR.asn1.tsp.TimeStampResp.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -494,6 +498,15 @@

    + + + + +
    +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + diff --git a/api/symbols/KJUR.asn1.tsp.html b/api/symbols/KJUR.asn1.tsp.html index 104f71ba..a7aca6be 100644 --- a/api/symbols/KJUR.asn1.tsp.html +++ b/api/symbols/KJUR.asn1.tsp.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • diff --git a/api/symbols/KJUR.asn1.x509.AlgorithmIdentifier.html b/api/symbols/KJUR.asn1.x509.AlgorithmIdentifier.html index f91428ff..3f14546c 100644 --- a/api/symbols/KJUR.asn1.x509.AlgorithmIdentifier.html +++ b/api/symbols/KJUR.asn1.x509.AlgorithmIdentifier.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -490,6 +494,15 @@

    + + + + +
    +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + diff --git a/api/symbols/KJUR.asn1.x509.AttributeTypeAndValue.html b/api/symbols/KJUR.asn1.x509.AttributeTypeAndValue.html index e609550a..70c0496f 100644 --- a/api/symbols/KJUR.asn1.x509.AttributeTypeAndValue.html +++ b/api/symbols/KJUR.asn1.x509.AttributeTypeAndValue.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -490,6 +494,15 @@

    + + + + +
    +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + diff --git a/api/symbols/KJUR.asn1.x509.AuthorityInfoAccess.html b/api/symbols/KJUR.asn1.x509.AuthorityInfoAccess.html index c543088a..1ef44ca1 100644 --- a/api/symbols/KJUR.asn1.x509.AuthorityInfoAccess.html +++ b/api/symbols/KJUR.asn1.x509.AuthorityInfoAccess.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -494,6 +498,15 @@

    + + + + +
    +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + @@ -527,11 +540,12 @@

    -
    var param = {'array':[
    -              { 'accessMethod':{'oid': '1.3.6.1.5.5.7.48.1'},
    -                'accessLocation':{'uri': 'http://ocsp.cacert.org'}
    -              } ]};
    -var e1 = new KJUR.asn1.x509.AuthorityInfoAccess(param);
    +
    e1 = new KJUR.asn1.x509.AuthorityInfoAccess({
    +  array: [{
    +    accessMethod:{'oid': '1.3.6.1.5.5.7.48.1'},
    +    accessLocation:{'uri': 'http://ocsp.cacert.org'}
    +  }]
    +});
    diff --git a/api/symbols/KJUR.asn1.x509.AuthorityKeyIdentifier.html b/api/symbols/KJUR.asn1.x509.AuthorityKeyIdentifier.html index b22d49b1..5ab1890e 100644 --- a/api/symbols/KJUR.asn1.x509.AuthorityKeyIdentifier.html +++ b/api/symbols/KJUR.asn1.x509.AuthorityKeyIdentifier.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -510,9 +514,9 @@

    - <static>   +   -
    KJUR.asn1.x509.AuthorityKeyIdentifier.setCertIssuerByParam(param) +
    set authorityCertIssuer value by X500Name parameter NOTE: Automatic authorityCertIssuer name setting by an issuer @@ -521,9 +525,9 @@

    - <static>   +   -
    KJUR.asn1.x509.AuthorityKeyIdentifier.setCertSerialNumberByParam(param) +
    set authorityCertSerialNumber value by DERInteger parameter NOTE: Automatic authorityCertSerialNumber setting by an issuer @@ -548,7 +552,7 @@

    - +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    @@ -581,11 +585,12 @@

    -
    var param = {'kid': {'hex': '89ab'},
    -             'issuer': {'str': '/C=US/CN=a'},
    -             'sn': {'hex': '1234'},
    -             'critical': true});
    -var e1 = new KJUR.asn1.x509.AuthorityKeyIdentifier(param);
    +
    e1 = new KJUR.asn1.x509.AuthorityKeyIdentifier({
    +  critical: true,
    +  kid:    {hex: '89ab'},
    +  issuer: {str: '/C=US/CN=a'},
    +  sn:     {hex: '1234'}
    +});
    @@ -626,11 +631,11 @@

    Method Detail

    - -
    <static> + +
    - KJUR.asn1.x509.AuthorityKeyIdentifier.setCertIssuerByParam(param) + setCertIssuerByParam(param)
    @@ -670,11 +675,11 @@


    - -
    <static> + +
    - KJUR.asn1.x509.AuthorityKeyIdentifier.setCertSerialNumberByParam(param) + setCertSerialNumberByParam(param)
    diff --git a/api/symbols/KJUR.asn1.x509.BasicConstraints.html b/api/symbols/KJUR.asn1.x509.BasicConstraints.html index 61f3e5ab..c2e64b5a 100644 --- a/api/symbols/KJUR.asn1.x509.BasicConstraints.html +++ b/api/symbols/KJUR.asn1.x509.BasicConstraints.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -490,6 +494,15 @@

    + + + + +
    +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + diff --git a/api/symbols/KJUR.asn1.x509.CRL.html b/api/symbols/KJUR.asn1.x509.CRL.html index e96bfd24..bda9fc07 100644 --- a/api/symbols/KJUR.asn1.x509.CRL.html +++ b/api/symbols/KJUR.asn1.x509.CRL.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -546,7 +550,7 @@

    EXAMPLES

    - +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    diff --git a/api/symbols/KJUR.asn1.x509.CRLDistributionPoints.html b/api/symbols/KJUR.asn1.x509.CRLDistributionPoints.html index b5e30210..4ac7b5f9 100644 --- a/api/symbols/KJUR.asn1.x509.CRLDistributionPoints.html +++ b/api/symbols/KJUR.asn1.x509.CRLDistributionPoints.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -490,6 +494,15 @@

    + + + + +
    +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + diff --git a/api/symbols/KJUR.asn1.x509.CRLEntry.html b/api/symbols/KJUR.asn1.x509.CRLEntry.html index 13ebfa4c..d9ea2ea3 100644 --- a/api/symbols/KJUR.asn1.x509.CRLEntry.html +++ b/api/symbols/KJUR.asn1.x509.CRLEntry.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -528,7 +532,7 @@

    - +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    diff --git a/api/symbols/KJUR.asn1.x509.Certificate.html b/api/symbols/KJUR.asn1.x509.Certificate.html index 2ef2eb0f..dc928f0f 100644 --- a/api/symbols/KJUR.asn1.x509.Certificate.html +++ b/api/symbols/KJUR.asn1.x509.Certificate.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -558,7 +562,7 @@

    EXAMPLES

    - +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    diff --git a/api/symbols/KJUR.asn1.x509.DistributionPoint.html b/api/symbols/KJUR.asn1.x509.DistributionPoint.html index 889a94b1..8968b397 100644 --- a/api/symbols/KJUR.asn1.x509.DistributionPoint.html +++ b/api/symbols/KJUR.asn1.x509.DistributionPoint.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • diff --git a/api/symbols/KJUR.asn1.x509.DistributionPointName.html b/api/symbols/KJUR.asn1.x509.DistributionPointName.html index d79cd418..b93e4e8f 100644 --- a/api/symbols/KJUR.asn1.x509.DistributionPointName.html +++ b/api/symbols/KJUR.asn1.x509.DistributionPointName.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • diff --git a/api/symbols/KJUR.asn1.x509.ExtKeyUsage.html b/api/symbols/KJUR.asn1.x509.ExtKeyUsage.html index 7b7dfe9c..b75914a8 100644 --- a/api/symbols/KJUR.asn1.x509.ExtKeyUsage.html +++ b/api/symbols/KJUR.asn1.x509.ExtKeyUsage.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -490,6 +494,15 @@

    + + + + +
    +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + @@ -512,12 +525,13 @@

    -
    var e1 =
    -    new KJUR.asn1.x509.ExtKeyUsage({'critical': true,
    -                                    'array':
    -                                    [{'oid': '2.5.29.37.0',  // anyExtendedKeyUsage
    -                                      'name': 'clientAuth'}]});
    -
    +				
    e1 = new KJUR.asn1.x509.ExtKeyUsage({
    +  critical: true,
    +  array: [
    +    {oid: '2.5.29.37.0'},  // anyExtendedKeyUsage
    +    {name: 'clientAuth'}
    +  ]
    +});
     // id-ce-extKeyUsage OBJECT IDENTIFIER ::= { id-ce 37 }
     // ExtKeyUsageSyntax ::= SEQUENCE SIZE (1..MAX) OF KeyPurposeId
     // KeyPurposeId ::= OBJECT IDENTIFIER
    diff --git a/api/symbols/KJUR.asn1.x509.Extension.html b/api/symbols/KJUR.asn1.x509.Extension.html index c98f8a23..db5d2291 100644 --- a/api/symbols/KJUR.asn1.x509.Extension.html +++ b/api/symbols/KJUR.asn1.x509.Extension.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -490,6 +494,39 @@

    + + + + + + + + + + + + + + + + + + +
    Method Summary
    Method AttributesMethod Name and Description
    <static>   +
    KJUR.asn1.x509.Extension.appendByNameToArray(name, extParams, a) +
    +
    append X.509v3 extension to any specified array
    +This static function add a X.509v3 extension specified by name and extParams to +array 'a' so that 'a' will be an array of X.509v3 extension objects.
    +
    + + + +
    +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + @@ -547,6 +584,80 @@

    +
    + Method Detail +
    + + +
    <static> + + + KJUR.asn1.x509.Extension.appendByNameToArray(name, extParams, a) + +
    +
    + append X.509v3 extension to any specified array
    +This static function add a X.509v3 extension specified by name and extParams to +array 'a' so that 'a' will be an array of X.509v3 extension objects. + + +
    + + + +
    var a = new Array();
    +KJUR.asn1.x509.Extension.appendByNameToArray("BasicConstraints", {'cA':true, 'critical': true}, a);
    +KJUR.asn1.x509.Extension.appendByNameToArray("KeyUsage", {'bin':'11'}, a);
    + + + + +
    +
    Parameters:
    + +
    + {String} name + +
    +
    X.509v3 extension name
    + +
    + {Object} extParams + +
    +
    associative array of extension parameters
    + +
    + {Array} a + +
    +
    array to add specified extension
    + +
    + + + +
    +
    Since:
    +
    jsrsasign 6.2.3 asn1x509 1.0.19
    +
    +

    + + + + + +
    +
    See:
    + +
    KJUR.asn1.x509.Extension
    + +
    + + + + + diff --git a/api/symbols/KJUR.asn1.x509.GeneralName.html b/api/symbols/KJUR.asn1.x509.GeneralName.html index 7bbdf0f6..1b550a80 100644 --- a/api/symbols/KJUR.asn1.x509.GeneralName.html +++ b/api/symbols/KJUR.asn1.x509.GeneralName.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -506,35 +510,40 @@

  • rfc822 - rfc822Name[1] (ex. user1@foo.com)
  • dns - dNSName[2] (ex. foo.com)
  • uri - uniformResourceIdentifier[6] (ex. http://foo.com/)
  • +
  • dn - directoryName[4] (ex. /C=US/O=Test)
  • +
  • ldapdn - directoryName[4] (ex. O=Test,C=US)
  • certissuer - directoryName[4] (PEM or hex string of cert)
  • certsubj - directoryName[4] (PEM or hex string of cert)
  • -NOTE1: certissuer and certsubj is supported since asn1x509 1.0.10. +NOTE1: certissuer and certsubj were supported since asn1x509 1.0.10.
    +NOTE2: dn and ldapdn were supported since jsrsasign 6.2.3 asn1x509 1.0.19.
    Here is definition of the ASN.1 syntax:
     -- NOTE: under the CHOICE, it will always be explicit.
     GeneralName ::= CHOICE {
    -        otherName                       [0]     OtherName,
    -        rfc822Name                      [1]     IA5String,
    -        dNSName                         [2]     IA5String,
    -        x400Address                     [3]     ORAddress,
    -        directoryName                   [4]     Name,
    -        ediPartyName                    [5]     EDIPartyName,
    -        uniformResourceIdentifier       [6]     IA5String,
    -        iPAddress                       [7]     OCTET STRING,
    -        registeredID                    [8]     OBJECT IDENTIFIER }
    +  otherName                  [0] OtherName,
    +  rfc822Name                 [1] IA5String,
    +  dNSName                    [2] IA5String,
    +  x400Address                [3] ORAddress,
    +  directoryName              [4] Name,
    +  ediPartyName               [5] EDIPartyName,
    +  uniformResourceIdentifier  [6] IA5String,
    +  iPAddress                  [7] OCTET STRING,
    +  registeredID               [8] OBJECT IDENTIFIER }
     

    -
    gn = new KJUR.asn1.x509.GeneralName({rfc822:      'test@aaa.com'});
    -gn = new KJUR.asn1.x509.GeneralName({dns:         'aaa.com'});
    -gn = new KJUR.asn1.x509.GeneralName({uri:         'http://aaa.com/'});
    -gn = new KJUR.asn1.x509.GeneralName({certissuer:  certPEM});
    -gn = new KJUR.asn1.x509.GeneralName({certsubj:    certPEM});
    +
    gn = new KJUR.asn1.x509.GeneralName({rfc822:     'test@aaa.com'});
    +gn = new KJUR.asn1.x509.GeneralName({dns:        'aaa.com'});
    +gn = new KJUR.asn1.x509.GeneralName({uri:        'http://aaa.com/'});
    +gn = new KJUR.asn1.x509.GeneralName({dn:         '/C=US/O=Test'});
    +gn = new KJUR.asn1.x509.GeneralName({ldapdn:     'O=Test,C=US'});
    +gn = new KJUR.asn1.x509.GeneralName({certissuer: certPEM});
    +gn = new KJUR.asn1.x509.GeneralName({certsubj:   certPEM});
    diff --git a/api/symbols/KJUR.asn1.x509.GeneralNames.html b/api/symbols/KJUR.asn1.x509.GeneralNames.html index 64d8016d..8148bcff 100644 --- a/api/symbols/KJUR.asn1.x509.GeneralNames.html +++ b/api/symbols/KJUR.asn1.x509.GeneralNames.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • diff --git a/api/symbols/KJUR.asn1.x509.IssuerAltName.html b/api/symbols/KJUR.asn1.x509.IssuerAltName.html new file mode 100644 index 00000000..0c2830fe --- /dev/null +++ b/api/symbols/KJUR.asn1.x509.IssuerAltName.html @@ -0,0 +1,607 @@ + + + + + + + jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.x509.IssuerAltName + + + + + + + + + + + + +
    + + +
    +

    Classes

    + +
    + +
    + +
    + +

    + + Class KJUR.asn1.x509.IssuerAltName +

    + + +

    + +
    Extends + KJUR.asn1.x509.Extension.
    + + + IssuerAltName ASN.1 structure class + + +
    Defined in: asn1x509-1.0.js. + +

    + + + + + + + + + + + + + + + + + +
    Class Summary
    Constructor AttributesConstructor Name and Description
      + +
    IssuerAltName ASN.1 structure class
    +This class provides X.509v3 IssuerAltName extension.
    +
    + + + + + + + + +
    +
    Fields borrowed from class KJUR.asn1.ASN1Object:
    hL, hT, hTLV, hV, isModified
    +
    + + + + + + + + + +
    +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + + + + + + +
    +
    + Class Detail +
    + +
    + KJUR.asn1.x509.IssuerAltName(params) +
    + +
    + IssuerAltName ASN.1 structure class
    +This class provides X.509v3 IssuerAltName extension. +
    +id-ce-subjectAltName OBJECT IDENTIFIER ::=  { id-ce 18 }
    +IssuerAltName ::= GeneralNames
    +GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName
    +GeneralName ::= CHOICE {
    +  otherName                  [0] OtherName,
    +  rfc822Name                 [1] IA5String,
    +  dNSName                    [2] IA5String,
    +  x400Address                [3] ORAddress,
    +  directoryName              [4] Name,
    +  ediPartyName               [5] EDIPartyName,
    +  uniformResourceIdentifier  [6] IA5String,
    +  iPAddress                  [7] OCTET STRING,
    +  registeredID               [8] OBJECT IDENTIFIER }
    +
    + +
    + + + +
    e1 = new KJUR.asn1.x509.IssuerAltName({
    +  critical: true,
    +  array: [{uri: 'http://aaa.com/'}, {uri: 'http://bbb.com/'}]
    +});
    + + + + + +
    +
    Parameters:
    + +
    + {Array} params + +
    +
    associative array of parameters
    + +
    + + + +
    +
    Since:
    +
    jsrsasign 6.2.3 asn1x509 1.0.19
    +
    + + + + + +
    +
    See:
    + +
    KJUR.asn1.x509.GeneralNames
    + +
    KJUR.asn1.x509.GeneralName
    + +
    + + +
    + + + + + + + + + + + +
    +
    + + + +
    + © 2012-2015 Kenji Urushima, All rights reserved
    + + Documentation generated by JsDoc Toolkit 2.4.0 +
    + + diff --git a/api/symbols/KJUR.asn1.x509.KeyUsage.html b/api/symbols/KJUR.asn1.x509.KeyUsage.html index 79f4f3cc..a204e955 100644 --- a/api/symbols/KJUR.asn1.x509.KeyUsage.html +++ b/api/symbols/KJUR.asn1.x509.KeyUsage.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -490,6 +494,15 @@

    + + + + +
    +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + diff --git a/api/symbols/KJUR.asn1.x509.OID.html b/api/symbols/KJUR.asn1.x509.OID.html index a7272e1e..269836c4 100644 --- a/api/symbols/KJUR.asn1.x509.OID.html +++ b/api/symbols/KJUR.asn1.x509.OID.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • diff --git a/api/symbols/KJUR.asn1.x509.RDN.html b/api/symbols/KJUR.asn1.x509.RDN.html index aa4dffb9..14dd68cd 100644 --- a/api/symbols/KJUR.asn1.x509.RDN.html +++ b/api/symbols/KJUR.asn1.x509.RDN.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -540,7 +544,7 @@

    - +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    diff --git a/api/symbols/KJUR.asn1.x509.SubjectAltName.html b/api/symbols/KJUR.asn1.x509.SubjectAltName.html new file mode 100644 index 00000000..ff2725d7 --- /dev/null +++ b/api/symbols/KJUR.asn1.x509.SubjectAltName.html @@ -0,0 +1,607 @@ + + + + + + + jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.x509.SubjectAltName + + + + + + + + + + + + +
    + + +
    +

    Classes

    + +
    + +
    + +
    + +

    + + Class KJUR.asn1.x509.SubjectAltName +

    + + +

    + +
    Extends + KJUR.asn1.x509.Extension.
    + + + SubjectAltName ASN.1 structure class + + +
    Defined in: asn1x509-1.0.js. + +

    + + + + + + + + + + + + + + + + + +
    Class Summary
    Constructor AttributesConstructor Name and Description
      + +
    SubjectAltName ASN.1 structure class
    +This class provides X.509v3 SubjectAltName extension.
    +
    + + + + + + + + +
    +
    Fields borrowed from class KJUR.asn1.ASN1Object:
    hL, hT, hTLV, hV, isModified
    +
    + + + + + + + + + +
    +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + + + + + + +
    +
    + Class Detail +
    + +
    + KJUR.asn1.x509.SubjectAltName(params) +
    + +
    + SubjectAltName ASN.1 structure class
    +This class provides X.509v3 SubjectAltName extension. +
    +id-ce-subjectAltName OBJECT IDENTIFIER ::=  { id-ce 17 }
    +SubjectAltName ::= GeneralNames
    +GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName
    +GeneralName ::= CHOICE {
    +  otherName                  [0] OtherName,
    +  rfc822Name                 [1] IA5String,
    +  dNSName                    [2] IA5String,
    +  x400Address                [3] ORAddress,
    +  directoryName              [4] Name,
    +  ediPartyName               [5] EDIPartyName,
    +  uniformResourceIdentifier  [6] IA5String,
    +  iPAddress                  [7] OCTET STRING,
    +  registeredID               [8] OBJECT IDENTIFIER }
    +
    + +
    + + + +
    e1 = new KJUR.asn1.x509.SubjectAltName({
    +  critical: true,
    +  array: [{uri: 'http://aaa.com/'}, {uri: 'http://bbb.com/'}]
    +});
    + + + + + +
    +
    Parameters:
    + +
    + {Array} params + +
    +
    associative array of parameters
    + +
    + + + +
    +
    Since:
    +
    jsrsasign 6.2.3 asn1x509 1.0.19
    +
    + + + + + +
    +
    See:
    + +
    KJUR.asn1.x509.GeneralNames
    + +
    KJUR.asn1.x509.GeneralName
    + +
    + + +
    + + + + + + + + + + + +
    +
    + + + +
    + © 2012-2015 Kenji Urushima, All rights reserved
    + + Documentation generated by JsDoc Toolkit 2.4.0 +
    + + diff --git a/api/symbols/KJUR.asn1.x509.SubjectPublicKeyInfo.html b/api/symbols/KJUR.asn1.x509.SubjectPublicKeyInfo.html index b20bc8e6..97142376 100644 --- a/api/symbols/KJUR.asn1.x509.SubjectPublicKeyInfo.html +++ b/api/symbols/KJUR.asn1.x509.SubjectPublicKeyInfo.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -538,7 +542,7 @@

    - +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    diff --git a/api/symbols/KJUR.asn1.x509.TBSCertList.html b/api/symbols/KJUR.asn1.x509.TBSCertList.html index e09ea166..db7f2806 100644 --- a/api/symbols/KJUR.asn1.x509.TBSCertList.html +++ b/api/symbols/KJUR.asn1.x509.TBSCertList.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -559,7 +563,7 @@

    EXAMPLE

    - +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    diff --git a/api/symbols/KJUR.asn1.x509.TBSCertificate.html b/api/symbols/KJUR.asn1.x509.TBSCertificate.html index 490e57ea..1490e681 100644 --- a/api/symbols/KJUR.asn1.x509.TBSCertificate.html +++ b/api/symbols/KJUR.asn1.x509.TBSCertificate.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -504,9 +508,9 @@

    EXAMPLE

    - <static>   +   -
    KJUR.asn1.x509.TBSCertificate.appendExtension(extObj) +
    append X.509v3 extension to this object
    @@ -514,9 +518,9 @@

    EXAMPLE

    - <static>   +   -
    KJUR.asn1.x509.TBSCertificate.appendExtensionByName(name, extParams) +
    appendExtensionByName(name, extParams)
    append X.509v3 extension to this object by name and parameters
    @@ -524,9 +528,9 @@

    EXAMPLE

    - <static>   +   -
    KJUR.asn1.x509.TBSCertificate.setIssuerByParam(x500NameParam) +
    setIssuerByParam(x500NameParam)
    set issuer name field by parameter
    @@ -534,9 +538,9 @@

    EXAMPLE

    - <static>   +   -
    KJUR.asn1.x509.TBSCertificate.setNotAfterByParam(timeParam) +
    setNotAfterByParam(timeParam)
    set notAfter field by parameter
    @@ -544,9 +548,9 @@

    EXAMPLE

    - <static>   +   -
    KJUR.asn1.x509.TBSCertificate.setNotBeforeByParam(timeParam) +
    set notBefore field by parameter
    @@ -554,9 +558,9 @@

    EXAMPLE

    - <static>   +   -
    KJUR.asn1.x509.TBSCertificate.setSerialNumberByParam(intParam) +
    set serial number field by parameter
    @@ -564,9 +568,9 @@

    EXAMPLE

    - <static>   +   -
    KJUR.asn1.x509.TBSCertificate.setSignatureAlgByParam(algIdParam) +
    set signature algorithm field by parameter
    @@ -574,9 +578,9 @@

    EXAMPLE

    - <static>   +   -
    KJUR.asn1.x509.TBSCertificate.setSubjectByParam(x500NameParam) +
    setSubjectByParam(x500NameParam)
    set subject name field by parameter
    @@ -594,9 +598,9 @@

    EXAMPLE

    - <static>   +   -
    KJUR.asn1.x509.TBSCertificate.setSubjectPublicKeyByParam(subjPKeyParam) +
    (DEPRECATED) set subject public key info field by RSA key parameter
    @@ -609,7 +613,7 @@

    EXAMPLE

    - +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    @@ -681,11 +685,11 @@

    EXAMPLE

    Method Detail
    - -
    <static> + +
    - KJUR.asn1.x509.TBSCertificate.appendExtension(extObj) + appendExtension(extObj)
    @@ -730,11 +734,11 @@

    EXAMPLE


    - -
    <static> + +
    - KJUR.asn1.x509.TBSCertificate.appendExtensionByName(name, extParams) + appendExtensionByName(name, extParams)
    @@ -746,12 +750,13 @@

    EXAMPLE

    -
    tbsc.appendExtensionByName('BasicConstraints', {'cA':true, 'critical': true});
    -tbsc.appendExtensionByName('KeyUsage', {'bin':'11'});
    -tbsc.appendExtensionByName('CRLDistributionPoints', {uri: 'http://aaa.com/a.crl'});
    -tbsc.appendExtensionByName('ExtKeyUsage', {array: [{name: 'clientAuth'}]});
    -tbsc.appendExtensionByName('AuthorityKeyIdentifier', {kid: '1234ab..'});
    -tbsc.appendExtensionByName('AuthorityInfoAccess', {array: [{accessMethod:{oid:...},accessLocation:{uri:...}}]});
    +
    var o = new KJUR.asn1.x509.TBSCertificate();
    +o.appendExtensionByName('BasicConstraints', {'cA':true, 'critical': true});
    +o.appendExtensionByName('KeyUsage', {'bin':'11'});
    +o.appendExtensionByName('CRLDistributionPoints', {uri: 'http://aaa.com/a.crl'});
    +o.appendExtensionByName('ExtKeyUsage', {array: [{name: 'clientAuth'}]});
    +o.appendExtensionByName('AuthorityKeyIdentifier', {kid: '1234ab..'});
    +o.appendExtensionByName('AuthorityInfoAccess', {array: [{accessMethod:{oid:...},accessLocation:{uri:...}}]});
    @@ -789,11 +794,11 @@

    EXAMPLE


    - -
    <static> + +
    - KJUR.asn1.x509.TBSCertificate.setIssuerByParam(x500NameParam) + setIssuerByParam(x500NameParam)
    @@ -837,11 +842,11 @@

    EXAMPLE


    - -
    <static> + +
    - KJUR.asn1.x509.TBSCertificate.setNotAfterByParam(timeParam) + setNotAfterByParam(timeParam)
    @@ -885,11 +890,11 @@

    EXAMPLE


    - -
    <static> + +
    - KJUR.asn1.x509.TBSCertificate.setNotBeforeByParam(timeParam) + setNotBeforeByParam(timeParam)
    @@ -933,11 +938,11 @@

    EXAMPLE


    - -
    <static> + +
    - KJUR.asn1.x509.TBSCertificate.setSerialNumberByParam(intParam) + setSerialNumberByParam(intParam)
    @@ -974,11 +979,11 @@

    EXAMPLE


    - -
    <static> + +
    - KJUR.asn1.x509.TBSCertificate.setSignatureAlgByParam(algIdParam) + setSignatureAlgByParam(algIdParam)
    @@ -1015,11 +1020,11 @@

    EXAMPLE


    - -
    <static> + +
    - KJUR.asn1.x509.TBSCertificate.setSubjectByParam(x500NameParam) + setSubjectByParam(x500NameParam)
    @@ -1121,11 +1126,11 @@

    EXAMPLE


    - -
    <static> + +
    - KJUR.asn1.x509.TBSCertificate.setSubjectPublicKeyByParam(subjPKeyParam) + setSubjectPublicKeyByParam(subjPKeyParam)
    diff --git a/api/symbols/KJUR.asn1.x509.Time.html b/api/symbols/KJUR.asn1.x509.Time.html index 64475404..ca78758d 100644 --- a/api/symbols/KJUR.asn1.x509.Time.html +++ b/api/symbols/KJUR.asn1.x509.Time.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -491,6 +495,15 @@

    EXAMPLES

    + + + + +
    +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    +
    + + diff --git a/api/symbols/KJUR.asn1.x509.X500Name.html b/api/symbols/KJUR.asn1.x509.X500Name.html index 342fee17..ac496bc6 100644 --- a/api/symbols/KJUR.asn1.x509.X500Name.html +++ b/api/symbols/KJUR.asn1.x509.X500Name.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -561,7 +565,7 @@

    - +
    Methods borrowed from class KJUR.asn1.ASN1Object:
    getEncodedHex, getLengthHexFromValue, getValueHex
    diff --git a/api/symbols/KJUR.asn1.x509.X509Util.html b/api/symbols/KJUR.asn1.x509.X509Util.html index 00207bda..03cf206b 100644 --- a/api/symbols/KJUR.asn1.x509.X509Util.html +++ b/api/symbols/KJUR.asn1.x509.X509Util.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • diff --git a/api/symbols/KJUR.asn1.x509.html b/api/symbols/KJUR.asn1.x509.html index 7e4d62e1..da4e75e3 100644 --- a/api/symbols/KJUR.asn1.x509.html +++ b/api/symbols/KJUR.asn1.x509.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • @@ -540,6 +544,15 @@

    FEATURES

    + + <static>   + +
    KJUR.asn1.x509.setNameArray(paramsArray) +
    +
    + + + <static>   @@ -623,8 +636,12 @@

    SUPPORTED EXTENSIONS

  • KJUR.asn1.x509.ExtKeyUsage
  • KJUR.asn1.x509.AuthorityKeyIdentifier
  • KJUR.asn1.x509.AuthorityInfoAccess
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.IssuerAltName
  • -NOTE: Please ignore method summary and document of this namespace. This caused by a bug of jsdoc2. +NOTE1: Please ignore method summary and document of this namespace. This caused by a bug of jsdoc2.
    +NOTE2: SubjectAltName and IssuerAltName extension were supported since +jsrsasign 6.2.3 asn1x509 1.0.19.
    @@ -796,6 +813,42 @@

    SUPPORTED EXTENSIONS

    +
    + + +
    <static> + + + KJUR.asn1.x509.setNameArray(paramsArray) + +
    +
    + + + +
    + + + + +
    +
    Parameters:
    + +
    + paramsArray + +
    +
    + +
    + + + + + + + +
    diff --git a/api/symbols/KJUR.crypto.Cipher.html b/api/symbols/KJUR.crypto.Cipher.html index 6dcf9fb2..aedeaf69 100644 --- a/api/symbols/KJUR.crypto.Cipher.html +++ b/api/symbols/KJUR.crypto.Cipher.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • diff --git a/api/symbols/KJUR.crypto.DSA.html b/api/symbols/KJUR.crypto.DSA.html index c9495e6f..aa8609b3 100644 --- a/api/symbols/KJUR.crypto.DSA.html +++ b/api/symbols/KJUR.crypto.DSA.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • diff --git a/api/symbols/KJUR.crypto.ECDSA.html b/api/symbols/KJUR.crypto.ECDSA.html index e9a5de16..22cc34c9 100644 --- a/api/symbols/KJUR.crypto.ECDSA.html +++ b/api/symbols/KJUR.crypto.ECDSA.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • diff --git a/api/symbols/KJUR.crypto.ECParameterDB.html b/api/symbols/KJUR.crypto.ECParameterDB.html index d3a83a96..6f2c917d 100644 --- a/api/symbols/KJUR.crypto.ECParameterDB.html +++ b/api/symbols/KJUR.crypto.ECParameterDB.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • diff --git a/api/symbols/KJUR.crypto.Mac.html b/api/symbols/KJUR.crypto.Mac.html index 8d370374..43f4b8dd 100644 --- a/api/symbols/KJUR.crypto.Mac.html +++ b/api/symbols/KJUR.crypto.Mac.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • diff --git a/api/symbols/KJUR.crypto.MessageDigest.html b/api/symbols/KJUR.crypto.MessageDigest.html index 36fa06ae..bd2a889d 100644 --- a/api/symbols/KJUR.crypto.MessageDigest.html +++ b/api/symbols/KJUR.crypto.MessageDigest.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • diff --git a/api/symbols/KJUR.crypto.OID.html b/api/symbols/KJUR.crypto.OID.html index 12305c03..88e7ad93 100644 --- a/api/symbols/KJUR.crypto.OID.html +++ b/api/symbols/KJUR.crypto.OID.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • diff --git a/api/symbols/KJUR.crypto.Signature.html b/api/symbols/KJUR.crypto.Signature.html index aee93cac..2bedbd90 100644 --- a/api/symbols/KJUR.crypto.Signature.html +++ b/api/symbols/KJUR.crypto.Signature.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • diff --git a/api/symbols/KJUR.crypto.Util.html b/api/symbols/KJUR.crypto.Util.html index 1c7458c7..8f2142bb 100644 --- a/api/symbols/KJUR.crypto.Util.html +++ b/api/symbols/KJUR.crypto.Util.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • diff --git a/api/symbols/KJUR.crypto.html b/api/symbols/KJUR.crypto.html index 214a4552..89469b12 100644 --- a/api/symbols/KJUR.crypto.html +++ b/api/symbols/KJUR.crypto.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • diff --git a/api/symbols/KJUR.html b/api/symbols/KJUR.html index e89d8ac5..a4ae4153 100644 --- a/api/symbols/KJUR.html +++ b/api/symbols/KJUR.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • diff --git a/api/symbols/KJUR.jws.IntDate.html b/api/symbols/KJUR.jws.IntDate.html index 73c58c60..e02d3698 100644 --- a/api/symbols/KJUR.jws.IntDate.html +++ b/api/symbols/KJUR.jws.IntDate.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • diff --git a/api/symbols/KJUR.jws.JWS.html b/api/symbols/KJUR.jws.JWS.html index dd93da60..eda32653 100644 --- a/api/symbols/KJUR.jws.JWS.html +++ b/api/symbols/KJUR.jws.JWS.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • diff --git a/api/symbols/KJUR.jws.JWSJS.html b/api/symbols/KJUR.jws.JWSJS.html index 056fc6d2..1ccf9d9c 100644 --- a/api/symbols/KJUR.jws.JWSJS.html +++ b/api/symbols/KJUR.jws.JWSJS.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • diff --git a/api/symbols/KJUR.jws.html b/api/symbols/KJUR.jws.html index fd0f4ab3..200b1d5f 100644 --- a/api/symbols/KJUR.jws.html +++ b/api/symbols/KJUR.jws.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • diff --git a/api/symbols/KJUR.lang.String.html b/api/symbols/KJUR.lang.String.html index 4a676a74..68b8acf2 100644 --- a/api/symbols/KJUR.lang.String.html +++ b/api/symbols/KJUR.lang.String.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • diff --git a/api/symbols/PKCS5PKEY.html b/api/symbols/PKCS5PKEY.html index baf6b561..bcb35066 100644 --- a/api/symbols/PKCS5PKEY.html +++ b/api/symbols/PKCS5PKEY.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • diff --git a/api/symbols/RSAKey.html b/api/symbols/RSAKey.html index a7d2cca5..4292fc2b 100644 --- a/api/symbols/RSAKey.html +++ b/api/symbols/RSAKey.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • diff --git a/api/symbols/X509.html b/api/symbols/X509.html index 2fc3d3de..4f36d4f8 100644 --- a/api/symbols/X509.html +++ b/api/symbols/X509.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • diff --git a/api/symbols/global__.html b/api/symbols/global__.html index 74e8212a..3058d918 100644 --- a/api/symbols/global__.html +++ b/api/symbols/global__.html @@ -371,12 +371,16 @@

    Classes

  • KJUR.asn1.x509.GeneralNames
  • +
  • KJUR.asn1.x509.IssuerAltName
  • +
  • KJUR.asn1.x509.KeyUsage
  • KJUR.asn1.x509.OID
  • KJUR.asn1.x509.RDN
  • +
  • KJUR.asn1.x509.SubjectAltName
  • +
  • KJUR.asn1.x509.SubjectPublicKeyInfo
  • KJUR.asn1.x509.TBSCertificate
  • diff --git a/api/symbols/src/asn1-1.0.js.html b/api/symbols/src/asn1-1.0.js.html index 2a6d7477..6839d488 100644 --- a/api/symbols/src/asn1-1.0.js.html +++ b/api/symbols/src/asn1-1.0.js.html @@ -416,7 +416,7 @@ 409 /** 410 * get hexadecimal ASN.1 TLV length(L) bytes from TLV value(V) 411 * @name getLengthHexFromValue -412 * @memberOf KJUR.asn1.ASN1Object +412 * @memberOf KJUR.asn1.ASN1Object# 413 * @function 414 * @return {String} hexadecimal string of ASN.1 TLV length(L) 415 */ @@ -447,7 +447,7 @@ 440 /** 441 * get hexadecimal string of ASN.1 TLV bytes 442 * @name getEncodedHex -443 * @memberOf KJUR.asn1.ASN1Object +443 * @memberOf KJUR.asn1.ASN1Object# 444 * @function 445 * @return {String} hexadecimal string of ASN.1 TLV 446 */ @@ -465,7 +465,7 @@ 458 /** 459 * get hexadecimal string of ASN.1 TLV value(V) bytes 460 * @name getValueHex -461 * @memberOf KJUR.asn1.ASN1Object +461 * @memberOf KJUR.asn1.ASN1Object# 462 * @function 463 * @return {String} hexadecimal string of ASN.1 TLV value(V) bytes 464 */ @@ -505,7 +505,7 @@ 498 /** 499 * get string value of this string object 500 * @name getString -501 * @memberOf KJUR.asn1.DERAbstractString +501 * @memberOf KJUR.asn1.DERAbstractString# 502 * @function 503 * @return {String} string value of this string object 504 */ @@ -516,7 +516,7 @@ 509 /** 510 * set value by a string 511 * @name setString -512 * @memberOf KJUR.asn1.DERAbstractString +512 * @memberOf KJUR.asn1.DERAbstractString# 513 * @function 514 * @param {String} newS value by a string to set 515 */ @@ -530,7 +530,7 @@ 523 /** 524 * set value by a hexadecimal string 525 * @name setStringHex -526 * @memberOf KJUR.asn1.DERAbstractString +526 * @memberOf KJUR.asn1.DERAbstractString# 527 * @function 528 * @param {String} newHexString value by a hexadecimal string to set 529 */ @@ -621,7 +621,7 @@ 614 /** 615 * get string value of this string object 616 * @name getString -617 * @memberOf KJUR.asn1.DERAbstractTime +617 * @memberOf KJUR.asn1.DERAbstractTime# 618 * @function 619 * @return {String} string value of this time object 620 */ @@ -632,7 +632,7 @@ 625 /** 626 * set value by a string 627 * @name setString -628 * @memberOf KJUR.asn1.DERAbstractTime +628 * @memberOf KJUR.asn1.DERAbstractTime# 629 * @function 630 * @param {String} newS value by a string to set such like "130430235959Z" 631 */ @@ -646,7 +646,7 @@ 639 /** 640 * set value by a Date object 641 * @name setByDateValue -642 * @memberOf KJUR.asn1.DERAbstractTime +642 * @memberOf KJUR.asn1.DERAbstractTime# 643 * @function 644 * @param {Integer} year year of date (ex. 2013) 645 * @param {Integer} month month of date between 1 and 12 (ex. 12) @@ -684,7 +684,7 @@ 677 /** 678 * set value by array of ASN1Object 679 * @name setByASN1ObjectArray -680 * @memberOf KJUR.asn1.DERAbstractStructured +680 * @memberOf KJUR.asn1.DERAbstractStructured# 681 * @function 682 * @param {array} asn1ObjectArray array of ASN1Object to set 683 */ @@ -697,7 +697,7 @@ 690 /** 691 * append an ASN1Object to internal array 692 * @name appendASN1Object -693 * @memberOf KJUR.asn1.DERAbstractStructured +693 * @memberOf KJUR.asn1.DERAbstractStructured# 694 * @function 695 * @param {ASN1Object} asn1Object to add 696 */ @@ -761,7 +761,7 @@ 754 /** 755 * set value by Tom Wu's BigInteger object 756 * @name setByBigInteger -757 * @memberOf KJUR.asn1.DERInteger +757 * @memberOf KJUR.asn1.DERInteger# 758 * @function 759 * @param {BigInteger} bigIntegerValue to set 760 */ @@ -786,7 +786,7 @@ 779 /** 780 * set value by integer value 781 * @name setValueHex -782 * @memberOf KJUR.asn1.DERInteger +782 * @memberOf KJUR.asn1.DERInteger# 783 * @function 784 * @param {String} hexadecimal string of integer value 785 * @description @@ -870,7 +870,7 @@ 863 /** 864 * set ASN.1 value(V) by a hexadecimal string including unused bits 865 * @name setHexValueIncludingUnusedBits -866 * @memberOf KJUR.asn1.DERBitString +866 * @memberOf KJUR.asn1.DERBitString# 867 * @function 868 * @param {String} newHexStringIncludingUnusedBits 869 */ @@ -883,7 +883,7 @@ 876 /** 877 * set ASN.1 value(V) by unused bit and hexadecimal string of value 878 * @name setUnusedBitsAndHexValue -879 * @memberOf KJUR.asn1.DERBitString +879 * @memberOf KJUR.asn1.DERBitString# 880 * @function 881 * @param {Integer} unusedBits 882 * @param {String} hValue @@ -899,722 +899,741 @@ 892 }; 893 894 /** -895 * set ASN.1 DER BitString by binary string +895 * set ASN.1 DER BitString by binary string<br/> 896 * @name setByBinaryString -897 * @memberOf KJUR.asn1.DERBitString +897 * @memberOf KJUR.asn1.DERBitString# 898 * @function 899 * @param {String} binaryString binary value string (i.e. '10111') 900 * @description 901 * Its unused bits will be calculated automatically by length of 902 * 'binaryValue'. <br/> 903 * NOTE: Trailing zeros '0' will be ignored. -904 */ -905 this.setByBinaryString = function(binaryString) { -906 binaryString = binaryString.replace(/0+$/, ''); -907 var unusedBits = 8 - binaryString.length % 8; -908 if (unusedBits == 8) unusedBits = 0; -909 for (var i = 0; i <= unusedBits; i++) { -910 binaryString += '0'; -911 } -912 var h = ''; -913 for (var i = 0; i < binaryString.length - 1; i += 8) { -914 var b = binaryString.substr(i, 8); -915 var x = parseInt(b, 2).toString(16); -916 if (x.length == 1) x = '0' + x; -917 h += x; -918 } -919 this.hTLV = null; -920 this.isModified = true; -921 this.hV = '0' + unusedBits + h; -922 }; -923 -924 /** -925 * set ASN.1 TLV value(V) by an array of boolean -926 * @name setByBooleanArray -927 * @memberOf KJUR.asn1.DERBitString -928 * @function -929 * @param {array} booleanArray array of boolean (ex. [true, false, true]) -930 * @description -931 * NOTE: Trailing falses will be ignored. -932 */ -933 this.setByBooleanArray = function(booleanArray) { -934 var s = ''; -935 for (var i = 0; i < booleanArray.length; i++) { -936 if (booleanArray[i] == true) { -937 s += '1'; -938 } else { -939 s += '0'; -940 } -941 } -942 this.setByBinaryString(s); -943 }; -944 -945 /** -946 * generate an array of false with specified length -947 * @name newFalseArray -948 * @memberOf KJUR.asn1.DERBitString -949 * @function -950 * @param {Integer} nLength length of array to generate -951 * @return {array} array of boolean faluse -952 * @description -953 * This static method may be useful to initialize boolean array. -954 */ -955 this.newFalseArray = function(nLength) { -956 var a = new Array(nLength); -957 for (var i = 0; i < nLength; i++) { -958 a[i] = false; -959 } -960 return a; -961 }; -962 -963 this.getFreshValueHex = function() { -964 return this.hV; -965 }; -966 -967 if (typeof params != "undefined") { -968 if (typeof params == "string" && params.toLowerCase().match(/^[0-9a-f]+$/)) { -969 this.setHexValueIncludingUnusedBits(params); -970 } else if (typeof params['hex'] != "undefined") { -971 this.setHexValueIncludingUnusedBits(params['hex']); -972 } else if (typeof params['bin'] != "undefined") { -973 this.setByBinaryString(params['bin']); -974 } else if (typeof params['array'] != "undefined") { -975 this.setByBooleanArray(params['array']); -976 } -977 } -978 }; -979 YAHOO.lang.extend(KJUR.asn1.DERBitString, KJUR.asn1.ASN1Object); -980 -981 // ******************************************************************** -982 /** -983 * class for ASN.1 DER OctetString<br/> -984 * @name KJUR.asn1.DEROctetString -985 * @class class for ASN.1 DER OctetString -986 * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) -987 * @extends KJUR.asn1.DERAbstractString -988 * @description -989 * This class provides ASN.1 OctetString simple type.<br/> -990 * Supported "params" attributes are: -991 * <ul> -992 * <li>str - to set a string as a value</li> -993 * <li>hex - to set a hexadecimal string as a value</li> -994 * <li>obj - to set a encapsulated ASN.1 value by JSON object -995 * which is defined in {@link KJUR.asn1.ASN1Util.newObject}</li> -996 * </ul> -997 * NOTE: A parameter 'obj' have been supported -998 * for "OCTET STRING, encapsulates" structure. -999 * since asn1 1.0.11, jsrsasign 6.1.1 (2016-Sep-25). -1000 * @see KJUR.asn1.DERAbstractString - superclass -1001 * @example -1002 * // default constructor -1003 * o = new KJUR.asn1.DEROctetString(); -1004 * // initialize with string -1005 * o = new KJUR.asn1.DEROctetString({str: "aaa"}); -1006 * // initialize with hexadecimal string -1007 * o = new KJUR.asn1.DEROctetString({hex: "616161"}); -1008 * // initialize with ASN1Util.newObject argument -1009 * o = new KJUR.asn1.DEROctetString({obj: {seq: [{int: 3}, {prnstr: 'aaa'}]}}); -1010 * // above generates a ASN.1 data like this: -1011 * // OCTET STRING, encapsulates { -1012 * // SEQUENCE { -1013 * // INTEGER 3 -1014 * // PrintableString 'aaa' -1015 * // } -1016 * // } -1017 */ -1018 KJUR.asn1.DEROctetString = function(params) { -1019 if (params !== undefined && typeof params.obj !== "undefined") { -1020 var o = KJUR.asn1.ASN1Util.newObject(params.obj); -1021 params.hex = o.getEncodedHex(); -1022 } -1023 KJUR.asn1.DEROctetString.superclass.constructor.call(this, params); -1024 this.hT = "04"; -1025 }; -1026 YAHOO.lang.extend(KJUR.asn1.DEROctetString, KJUR.asn1.DERAbstractString); -1027 -1028 // ******************************************************************** -1029 /** -1030 * class for ASN.1 DER Null -1031 * @name KJUR.asn1.DERNull -1032 * @class class for ASN.1 DER Null -1033 * @extends KJUR.asn1.ASN1Object -1034 * @description -1035 * @see KJUR.asn1.ASN1Object - superclass -1036 */ -1037 KJUR.asn1.DERNull = function() { -1038 KJUR.asn1.DERNull.superclass.constructor.call(this); -1039 this.hT = "05"; -1040 this.hTLV = "0500"; -1041 }; -1042 YAHOO.lang.extend(KJUR.asn1.DERNull, KJUR.asn1.ASN1Object); -1043 -1044 // ******************************************************************** -1045 /** -1046 * class for ASN.1 DER ObjectIdentifier -1047 * @name KJUR.asn1.DERObjectIdentifier -1048 * @class class for ASN.1 DER ObjectIdentifier -1049 * @param {Array} params associative array of parameters (ex. {'oid': '2.5.4.5'}) -1050 * @extends KJUR.asn1.ASN1Object -1051 * @description -1052 * <br/> -1053 * As for argument 'params' for constructor, you can specify one of -1054 * following properties: -1055 * <ul> -1056 * <li>oid - specify initial ASN.1 value(V) by a oid string (ex. 2.5.4.13)</li> -1057 * <li>hex - specify initial ASN.1 value(V) by a hexadecimal string</li> -1058 * </ul> -1059 * NOTE: 'params' can be omitted. -1060 */ -1061 KJUR.asn1.DERObjectIdentifier = function(params) { -1062 var itox = function(i) { -1063 var h = i.toString(16); -1064 if (h.length == 1) h = '0' + h; -1065 return h; -1066 }; -1067 var roidtox = function(roid) { -1068 var h = ''; -1069 var bi = new BigInteger(roid, 10); -1070 var b = bi.toString(2); -1071 var padLen = 7 - b.length % 7; -1072 if (padLen == 7) padLen = 0; -1073 var bPad = ''; -1074 for (var i = 0; i < padLen; i++) bPad += '0'; -1075 b = bPad + b; -1076 for (var i = 0; i < b.length - 1; i += 7) { -1077 var b8 = b.substr(i, 7); -1078 if (i != b.length - 7) b8 = '1' + b8; -1079 h += itox(parseInt(b8, 2)); -1080 } -1081 return h; -1082 } -1083 -1084 KJUR.asn1.DERObjectIdentifier.superclass.constructor.call(this); -1085 this.hT = "06"; -1086 -1087 /** -1088 * set value by a hexadecimal string -1089 * @name setValueHex -1090 * @memberOf KJUR.asn1.DERObjectIdentifier -1091 * @function -1092 * @param {String} newHexString hexadecimal value of OID bytes -1093 */ -1094 this.setValueHex = function(newHexString) { -1095 this.hTLV = null; -1096 this.isModified = true; -1097 this.s = null; -1098 this.hV = newHexString; -1099 }; -1100 -1101 /** -1102 * set value by a OID string -1103 * @name setValueOidString -1104 * @memberOf KJUR.asn1.DERObjectIdentifier -1105 * @function -1106 * @param {String} oidString OID string (ex. 2.5.4.13) -1107 */ -1108 this.setValueOidString = function(oidString) { -1109 if (! oidString.match(/^[0-9.]+$/)) { -1110 throw "malformed oid string: " + oidString; -1111 } -1112 var h = ''; -1113 var a = oidString.split('.'); -1114 var i0 = parseInt(a[0]) * 40 + parseInt(a[1]); -1115 h += itox(i0); -1116 a.splice(0, 2); -1117 for (var i = 0; i < a.length; i++) { -1118 h += roidtox(a[i]); -1119 } -1120 this.hTLV = null; -1121 this.isModified = true; -1122 this.s = null; -1123 this.hV = h; -1124 }; -1125 -1126 /** -1127 * set value by a OID name -1128 * @name setValueName -1129 * @memberOf KJUR.asn1.DERObjectIdentifier -1130 * @function -1131 * @param {String} oidName OID name (ex. 'serverAuth') -1132 * @since 1.0.1 -1133 * @description -1134 * OID name shall be defined in 'KJUR.asn1.x509.OID.name2oidList'. -1135 * Otherwise raise error. -1136 */ -1137 this.setValueName = function(oidName) { -1138 var oid = KJUR.asn1.x509.OID.name2oid(oidName); -1139 if (oid !== '') { -1140 this.setValueOidString(oid); -1141 } else { -1142 throw "DERObjectIdentifier oidName undefined: " + oidName; -1143 } -1144 }; -1145 -1146 this.getFreshValueHex = function() { -1147 return this.hV; -1148 }; -1149 -1150 if (params !== undefined) { -1151 if (typeof params === "string") { -1152 if (params.match(/^[0-2].[0-9.]+$/)) { -1153 this.setValueOidString(params); -1154 } else { -1155 this.setValueName(params); -1156 } -1157 } else if (params.oid !== undefined) { -1158 this.setValueOidString(params.oid); -1159 } else if (params.hex !== undefined) { -1160 this.setValueHex(params.hex); -1161 } else if (params.name !== undefined) { -1162 this.setValueName(params.name); -1163 } -1164 } -1165 }; -1166 YAHOO.lang.extend(KJUR.asn1.DERObjectIdentifier, KJUR.asn1.ASN1Object); -1167 -1168 // ******************************************************************** -1169 /** -1170 * class for ASN.1 DER Enumerated -1171 * @name KJUR.asn1.DEREnumerated -1172 * @class class for ASN.1 DER Enumerated -1173 * @extends KJUR.asn1.ASN1Object -1174 * @description -1175 * <br/> -1176 * As for argument 'params' for constructor, you can specify one of -1177 * following properties: -1178 * <ul> -1179 * <li>int - specify initial ASN.1 value(V) by integer value</li> -1180 * <li>hex - specify initial ASN.1 value(V) by a hexadecimal string</li> -1181 * </ul> -1182 * NOTE: 'params' can be omitted. -1183 */ -1184 KJUR.asn1.DEREnumerated = function(params) { -1185 KJUR.asn1.DEREnumerated.superclass.constructor.call(this); -1186 this.hT = "0a"; -1187 -1188 /** -1189 * set value by Tom Wu's BigInteger object -1190 * @name setByBigInteger -1191 * @memberOf KJUR.asn1.DEREnumerated -1192 * @function -1193 * @param {BigInteger} bigIntegerValue to set -1194 */ -1195 this.setByBigInteger = function(bigIntegerValue) { -1196 this.hTLV = null; -1197 this.isModified = true; -1198 this.hV = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(bigIntegerValue); -1199 }; -1200 -1201 /** -1202 * set value by integer value -1203 * @name setByInteger -1204 * @memberOf KJUR.asn1.DEREnumerated -1205 * @function -1206 * @param {Integer} integer value to set -1207 */ -1208 this.setByInteger = function(intValue) { -1209 var bi = new BigInteger(String(intValue), 10); -1210 this.setByBigInteger(bi); -1211 }; -1212 -1213 /** -1214 * set value by integer value -1215 * @name setValueHex -1216 * @memberOf KJUR.asn1.DEREnumerated -1217 * @function -1218 * @param {String} hexadecimal string of integer value -1219 * @description -1220 * <br/> -1221 * NOTE: Value shall be represented by minimum octet length of -1222 * two's complement representation. -1223 * @example -1224 * new KJUR.asn1.DEREnumerated(123); -1225 * new KJUR.asn1.DEREnumerated({int: 123}); -1226 * new KJUR.asn1.DEREnumerated({hex: '1fad'}); -1227 */ -1228 this.setValueHex = function(newHexString) { -1229 this.hV = newHexString; +904 * @example +905 * o = new KJUR.asn1.DERBitString(); +906 * o.setByBooleanArray("01011"); +907 */ +908 this.setByBinaryString = function(binaryString) { +909 binaryString = binaryString.replace(/0+$/, ''); +910 var unusedBits = 8 - binaryString.length % 8; +911 if (unusedBits == 8) unusedBits = 0; +912 for (var i = 0; i <= unusedBits; i++) { +913 binaryString += '0'; +914 } +915 var h = ''; +916 for (var i = 0; i < binaryString.length - 1; i += 8) { +917 var b = binaryString.substr(i, 8); +918 var x = parseInt(b, 2).toString(16); +919 if (x.length == 1) x = '0' + x; +920 h += x; +921 } +922 this.hTLV = null; +923 this.isModified = true; +924 this.hV = '0' + unusedBits + h; +925 }; +926 +927 /** +928 * set ASN.1 TLV value(V) by an array of boolean<br/> +929 * @name setByBooleanArray +930 * @memberOf KJUR.asn1.DERBitString# +931 * @function +932 * @param {array} booleanArray array of boolean (ex. [true, false, true]) +933 * @description +934 * NOTE: Trailing falses will be ignored in the ASN.1 DER Object. +935 * @example +936 * o = new KJUR.asn1.DERBitString(); +937 * o.setByBooleanArray([false, true, false, true, true]); +938 */ +939 this.setByBooleanArray = function(booleanArray) { +940 var s = ''; +941 for (var i = 0; i < booleanArray.length; i++) { +942 if (booleanArray[i] == true) { +943 s += '1'; +944 } else { +945 s += '0'; +946 } +947 } +948 this.setByBinaryString(s); +949 }; +950 +951 /** +952 * generate an array of falses with specified length<br/> +953 * @name newFalseArray +954 * @memberOf KJUR.asn1.DERBitString +955 * @function +956 * @param {Integer} nLength length of array to generate +957 * @return {array} array of boolean falses +958 * @description +959 * This static method may be useful to initialize boolean array. +960 * @example +961 * o = new KJUR.asn1.DERBitString(); +962 * o.newFalseArray(3) → [false, false, false] +963 */ +964 this.newFalseArray = function(nLength) { +965 var a = new Array(nLength); +966 for (var i = 0; i < nLength; i++) { +967 a[i] = false; +968 } +969 return a; +970 }; +971 +972 this.getFreshValueHex = function() { +973 return this.hV; +974 }; +975 +976 if (typeof params != "undefined") { +977 if (typeof params == "string" && params.toLowerCase().match(/^[0-9a-f]+$/)) { +978 this.setHexValueIncludingUnusedBits(params); +979 } else if (typeof params['hex'] != "undefined") { +980 this.setHexValueIncludingUnusedBits(params['hex']); +981 } else if (typeof params['bin'] != "undefined") { +982 this.setByBinaryString(params['bin']); +983 } else if (typeof params['array'] != "undefined") { +984 this.setByBooleanArray(params['array']); +985 } +986 } +987 }; +988 YAHOO.lang.extend(KJUR.asn1.DERBitString, KJUR.asn1.ASN1Object); +989 +990 // ******************************************************************** +991 /** +992 * class for ASN.1 DER OctetString<br/> +993 * @name KJUR.asn1.DEROctetString +994 * @class class for ASN.1 DER OctetString +995 * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) +996 * @extends KJUR.asn1.DERAbstractString +997 * @description +998 * This class provides ASN.1 OctetString simple type.<br/> +999 * Supported "params" attributes are: +1000 * <ul> +1001 * <li>str - to set a string as a value</li> +1002 * <li>hex - to set a hexadecimal string as a value</li> +1003 * <li>obj - to set a encapsulated ASN.1 value by JSON object +1004 * which is defined in {@link KJUR.asn1.ASN1Util.newObject}</li> +1005 * </ul> +1006 * NOTE: A parameter 'obj' have been supported +1007 * for "OCTET STRING, encapsulates" structure. +1008 * since asn1 1.0.11, jsrsasign 6.1.1 (2016-Sep-25). +1009 * @see KJUR.asn1.DERAbstractString - superclass +1010 * @example +1011 * // default constructor +1012 * o = new KJUR.asn1.DEROctetString(); +1013 * // initialize with string +1014 * o = new KJUR.asn1.DEROctetString({str: "aaa"}); +1015 * // initialize with hexadecimal string +1016 * o = new KJUR.asn1.DEROctetString({hex: "616161"}); +1017 * // initialize with ASN1Util.newObject argument +1018 * o = new KJUR.asn1.DEROctetString({obj: {seq: [{int: 3}, {prnstr: 'aaa'}]}}); +1019 * // above generates a ASN.1 data like this: +1020 * // OCTET STRING, encapsulates { +1021 * // SEQUENCE { +1022 * // INTEGER 3 +1023 * // PrintableString 'aaa' +1024 * // } +1025 * // } +1026 */ +1027 KJUR.asn1.DEROctetString = function(params) { +1028 if (params !== undefined && typeof params.obj !== "undefined") { +1029 var o = KJUR.asn1.ASN1Util.newObject(params.obj); +1030 params.hex = o.getEncodedHex(); +1031 } +1032 KJUR.asn1.DEROctetString.superclass.constructor.call(this, params); +1033 this.hT = "04"; +1034 }; +1035 YAHOO.lang.extend(KJUR.asn1.DEROctetString, KJUR.asn1.DERAbstractString); +1036 +1037 // ******************************************************************** +1038 /** +1039 * class for ASN.1 DER Null +1040 * @name KJUR.asn1.DERNull +1041 * @class class for ASN.1 DER Null +1042 * @extends KJUR.asn1.ASN1Object +1043 * @description +1044 * @see KJUR.asn1.ASN1Object - superclass +1045 */ +1046 KJUR.asn1.DERNull = function() { +1047 KJUR.asn1.DERNull.superclass.constructor.call(this); +1048 this.hT = "05"; +1049 this.hTLV = "0500"; +1050 }; +1051 YAHOO.lang.extend(KJUR.asn1.DERNull, KJUR.asn1.ASN1Object); +1052 +1053 // ******************************************************************** +1054 /** +1055 * class for ASN.1 DER ObjectIdentifier +1056 * @name KJUR.asn1.DERObjectIdentifier +1057 * @class class for ASN.1 DER ObjectIdentifier +1058 * @param {Array} params associative array of parameters (ex. {'oid': '2.5.4.5'}) +1059 * @extends KJUR.asn1.ASN1Object +1060 * @description +1061 * <br/> +1062 * As for argument 'params' for constructor, you can specify one of +1063 * following properties: +1064 * <ul> +1065 * <li>oid - specify initial ASN.1 value(V) by a oid string (ex. 2.5.4.13)</li> +1066 * <li>hex - specify initial ASN.1 value(V) by a hexadecimal string</li> +1067 * </ul> +1068 * NOTE: 'params' can be omitted. +1069 */ +1070 KJUR.asn1.DERObjectIdentifier = function(params) { +1071 var itox = function(i) { +1072 var h = i.toString(16); +1073 if (h.length == 1) h = '0' + h; +1074 return h; +1075 }; +1076 var roidtox = function(roid) { +1077 var h = ''; +1078 var bi = new BigInteger(roid, 10); +1079 var b = bi.toString(2); +1080 var padLen = 7 - b.length % 7; +1081 if (padLen == 7) padLen = 0; +1082 var bPad = ''; +1083 for (var i = 0; i < padLen; i++) bPad += '0'; +1084 b = bPad + b; +1085 for (var i = 0; i < b.length - 1; i += 7) { +1086 var b8 = b.substr(i, 7); +1087 if (i != b.length - 7) b8 = '1' + b8; +1088 h += itox(parseInt(b8, 2)); +1089 } +1090 return h; +1091 } +1092 +1093 KJUR.asn1.DERObjectIdentifier.superclass.constructor.call(this); +1094 this.hT = "06"; +1095 +1096 /** +1097 * set value by a hexadecimal string +1098 * @name setValueHex +1099 * @memberOf KJUR.asn1.DERObjectIdentifier# +1100 * @function +1101 * @param {String} newHexString hexadecimal value of OID bytes +1102 */ +1103 this.setValueHex = function(newHexString) { +1104 this.hTLV = null; +1105 this.isModified = true; +1106 this.s = null; +1107 this.hV = newHexString; +1108 }; +1109 +1110 /** +1111 * set value by a OID string<br/> +1112 * @name setValueOidString +1113 * @memberOf KJUR.asn1.DERObjectIdentifier# +1114 * @function +1115 * @param {String} oidString OID string (ex. 2.5.4.13) +1116 * @example +1117 * o = new KJUR.asn1.DERObjectIdentifier(); +1118 * o.setValueOidString("2.5.4.13"); +1119 */ +1120 this.setValueOidString = function(oidString) { +1121 if (! oidString.match(/^[0-9.]+$/)) { +1122 throw "malformed oid string: " + oidString; +1123 } +1124 var h = ''; +1125 var a = oidString.split('.'); +1126 var i0 = parseInt(a[0]) * 40 + parseInt(a[1]); +1127 h += itox(i0); +1128 a.splice(0, 2); +1129 for (var i = 0; i < a.length; i++) { +1130 h += roidtox(a[i]); +1131 } +1132 this.hTLV = null; +1133 this.isModified = true; +1134 this.s = null; +1135 this.hV = h; +1136 }; +1137 +1138 /** +1139 * set value by a OID name +1140 * @name setValueName +1141 * @memberOf KJUR.asn1.DERObjectIdentifier# +1142 * @function +1143 * @param {String} oidName OID name (ex. 'serverAuth') +1144 * @since 1.0.1 +1145 * @description +1146 * OID name shall be defined in 'KJUR.asn1.x509.OID.name2oidList'. +1147 * Otherwise raise error. +1148 * @example +1149 * o = new KJUR.asn1.DERObjectIdentifier(); +1150 * o.setValueName("serverAuth"); +1151 */ +1152 this.setValueName = function(oidName) { +1153 var oid = KJUR.asn1.x509.OID.name2oid(oidName); +1154 if (oid !== '') { +1155 this.setValueOidString(oid); +1156 } else { +1157 throw "DERObjectIdentifier oidName undefined: " + oidName; +1158 } +1159 }; +1160 +1161 this.getFreshValueHex = function() { +1162 return this.hV; +1163 }; +1164 +1165 if (params !== undefined) { +1166 if (typeof params === "string") { +1167 if (params.match(/^[0-2].[0-9.]+$/)) { +1168 this.setValueOidString(params); +1169 } else { +1170 this.setValueName(params); +1171 } +1172 } else if (params.oid !== undefined) { +1173 this.setValueOidString(params.oid); +1174 } else if (params.hex !== undefined) { +1175 this.setValueHex(params.hex); +1176 } else if (params.name !== undefined) { +1177 this.setValueName(params.name); +1178 } +1179 } +1180 }; +1181 YAHOO.lang.extend(KJUR.asn1.DERObjectIdentifier, KJUR.asn1.ASN1Object); +1182 +1183 // ******************************************************************** +1184 /** +1185 * class for ASN.1 DER Enumerated +1186 * @name KJUR.asn1.DEREnumerated +1187 * @class class for ASN.1 DER Enumerated +1188 * @extends KJUR.asn1.ASN1Object +1189 * @description +1190 * <br/> +1191 * As for argument 'params' for constructor, you can specify one of +1192 * following properties: +1193 * <ul> +1194 * <li>int - specify initial ASN.1 value(V) by integer value</li> +1195 * <li>hex - specify initial ASN.1 value(V) by a hexadecimal string</li> +1196 * </ul> +1197 * NOTE: 'params' can be omitted. +1198 * @example +1199 * new KJUR.asn1.DEREnumerated(123); +1200 * new KJUR.asn1.DEREnumerated({int: 123}); +1201 * new KJUR.asn1.DEREnumerated({hex: '1fad'}); +1202 */ +1203 KJUR.asn1.DEREnumerated = function(params) { +1204 KJUR.asn1.DEREnumerated.superclass.constructor.call(this); +1205 this.hT = "0a"; +1206 +1207 /** +1208 * set value by Tom Wu's BigInteger object +1209 * @name setByBigInteger +1210 * @memberOf KJUR.asn1.DEREnumerated# +1211 * @function +1212 * @param {BigInteger} bigIntegerValue to set +1213 */ +1214 this.setByBigInteger = function(bigIntegerValue) { +1215 this.hTLV = null; +1216 this.isModified = true; +1217 this.hV = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(bigIntegerValue); +1218 }; +1219 +1220 /** +1221 * set value by integer value +1222 * @name setByInteger +1223 * @memberOf KJUR.asn1.DEREnumerated# +1224 * @function +1225 * @param {Integer} integer value to set +1226 */ +1227 this.setByInteger = function(intValue) { +1228 var bi = new BigInteger(String(intValue), 10); +1229 this.setByBigInteger(bi); 1230 }; 1231 -1232 this.getFreshValueHex = function() { -1233 return this.hV; -1234 }; -1235 -1236 if (typeof params != "undefined") { -1237 if (typeof params['int'] != "undefined") { -1238 this.setByInteger(params['int']); -1239 } else if (typeof params == "number") { -1240 this.setByInteger(params); -1241 } else if (typeof params['hex'] != "undefined") { -1242 this.setValueHex(params['hex']); -1243 } -1244 } -1245 }; -1246 YAHOO.lang.extend(KJUR.asn1.DEREnumerated, KJUR.asn1.ASN1Object); -1247 -1248 // ******************************************************************** -1249 /** -1250 * class for ASN.1 DER UTF8String -1251 * @name KJUR.asn1.DERUTF8String -1252 * @class class for ASN.1 DER UTF8String -1253 * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) -1254 * @extends KJUR.asn1.DERAbstractString -1255 * @description -1256 * @see KJUR.asn1.DERAbstractString - superclass -1257 */ -1258 KJUR.asn1.DERUTF8String = function(params) { -1259 KJUR.asn1.DERUTF8String.superclass.constructor.call(this, params); -1260 this.hT = "0c"; -1261 }; -1262 YAHOO.lang.extend(KJUR.asn1.DERUTF8String, KJUR.asn1.DERAbstractString); -1263 -1264 // ******************************************************************** -1265 /** -1266 * class for ASN.1 DER NumericString -1267 * @name KJUR.asn1.DERNumericString -1268 * @class class for ASN.1 DER NumericString -1269 * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) -1270 * @extends KJUR.asn1.DERAbstractString -1271 * @description -1272 * @see KJUR.asn1.DERAbstractString - superclass -1273 */ -1274 KJUR.asn1.DERNumericString = function(params) { -1275 KJUR.asn1.DERNumericString.superclass.constructor.call(this, params); -1276 this.hT = "12"; -1277 }; -1278 YAHOO.lang.extend(KJUR.asn1.DERNumericString, KJUR.asn1.DERAbstractString); -1279 -1280 // ******************************************************************** -1281 /** -1282 * class for ASN.1 DER PrintableString -1283 * @name KJUR.asn1.DERPrintableString -1284 * @class class for ASN.1 DER PrintableString -1285 * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) -1286 * @extends KJUR.asn1.DERAbstractString -1287 * @description -1288 * @see KJUR.asn1.DERAbstractString - superclass -1289 */ -1290 KJUR.asn1.DERPrintableString = function(params) { -1291 KJUR.asn1.DERPrintableString.superclass.constructor.call(this, params); -1292 this.hT = "13"; -1293 }; -1294 YAHOO.lang.extend(KJUR.asn1.DERPrintableString, KJUR.asn1.DERAbstractString); -1295 -1296 // ******************************************************************** -1297 /** -1298 * class for ASN.1 DER TeletexString -1299 * @name KJUR.asn1.DERTeletexString -1300 * @class class for ASN.1 DER TeletexString -1301 * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) -1302 * @extends KJUR.asn1.DERAbstractString -1303 * @description -1304 * @see KJUR.asn1.DERAbstractString - superclass -1305 */ -1306 KJUR.asn1.DERTeletexString = function(params) { -1307 KJUR.asn1.DERTeletexString.superclass.constructor.call(this, params); -1308 this.hT = "14"; -1309 }; -1310 YAHOO.lang.extend(KJUR.asn1.DERTeletexString, KJUR.asn1.DERAbstractString); -1311 -1312 // ******************************************************************** -1313 /** -1314 * class for ASN.1 DER IA5String -1315 * @name KJUR.asn1.DERIA5String -1316 * @class class for ASN.1 DER IA5String -1317 * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) -1318 * @extends KJUR.asn1.DERAbstractString -1319 * @description -1320 * @see KJUR.asn1.DERAbstractString - superclass -1321 */ -1322 KJUR.asn1.DERIA5String = function(params) { -1323 KJUR.asn1.DERIA5String.superclass.constructor.call(this, params); -1324 this.hT = "16"; -1325 }; -1326 YAHOO.lang.extend(KJUR.asn1.DERIA5String, KJUR.asn1.DERAbstractString); -1327 -1328 // ******************************************************************** -1329 /** -1330 * class for ASN.1 DER UTCTime -1331 * @name KJUR.asn1.DERUTCTime -1332 * @class class for ASN.1 DER UTCTime -1333 * @param {Array} params associative array of parameters (ex. {'str': '130430235959Z'}) -1334 * @extends KJUR.asn1.DERAbstractTime -1335 * @description -1336 * <br/> -1337 * As for argument 'params' for constructor, you can specify one of -1338 * following properties: -1339 * <ul> -1340 * <li>str - specify initial ASN.1 value(V) by a string (ex.'130430235959Z')</li> -1341 * <li>hex - specify initial ASN.1 value(V) by a hexadecimal string</li> -1342 * <li>date - specify Date object.</li> -1343 * </ul> -1344 * NOTE: 'params' can be omitted. -1345 * <h4>EXAMPLES</h4> -1346 * @example -1347 * var d1 = new KJUR.asn1.DERUTCTime(); -1348 * d1.setString('130430125959Z'); -1349 * -1350 * var d2 = new KJUR.asn1.DERUTCTime({'str': '130430125959Z'}); -1351 * var d3 = new KJUR.asn1.DERUTCTime({'date': new Date(Date.UTC(2015, 0, 31, 0, 0, 0, 0))}); -1352 * var d4 = new KJUR.asn1.DERUTCTime('130430125959Z'); -1353 */ -1354 KJUR.asn1.DERUTCTime = function(params) { -1355 KJUR.asn1.DERUTCTime.superclass.constructor.call(this, params); -1356 this.hT = "17"; -1357 -1358 /** -1359 * set value by a Date object -1360 * @name setByDate -1361 * @memberOf KJUR.asn1.DERUTCTime -1362 * @function -1363 * @param {Date} dateObject Date object to set ASN.1 value(V) -1364 */ -1365 this.setByDate = function(dateObject) { -1366 this.hTLV = null; -1367 this.isModified = true; -1368 this.date = dateObject; -1369 this.s = this.formatDate(this.date, 'utc'); -1370 this.hV = stohex(this.s); -1371 }; +1232 /** +1233 * set value by integer value +1234 * @name setValueHex +1235 * @memberOf KJUR.asn1.DEREnumerated# +1236 * @function +1237 * @param {String} hexadecimal string of integer value +1238 * @description +1239 * <br/> +1240 * NOTE: Value shall be represented by minimum octet length of +1241 * two's complement representation. +1242 */ +1243 this.setValueHex = function(newHexString) { +1244 this.hV = newHexString; +1245 }; +1246 +1247 this.getFreshValueHex = function() { +1248 return this.hV; +1249 }; +1250 +1251 if (typeof params != "undefined") { +1252 if (typeof params['int'] != "undefined") { +1253 this.setByInteger(params['int']); +1254 } else if (typeof params == "number") { +1255 this.setByInteger(params); +1256 } else if (typeof params['hex'] != "undefined") { +1257 this.setValueHex(params['hex']); +1258 } +1259 } +1260 }; +1261 YAHOO.lang.extend(KJUR.asn1.DEREnumerated, KJUR.asn1.ASN1Object); +1262 +1263 // ******************************************************************** +1264 /** +1265 * class for ASN.1 DER UTF8String +1266 * @name KJUR.asn1.DERUTF8String +1267 * @class class for ASN.1 DER UTF8String +1268 * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) +1269 * @extends KJUR.asn1.DERAbstractString +1270 * @description +1271 * @see KJUR.asn1.DERAbstractString - superclass +1272 */ +1273 KJUR.asn1.DERUTF8String = function(params) { +1274 KJUR.asn1.DERUTF8String.superclass.constructor.call(this, params); +1275 this.hT = "0c"; +1276 }; +1277 YAHOO.lang.extend(KJUR.asn1.DERUTF8String, KJUR.asn1.DERAbstractString); +1278 +1279 // ******************************************************************** +1280 /** +1281 * class for ASN.1 DER NumericString +1282 * @name KJUR.asn1.DERNumericString +1283 * @class class for ASN.1 DER NumericString +1284 * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) +1285 * @extends KJUR.asn1.DERAbstractString +1286 * @description +1287 * @see KJUR.asn1.DERAbstractString - superclass +1288 */ +1289 KJUR.asn1.DERNumericString = function(params) { +1290 KJUR.asn1.DERNumericString.superclass.constructor.call(this, params); +1291 this.hT = "12"; +1292 }; +1293 YAHOO.lang.extend(KJUR.asn1.DERNumericString, KJUR.asn1.DERAbstractString); +1294 +1295 // ******************************************************************** +1296 /** +1297 * class for ASN.1 DER PrintableString +1298 * @name KJUR.asn1.DERPrintableString +1299 * @class class for ASN.1 DER PrintableString +1300 * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) +1301 * @extends KJUR.asn1.DERAbstractString +1302 * @description +1303 * @see KJUR.asn1.DERAbstractString - superclass +1304 */ +1305 KJUR.asn1.DERPrintableString = function(params) { +1306 KJUR.asn1.DERPrintableString.superclass.constructor.call(this, params); +1307 this.hT = "13"; +1308 }; +1309 YAHOO.lang.extend(KJUR.asn1.DERPrintableString, KJUR.asn1.DERAbstractString); +1310 +1311 // ******************************************************************** +1312 /** +1313 * class for ASN.1 DER TeletexString +1314 * @name KJUR.asn1.DERTeletexString +1315 * @class class for ASN.1 DER TeletexString +1316 * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) +1317 * @extends KJUR.asn1.DERAbstractString +1318 * @description +1319 * @see KJUR.asn1.DERAbstractString - superclass +1320 */ +1321 KJUR.asn1.DERTeletexString = function(params) { +1322 KJUR.asn1.DERTeletexString.superclass.constructor.call(this, params); +1323 this.hT = "14"; +1324 }; +1325 YAHOO.lang.extend(KJUR.asn1.DERTeletexString, KJUR.asn1.DERAbstractString); +1326 +1327 // ******************************************************************** +1328 /** +1329 * class for ASN.1 DER IA5String +1330 * @name KJUR.asn1.DERIA5String +1331 * @class class for ASN.1 DER IA5String +1332 * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) +1333 * @extends KJUR.asn1.DERAbstractString +1334 * @description +1335 * @see KJUR.asn1.DERAbstractString - superclass +1336 */ +1337 KJUR.asn1.DERIA5String = function(params) { +1338 KJUR.asn1.DERIA5String.superclass.constructor.call(this, params); +1339 this.hT = "16"; +1340 }; +1341 YAHOO.lang.extend(KJUR.asn1.DERIA5String, KJUR.asn1.DERAbstractString); +1342 +1343 // ******************************************************************** +1344 /** +1345 * class for ASN.1 DER UTCTime +1346 * @name KJUR.asn1.DERUTCTime +1347 * @class class for ASN.1 DER UTCTime +1348 * @param {Array} params associative array of parameters (ex. {'str': '130430235959Z'}) +1349 * @extends KJUR.asn1.DERAbstractTime +1350 * @description +1351 * <br/> +1352 * As for argument 'params' for constructor, you can specify one of +1353 * following properties: +1354 * <ul> +1355 * <li>str - specify initial ASN.1 value(V) by a string (ex.'130430235959Z')</li> +1356 * <li>hex - specify initial ASN.1 value(V) by a hexadecimal string</li> +1357 * <li>date - specify Date object.</li> +1358 * </ul> +1359 * NOTE: 'params' can be omitted. +1360 * <h4>EXAMPLES</h4> +1361 * @example +1362 * d1 = new KJUR.asn1.DERUTCTime(); +1363 * d1.setString('130430125959Z'); +1364 * +1365 * d2 = new KJUR.asn1.DERUTCTime({'str': '130430125959Z'}); +1366 * d3 = new KJUR.asn1.DERUTCTime({'date': new Date(Date.UTC(2015, 0, 31, 0, 0, 0, 0))}); +1367 * d4 = new KJUR.asn1.DERUTCTime('130430125959Z'); +1368 */ +1369 KJUR.asn1.DERUTCTime = function(params) { +1370 KJUR.asn1.DERUTCTime.superclass.constructor.call(this, params); +1371 this.hT = "17"; 1372 -1373 this.getFreshValueHex = function() { -1374 if (typeof this.date == "undefined" && typeof this.s == "undefined") { -1375 this.date = new Date(); -1376 this.s = this.formatDate(this.date, 'utc'); -1377 this.hV = stohex(this.s); -1378 } -1379 return this.hV; -1380 }; -1381 -1382 if (params !== undefined) { -1383 if (params.str !== undefined) { -1384 this.setString(params.str); -1385 } else if (typeof params == "string" && params.match(/^[0-9]{12}Z$/)) { -1386 this.setString(params); -1387 } else if (params.hex !== undefined) { -1388 this.setStringHex(params.hex); -1389 } else if (params.date !== undefined) { -1390 this.setByDate(params.date); -1391 } -1392 } -1393 }; -1394 YAHOO.lang.extend(KJUR.asn1.DERUTCTime, KJUR.asn1.DERAbstractTime); -1395 -1396 // ******************************************************************** -1397 /** -1398 * class for ASN.1 DER GeneralizedTime -1399 * @name KJUR.asn1.DERGeneralizedTime -1400 * @class class for ASN.1 DER GeneralizedTime -1401 * @param {Array} params associative array of parameters (ex. {'str': '20130430235959Z'}) -1402 * @property {Boolean} withMillis flag to show milliseconds or not -1403 * @extends KJUR.asn1.DERAbstractTime -1404 * @description -1405 * <br/> -1406 * As for argument 'params' for constructor, you can specify one of -1407 * following properties: -1408 * <ul> -1409 * <li>str - specify initial ASN.1 value(V) by a string (ex.'20130430235959Z')</li> -1410 * <li>hex - specify initial ASN.1 value(V) by a hexadecimal string</li> -1411 * <li>date - specify Date object.</li> -1412 * <li>millis - specify flag to show milliseconds (from 1.0.6)</li> -1413 * </ul> -1414 * NOTE1: 'params' can be omitted. -1415 * NOTE2: 'withMillis' property is supported from asn1 1.0.6. -1416 */ -1417 KJUR.asn1.DERGeneralizedTime = function(params) { -1418 KJUR.asn1.DERGeneralizedTime.superclass.constructor.call(this, params); -1419 this.hT = "18"; -1420 this.withMillis = false; -1421 -1422 /** -1423 * set value by a Date object -1424 * @name setByDate -1425 * @memberOf KJUR.asn1.DERGeneralizedTime -1426 * @function -1427 * @param {Date} dateObject Date object to set ASN.1 value(V) -1428 * @example -1429 * When you specify UTC time, use 'Date.UTC' method like this:<br/> -1430 * var o = new DERUTCTime(); -1431 * var date = new Date(Date.UTC(2015, 0, 31, 23, 59, 59, 0)); #2015JAN31 23:59:59 -1432 * o.setByDate(date); -1433 */ -1434 this.setByDate = function(dateObject) { -1435 this.hTLV = null; -1436 this.isModified = true; -1437 this.date = dateObject; -1438 this.s = this.formatDate(this.date, 'gen', this.withMillis); -1439 this.hV = stohex(this.s); -1440 }; -1441 -1442 this.getFreshValueHex = function() { -1443 if (this.date === undefined && this.s === undefined) { -1444 this.date = new Date(); -1445 this.s = this.formatDate(this.date, 'gen', this.withMillis); -1446 this.hV = stohex(this.s); -1447 } -1448 return this.hV; -1449 }; -1450 -1451 if (params !== undefined) { -1452 if (params.str !== undefined) { -1453 this.setString(params.str); -1454 } else if (typeof params == "string" && params.match(/^[0-9]{14}Z$/)) { -1455 this.setString(params); -1456 } else if (params.hex !== undefined) { -1457 this.setStringHex(params.hex); -1458 } else if (params.date !== undefined) { -1459 this.setByDate(params.date); -1460 } -1461 if (params.millis === true) { -1462 this.withMillis = true; -1463 } -1464 } -1465 }; -1466 YAHOO.lang.extend(KJUR.asn1.DERGeneralizedTime, KJUR.asn1.DERAbstractTime); -1467 -1468 // ******************************************************************** -1469 /** -1470 * class for ASN.1 DER Sequence -1471 * @name KJUR.asn1.DERSequence -1472 * @class class for ASN.1 DER Sequence -1473 * @extends KJUR.asn1.DERAbstractStructured -1474 * @description -1475 * <br/> -1476 * As for argument 'params' for constructor, you can specify one of -1477 * following properties: -1478 * <ul> -1479 * <li>array - specify array of ASN1Object to set elements of content</li> -1480 * </ul> -1481 * NOTE: 'params' can be omitted. -1482 */ -1483 KJUR.asn1.DERSequence = function(params) { -1484 KJUR.asn1.DERSequence.superclass.constructor.call(this, params); -1485 this.hT = "30"; -1486 this.getFreshValueHex = function() { -1487 var h = ''; -1488 for (var i = 0; i < this.asn1Array.length; i++) { -1489 var asn1Obj = this.asn1Array[i]; -1490 h += asn1Obj.getEncodedHex(); -1491 } -1492 this.hV = h; -1493 return this.hV; -1494 }; -1495 }; -1496 YAHOO.lang.extend(KJUR.asn1.DERSequence, KJUR.asn1.DERAbstractStructured); -1497 -1498 // ******************************************************************** -1499 /** -1500 * class for ASN.1 DER Set -1501 * @name KJUR.asn1.DERSet -1502 * @class class for ASN.1 DER Set -1503 * @extends KJUR.asn1.DERAbstractStructured -1504 * @description -1505 * <br/> -1506 * As for argument 'params' for constructor, you can specify one of -1507 * following properties: -1508 * <ul> -1509 * <li>array - specify array of ASN1Object to set elements of content</li> -1510 * <li>sortflag - flag for sort (default: true). ASN.1 BER is not sorted in 'SET OF'.</li> -1511 * </ul> -1512 * NOTE1: 'params' can be omitted.<br/> -1513 * NOTE2: sortflag is supported since 1.0.5. -1514 */ -1515 KJUR.asn1.DERSet = function(params) { -1516 KJUR.asn1.DERSet.superclass.constructor.call(this, params); -1517 this.hT = "31"; -1518 this.sortFlag = true; // item shall be sorted only in ASN.1 DER -1519 this.getFreshValueHex = function() { -1520 var a = new Array(); -1521 for (var i = 0; i < this.asn1Array.length; i++) { -1522 var asn1Obj = this.asn1Array[i]; -1523 a.push(asn1Obj.getEncodedHex()); -1524 } -1525 if (this.sortFlag == true) a.sort(); -1526 this.hV = a.join(''); -1527 return this.hV; -1528 }; -1529 -1530 if (typeof params != "undefined") { -1531 if (typeof params.sortflag != "undefined" && -1532 params.sortflag == false) -1533 this.sortFlag = false; -1534 } -1535 }; -1536 YAHOO.lang.extend(KJUR.asn1.DERSet, KJUR.asn1.DERAbstractStructured); -1537 -1538 // ******************************************************************** -1539 /** -1540 * class for ASN.1 DER TaggedObject -1541 * @name KJUR.asn1.DERTaggedObject -1542 * @class class for ASN.1 DER TaggedObject -1543 * @extends KJUR.asn1.ASN1Object -1544 * @description -1545 * <br/> -1546 * Parameter 'tagNoNex' is ASN.1 tag(T) value for this object. -1547 * For example, if you find '[1]' tag in a ASN.1 dump, -1548 * 'tagNoHex' will be 'a1'. -1549 * <br/> -1550 * As for optional argument 'params' for constructor, you can specify *ANY* of -1551 * following properties: -1552 * <ul> -1553 * <li>explicit - specify true if this is explicit tag otherwise false -1554 * (default is 'true').</li> -1555 * <li>tag - specify tag (default is 'a0' which means [0])</li> -1556 * <li>obj - specify ASN1Object which is tagged</li> -1557 * </ul> -1558 * @example -1559 * d1 = new KJUR.asn1.DERUTF8String({'str':'a'}); -1560 * d2 = new KJUR.asn1.DERTaggedObject({'obj': d1}); -1561 * hex = d2.getEncodedHex(); -1562 */ -1563 KJUR.asn1.DERTaggedObject = function(params) { -1564 KJUR.asn1.DERTaggedObject.superclass.constructor.call(this); -1565 this.hT = "a0"; -1566 this.hV = ''; -1567 this.isExplicit = true; -1568 this.asn1Object = null; -1569 -1570 /** -1571 * set value by an ASN1Object -1572 * @name setString -1573 * @memberOf KJUR.asn1.DERTaggedObject -1574 * @function -1575 * @param {Boolean} isExplicitFlag flag for explicit/implicit tag -1576 * @param {Integer} tagNoHex hexadecimal string of ASN.1 tag -1577 * @param {ASN1Object} asn1Object ASN.1 to encapsulate -1578 */ -1579 this.setASN1Object = function(isExplicitFlag, tagNoHex, asn1Object) { -1580 this.hT = tagNoHex; -1581 this.isExplicit = isExplicitFlag; -1582 this.asn1Object = asn1Object; -1583 if (this.isExplicit) { -1584 this.hV = this.asn1Object.getEncodedHex(); -1585 this.hTLV = null; -1586 this.isModified = true; -1587 } else { -1588 this.hV = null; -1589 this.hTLV = asn1Object.getEncodedHex(); -1590 this.hTLV = this.hTLV.replace(/^../, tagNoHex); -1591 this.isModified = false; -1592 } -1593 }; -1594 -1595 this.getFreshValueHex = function() { -1596 return this.hV; -1597 }; -1598 -1599 if (typeof params != "undefined") { -1600 if (typeof params['tag'] != "undefined") { -1601 this.hT = params['tag']; -1602 } -1603 if (typeof params['explicit'] != "undefined") { -1604 this.isExplicit = params['explicit']; -1605 } -1606 if (typeof params['obj'] != "undefined") { -1607 this.asn1Object = params['obj']; -1608 this.setASN1Object(this.isExplicit, this.hT, this.asn1Object); -1609 } -1610 } -1611 }; -1612 YAHOO.lang.extend(KJUR.asn1.DERTaggedObject, KJUR.asn1.ASN1Object); -1613 \ No newline at end of file +1373 /** +1374 * set value by a Date object<br/> +1375 * @name setByDate +1376 * @memberOf KJUR.asn1.DERUTCTime# +1377 * @function +1378 * @param {Date} dateObject Date object to set ASN.1 value(V) +1379 * @example +1380 * o = new KJUR.asn1.DERUTCTime(); +1381 * o.setByDate(new Date("2016/12/31")); +1382 */ +1383 this.setByDate = function(dateObject) { +1384 this.hTLV = null; +1385 this.isModified = true; +1386 this.date = dateObject; +1387 this.s = this.formatDate(this.date, 'utc'); +1388 this.hV = stohex(this.s); +1389 }; +1390 +1391 this.getFreshValueHex = function() { +1392 if (typeof this.date == "undefined" && typeof this.s == "undefined") { +1393 this.date = new Date(); +1394 this.s = this.formatDate(this.date, 'utc'); +1395 this.hV = stohex(this.s); +1396 } +1397 return this.hV; +1398 }; +1399 +1400 if (params !== undefined) { +1401 if (params.str !== undefined) { +1402 this.setString(params.str); +1403 } else if (typeof params == "string" && params.match(/^[0-9]{12}Z$/)) { +1404 this.setString(params); +1405 } else if (params.hex !== undefined) { +1406 this.setStringHex(params.hex); +1407 } else if (params.date !== undefined) { +1408 this.setByDate(params.date); +1409 } +1410 } +1411 }; +1412 YAHOO.lang.extend(KJUR.asn1.DERUTCTime, KJUR.asn1.DERAbstractTime); +1413 +1414 // ******************************************************************** +1415 /** +1416 * class for ASN.1 DER GeneralizedTime +1417 * @name KJUR.asn1.DERGeneralizedTime +1418 * @class class for ASN.1 DER GeneralizedTime +1419 * @param {Array} params associative array of parameters (ex. {'str': '20130430235959Z'}) +1420 * @property {Boolean} withMillis flag to show milliseconds or not +1421 * @extends KJUR.asn1.DERAbstractTime +1422 * @description +1423 * <br/> +1424 * As for argument 'params' for constructor, you can specify one of +1425 * following properties: +1426 * <ul> +1427 * <li>str - specify initial ASN.1 value(V) by a string (ex.'20130430235959Z')</li> +1428 * <li>hex - specify initial ASN.1 value(V) by a hexadecimal string</li> +1429 * <li>date - specify Date object.</li> +1430 * <li>millis - specify flag to show milliseconds (from 1.0.6)</li> +1431 * </ul> +1432 * NOTE1: 'params' can be omitted. +1433 * NOTE2: 'withMillis' property is supported from asn1 1.0.6. +1434 */ +1435 KJUR.asn1.DERGeneralizedTime = function(params) { +1436 KJUR.asn1.DERGeneralizedTime.superclass.constructor.call(this, params); +1437 this.hT = "18"; +1438 this.withMillis = false; +1439 +1440 /** +1441 * set value by a Date object +1442 * @name setByDate +1443 * @memberOf KJUR.asn1.DERGeneralizedTime# +1444 * @function +1445 * @param {Date} dateObject Date object to set ASN.1 value(V) +1446 * @example +1447 * When you specify UTC time, use 'Date.UTC' method like this:<br/> +1448 * o1 = new DERUTCTime(); +1449 * o1.setByDate(date); +1450 * +1451 * date = new Date(Date.UTC(2015, 0, 31, 23, 59, 59, 0)); #2015JAN31 23:59:59 +1452 */ +1453 this.setByDate = function(dateObject) { +1454 this.hTLV = null; +1455 this.isModified = true; +1456 this.date = dateObject; +1457 this.s = this.formatDate(this.date, 'gen', this.withMillis); +1458 this.hV = stohex(this.s); +1459 }; +1460 +1461 this.getFreshValueHex = function() { +1462 if (this.date === undefined && this.s === undefined) { +1463 this.date = new Date(); +1464 this.s = this.formatDate(this.date, 'gen', this.withMillis); +1465 this.hV = stohex(this.s); +1466 } +1467 return this.hV; +1468 }; +1469 +1470 if (params !== undefined) { +1471 if (params.str !== undefined) { +1472 this.setString(params.str); +1473 } else if (typeof params == "string" && params.match(/^[0-9]{14}Z$/)) { +1474 this.setString(params); +1475 } else if (params.hex !== undefined) { +1476 this.setStringHex(params.hex); +1477 } else if (params.date !== undefined) { +1478 this.setByDate(params.date); +1479 } +1480 if (params.millis === true) { +1481 this.withMillis = true; +1482 } +1483 } +1484 }; +1485 YAHOO.lang.extend(KJUR.asn1.DERGeneralizedTime, KJUR.asn1.DERAbstractTime); +1486 +1487 // ******************************************************************** +1488 /** +1489 * class for ASN.1 DER Sequence +1490 * @name KJUR.asn1.DERSequence +1491 * @class class for ASN.1 DER Sequence +1492 * @extends KJUR.asn1.DERAbstractStructured +1493 * @description +1494 * <br/> +1495 * As for argument 'params' for constructor, you can specify one of +1496 * following properties: +1497 * <ul> +1498 * <li>array - specify array of ASN1Object to set elements of content</li> +1499 * </ul> +1500 * NOTE: 'params' can be omitted. +1501 */ +1502 KJUR.asn1.DERSequence = function(params) { +1503 KJUR.asn1.DERSequence.superclass.constructor.call(this, params); +1504 this.hT = "30"; +1505 this.getFreshValueHex = function() { +1506 var h = ''; +1507 for (var i = 0; i < this.asn1Array.length; i++) { +1508 var asn1Obj = this.asn1Array[i]; +1509 h += asn1Obj.getEncodedHex(); +1510 } +1511 this.hV = h; +1512 return this.hV; +1513 }; +1514 }; +1515 YAHOO.lang.extend(KJUR.asn1.DERSequence, KJUR.asn1.DERAbstractStructured); +1516 +1517 // ******************************************************************** +1518 /** +1519 * class for ASN.1 DER Set +1520 * @name KJUR.asn1.DERSet +1521 * @class class for ASN.1 DER Set +1522 * @extends KJUR.asn1.DERAbstractStructured +1523 * @description +1524 * <br/> +1525 * As for argument 'params' for constructor, you can specify one of +1526 * following properties: +1527 * <ul> +1528 * <li>array - specify array of ASN1Object to set elements of content</li> +1529 * <li>sortflag - flag for sort (default: true). ASN.1 BER is not sorted in 'SET OF'.</li> +1530 * </ul> +1531 * NOTE1: 'params' can be omitted.<br/> +1532 * NOTE2: sortflag is supported since 1.0.5. +1533 */ +1534 KJUR.asn1.DERSet = function(params) { +1535 KJUR.asn1.DERSet.superclass.constructor.call(this, params); +1536 this.hT = "31"; +1537 this.sortFlag = true; // item shall be sorted only in ASN.1 DER +1538 this.getFreshValueHex = function() { +1539 var a = new Array(); +1540 for (var i = 0; i < this.asn1Array.length; i++) { +1541 var asn1Obj = this.asn1Array[i]; +1542 a.push(asn1Obj.getEncodedHex()); +1543 } +1544 if (this.sortFlag == true) a.sort(); +1545 this.hV = a.join(''); +1546 return this.hV; +1547 }; +1548 +1549 if (typeof params != "undefined") { +1550 if (typeof params.sortflag != "undefined" && +1551 params.sortflag == false) +1552 this.sortFlag = false; +1553 } +1554 }; +1555 YAHOO.lang.extend(KJUR.asn1.DERSet, KJUR.asn1.DERAbstractStructured); +1556 +1557 // ******************************************************************** +1558 /** +1559 * class for ASN.1 DER TaggedObject +1560 * @name KJUR.asn1.DERTaggedObject +1561 * @class class for ASN.1 DER TaggedObject +1562 * @extends KJUR.asn1.ASN1Object +1563 * @description +1564 * <br/> +1565 * Parameter 'tagNoNex' is ASN.1 tag(T) value for this object. +1566 * For example, if you find '[1]' tag in a ASN.1 dump, +1567 * 'tagNoHex' will be 'a1'. +1568 * <br/> +1569 * As for optional argument 'params' for constructor, you can specify *ANY* of +1570 * following properties: +1571 * <ul> +1572 * <li>explicit - specify true if this is explicit tag otherwise false +1573 * (default is 'true').</li> +1574 * <li>tag - specify tag (default is 'a0' which means [0])</li> +1575 * <li>obj - specify ASN1Object which is tagged</li> +1576 * </ul> +1577 * @example +1578 * d1 = new KJUR.asn1.DERUTF8String({'str':'a'}); +1579 * d2 = new KJUR.asn1.DERTaggedObject({'obj': d1}); +1580 * hex = d2.getEncodedHex(); +1581 */ +1582 KJUR.asn1.DERTaggedObject = function(params) { +1583 KJUR.asn1.DERTaggedObject.superclass.constructor.call(this); +1584 this.hT = "a0"; +1585 this.hV = ''; +1586 this.isExplicit = true; +1587 this.asn1Object = null; +1588 +1589 /** +1590 * set value by an ASN1Object +1591 * @name setString +1592 * @memberOf KJUR.asn1.DERTaggedObject# +1593 * @function +1594 * @param {Boolean} isExplicitFlag flag for explicit/implicit tag +1595 * @param {Integer} tagNoHex hexadecimal string of ASN.1 tag +1596 * @param {ASN1Object} asn1Object ASN.1 to encapsulate +1597 */ +1598 this.setASN1Object = function(isExplicitFlag, tagNoHex, asn1Object) { +1599 this.hT = tagNoHex; +1600 this.isExplicit = isExplicitFlag; +1601 this.asn1Object = asn1Object; +1602 if (this.isExplicit) { +1603 this.hV = this.asn1Object.getEncodedHex(); +1604 this.hTLV = null; +1605 this.isModified = true; +1606 } else { +1607 this.hV = null; +1608 this.hTLV = asn1Object.getEncodedHex(); +1609 this.hTLV = this.hTLV.replace(/^../, tagNoHex); +1610 this.isModified = false; +1611 } +1612 }; +1613 +1614 this.getFreshValueHex = function() { +1615 return this.hV; +1616 }; +1617 +1618 if (typeof params != "undefined") { +1619 if (typeof params['tag'] != "undefined") { +1620 this.hT = params['tag']; +1621 } +1622 if (typeof params['explicit'] != "undefined") { +1623 this.isExplicit = params['explicit']; +1624 } +1625 if (typeof params['obj'] != "undefined") { +1626 this.asn1Object = params['obj']; +1627 this.setASN1Object(this.isExplicit, this.hT, this.asn1Object); +1628 } +1629 } +1630 }; +1631 YAHOO.lang.extend(KJUR.asn1.DERTaggedObject, KJUR.asn1.ASN1Object); +1632 \ No newline at end of file diff --git a/api/symbols/src/asn1csr-1.0.js.html b/api/symbols/src/asn1csr-1.0.js.html index e79a7048..1a5c6d8f 100644 --- a/api/symbols/src/asn1csr-1.0.js.html +++ b/api/symbols/src/asn1csr-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 /*! asn1csr-1.0.1.js (c) 2015-2016 Kenji Urushima | kjur.github.com/jsrsasign/license
    +	
      1 /*! asn1csr-1.0.2.js (c) 2015-2016 Kenji Urushima | kjur.github.com/jsrsasign/license
       2  */
       3 /*
       4  * asn1csr.js - ASN.1 DER encoder classes for PKCS#10 CSR
    @@ -23,7 +23,7 @@
      16  * @fileOverview
      17  * @name asn1csr-1.0.js
      18  * @author Kenji Urushima kenji.urushima@gmail.com
    - 19  * @version 1.0.1 (2016-Oct-15)
    + 19  * @version 1.0.2 (2016-Nov-26)
      20  * @since jsrsasign 4.9.0
      21  * @license <a href="http://kjur.github.io/jsrsasign/license/">MIT License</a>
      22  */
    @@ -91,9 +91,9 @@
      84     var prvKey = null;
      85 
      86     /**
    - 87      * sign CertificationRequest and set signature value internally
    + 87      * sign CertificationRequest and set signature value internally<br/>
      88      * @name sign
    - 89      * @memberOf KJUR.asn1.csr.CertificationRequest
    + 89      * @memberOf KJUR.asn1.csr.CertificationRequest#
      90      * @function
      91      * @description
      92      * This method self-signs CertificateRequestInfo with a subject's
    @@ -123,9 +123,9 @@
     116     };
     117 
     118     /**
    -119      * get PEM formatted certificate signing request (CSR/PKCS#10)
    +119      * get PEM formatted certificate signing request (CSR/PKCS#10)<br/>
     120      * @name getPEMString
    -121      * @memberOf KJUR.asn1.csr.CertificationRequest
    +121      * @memberOf KJUR.asn1.csr.CertificationRequest#
     122      * @function
     123      * @return PEM formatted string of CSR/PKCS#10
     124      * @description
    @@ -167,19 +167,19 @@
     160  * @extends KJUR.asn1.ASN1Object
     161  * @since jsrsasign 4.9.0 asn1csr 1.0.0
     162  * @description
    -163  * <br/>
    -164  * @example
    -165  * csri = new KJUR.asn1.csr.CertificationRequestInfo();
    -166  * csri.setSubjectByParam({'str': '/C=US/O=Test/CN=example.com'});
    -167  * csri.setSubjectPublicKeyByGetKey(pubKeyObj);
    -168  *
    -169  * // -- DEFINITION OF ASN.1 SYNTAX --
    -170  * // CertificationRequestInfo ::= SEQUENCE {
    -171  * //   version       INTEGER { v1(0) } (v1,...),
    -172  * //   subject       Name,
    -173  * //   subjectPKInfo SubjectPublicKeyInfo{{ PKInfoAlgorithms }},
    -174  * //   attributes    [0] Attributes{{ CRIAttributes }} }
    -175  *
    +163  * <pre>
    +164  * // -- DEFINITION OF ASN.1 SYNTAX --
    +165  * // CertificationRequestInfo ::= SEQUENCE {
    +166  * //   version       INTEGER { v1(0) } (v1,...),
    +167  * //   subject       Name,
    +168  * //   subjectPKInfo SubjectPublicKeyInfo{{ PKInfoAlgorithms }},
    +169  * //   attributes    [0] Attributes{{ CRIAttributes }} }
    +170  * </pre>
    +171  * <br/>
    +172  * @example
    +173  * csri = new KJUR.asn1.csr.CertificationRequestInfo();
    +174  * csri.setSubjectByParam({'str': '/C=US/O=Test/CN=example.com'});
    +175  * csri.setSubjectPublicKeyByGetKey(pubKeyObj);
     176  */
     177 KJUR.asn1.csr.CertificationRequestInfo = function(params) {
     178     KJUR.asn1.csr.CertificationRequestInfo.superclass.constructor.call(this);
    @@ -196,7 +196,7 @@
     189     /**
     190      * set subject name field by parameter
     191      * @name setSubjectByParam
    -192      * @memberOf KJUR.asn1.csr.CertificationRequestInfo
    +192      * @memberOf KJUR.asn1.csr.CertificationRequestInfo#
     193      * @function
     194      * @param {Array} x500NameParam X500Name parameter
     195      * @description
    @@ -211,7 +211,7 @@
     204     /**
     205      * set subject public key info by RSA/ECDSA/DSA key parameter
     206      * @name setSubjectPublicKeyByGetKey
    -207      * @memberOf KJUR.asn1.csr.CertificationRequestInfo
    +207      * @memberOf KJUR.asn1.csr.CertificationRequestInfo#
     208      * @function
     209      * @param {Object} keyParam public key parameter which passed to {@link KEYUTIL.getKey} argument
     210      * @description
    @@ -227,149 +227,209 @@
     220         this.asn1SubjPKey = new KJUR.asn1.x509.SubjectPublicKeyInfo(keyObj);
     221     };
     222 
    -223     this.getEncodedHex = function() {
    -224         this.asn1Array = new Array();
    -225 
    -226         this.asn1Array.push(this.asn1Version);
    -227         this.asn1Array.push(this.asn1Subject);
    -228         this.asn1Array.push(this.asn1SubjPKey);
    -229 
    -230         var extSeq = new KJUR.asn1.DERSequence({"array": this.extensionsArray});
    -231         var extTagObj = new KJUR.asn1.DERTaggedObject({'explicit': false,
    -232                                                        'tag': 'a0',
    -233                                                        'obj': extSeq});
    -234         this.asn1Array.push(extTagObj);
    -235 
    -236         var o = new KJUR.asn1.DERSequence({"array": this.asn1Array});
    -237         this.hTLV = o.getEncodedHex();
    -238         this.isModified = false;
    -239         return this.hTLV;
    -240     };
    -241 
    -242     this._initialize();
    -243 };
    -244 YAHOO.lang.extend(KJUR.asn1.csr.CertificationRequestInfo, KJUR.asn1.ASN1Object);
    -245 
    -246 /**
    -247  * Certification Request (CSR/PKCS#10) utilities class<br/>
    -248  * @name KJUR.asn1.csr.CSRUtil
    -249  * @class Certification Request (CSR/PKCS#10) utilities class
    -250  * @description
    -251  * This class provides utility static methods for CSR/PKCS#10.
    -252  * Here is a list of methods:
    -253  * <ul>
    -254  * <li>{@link KJUR.asn1.csr.CSRUtil.newCSRPEM}</li>
    -255  * <li>{@link KJUR.asn1.csr.CSRUtil.getInfo}</li>
    -256  * </ul>
    -257  * <br/>
    -258  */
    -259 KJUR.asn1.csr.CSRUtil = new function() {
    -260 };
    -261 
    -262 /**
    -263  * generate a PEM format of CSR/PKCS#10 certificate signing request
    -264  * @name newCSRPEM
    -265  * @memberOf KJUR.asn1.csr.CSRUtil
    -266  * @function
    -267  * @param {Array} param parameter to generate CSR
    -268  * @since jsrsasign 4.9.0 asn1csr 1.0.0
    -269  * @description
    -270  * This method can generate a CSR certificate signing
    -271  * request by a simple JSON object which has following parameters:
    -272  * <ul>
    -273  * <li>subject - parameter to be passed to {@link KJUR.asn1.x509.X500Name}</li>
    -274  * <li>sbjpubkey - parameter to be passed to {@link KEYUTIL.getKey}</li>
    -275  * <li>sigalg - signature algorithm name (ex. SHA256withRSA)</li>
    -276  * <li>sbjprvkey - parameter to be passed to {@link KEYUTIL.getKey}</li>
    -277  * </ul>
    -278  *
    -279  * @example
    -280  * // 1) by key object
    -281  * pem = KJUR.asn1.csr.CSRUtil.newCSRPEM({
    -282  *   subject: {str: '/C=US/O=Test/CN=example.com'},
    -283  *   sbjpubkey: pubKeyObj,
    -284  *   sigalg: "SHA256withRSA",
    -285  *   sbjprvkey: prvKeyObj
    -286  * });
    -287  *
    -288  * // 2) by private/public key PEM 
    -289  * pem = KJUR.asn1.csr.CSRUtil.newCSRPEM({
    -290  *   subject: {str: '/C=US/O=Test/CN=example.com'},
    -291  *   sbjpubkey: pubKeyPEM,
    -292  *   sigalg: "SHA256withRSA",
    -293  *   sbjprvkey: prvKeyPEM
    -294  * });
    -295  *
    -296  * // 3) with generateKeypair
    -297  * kp = KEYUTIL.generateKeypair("RSA", 2048);
    -298  * pem = KJUR.asn1.csr.CSRUtil.newCSRPEM({
    -299  *   subject: {str: '/C=US/O=Test/CN=example.com'},
    -300  *   sbjpubkey: kp.pubKeyObj,
    -301  *   sigalg: "SHA256withRSA",
    -302  *   sbjprvkey: kp.prvKeyObj
    -303  * });
    -304  */
    -305 KJUR.asn1.csr.CSRUtil.newCSRPEM = function(param) {
    -306     var ns1 = KJUR.asn1.csr;
    -307 
    -308     if (param.subject === undefined) throw "parameter subject undefined";
    -309     if (param.sbjpubkey === undefined) throw "parameter sbjpubkey undefined";
    -310     if (param.sigalg === undefined) throw "parameter sigalg undefined";
    -311     if (param.sbjprvkey === undefined) throw "parameter sbjpubkey undefined";
    -312 
    -313     var csri = new ns1.CertificationRequestInfo();
    -314     csri.setSubjectByParam(param.subject);
    -315     csri.setSubjectPublicKeyByGetKey(param.sbjpubkey);
    -316 
    -317     var csr = new ns1.CertificationRequest({'csrinfo': csri});
    -318     var prvKey = KEYUTIL.getKey(param.sbjprvkey);
    -319     csr.sign(param.sigalg, prvKey);
    -320 
    -321     var pem = csr.getPEMString();
    -322     return pem;
    -323 };
    -324 
    -325 /**
    -326  * get field values from CSR/PKCS#10 PEM string<br/>
    -327  * @name getInfo
    -328  * @memberOf KJUR.asn1.csr.CSRUtil
    -329  * @function
    -330  * @param {String} sPEM PEM string of CSR/PKCS#10
    -331  * @returns {Object} JSON object with parsed parameters such as name or public key
    -332  * @since jsrsasign 6.1.3 asn1csr 1.0.1
    -333  * @description
    -334  * This method parses PEM CSR/PKCS#1 string and retrieves
    -335  * subject name and public key. Following parameters are available in the
    -336  * resulted JSON object.
    -337  * <ul>
    -338  * <li>subject.name - subject name string (ex. /C=US/O=Test)</li>
    -339  * <li>subject.hex - hexadecimal string of X.500 Name of subject</li>
    -340  * <li>pubkey.obj - subject public key object such as RSAKey, KJUR.crypto.{ECDSA,DSA}</li>
    -341  * <li>pubkey.hex - hexadecimal string of subject public key</li>
    -342  * </ul>
    -343  *
    -344  * @example
    -345  * o = KJUR.asn1.csr.CSRUtil.getInfo("-----BEGIN CERTIFICATE REQUEST...");
    -346  * console.log(o.subject.name) → "/C=US/O=Test"
    -347  */
    -348 KJUR.asn1.csr.CSRUtil.getInfo = function(sPEM) {
    -349     var result = {};
    -350     result.subject = {};
    -351     result.pubkey = {};
    -352 
    -353     if (sPEM.indexOf("-----BEGIN CERTIFICATE REQUEST") == -1)
    -354 	throw "argument is not PEM file";
    -355 
    -356     var hex = KEYUTIL.getHexFromPEM(sPEM, "CERTIFICATE REQUEST");
    -357 
    -358     result.subject.hex = ASN1HEX.getDecendantHexTLVByNthList(hex, 0, [0, 1]);
    -359     result.subject.name = X509.hex2dn(result.subject.hex);
    -360 
    -361     result.pubkey.hex = ASN1HEX.getDecendantHexTLVByNthList(hex, 0, [0, 2]);
    -362     result.pubkey.obj = KEYUTIL.getKey(result.pubkey.hex, null, "pkcs8pub");
    -363 
    -364     return result;
    -365 };
    -366 
    -367 
    -368 
    \ No newline at end of file +223
    /** +224 * append X.509v3 extension to this object by name and parameters +225 * @name appendExtensionByName +226 * @memberOf KJUR.asn1.csr.CertificationRequestInfo# +227 * @function +228 * @param {name} name name of X.509v3 Extension object +229 * @param {Array} extParams parameters as argument of Extension constructor. +230 * @see KJUR.asn1.x509.Extension +231 * @description +232 * @example +233 * var o = new KJUR.asn1.csr.CertificationRequestInfo(); +234 * o.appendExtensionByName('BasicConstraints', {'cA':true, 'critical': true}); +235 * o.appendExtensionByName('KeyUsage', {'bin':'11'}); +236 * o.appendExtensionByName('CRLDistributionPoints', {uri: 'http://aaa.com/a.crl'}); +237 * o.appendExtensionByName('ExtKeyUsage', {array: [{name: 'clientAuth'}]}); +238 * o.appendExtensionByName('AuthorityKeyIdentifier', {kid: '1234ab..'}); +239 * o.appendExtensionByName('AuthorityInfoAccess', {array: [{accessMethod:{oid:...},accessLocation:{uri:...}}]}); +240 */ +241 this.appendExtensionByName = function(name, extParams) { +242 KJUR.asn1.x509.Extension.appendByNameToArray(name, +243 extParams, +244 this.extensionsArray); +245 }; +246 +247 this.getEncodedHex = function() { +248 this.asn1Array = new Array(); +249 +250 this.asn1Array.push(this.asn1Version); +251 this.asn1Array.push(this.asn1Subject); +252 this.asn1Array.push(this.asn1SubjPKey); +253 +254 // extensionRequest +255 if (this.extensionsArray.length > 0) { +256 var extSeq = new KJUR.asn1.DERSequence({array: this.extensionsArray}); +257 var extSet = new KJUR.asn1.DERSet({array: [extSeq]}); +258 var extSeq2 = new KJUR.asn1.DERSequence({array: [ +259 new KJUR.asn1.DERObjectIdentifier({oid: "1.2.840.113549.1.9.14"}), +260 extSet +261 ]}); +262 var extTagObj = new KJUR.asn1.DERTaggedObject({ +263 explicit: true, +264 tag: 'a0', +265 obj: extSeq2 +266 }); +267 this.asn1Array.push(extTagObj); +268 } else { +269 var extTagObj = new KJUR.asn1.DERTaggedObject({ +270 explicit: false, +271 tag: 'a0', +272 obj: new KJUR.asn1.DERNull() +273 }); +274 this.asn1Array.push(extTagObj); +275 } +276 +277 var o = new KJUR.asn1.DERSequence({"array": this.asn1Array}); +278 this.hTLV = o.getEncodedHex(); +279 this.isModified = false; +280 return this.hTLV; +281 }; +282 +283 this._initialize(); +284 }; +285 YAHOO.lang.extend(KJUR.asn1.csr.CertificationRequestInfo, KJUR.asn1.ASN1Object); +286 +287 /** +288 * Certification Request (CSR/PKCS#10) utilities class<br/> +289 * @name KJUR.asn1.csr.CSRUtil +290 * @class Certification Request (CSR/PKCS#10) utilities class +291 * @description +292 * This class provides utility static methods for CSR/PKCS#10. +293 * Here is a list of methods: +294 * <ul> +295 * <li>{@link KJUR.asn1.csr.CSRUtil.newCSRPEM}</li> +296 * <li>{@link KJUR.asn1.csr.CSRUtil.getInfo}</li> +297 * </ul> +298 * <br/> +299 */ +300 KJUR.asn1.csr.CSRUtil = new function() { +301 }; +302 +303 /** +304 * generate a PEM format of CSR/PKCS#10 certificate signing request +305 * @name newCSRPEM +306 * @memberOf KJUR.asn1.csr.CSRUtil +307 * @function +308 * @param {Array} param parameter to generate CSR +309 * @since jsrsasign 4.9.0 asn1csr 1.0.0 +310 * @description +311 * This method can generate a CSR certificate signing +312 * request by a simple JSON object which has following parameters: +313 * <ul> +314 * <li>subject - parameter to be passed to {@link KJUR.asn1.x509.X500Name}</li> +315 * <li>sbjpubkey - parameter to be passed to {@link KEYUTIL.getKey}</li> +316 * <li>sigalg - signature algorithm name (ex. SHA256withRSA)</li> +317 * <li>sbjprvkey - parameter to be passed to {@link KEYUTIL.getKey}</li> +318 * </ul> +319 * +320 * @example +321 * // 1) by key object +322 * pem = KJUR.asn1.csr.CSRUtil.newCSRPEM({ +323 * subject: {str: '/C=US/O=Test/CN=example.com'}, +324 * sbjpubkey: pubKeyObj, +325 * sigalg: "SHA256withRSA", +326 * sbjprvkey: prvKeyObj +327 * }); +328 * +329 * // 2) by private/public key PEM +330 * pem = KJUR.asn1.csr.CSRUtil.newCSRPEM({ +331 * subject: {str: '/C=US/O=Test/CN=example.com'}, +332 * sbjpubkey: pubKeyPEM, +333 * sigalg: "SHA256withRSA", +334 * sbjprvkey: prvKeyPEM +335 * }); +336 * +337 * // 3) with generateKeypair +338 * kp = KEYUTIL.generateKeypair("RSA", 2048); +339 * pem = KJUR.asn1.csr.CSRUtil.newCSRPEM({ +340 * subject: {str: '/C=US/O=Test/CN=example.com'}, +341 * sbjpubkey: kp.pubKeyObj, +342 * sigalg: "SHA256withRSA", +343 * sbjprvkey: kp.prvKeyObj +344 * }); +345 * +346 * // 4) by private/public key PEM with extension +347 * pem = KJUR.asn1.csr.CSRUtil.newCSRPEM({ +348 * subject: {str: '/C=US/O=Test/CN=example.com'}, +349 * ext: [ +350 * {subjectAltName: {array: [{dns: 'example.net'}]} +351 * ], +352 * sbjpubkey: pubKeyPEM, +353 * sigalg: "SHA256withRSA", +354 * sbjprvkey: prvKeyPEM +355 * }); +356 */ +357 KJUR.asn1.csr.CSRUtil.newCSRPEM = function(param) { +358 var ns1 = KJUR.asn1.csr; +359 +360 if (param.subject === undefined) throw "parameter subject undefined"; +361 if (param.sbjpubkey === undefined) throw "parameter sbjpubkey undefined"; +362 if (param.sigalg === undefined) throw "parameter sigalg undefined"; +363 if (param.sbjprvkey === undefined) throw "parameter sbjpubkey undefined"; +364 +365 var csri = new ns1.CertificationRequestInfo(); +366 csri.setSubjectByParam(param.subject); +367 csri.setSubjectPublicKeyByGetKey(param.sbjpubkey); +368 +369 if (param.ext !== undefined && param.ext.length !== undefined) { +370 for (var i = 0; i < param.ext.length; i++) { +371 for (key in param.ext[i]) { +372 csri.appendExtensionByName(key, param.ext[i][key]); +373 } +374 } +375 } +376 +377 var csr = new ns1.CertificationRequest({'csrinfo': csri}); +378 var prvKey = KEYUTIL.getKey(param.sbjprvkey); +379 csr.sign(param.sigalg, prvKey); +380 +381 var pem = csr.getPEMString(); +382 return pem; +383 }; +384 +385 /** +386 * get field values from CSR/PKCS#10 PEM string<br/> +387 * @name getInfo +388 * @memberOf KJUR.asn1.csr.CSRUtil +389 * @function +390 * @param {String} sPEM PEM string of CSR/PKCS#10 +391 * @returns {Object} JSON object with parsed parameters such as name or public key +392 * @since jsrsasign 6.1.3 asn1csr 1.0.1 +393 * @description +394 * This method parses PEM CSR/PKCS#1 string and retrieves +395 * subject name and public key. Following parameters are available in the +396 * resulted JSON object. +397 * <ul> +398 * <li>subject.name - subject name string (ex. /C=US/O=Test)</li> +399 * <li>subject.hex - hexadecimal string of X.500 Name of subject</li> +400 * <li>pubkey.obj - subject public key object such as RSAKey, KJUR.crypto.{ECDSA,DSA}</li> +401 * <li>pubkey.hex - hexadecimal string of subject public key</li> +402 * </ul> +403 * +404 * @example +405 * o = KJUR.asn1.csr.CSRUtil.getInfo("-----BEGIN CERTIFICATE REQUEST..."); +406 * console.log(o.subject.name) → "/C=US/O=Test" +407 */ +408 KJUR.asn1.csr.CSRUtil.getInfo = function(sPEM) { +409 var result = {}; +410 result.subject = {}; +411 result.pubkey = {}; +412 +413 if (sPEM.indexOf("-----BEGIN CERTIFICATE REQUEST") == -1) +414 throw "argument is not PEM file"; +415 +416 var hex = KEYUTIL.getHexFromPEM(sPEM, "CERTIFICATE REQUEST"); +417 +418 result.subject.hex = ASN1HEX.getDecendantHexTLVByNthList(hex, 0, [0, 1]); +419 result.subject.name = X509.hex2dn(result.subject.hex); +420 +421 result.pubkey.hex = ASN1HEX.getDecendantHexTLVByNthList(hex, 0, [0, 2]); +422 result.pubkey.obj = KEYUTIL.getKey(result.pubkey.hex, null, "pkcs8pub"); +423 +424 return result; +425 }; +426 +427 +428
    \ No newline at end of file diff --git a/api/symbols/src/asn1x509-1.0.js.html b/api/symbols/src/asn1x509-1.0.js.html index 0b9de6db..f43ccf17 100644 --- a/api/symbols/src/asn1x509-1.0.js.html +++ b/api/symbols/src/asn1x509-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 /*! asn1x509-1.0.18.js (c) 2013-2016 Kenji Urushima | kjur.github.com/jsrsasign/license
    +	
      1 /*! asn1x509-1.0.19.js (c) 2013-2016 Kenji Urushima | kjur.github.com/jsrsasign/license
       2  */
       3 /*
       4  * asn1x509.js - ASN.1 DER encoder classes for X.509 certificate
    @@ -23,7 +23,7 @@
      16  * @fileOverview
      17  * @name asn1x509-1.0.js
      18  * @author Kenji Urushima kenji.urushima@gmail.com
    - 19  * @version 1.0.18 (2016-Nov-19)
    + 19  * @version 1.0.19 (2016-Nov-26)
      20  * @since jsrsasign 2.1
      21  * @license <a href="http://kjur.github.io/jsrsasign/license/">MIT License</a>
      22  */
    @@ -80,2469 +80,2625 @@
      73  * <li>{@link KJUR.asn1.x509.ExtKeyUsage}</li>
      74  * <li>{@link KJUR.asn1.x509.AuthorityKeyIdentifier}</li>
      75  * <li>{@link KJUR.asn1.x509.AuthorityInfoAccess}</li>
    - 76  * </ul>
    - 77  * NOTE: Please ignore method summary and document of this namespace. This caused by a bug of jsdoc2.
    - 78  * @name KJUR.asn1.x509
    - 79  * @namespace
    - 80  */
    - 81 if (typeof KJUR.asn1.x509 == "undefined" || !KJUR.asn1.x509) KJUR.asn1.x509 = {};
    - 82 
    - 83 // === BEGIN Certificate ===================================================
    - 84 
    - 85 /**
    - 86  * X.509 Certificate class to sign and generate hex encoded certificate
    - 87  * @name KJUR.asn1.x509.Certificate
    - 88  * @class X.509 Certificate class to sign and generate hex encoded certificate
    - 89  * @param {Array} params associative array of parameters (ex. {'tbscertobj': obj, 'prvkeyobj': key})
    - 90  * @extends KJUR.asn1.ASN1Object
    - 91  * @description
    - 92  * <br/>
    - 93  * As for argument 'params' for constructor, you can specify one of
    - 94  * following properties:
    - 95  * <ul>
    - 96  * <li>tbscertobj - specify {@link KJUR.asn1.x509.TBSCertificate} object</li>
    - 97  * <li>prvkeyobj - specify {@link RSAKey}, {@link KJUR.crypto.ECDSA} or {@link KJUR.crypto.DSA} object for CA private key to sign the certificate</li>
    - 98  * <li>(DEPRECATED)rsaprvkey - specify {@link RSAKey} object CA private key</li>
    - 99  * <li>(DEPRECATED)rsaprvpem - specify PEM string of RSA CA private key</li>
    -100  * </ul>
    -101  * NOTE1: 'params' can be omitted.<br/>
    -102  * NOTE2: DSA/ECDSA is also supported for CA signging key from asn1x509 1.0.6.
    -103  * @example
    -104  * var caKey = KEYUTIL.getKey(caKeyPEM); // CA's private key
    -105  * var cert = new KJUR.asn1x509.Certificate({'tbscertobj': tbs, 'prvkeyobj': caKey});
    -106  * cert.sign(); // issue certificate by CA's private key
    -107  * var certPEM = cert.getPEMString();
    -108  *
    -109  * // Certificate  ::=  SEQUENCE  {
    -110  * //     tbsCertificate       TBSCertificate,
    -111  * //     signatureAlgorithm   AlgorithmIdentifier,
    -112  * //     signature            BIT STRING  }
    -113  */
    -114 KJUR.asn1.x509.Certificate = function(params) {
    -115     KJUR.asn1.x509.Certificate.superclass.constructor.call(this);
    -116     var asn1TBSCert = null;
    -117     var asn1SignatureAlg = null;
    -118     var asn1Sig = null;
    -119     var hexSig = null;
    -120     var prvKey = null;
    -121     var rsaPrvKey = null; // DEPRECATED
    -122 
    -123 
    -124     /**
    -125      * set PKCS#5 encrypted RSA PEM private key as CA key
    -126      * @name setRsaPrvKeyByPEMandPass
    -127      * @memberOf KJUR.asn1.x509.Certificate
    -128      * @function
    -129      * @param {String} rsaPEM string of PKCS#5 encrypted RSA PEM private key
    -130      * @param {String} passPEM passcode string to decrypt private key
    -131      * @since 1.0.1
    -132      * @description
    -133      * <br/>
    -134      * <h4>EXAMPLES</h4>
    -135      * @example
    -136      * var cert = new KJUR.asn1.x509.Certificate({'tbscertobj': tbs});
    -137      * cert.setRsaPrvKeyByPEMandPass("-----BEGIN RSA PRIVATE..(snip)", "password");
    -138      */
    -139     this.setRsaPrvKeyByPEMandPass = function(rsaPEM, passPEM) {
    -140         var caKeyHex = PKCS5PKEY.getDecryptedKeyHex(rsaPEM, passPEM);
    -141         var caKey = new RSAKey();
    -142         caKey.readPrivateKeyFromASN1HexString(caKeyHex);
    -143         this.prvKey = caKey;
    -144     };
    -145 
    -146     /**
    -147      * sign TBSCertificate and set signature value internally
    -148      * @name sign
    -149      * @memberOf KJUR.asn1.x509.Certificate
    -150      * @function
    -151      * @description
    -152      * @example
    -153      * var cert = new KJUR.asn1.x509.Certificate({'tbscertobj': tbs, 'rsaprvkey': prvKey});
    -154      * cert.sign();
    -155      */
    -156     this.sign = function() {
    -157         this.asn1SignatureAlg = this.asn1TBSCert.asn1SignatureAlg;
    -158 
    -159         sig = new KJUR.crypto.Signature({'alg': 'SHA1withRSA'});
    -160         sig.init(this.prvKey);
    -161         sig.updateHex(this.asn1TBSCert.getEncodedHex());
    -162         this.hexSig = sig.sign();
    -163 
    -164         this.asn1Sig = new KJUR.asn1.DERBitString({'hex': '00' + this.hexSig});
    -165 
    -166         var seq = new KJUR.asn1.DERSequence({'array': [this.asn1TBSCert,
    -167                                                        this.asn1SignatureAlg,
    -168                                                        this.asn1Sig]});
    -169         this.hTLV = seq.getEncodedHex();
    -170         this.isModified = false;
    -171     };
    -172 
    -173     /**
    -174      * set signature value internally by hex string
    -175      * @name setSignatureHex
    -176      * @memberOf KJUR.asn1.x509.Certificate
    -177      * @function
    -178      * @since asn1x509 1.0.8
    -179      * @description
    -180      * @example
    -181      * var cert = new KJUR.asn1.x509.Certificate({'tbscertobj': tbs});
    -182      * cert.setSignatureHex('01020304');
    -183      */
    -184     this.setSignatureHex = function(sigHex) {
    -185         this.asn1SignatureAlg = this.asn1TBSCert.asn1SignatureAlg;
    -186         this.hexSig = sigHex;
    -187         this.asn1Sig = new KJUR.asn1.DERBitString({'hex': '00' + this.hexSig});
    -188 
    -189         var seq = new KJUR.asn1.DERSequence({'array': [this.asn1TBSCert,
    -190                                                        this.asn1SignatureAlg,
    -191                                                        this.asn1Sig]});
    -192         this.hTLV = seq.getEncodedHex();
    -193         this.isModified = false;
    -194     };
    -195 
    -196     this.getEncodedHex = function() {
    -197         if (this.isModified == false && this.hTLV != null) return this.hTLV;
    -198         throw "not signed yet";
    -199     };
    -200 
    -201     /**
    -202      * get PEM formatted certificate string after signed
    -203      * @name getPEMString
    -204      * @memberOf KJUR.asn1.x509.Certificate
    -205      * @function
    -206      * @return PEM formatted string of certificate
    -207      * @description
    -208      * @example
    -209      * var cert = new KJUR.asn1.x509.Certificate({'tbscertobj': tbs, 'rsaprvkey': prvKey});
    -210      * cert.sign();
    -211      * var sPEM = cert.getPEMString();
    -212      */
    -213     this.getPEMString = function() {
    -214         var hCert = this.getEncodedHex();
    -215         var wCert = CryptoJS.enc.Hex.parse(hCert);
    -216         var b64Cert = CryptoJS.enc.Base64.stringify(wCert);
    -217         var pemBody = b64Cert.replace(/(.{64})/g, "$1\r\n");
    -218         return "-----BEGIN CERTIFICATE-----\r\n" + pemBody + "\r\n-----END CERTIFICATE-----\r\n";
    -219     };
    -220 
    -221     if (typeof params != "undefined") {
    -222         if (typeof params['tbscertobj'] != "undefined") {
    -223             this.asn1TBSCert = params['tbscertobj'];
    -224         }
    -225         if (typeof params['prvkeyobj'] != "undefined") {
    -226             this.prvKey = params['prvkeyobj'];
    -227         } else if (typeof params['rsaprvkey'] != "undefined") {
    -228             this.prvKey = params['rsaprvkey'];
    -229         } else if ((typeof params['rsaprvpem'] != "undefined") &&
    -230                    (typeof params['rsaprvpas'] != "undefined")) {
    -231             this.setRsaPrvKeyByPEMandPass(params['rsaprvpem'], params['rsaprvpas']);
    -232         }
    -233     }
    -234 };
    -235 YAHOO.lang.extend(KJUR.asn1.x509.Certificate, KJUR.asn1.ASN1Object);
    -236 
    -237 /**
    -238  * ASN.1 TBSCertificate structure class
    -239  * @name KJUR.asn1.x509.TBSCertificate
    -240  * @class ASN.1 TBSCertificate structure class
    -241  * @param {Array} params associative array of parameters (ex. {})
    -242  * @extends KJUR.asn1.ASN1Object
    -243  * @description
    -244  * <br/>
    -245  * <h4>EXAMPLE</h4>
    -246  * @example
    -247  *  var o = new KJUR.asn1.x509.TBSCertificate();
    -248  *  o.setSerialNumberByParam({'int': 4});
    -249  *  o.setSignatureAlgByParam({'name': 'SHA1withRSA'});
    -250  *  o.setIssuerByParam({'str': '/C=US/O=a'});
    -251  *  o.setNotBeforeByParam({'str': '130504235959Z'});
    -252  *  o.setNotAfterByParam({'str': '140504235959Z'});
    -253  *  o.setSubjectByParam({'str': '/C=US/CN=b'});
    -254  *  o.setSubjectPublicKeyByParam({'rsakey': rsaKey});
    -255  *  o.appendExtension(new KJUR.asn1.x509.BasicConstraints({'cA':true}));
    -256  *  o.appendExtension(new KJUR.asn1.x509.KeyUsage({'bin':'11'}));
    -257  */
    -258 KJUR.asn1.x509.TBSCertificate = function(params) {
    -259     KJUR.asn1.x509.TBSCertificate.superclass.constructor.call(this);
    -260 
    -261     this._initialize = function() {
    -262         this.asn1Array = new Array();
    -263 
    -264         this.asn1Version =
    -265             new KJUR.asn1.DERTaggedObject({'obj': new KJUR.asn1.DERInteger({'int': 2})});
    -266         this.asn1SerialNumber = null;
    -267         this.asn1SignatureAlg = null;
    -268         this.asn1Issuer = null;
    -269         this.asn1NotBefore = null;
    -270         this.asn1NotAfter = null;
    -271         this.asn1Subject = null;
    -272         this.asn1SubjPKey = null;
    -273         this.extensionsArray = new Array();
    -274     };
    -275 
    -276     /**
    -277      * set serial number field by parameter
    -278      * @name setSerialNumberByParam
    -279      * @memberOf KJUR.asn1.x509.TBSCertificate
    -280      * @function
    -281      * @param {Array} intParam DERInteger param
    -282      * @description
    -283      * @example
    -284      * tbsc.setSerialNumberByParam({'int': 3});
    -285      */
    -286     this.setSerialNumberByParam = function(intParam) {
    -287         this.asn1SerialNumber = new KJUR.asn1.DERInteger(intParam);
    -288     };
    -289 
    -290     /**
    -291      * set signature algorithm field by parameter
    -292      * @name setSignatureAlgByParam
    -293      * @memberOf KJUR.asn1.x509.TBSCertificate
    -294      * @function
    -295      * @param {Array} algIdParam AlgorithmIdentifier parameter
    -296      * @description
    -297      * @example
    -298      * tbsc.setSignatureAlgByParam({'name': 'SHA1withRSA'});
    -299      */
    -300     this.setSignatureAlgByParam = function(algIdParam) {
    -301         this.asn1SignatureAlg = new KJUR.asn1.x509.AlgorithmIdentifier(algIdParam);
    -302     };
    -303 
    -304     /**
    -305      * set issuer name field by parameter
    -306      * @name setIssuerByParam
    -307      * @memberOf KJUR.asn1.x509.TBSCertificate
    -308      * @function
    -309      * @param {Array} x500NameParam X500Name parameter
    -310      * @description
    -311      * @example
    -312      * tbsc.setIssuerParam({'str': '/C=US/CN=b'});
    -313      * @see KJUR.asn1.x509.X500Name
    -314      */
    -315     this.setIssuerByParam = function(x500NameParam) {
    -316         this.asn1Issuer = new KJUR.asn1.x509.X500Name(x500NameParam);
    -317     };
    -318 
    -319     /**
    -320      * set notBefore field by parameter
    -321      * @name setNotBeforeByParam
    -322      * @memberOf KJUR.asn1.x509.TBSCertificate
    -323      * @function
    -324      * @param {Array} timeParam Time parameter
    -325      * @description
    -326      * @example
    -327      * tbsc.setNotBeforeByParam({'str': '130508235959Z'});
    -328      * @see KJUR.asn1.x509.Time
    -329      */
    -330     this.setNotBeforeByParam = function(timeParam) {
    -331         this.asn1NotBefore = new KJUR.asn1.x509.Time(timeParam);
    -332     };
    -333 
    -334     /**
    -335      * set notAfter field by parameter
    -336      * @name setNotAfterByParam
    -337      * @memberOf KJUR.asn1.x509.TBSCertificate
    -338      * @function
    -339      * @param {Array} timeParam Time parameter
    -340      * @description
    -341      * @example
    -342      * tbsc.setNotAfterByParam({'str': '130508235959Z'});
    -343      * @see KJUR.asn1.x509.Time
    -344      */
    -345     this.setNotAfterByParam = function(timeParam) {
    -346         this.asn1NotAfter = new KJUR.asn1.x509.Time(timeParam);
    -347     };
    -348 
    -349     /**
    -350      * set subject name field by parameter
    -351      * @name setSubjectByParam
    -352      * @memberOf KJUR.asn1.x509.TBSCertificate
    -353      * @function
    -354      * @param {Array} x500NameParam X500Name parameter
    -355      * @description
    -356      * @example
    -357      * tbsc.setSubjectParam({'str': '/C=US/CN=b'});
    -358      * @see KJUR.asn1.x509.X500Name
    -359      */
    -360     this.setSubjectByParam = function(x500NameParam) {
    -361         this.asn1Subject = new KJUR.asn1.x509.X500Name(x500NameParam);
    -362     };
    -363 
    -364     /**
    -365      * (DEPRECATED) set subject public key info field by RSA key parameter
    -366      * @name setSubjectPublicKeyByParam
    -367      * @memberOf KJUR.asn1.x509.TBSCertificate
    -368      * @function
    -369      * @param {Array} subjPKeyParam SubjectPublicKeyInfo parameter of RSA
    -370      * @deprecated
    -371      * @description
    -372      * @example
    -373      * tbsc.setSubjectPublicKeyByParam({'rsakey': pubKey});
    -374      * @see KJUR.asn1.x509.SubjectPublicKeyInfo
    -375      */
    -376     this.setSubjectPublicKeyByParam = function(subjPKeyParam) {
    -377         this.asn1SubjPKey = new KJUR.asn1.x509.SubjectPublicKeyInfo(subjPKeyParam);
    -378     };
    -379 
    -380     /**
    -381      * set subject public key info by RSA/ECDSA/DSA key parameter
    -382      * @name setSubjectPublicKeyByGetKey
    -383      * @memberOf KJUR.asn1.x509.TBSCertificate
    -384      * @function
    -385      * @param {Object} keyParam public key parameter which passed to {@link KEYUTIL.getKey} argument
    -386      * @description
    -387      * @example
    -388      * tbsc.setSubjectPublicKeyByGetKeyParam(certPEMString); // or
    -389      * tbsc.setSubjectPublicKeyByGetKeyParam(pkcs8PublicKeyPEMString); // or
    -390      * tbsc.setSubjectPublicKeyByGetKeyParam(kjurCryptoECDSAKeyObject); // et.al.
    -391      * @see KJUR.asn1.x509.SubjectPublicKeyInfo
    -392      * @see KEYUTIL.getKey
    -393      * @since asn1x509 1.0.6
    -394      */
    -395     this.setSubjectPublicKeyByGetKey = function(keyParam) {
    -396         var keyObj = KEYUTIL.getKey(keyParam);
    -397         this.asn1SubjPKey = new KJUR.asn1.x509.SubjectPublicKeyInfo(keyObj);
    -398     };
    -399 
    -400     /**
    -401      * append X.509v3 extension to this object
    -402      * @name appendExtension
    -403      * @memberOf KJUR.asn1.x509.TBSCertificate
    -404      * @function
    -405      * @param {Extension} extObj X.509v3 Extension object
    -406      * @description
    -407      * @example
    -408      * tbsc.appendExtension(new KJUR.asn1.x509.BasicConstraints({'cA':true, 'critical': true}));
    -409      * tbsc.appendExtension(new KJUR.asn1.x509.KeyUsage({'bin':'11'}));
    -410      * @see KJUR.asn1.x509.Extension
    -411      */
    -412     this.appendExtension = function(extObj) {
    -413         this.extensionsArray.push(extObj);
    -414     };
    -415 
    -416     /**
    -417      * append X.509v3 extension to this object by name and parameters
    -418      * @name appendExtensionByName
    -419      * @memberOf KJUR.asn1.x509.TBSCertificate
    -420      * @function
    -421      * @param {name} name name of X.509v3 Extension object
    -422      * @param {Array} extParams parameters as argument of Extension constructor.
    -423      * @description
    -424      * @example
    -425      * tbsc.appendExtensionByName('BasicConstraints', {'cA':true, 'critical': true});
    -426      * tbsc.appendExtensionByName('KeyUsage', {'bin':'11'});
    -427      * tbsc.appendExtensionByName('CRLDistributionPoints', {uri: 'http://aaa.com/a.crl'});
    -428      * tbsc.appendExtensionByName('ExtKeyUsage', {array: [{name: 'clientAuth'}]});
    -429      * tbsc.appendExtensionByName('AuthorityKeyIdentifier', {kid: '1234ab..'});
    -430      * tbsc.appendExtensionByName('AuthorityInfoAccess', {array: [{accessMethod:{oid:...},accessLocation:{uri:...}}]});
    -431      * @see KJUR.asn1.x509.Extension
    -432      */
    -433     this.appendExtensionByName = function(name, extParams) {
    -434         if (name.toLowerCase() == "basicconstraints") {
    -435             var extObj = new KJUR.asn1.x509.BasicConstraints(extParams);
    -436             this.appendExtension(extObj);
    -437         } else if (name.toLowerCase() == "keyusage") {
    -438             var extObj = new KJUR.asn1.x509.KeyUsage(extParams);
    -439             this.appendExtension(extObj);
    -440         } else if (name.toLowerCase() == "crldistributionpoints") {
    -441             var extObj = new KJUR.asn1.x509.CRLDistributionPoints(extParams);
    -442             this.appendExtension(extObj);
    -443         } else if (name.toLowerCase() == "extkeyusage") {
    -444             var extObj = new KJUR.asn1.x509.ExtKeyUsage(extParams);
    -445             this.appendExtension(extObj);
    -446         } else if (name.toLowerCase() == "authoritykeyidentifier") {
    -447             var extObj = new KJUR.asn1.x509.AuthorityKeyIdentifier(extParams);
    -448             this.appendExtension(extObj);
    -449         } else if (name.toLowerCase() == "authorityinfoaccess") {
    -450             var extObj = new KJUR.asn1.x509.AuthorityInfoAccess(extParams);
    -451             this.appendExtension(extObj);
    -452         } else {
    -453             throw "unsupported extension name: " + name;
    -454         }
    -455     };
    -456 
    -457     this.getEncodedHex = function() {
    -458         if (this.asn1NotBefore == null || this.asn1NotAfter == null)
    -459             throw "notBefore and/or notAfter not set";
    -460         var asn1Validity =
    -461             new KJUR.asn1.DERSequence({'array':[this.asn1NotBefore, this.asn1NotAfter]});
    -462 
    -463         this.asn1Array = new Array();
    -464 
    -465         this.asn1Array.push(this.asn1Version);
    -466         this.asn1Array.push(this.asn1SerialNumber);
    -467         this.asn1Array.push(this.asn1SignatureAlg);
    -468         this.asn1Array.push(this.asn1Issuer);
    -469         this.asn1Array.push(asn1Validity);
    -470         this.asn1Array.push(this.asn1Subject);
    -471         this.asn1Array.push(this.asn1SubjPKey);
    -472 
    -473         if (this.extensionsArray.length > 0) {
    -474             var extSeq = new KJUR.asn1.DERSequence({"array": this.extensionsArray});
    -475             var extTagObj = new KJUR.asn1.DERTaggedObject({'explicit': true,
    -476                                                            'tag': 'a3',
    -477                                                            'obj': extSeq});
    -478             this.asn1Array.push(extTagObj);
    -479         }
    -480 
    -481         var o = new KJUR.asn1.DERSequence({"array": this.asn1Array});
    -482         this.hTLV = o.getEncodedHex();
    -483         this.isModified = false;
    -484         return this.hTLV;
    -485     };
    -486 
    -487     this._initialize();
    -488 };
    -489 YAHOO.lang.extend(KJUR.asn1.x509.TBSCertificate, KJUR.asn1.ASN1Object);
    -490 
    -491 // === END   TBSCertificate ===================================================
    -492 
    -493 // === BEGIN X.509v3 Extensions Related =======================================
    -494 
    -495 /**
    -496  * base Extension ASN.1 structure class
    -497  * @name KJUR.asn1.x509.Extension
    -498  * @class base Extension ASN.1 structure class
    -499  * @param {Array} params associative array of parameters (ex. {'critical': true})
    -500  * @extends KJUR.asn1.ASN1Object
    -501  * @description
    -502  * @example
    -503  * // Extension  ::=  SEQUENCE  {
    -504  * //     extnID      OBJECT IDENTIFIER,
    -505  * //     critical    BOOLEAN DEFAULT FALSE,
    -506  * //     extnValue   OCTET STRING  }
    -507  */
    -508 KJUR.asn1.x509.Extension = function(params) {
    -509     KJUR.asn1.x509.Extension.superclass.constructor.call(this);
    -510     var asn1ExtnValue = null;
    -511 
    -512     this.getEncodedHex = function() {
    -513         var asn1Oid = new KJUR.asn1.DERObjectIdentifier({'oid': this.oid});
    -514         var asn1EncapExtnValue =
    -515             new KJUR.asn1.DEROctetString({'hex': this.getExtnValueHex()});
    -516 
    -517         var asn1Array = new Array();
    -518         asn1Array.push(asn1Oid);
    -519         if (this.critical) asn1Array.push(new KJUR.asn1.DERBoolean());
    -520         asn1Array.push(asn1EncapExtnValue);
    + 76  * <li>{@link KJUR.asn1.x509.SubjectAltName}</li>
    + 77  * <li>{@link KJUR.asn1.x509.IssuerAltName}</li>
    + 78  * </ul>
    + 79  * NOTE1: Please ignore method summary and document of this namespace. This caused by a bug of jsdoc2.<br/>
    + 80  * NOTE2: SubjectAltName and IssuerAltName extension were supported since 
    + 81  * jsrsasign 6.2.3 asn1x509 1.0.19.<br/>
    + 82  * @name KJUR.asn1.x509
    + 83  * @namespace
    + 84  */
    + 85 if (typeof KJUR.asn1.x509 == "undefined" || !KJUR.asn1.x509) KJUR.asn1.x509 = {};
    + 86 
    + 87 // === BEGIN Certificate ===================================================
    + 88 
    + 89 /**
    + 90  * X.509 Certificate class to sign and generate hex encoded certificate
    + 91  * @name KJUR.asn1.x509.Certificate
    + 92  * @class X.509 Certificate class to sign and generate hex encoded certificate
    + 93  * @param {Array} params associative array of parameters (ex. {'tbscertobj': obj, 'prvkeyobj': key})
    + 94  * @extends KJUR.asn1.ASN1Object
    + 95  * @description
    + 96  * <br/>
    + 97  * As for argument 'params' for constructor, you can specify one of
    + 98  * following properties:
    + 99  * <ul>
    +100  * <li>tbscertobj - specify {@link KJUR.asn1.x509.TBSCertificate} object</li>
    +101  * <li>prvkeyobj - specify {@link RSAKey}, {@link KJUR.crypto.ECDSA} or {@link KJUR.crypto.DSA} object for CA private key to sign the certificate</li>
    +102  * <li>(DEPRECATED)rsaprvkey - specify {@link RSAKey} object CA private key</li>
    +103  * <li>(DEPRECATED)rsaprvpem - specify PEM string of RSA CA private key</li>
    +104  * </ul>
    +105  * NOTE1: 'params' can be omitted.<br/>
    +106  * NOTE2: DSA/ECDSA is also supported for CA signging key from asn1x509 1.0.6.
    +107  * @example
    +108  * var caKey = KEYUTIL.getKey(caKeyPEM); // CA's private key
    +109  * var cert = new KJUR.asn1x509.Certificate({'tbscertobj': tbs, 'prvkeyobj': caKey});
    +110  * cert.sign(); // issue certificate by CA's private key
    +111  * var certPEM = cert.getPEMString();
    +112  *
    +113  * // Certificate  ::=  SEQUENCE  {
    +114  * //     tbsCertificate       TBSCertificate,
    +115  * //     signatureAlgorithm   AlgorithmIdentifier,
    +116  * //     signature            BIT STRING  }
    +117  */
    +118 KJUR.asn1.x509.Certificate = function(params) {
    +119     KJUR.asn1.x509.Certificate.superclass.constructor.call(this);
    +120     var asn1TBSCert = null;
    +121     var asn1SignatureAlg = null;
    +122     var asn1Sig = null;
    +123     var hexSig = null;
    +124     var prvKey = null;
    +125     var rsaPrvKey = null; // DEPRECATED
    +126 
    +127 
    +128     /**
    +129      * set PKCS#5 encrypted RSA PEM private key as CA key
    +130      * @name setRsaPrvKeyByPEMandPass
    +131      * @memberOf KJUR.asn1.x509.Certificate
    +132      * @function
    +133      * @param {String} rsaPEM string of PKCS#5 encrypted RSA PEM private key
    +134      * @param {String} passPEM passcode string to decrypt private key
    +135      * @since 1.0.1
    +136      * @description
    +137      * <br/>
    +138      * <h4>EXAMPLES</h4>
    +139      * @example
    +140      * var cert = new KJUR.asn1.x509.Certificate({'tbscertobj': tbs});
    +141      * cert.setRsaPrvKeyByPEMandPass("-----BEGIN RSA PRIVATE..(snip)", "password");
    +142      */
    +143     this.setRsaPrvKeyByPEMandPass = function(rsaPEM, passPEM) {
    +144         var caKeyHex = PKCS5PKEY.getDecryptedKeyHex(rsaPEM, passPEM);
    +145         var caKey = new RSAKey();
    +146         caKey.readPrivateKeyFromASN1HexString(caKeyHex);
    +147         this.prvKey = caKey;
    +148     };
    +149 
    +150     /**
    +151      * sign TBSCertificate and set signature value internally
    +152      * @name sign
    +153      * @memberOf KJUR.asn1.x509.Certificate
    +154      * @function
    +155      * @description
    +156      * @example
    +157      * var cert = new KJUR.asn1.x509.Certificate({'tbscertobj': tbs, 'rsaprvkey': prvKey});
    +158      * cert.sign();
    +159      */
    +160     this.sign = function() {
    +161         this.asn1SignatureAlg = this.asn1TBSCert.asn1SignatureAlg;
    +162 
    +163         sig = new KJUR.crypto.Signature({'alg': 'SHA1withRSA'});
    +164         sig.init(this.prvKey);
    +165         sig.updateHex(this.asn1TBSCert.getEncodedHex());
    +166         this.hexSig = sig.sign();
    +167 
    +168         this.asn1Sig = new KJUR.asn1.DERBitString({'hex': '00' + this.hexSig});
    +169 
    +170         var seq = new KJUR.asn1.DERSequence({'array': [this.asn1TBSCert,
    +171                                                        this.asn1SignatureAlg,
    +172                                                        this.asn1Sig]});
    +173         this.hTLV = seq.getEncodedHex();
    +174         this.isModified = false;
    +175     };
    +176 
    +177     /**
    +178      * set signature value internally by hex string
    +179      * @name setSignatureHex
    +180      * @memberOf KJUR.asn1.x509.Certificate
    +181      * @function
    +182      * @since asn1x509 1.0.8
    +183      * @description
    +184      * @example
    +185      * var cert = new KJUR.asn1.x509.Certificate({'tbscertobj': tbs});
    +186      * cert.setSignatureHex('01020304');
    +187      */
    +188     this.setSignatureHex = function(sigHex) {
    +189         this.asn1SignatureAlg = this.asn1TBSCert.asn1SignatureAlg;
    +190         this.hexSig = sigHex;
    +191         this.asn1Sig = new KJUR.asn1.DERBitString({'hex': '00' + this.hexSig});
    +192 
    +193         var seq = new KJUR.asn1.DERSequence({'array': [this.asn1TBSCert,
    +194                                                        this.asn1SignatureAlg,
    +195                                                        this.asn1Sig]});
    +196         this.hTLV = seq.getEncodedHex();
    +197         this.isModified = false;
    +198     };
    +199 
    +200     this.getEncodedHex = function() {
    +201         if (this.isModified == false && this.hTLV != null) return this.hTLV;
    +202         throw "not signed yet";
    +203     };
    +204 
    +205     /**
    +206      * get PEM formatted certificate string after signed
    +207      * @name getPEMString
    +208      * @memberOf KJUR.asn1.x509.Certificate
    +209      * @function
    +210      * @return PEM formatted string of certificate
    +211      * @description
    +212      * @example
    +213      * var cert = new KJUR.asn1.x509.Certificate({'tbscertobj': tbs, 'rsaprvkey': prvKey});
    +214      * cert.sign();
    +215      * var sPEM = cert.getPEMString();
    +216      */
    +217     this.getPEMString = function() {
    +218         var hCert = this.getEncodedHex();
    +219         var wCert = CryptoJS.enc.Hex.parse(hCert);
    +220         var b64Cert = CryptoJS.enc.Base64.stringify(wCert);
    +221         var pemBody = b64Cert.replace(/(.{64})/g, "$1\r\n");
    +222         return "-----BEGIN CERTIFICATE-----\r\n" + pemBody + "\r\n-----END CERTIFICATE-----\r\n";
    +223     };
    +224 
    +225     if (typeof params != "undefined") {
    +226         if (typeof params['tbscertobj'] != "undefined") {
    +227             this.asn1TBSCert = params['tbscertobj'];
    +228         }
    +229         if (typeof params['prvkeyobj'] != "undefined") {
    +230             this.prvKey = params['prvkeyobj'];
    +231         } else if (typeof params['rsaprvkey'] != "undefined") {
    +232             this.prvKey = params['rsaprvkey'];
    +233         } else if ((typeof params['rsaprvpem'] != "undefined") &&
    +234                    (typeof params['rsaprvpas'] != "undefined")) {
    +235             this.setRsaPrvKeyByPEMandPass(params['rsaprvpem'], params['rsaprvpas']);
    +236         }
    +237     }
    +238 };
    +239 YAHOO.lang.extend(KJUR.asn1.x509.Certificate, KJUR.asn1.ASN1Object);
    +240 
    +241 /**
    +242  * ASN.1 TBSCertificate structure class
    +243  * @name KJUR.asn1.x509.TBSCertificate
    +244  * @class ASN.1 TBSCertificate structure class
    +245  * @param {Array} params associative array of parameters (ex. {})
    +246  * @extends KJUR.asn1.ASN1Object
    +247  * @description
    +248  * <br/>
    +249  * <h4>EXAMPLE</h4>
    +250  * @example
    +251  *  var o = new KJUR.asn1.x509.TBSCertificate();
    +252  *  o.setSerialNumberByParam({'int': 4});
    +253  *  o.setSignatureAlgByParam({'name': 'SHA1withRSA'});
    +254  *  o.setIssuerByParam({'str': '/C=US/O=a'});
    +255  *  o.setNotBeforeByParam({'str': '130504235959Z'});
    +256  *  o.setNotAfterByParam({'str': '140504235959Z'});
    +257  *  o.setSubjectByParam({'str': '/C=US/CN=b'});
    +258  *  o.setSubjectPublicKeyByParam({'rsakey': rsaKey});
    +259  *  o.appendExtension(new KJUR.asn1.x509.BasicConstraints({'cA':true}));
    +260  *  o.appendExtension(new KJUR.asn1.x509.KeyUsage({'bin':'11'}));
    +261  */
    +262 KJUR.asn1.x509.TBSCertificate = function(params) {
    +263     KJUR.asn1.x509.TBSCertificate.superclass.constructor.call(this);
    +264 
    +265     this._initialize = function() {
    +266         this.asn1Array = new Array();
    +267 
    +268         this.asn1Version =
    +269             new KJUR.asn1.DERTaggedObject({'obj': new KJUR.asn1.DERInteger({'int': 2})});
    +270         this.asn1SerialNumber = null;
    +271         this.asn1SignatureAlg = null;
    +272         this.asn1Issuer = null;
    +273         this.asn1NotBefore = null;
    +274         this.asn1NotAfter = null;
    +275         this.asn1Subject = null;
    +276         this.asn1SubjPKey = null;
    +277         this.extensionsArray = new Array();
    +278     };
    +279 
    +280     /**
    +281      * set serial number field by parameter
    +282      * @name setSerialNumberByParam
    +283      * @memberOf KJUR.asn1.x509.TBSCertificate#
    +284      * @function
    +285      * @param {Array} intParam DERInteger param
    +286      * @description
    +287      * @example
    +288      * tbsc.setSerialNumberByParam({'int': 3});
    +289      */
    +290     this.setSerialNumberByParam = function(intParam) {
    +291         this.asn1SerialNumber = new KJUR.asn1.DERInteger(intParam);
    +292     };
    +293 
    +294     /**
    +295      * set signature algorithm field by parameter
    +296      * @name setSignatureAlgByParam
    +297      * @memberOf KJUR.asn1.x509.TBSCertificate#
    +298      * @function
    +299      * @param {Array} algIdParam AlgorithmIdentifier parameter
    +300      * @description
    +301      * @example
    +302      * tbsc.setSignatureAlgByParam({'name': 'SHA1withRSA'});
    +303      */
    +304     this.setSignatureAlgByParam = function(algIdParam) {
    +305         this.asn1SignatureAlg = new KJUR.asn1.x509.AlgorithmIdentifier(algIdParam);
    +306     };
    +307 
    +308     /**
    +309      * set issuer name field by parameter
    +310      * @name setIssuerByParam
    +311      * @memberOf KJUR.asn1.x509.TBSCertificate#
    +312      * @function
    +313      * @param {Array} x500NameParam X500Name parameter
    +314      * @description
    +315      * @example
    +316      * tbsc.setIssuerParam({'str': '/C=US/CN=b'});
    +317      * @see KJUR.asn1.x509.X500Name
    +318      */
    +319     this.setIssuerByParam = function(x500NameParam) {
    +320         this.asn1Issuer = new KJUR.asn1.x509.X500Name(x500NameParam);
    +321     };
    +322 
    +323     /**
    +324      * set notBefore field by parameter
    +325      * @name setNotBeforeByParam
    +326      * @memberOf KJUR.asn1.x509.TBSCertificate#
    +327      * @function
    +328      * @param {Array} timeParam Time parameter
    +329      * @description
    +330      * @example
    +331      * tbsc.setNotBeforeByParam({'str': '130508235959Z'});
    +332      * @see KJUR.asn1.x509.Time
    +333      */
    +334     this.setNotBeforeByParam = function(timeParam) {
    +335         this.asn1NotBefore = new KJUR.asn1.x509.Time(timeParam);
    +336     };
    +337 
    +338     /**
    +339      * set notAfter field by parameter
    +340      * @name setNotAfterByParam
    +341      * @memberOf KJUR.asn1.x509.TBSCertificate#
    +342      * @function
    +343      * @param {Array} timeParam Time parameter
    +344      * @description
    +345      * @example
    +346      * tbsc.setNotAfterByParam({'str': '130508235959Z'});
    +347      * @see KJUR.asn1.x509.Time
    +348      */
    +349     this.setNotAfterByParam = function(timeParam) {
    +350         this.asn1NotAfter = new KJUR.asn1.x509.Time(timeParam);
    +351     };
    +352 
    +353     /**
    +354      * set subject name field by parameter
    +355      * @name setSubjectByParam
    +356      * @memberOf KJUR.asn1.x509.TBSCertificate#
    +357      * @function
    +358      * @param {Array} x500NameParam X500Name parameter
    +359      * @description
    +360      * @example
    +361      * tbsc.setSubjectParam({'str': '/C=US/CN=b'});
    +362      * @see KJUR.asn1.x509.X500Name
    +363      */
    +364     this.setSubjectByParam = function(x500NameParam) {
    +365         this.asn1Subject = new KJUR.asn1.x509.X500Name(x500NameParam);
    +366     };
    +367 
    +368     /**
    +369      * (DEPRECATED) set subject public key info field by RSA key parameter
    +370      * @name setSubjectPublicKeyByParam
    +371      * @memberOf KJUR.asn1.x509.TBSCertificate#
    +372      * @function
    +373      * @param {Array} subjPKeyParam SubjectPublicKeyInfo parameter of RSA
    +374      * @deprecated
    +375      * @description
    +376      * @example
    +377      * tbsc.setSubjectPublicKeyByParam({'rsakey': pubKey});
    +378      * @see KJUR.asn1.x509.SubjectPublicKeyInfo
    +379      */
    +380     this.setSubjectPublicKeyByParam = function(subjPKeyParam) {
    +381         this.asn1SubjPKey = new KJUR.asn1.x509.SubjectPublicKeyInfo(subjPKeyParam);
    +382     };
    +383 
    +384     /**
    +385      * set subject public key info by RSA/ECDSA/DSA key parameter
    +386      * @name setSubjectPublicKeyByGetKey
    +387      * @memberOf KJUR.asn1.x509.TBSCertificate
    +388      * @function
    +389      * @param {Object} keyParam public key parameter which passed to {@link KEYUTIL.getKey} argument
    +390      * @description
    +391      * @example
    +392      * tbsc.setSubjectPublicKeyByGetKeyParam(certPEMString); // or
    +393      * tbsc.setSubjectPublicKeyByGetKeyParam(pkcs8PublicKeyPEMString); // or
    +394      * tbsc.setSubjectPublicKeyByGetKeyParam(kjurCryptoECDSAKeyObject); // et.al.
    +395      * @see KJUR.asn1.x509.SubjectPublicKeyInfo
    +396      * @see KEYUTIL.getKey
    +397      * @since asn1x509 1.0.6
    +398      */
    +399     this.setSubjectPublicKeyByGetKey = function(keyParam) {
    +400         var keyObj = KEYUTIL.getKey(keyParam);
    +401         this.asn1SubjPKey = new KJUR.asn1.x509.SubjectPublicKeyInfo(keyObj);
    +402     };
    +403 
    +404     /**
    +405      * append X.509v3 extension to this object
    +406      * @name appendExtension
    +407      * @memberOf KJUR.asn1.x509.TBSCertificate#
    +408      * @function
    +409      * @param {Extension} extObj X.509v3 Extension object
    +410      * @description
    +411      * @example
    +412      * tbsc.appendExtension(new KJUR.asn1.x509.BasicConstraints({'cA':true, 'critical': true}));
    +413      * tbsc.appendExtension(new KJUR.asn1.x509.KeyUsage({'bin':'11'}));
    +414      * @see KJUR.asn1.x509.Extension
    +415      */
    +416     this.appendExtension = function(extObj) {
    +417         this.extensionsArray.push(extObj);
    +418     };
    +419 
    +420     /**
    +421      * append X.509v3 extension to this object by name and parameters
    +422      * @name appendExtensionByName
    +423      * @memberOf KJUR.asn1.x509.TBSCertificate#
    +424      * @function
    +425      * @param {name} name name of X.509v3 Extension object
    +426      * @param {Array} extParams parameters as argument of Extension constructor.
    +427      * @description
    +428      * @example
    +429      * var o = new KJUR.asn1.x509.TBSCertificate();
    +430      * o.appendExtensionByName('BasicConstraints', {'cA':true, 'critical': true});
    +431      * o.appendExtensionByName('KeyUsage', {'bin':'11'});
    +432      * o.appendExtensionByName('CRLDistributionPoints', {uri: 'http://aaa.com/a.crl'});
    +433      * o.appendExtensionByName('ExtKeyUsage', {array: [{name: 'clientAuth'}]});
    +434      * o.appendExtensionByName('AuthorityKeyIdentifier', {kid: '1234ab..'});
    +435      * o.appendExtensionByName('AuthorityInfoAccess', {array: [{accessMethod:{oid:...},accessLocation:{uri:...}}]});
    +436      * @see KJUR.asn1.x509.Extension
    +437      */
    +438     this.appendExtensionByName = function(name, extParams) {
    +439 	KJUR.asn1.x509.Extension.appendByNameToArray(name,
    +440 						     extParams,
    +441 						     this.extensionsArray);
    +442     };
    +443 
    +444     this.getEncodedHex = function() {
    +445         if (this.asn1NotBefore == null || this.asn1NotAfter == null)
    +446             throw "notBefore and/or notAfter not set";
    +447         var asn1Validity =
    +448             new KJUR.asn1.DERSequence({'array':[this.asn1NotBefore, this.asn1NotAfter]});
    +449 
    +450         this.asn1Array = new Array();
    +451 
    +452         this.asn1Array.push(this.asn1Version);
    +453         this.asn1Array.push(this.asn1SerialNumber);
    +454         this.asn1Array.push(this.asn1SignatureAlg);
    +455         this.asn1Array.push(this.asn1Issuer);
    +456         this.asn1Array.push(asn1Validity);
    +457         this.asn1Array.push(this.asn1Subject);
    +458         this.asn1Array.push(this.asn1SubjPKey);
    +459 
    +460         if (this.extensionsArray.length > 0) {
    +461             var extSeq = new KJUR.asn1.DERSequence({"array": this.extensionsArray});
    +462             var extTagObj = new KJUR.asn1.DERTaggedObject({'explicit': true,
    +463                                                            'tag': 'a3',
    +464                                                            'obj': extSeq});
    +465             this.asn1Array.push(extTagObj);
    +466         }
    +467 
    +468         var o = new KJUR.asn1.DERSequence({"array": this.asn1Array});
    +469         this.hTLV = o.getEncodedHex();
    +470         this.isModified = false;
    +471         return this.hTLV;
    +472     };
    +473 
    +474     this._initialize();
    +475 };
    +476 YAHOO.lang.extend(KJUR.asn1.x509.TBSCertificate, KJUR.asn1.ASN1Object);
    +477 
    +478 // === END   TBSCertificate ===================================================
    +479 
    +480 // === BEGIN X.509v3 Extensions Related =======================================
    +481 
    +482 /**
    +483  * base Extension ASN.1 structure class
    +484  * @name KJUR.asn1.x509.Extension
    +485  * @class base Extension ASN.1 structure class
    +486  * @param {Array} params associative array of parameters (ex. {'critical': true})
    +487  * @extends KJUR.asn1.ASN1Object
    +488  * @description
    +489  * @example
    +490  * // Extension  ::=  SEQUENCE  {
    +491  * //     extnID      OBJECT IDENTIFIER,
    +492  * //     critical    BOOLEAN DEFAULT FALSE,
    +493  * //     extnValue   OCTET STRING  }
    +494  */
    +495 KJUR.asn1.x509.Extension = function(params) {
    +496     KJUR.asn1.x509.Extension.superclass.constructor.call(this);
    +497     var asn1ExtnValue = null;
    +498 
    +499     this.getEncodedHex = function() {
    +500         var asn1Oid = new KJUR.asn1.DERObjectIdentifier({'oid': this.oid});
    +501         var asn1EncapExtnValue =
    +502             new KJUR.asn1.DEROctetString({'hex': this.getExtnValueHex()});
    +503 
    +504         var asn1Array = new Array();
    +505         asn1Array.push(asn1Oid);
    +506         if (this.critical) asn1Array.push(new KJUR.asn1.DERBoolean());
    +507         asn1Array.push(asn1EncapExtnValue);
    +508 
    +509         var asn1Seq = new KJUR.asn1.DERSequence({'array': asn1Array});
    +510         return asn1Seq.getEncodedHex();
    +511     };
    +512 
    +513     this.critical = false;
    +514     if (typeof params != "undefined") {
    +515         if (typeof params['critical'] != "undefined") {
    +516             this.critical = params['critical'];
    +517         }
    +518     }
    +519 };
    +520 YAHOO.lang.extend(KJUR.asn1.x509.Extension, KJUR.asn1.ASN1Object);
     521 
    -522         var asn1Seq = new KJUR.asn1.DERSequence({'array': asn1Array});
    -523         return asn1Seq.getEncodedHex();
    -524     };
    -525 
    -526     this.critical = false;
    -527     if (typeof params != "undefined") {
    -528         if (typeof params['critical'] != "undefined") {
    -529             this.critical = params['critical'];
    -530         }
    -531     }
    -532 };
    -533 YAHOO.lang.extend(KJUR.asn1.x509.Extension, KJUR.asn1.ASN1Object);
    -534 
    -535 /**
    -536  * KeyUsage ASN.1 structure class
    -537  * @name KJUR.asn1.x509.KeyUsage
    -538  * @class KeyUsage ASN.1 structure class
    -539  * @param {Array} params associative array of parameters (ex. {'bin': '11', 'critical': true})
    -540  * @extends KJUR.asn1.x509.Extension
    -541  * @description
    -542  * @example
    -543  */
    -544 KJUR.asn1.x509.KeyUsage = function(params) {
    -545     KJUR.asn1.x509.KeyUsage.superclass.constructor.call(this, params);
    -546 
    -547     this.getExtnValueHex = function() {
    -548         return this.asn1ExtnValue.getEncodedHex();
    -549     };
    -550 
    -551     this.oid = "2.5.29.15";
    -552     if (typeof params != "undefined") {
    -553         if (typeof params['bin'] != "undefined") {
    -554             this.asn1ExtnValue = new KJUR.asn1.DERBitString(params);
    -555         }
    -556     }
    -557 };
    -558 YAHOO.lang.extend(KJUR.asn1.x509.KeyUsage, KJUR.asn1.x509.Extension);
    -559 
    -560 /**
    -561  * BasicConstraints ASN.1 structure class
    -562  * @name KJUR.asn1.x509.BasicConstraints
    -563  * @class BasicConstraints ASN.1 structure class
    -564  * @param {Array} params associative array of parameters (ex. {'cA': true, 'critical': true})
    -565  * @extends KJUR.asn1.x509.Extension
    -566  * @description
    -567  * @example
    -568  */
    -569 KJUR.asn1.x509.BasicConstraints = function(params) {
    -570     KJUR.asn1.x509.BasicConstraints.superclass.constructor.call(this, params);
    -571     var cA = false;
    -572     var pathLen = -1;
    -573 
    -574     this.getExtnValueHex = function() {
    -575         var asn1Array = new Array();
    -576         if (this.cA) asn1Array.push(new KJUR.asn1.DERBoolean());
    -577         if (this.pathLen > -1)
    -578             asn1Array.push(new KJUR.asn1.DERInteger({'int': this.pathLen}));
    -579         var asn1Seq = new KJUR.asn1.DERSequence({'array': asn1Array});
    -580         this.asn1ExtnValue = asn1Seq;
    -581         return this.asn1ExtnValue.getEncodedHex();
    -582     };
    -583 
    -584     this.oid = "2.5.29.19";
    -585     this.cA = false;
    -586     this.pathLen = -1;
    +522 /**
    +523  * append X.509v3 extension to any specified array<br/>
    +524  * @name appendByNameToArray
    +525  * @memberOf KJUR.asn1.x509.Extension
    +526  * @function
    +527  * @param {String} name X.509v3 extension name
    +528  * @param {Object} extParams associative array of extension parameters
    +529  * @param {Array} a array to add specified extension
    +530  * @see KJUR.asn1.x509.Extension
    +531  * @since jsrsasign 6.2.3 asn1x509 1.0.19
    +532  * @description
    +533  * This static function add a X.509v3 extension specified by name and extParams to
    +534  * array 'a' so that 'a' will be an array of X.509v3 extension objects.
    +535  * @example
    +536  * var a = new Array();
    +537  * KJUR.asn1.x509.Extension.appendByNameToArray("BasicConstraints", {'cA':true, 'critical': true}, a);
    +538  * KJUR.asn1.x509.Extension.appendByNameToArray("KeyUsage", {'bin':'11'}, a);
    +539  */
    +540 KJUR.asn1.x509.Extension.appendByNameToArray = function(name, extParams, a) {
    +541     if (name.toLowerCase() == "basicconstraints") {
    +542         var extObj = new KJUR.asn1.x509.BasicConstraints(extParams);
    +543         a.push(extObj);
    +544     } else if (name.toLowerCase() == "keyusage") {
    +545         var extObj = new KJUR.asn1.x509.KeyUsage(extParams);
    +546         a.push(extObj);
    +547     } else if (name.toLowerCase() == "crldistributionpoints") {
    +548         var extObj = new KJUR.asn1.x509.CRLDistributionPoints(extParams);
    +549         a.push(extObj);
    +550     } else if (name.toLowerCase() == "extkeyusage") {
    +551         var extObj = new KJUR.asn1.x509.ExtKeyUsage(extParams);
    +552         a.push(extObj);
    +553     } else if (name.toLowerCase() == "authoritykeyidentifier") {
    +554         var extObj = new KJUR.asn1.x509.AuthorityKeyIdentifier(extParams);
    +555         a.push(extObj);
    +556     } else if (name.toLowerCase() == "authorityinfoaccess") {
    +557         var extObj = new KJUR.asn1.x509.AuthorityInfoAccess(extParams);
    +558         a.push(extObj);
    +559     } else if (name.toLowerCase() == "subjectaltname") {
    +560         var extObj = new KJUR.asn1.x509.SubjectAltName(extParams);
    +561         a.push(extObj);
    +562     } else if (name.toLowerCase() == "issueraltname") {
    +563         var extObj = new KJUR.asn1.x509.IssuerAltName(extParams);
    +564         a.push(extObj);
    +565     } else {
    +566         throw "unsupported extension name: " + name;
    +567     }
    +568 };
    +569 
    +570 /**
    +571  * KeyUsage ASN.1 structure class
    +572  * @name KJUR.asn1.x509.KeyUsage
    +573  * @class KeyUsage ASN.1 structure class
    +574  * @param {Array} params associative array of parameters (ex. {'bin': '11', 'critical': true})
    +575  * @extends KJUR.asn1.x509.Extension
    +576  * @description
    +577  * @example
    +578  */
    +579 KJUR.asn1.x509.KeyUsage = function(params) {
    +580     KJUR.asn1.x509.KeyUsage.superclass.constructor.call(this, params);
    +581 
    +582     this.getExtnValueHex = function() {
    +583         return this.asn1ExtnValue.getEncodedHex();
    +584     };
    +585 
    +586     this.oid = "2.5.29.15";
     587     if (typeof params != "undefined") {
    -588         if (typeof params['cA'] != "undefined") {
    -589             this.cA = params['cA'];
    +588         if (typeof params['bin'] != "undefined") {
    +589             this.asn1ExtnValue = new KJUR.asn1.DERBitString(params);
     590         }
    -591         if (typeof params['pathLen'] != "undefined") {
    -592             this.pathLen = params['pathLen'];
    -593         }
    -594     }
    -595 };
    -596 YAHOO.lang.extend(KJUR.asn1.x509.BasicConstraints, KJUR.asn1.x509.Extension);
    -597 
    -598 /**
    -599  * CRLDistributionPoints ASN.1 structure class
    -600  * @name KJUR.asn1.x509.CRLDistributionPoints
    -601  * @class CRLDistributionPoints ASN.1 structure class
    -602  * @param {Array} params associative array of parameters (ex. {'uri': 'http://a.com/', 'critical': true})
    -603  * @extends KJUR.asn1.x509.Extension
    -604  * @description
    -605  * @example
    -606  */
    -607 KJUR.asn1.x509.CRLDistributionPoints = function(params) {
    -608     KJUR.asn1.x509.CRLDistributionPoints.superclass.constructor.call(this, params);
    -609 
    -610     this.getExtnValueHex = function() {
    -611         return this.asn1ExtnValue.getEncodedHex();
    -612     };
    -613 
    -614     this.setByDPArray = function(dpArray) {
    -615         this.asn1ExtnValue = new KJUR.asn1.DERSequence({'array': dpArray});
    -616     };
    -617 
    -618     this.setByOneURI = function(uri) {
    -619         var gn1 = new KJUR.asn1.x509.GeneralNames([{'uri': uri}]);
    -620         var dpn1 = new KJUR.asn1.x509.DistributionPointName(gn1);
    -621         var dp1 = new KJUR.asn1.x509.DistributionPoint({'dpobj': dpn1});
    -622         this.setByDPArray([dp1]);
    -623     };
    -624 
    -625     this.oid = "2.5.29.31";
    -626     if (typeof params != "undefined") {
    -627         if (typeof params['array'] != "undefined") {
    -628             this.setByDPArray(params['array']);
    -629         } else if (typeof params['uri'] != "undefined") {
    -630             this.setByOneURI(params['uri']);
    -631         }
    -632     }
    -633 };
    -634 YAHOO.lang.extend(KJUR.asn1.x509.CRLDistributionPoints, KJUR.asn1.x509.Extension);
    -635 
    -636 /**
    -637  * KeyUsage ASN.1 structure class
    -638  * @name KJUR.asn1.x509.ExtKeyUsage
    -639  * @class ExtKeyUsage ASN.1 structure class
    -640  * @param {Array} params associative array of parameters
    -641  * @extends KJUR.asn1.x509.Extension
    -642  * @description
    -643  * @example
    -644  * var e1 =
    -645  *     new KJUR.asn1.x509.ExtKeyUsage({'critical': true,
    -646  *                                     'array':
    -647  *                                     [{'oid': '2.5.29.37.0',  // anyExtendedKeyUsage
    -648  *                                       'name': 'clientAuth'}]});
    -649  *
    -650  * // id-ce-extKeyUsage OBJECT IDENTIFIER ::= { id-ce 37 }
    -651  * // ExtKeyUsageSyntax ::= SEQUENCE SIZE (1..MAX) OF KeyPurposeId
    -652  * // KeyPurposeId ::= OBJECT IDENTIFIER
    -653  */
    -654 KJUR.asn1.x509.ExtKeyUsage = function(params) {
    -655     KJUR.asn1.x509.ExtKeyUsage.superclass.constructor.call(this, params);
    -656 
    -657     this.setPurposeArray = function(purposeArray) {
    -658         this.asn1ExtnValue = new KJUR.asn1.DERSequence();
    -659         for (var i = 0; i < purposeArray.length; i++) {
    -660             var o = new KJUR.asn1.DERObjectIdentifier(purposeArray[i]);
    -661             this.asn1ExtnValue.appendASN1Object(o);
    -662         }
    -663     };
    -664 
    -665     this.getExtnValueHex = function() {
    -666         return this.asn1ExtnValue.getEncodedHex();
    -667     };
    -668 
    -669     this.oid = "2.5.29.37";
    -670     if (typeof params != "undefined") {
    -671         if (typeof params['array'] != "undefined") {
    -672             this.setPurposeArray(params['array']);
    -673         }
    -674     }
    -675 };
    -676 YAHOO.lang.extend(KJUR.asn1.x509.ExtKeyUsage, KJUR.asn1.x509.Extension);
    -677 
    -678 /**
    -679  * AuthorityKeyIdentifier ASN.1 structure class
    -680  * @name KJUR.asn1.x509.AuthorityKeyIdentifier
    -681  * @class AuthorityKeyIdentifier ASN.1 structure class
    -682  * @param {Array} params associative array of parameters (ex. {'uri': 'http://a.com/', 'critical': true})
    -683  * @extends KJUR.asn1.x509.Extension
    -684  * @since asn1x509 1.0.8
    -685  * @description
    -686  * <pre>
    -687  * d-ce-authorityKeyIdentifier OBJECT IDENTIFIER ::=  { id-ce 35 }
    -688  * AuthorityKeyIdentifier ::= SEQUENCE {
    -689  *    keyIdentifier             [0] KeyIdentifier           OPTIONAL,
    -690  *    authorityCertIssuer       [1] GeneralNames            OPTIONAL,
    -691  *    authorityCertSerialNumber [2] CertificateSerialNumber OPTIONAL  }
    -692  * KeyIdentifier ::= OCTET STRING
    -693  * </pre>
    -694  * @example
    -695  * var param = {'kid': {'hex': '89ab'},
    -696  *              'issuer': {'str': '/C=US/CN=a'},
    -697  *              'sn': {'hex': '1234'},
    -698  *              'critical': true});
    -699  * var e1 = new KJUR.asn1.x509.AuthorityKeyIdentifier(param);
    -700  */
    -701 KJUR.asn1.x509.AuthorityKeyIdentifier = function(params) {
    -702     KJUR.asn1.x509.AuthorityKeyIdentifier.superclass.constructor.call(this, params);
    -703     this.asn1KID = null;
    -704     this.asn1CertIssuer = null;
    -705     this.asn1CertSN = null;
    -706 
    -707     this.getExtnValueHex = function() {
    -708         var a = new Array();
    -709         if (this.asn1KID)
    -710             a.push(new KJUR.asn1.DERTaggedObject({'explicit': false,
    -711                                                   'tag': '80',
    -712                                                   'obj': this.asn1KID}));
    -713         if (this.asn1CertIssuer)
    -714             a.push(new KJUR.asn1.DERTaggedObject({'explicit': false,
    -715                                                   'tag': 'a1',
    -716                                                   'obj': this.asn1CertIssuer}));
    -717         if (this.asn1CertSN)
    -718             a.push(new KJUR.asn1.DERTaggedObject({'explicit': false,
    -719                                                   'tag': '82',
    -720                                                   'obj': this.asn1CertSN}));
    -721 
    -722         var asn1Seq = new KJUR.asn1.DERSequence({'array': a});
    -723         this.asn1ExtnValue = asn1Seq;
    -724         return this.asn1ExtnValue.getEncodedHex();
    -725     };
    -726 
    -727     /**
    -728      * set keyIdentifier value by DERInteger parameter
    -729      * @name setKIDByParam
    -730      * @memberOf KJUR.asn1.x509.AuthorityKeyIdentifier
    -731      * @function
    -732      * @param {Array} param array of {@link KJUR.asn1.DERInteger} parameter
    -733      * @since asn1x509 1.0.8
    -734      * @description
    -735      * NOTE: Automatic keyIdentifier value calculation by an issuer
    -736      * public key will be supported in future version.
    -737      */
    -738     this.setKIDByParam = function(param) {
    -739         this.asn1KID = new KJUR.asn1.DEROctetString(param);
    -740     };
    -741 
    -742     /**
    -743      * set authorityCertIssuer value by X500Name parameter
    -744      * @name setCertIssuerByParam
    -745      * @memberOf KJUR.asn1.x509.AuthorityKeyIdentifier
    -746      * @function
    -747      * @param {Array} param array of {@link KJUR.asn1.x509.X500Name} parameter
    -748      * @since asn1x509 1.0.8
    -749      * @description
    -750      * NOTE: Automatic authorityCertIssuer name setting by an issuer
    -751      * certificate will be supported in future version.
    -752      */
    -753     this.setCertIssuerByParam = function(param) {
    -754         this.asn1CertIssuer = new KJUR.asn1.x509.X500Name(param);
    -755     };
    -756 
    -757     /**
    -758      * set authorityCertSerialNumber value by DERInteger parameter
    -759      * @name setCertSerialNumberByParam
    -760      * @memberOf KJUR.asn1.x509.AuthorityKeyIdentifier
    -761      * @function
    -762      * @param {Array} param array of {@link KJUR.asn1.DERInteger} parameter
    -763      * @since asn1x509 1.0.8
    -764      * @description
    -765      * NOTE: Automatic authorityCertSerialNumber setting by an issuer
    -766      * certificate will be supported in future version.
    -767      */
    -768     this.setCertSNByParam = function(param) {
    -769         this.asn1CertSN = new KJUR.asn1.DERInteger(param);
    -770     };
    -771 
    -772     this.oid = "2.5.29.35";
    -773     if (typeof params != "undefined") {
    -774         if (typeof params['kid'] != "undefined") {
    -775             this.setKIDByParam(params['kid']);
    -776         }
    -777         if (typeof params['issuer'] != "undefined") {
    -778             this.setCertIssuerByParam(params['issuer']);
    -779         }
    -780         if (typeof params['sn'] != "undefined") {
    -781             this.setCertSNByParam(params['sn']);
    -782         }
    -783     }
    -784 };
    -785 YAHOO.lang.extend(KJUR.asn1.x509.AuthorityKeyIdentifier, KJUR.asn1.x509.Extension);
    -786 
    -787 /**
    -788  * AuthorityInfoAccess ASN.1 structure class
    -789  * @name KJUR.asn1.x509.AuthorityInfoAccess
    -790  * @class AuthorityInfoAccess ASN.1 structure class
    -791  * @param {Array} params associative array of parameters
    -792  * @extends KJUR.asn1.x509.Extension
    -793  * @since asn1x509 1.0.8
    -794  * @description
    -795  * <pre>
    -796  * id-pe OBJECT IDENTIFIER  ::=  { id-pkix 1 }
    -797  * id-pe-authorityInfoAccess OBJECT IDENTIFIER ::= { id-pe 1 }
    -798  * AuthorityInfoAccessSyntax  ::=
    -799  *         SEQUENCE SIZE (1..MAX) OF AccessDescription
    -800  * AccessDescription  ::=  SEQUENCE {
    -801  *         accessMethod          OBJECT IDENTIFIER,
    -802  *         accessLocation        GeneralName  }
    -803  * id-ad OBJECT IDENTIFIER ::= { id-pkix 48 }
    -804  * id-ad-caIssuers OBJECT IDENTIFIER ::= { id-ad 2 }
    -805  * id-ad-ocsp OBJECT IDENTIFIER ::= { id-ad 1 }
    -806  * </pre>
    -807  * @example
    -808  * var param = {'array':[
    -809  *               { 'accessMethod':{'oid': '1.3.6.1.5.5.7.48.1'},
    -810  *                 'accessLocation':{'uri': 'http://ocsp.cacert.org'}
    -811  *               } ]};
    -812  * var e1 = new KJUR.asn1.x509.AuthorityInfoAccess(param);
    -813  */
    -814 KJUR.asn1.x509.AuthorityInfoAccess = function(params) {
    -815     KJUR.asn1.x509.AuthorityInfoAccess.superclass.constructor.call(this, params);
    -816 
    -817     this.setAccessDescriptionArray = function(accessDescriptionArray) {
    -818         var array = new Array();
    -819         for (var i = 0; i < accessDescriptionArray.length; i++) {
    -820             var o = new KJUR.asn1.DERObjectIdentifier(accessDescriptionArray[i].accessMethod);
    -821             var gn = new KJUR.asn1.x509.GeneralName(accessDescriptionArray[i].accessLocation);
    -822             var accessDescription = new KJUR.asn1.DERSequence({'array':[o, gn]});
    -823             array.push(accessDescription);
    -824         }
    -825         this.asn1ExtnValue = new KJUR.asn1.DERSequence({'array':array});
    -826     };
    -827 
    -828     this.getExtnValueHex = function() {
    -829         return this.asn1ExtnValue.getEncodedHex();
    -830     };
    -831 
    -832     this.oid = "1.3.6.1.5.5.7.1.1";
    -833     if (typeof params != "undefined") {
    -834         if (typeof params['array'] != "undefined") {
    -835             this.setAccessDescriptionArray(params['array']);
    -836         }
    -837     }
    -838 };
    -839 YAHOO.lang.extend(KJUR.asn1.x509.AuthorityInfoAccess, KJUR.asn1.x509.Extension);
    -840 
    -841 // === END   X.509v3 Extensions Related =======================================
    -842 
    -843 // === BEGIN CRL Related ===================================================
    -844 /**
    -845  * X.509 CRL class to sign and generate hex encoded CRL
    -846  * @name KJUR.asn1.x509.CRL
    -847  * @class X.509 CRL class to sign and generate hex encoded certificate
    -848  * @param {Array} params associative array of parameters (ex. {'tbsobj': obj, 'rsaprvkey': key})
    -849  * @extends KJUR.asn1.ASN1Object
    -850  * @since 1.0.3
    -851  * @description
    -852  * <br/>
    -853  * As for argument 'params' for constructor, you can specify one of
    -854  * following properties:
    -855  * <ul>
    -856  * <li>tbsobj - specify {@link KJUR.asn1.x509.TBSCertList} object to be signed</li>
    -857  * <li>rsaprvkey - specify {@link RSAKey} object CA private key</li>
    -858  * </ul>
    -859  * NOTE: 'params' can be omitted.
    -860  * <h4>EXAMPLE</h4>
    -861  * @example
    -862  * var prvKey = new RSAKey(); // CA's private key
    -863  * prvKey.readPrivateKeyFromASN1HexString("3080...");
    -864  * var crl = new KJUR.asn1x509.CRL({'tbsobj': tbs, 'rsaprvkey': prvKey});
    -865  * crl.sign(); // issue CRL by CA's private key
    -866  * var hCRL = crl.getEncodedHex();
    -867  *
    -868  * // CertificateList  ::=  SEQUENCE  {
    -869  * //     tbsCertList          TBSCertList,
    -870  * //     signatureAlgorithm   AlgorithmIdentifier,
    -871  * //     signatureValue       BIT STRING  }
    -872  */
    -873 KJUR.asn1.x509.CRL = function(params) {
    -874     KJUR.asn1.x509.CRL.superclass.constructor.call(this);
    -875 
    -876     var asn1TBSCertList = null;
    -877     var asn1SignatureAlg = null;
    -878     var asn1Sig = null;
    -879     var hexSig = null;
    -880     var rsaPrvKey = null;
    -881 
    -882     /**
    -883      * set PKCS#5 encrypted RSA PEM private key as CA key
    -884      * @name setRsaPrvKeyByPEMandPass
    -885      * @memberOf KJUR.asn1.x509.CRL
    -886      * @function
    -887      * @param {String} rsaPEM string of PKCS#5 encrypted RSA PEM private key
    -888      * @param {String} passPEM passcode string to decrypt private key
    -889      * @description
    -890      * <br/>
    -891      * <h4>EXAMPLES</h4>
    -892      * @example
    -893      */
    -894     this.setRsaPrvKeyByPEMandPass = function(rsaPEM, passPEM) {
    -895         var caKeyHex = PKCS5PKEY.getDecryptedKeyHex(rsaPEM, passPEM);
    -896         var caKey = new RSAKey();
    -897         caKey.readPrivateKeyFromASN1HexString(caKeyHex);
    -898         this.rsaPrvKey = caKey;
    -899     };
    -900 
    -901     /**
    -902      * sign TBSCertList and set signature value internally
    -903      * @name sign
    -904      * @memberOf KJUR.asn1.x509.CRL
    -905      * @function
    -906      * @description
    -907      * @example
    -908      * var cert = new KJUR.asn1.x509.CRL({'tbsobj': tbs, 'rsaprvkey': prvKey});
    -909      * cert.sign();
    -910      */
    -911     this.sign = function() {
    -912         this.asn1SignatureAlg = this.asn1TBSCertList.asn1SignatureAlg;
    +591     }
    +592 };
    +593 YAHOO.lang.extend(KJUR.asn1.x509.KeyUsage, KJUR.asn1.x509.Extension);
    +594 
    +595 /**
    +596  * BasicConstraints ASN.1 structure class
    +597  * @name KJUR.asn1.x509.BasicConstraints
    +598  * @class BasicConstraints ASN.1 structure class
    +599  * @param {Array} params associative array of parameters (ex. {'cA': true, 'critical': true})
    +600  * @extends KJUR.asn1.x509.Extension
    +601  * @description
    +602  * @example
    +603  */
    +604 KJUR.asn1.x509.BasicConstraints = function(params) {
    +605     KJUR.asn1.x509.BasicConstraints.superclass.constructor.call(this, params);
    +606     var cA = false;
    +607     var pathLen = -1;
    +608 
    +609     this.getExtnValueHex = function() {
    +610         var asn1Array = new Array();
    +611         if (this.cA) asn1Array.push(new KJUR.asn1.DERBoolean());
    +612         if (this.pathLen > -1)
    +613             asn1Array.push(new KJUR.asn1.DERInteger({'int': this.pathLen}));
    +614         var asn1Seq = new KJUR.asn1.DERSequence({'array': asn1Array});
    +615         this.asn1ExtnValue = asn1Seq;
    +616         return this.asn1ExtnValue.getEncodedHex();
    +617     };
    +618 
    +619     this.oid = "2.5.29.19";
    +620     this.cA = false;
    +621     this.pathLen = -1;
    +622     if (typeof params != "undefined") {
    +623         if (typeof params['cA'] != "undefined") {
    +624             this.cA = params['cA'];
    +625         }
    +626         if (typeof params['pathLen'] != "undefined") {
    +627             this.pathLen = params['pathLen'];
    +628         }
    +629     }
    +630 };
    +631 YAHOO.lang.extend(KJUR.asn1.x509.BasicConstraints, KJUR.asn1.x509.Extension);
    +632 
    +633 /**
    +634  * CRLDistributionPoints ASN.1 structure class
    +635  * @name KJUR.asn1.x509.CRLDistributionPoints
    +636  * @class CRLDistributionPoints ASN.1 structure class
    +637  * @param {Array} params associative array of parameters (ex. {'uri': 'http://a.com/', 'critical': true})
    +638  * @extends KJUR.asn1.x509.Extension
    +639  * @description
    +640  * @example
    +641  */
    +642 KJUR.asn1.x509.CRLDistributionPoints = function(params) {
    +643     KJUR.asn1.x509.CRLDistributionPoints.superclass.constructor.call(this, params);
    +644 
    +645     this.getExtnValueHex = function() {
    +646         return this.asn1ExtnValue.getEncodedHex();
    +647     };
    +648 
    +649     this.setByDPArray = function(dpArray) {
    +650         this.asn1ExtnValue = new KJUR.asn1.DERSequence({'array': dpArray});
    +651     };
    +652 
    +653     this.setByOneURI = function(uri) {
    +654         var gn1 = new KJUR.asn1.x509.GeneralNames([{'uri': uri}]);
    +655         var dpn1 = new KJUR.asn1.x509.DistributionPointName(gn1);
    +656         var dp1 = new KJUR.asn1.x509.DistributionPoint({'dpobj': dpn1});
    +657         this.setByDPArray([dp1]);
    +658     };
    +659 
    +660     this.oid = "2.5.29.31";
    +661     if (typeof params != "undefined") {
    +662         if (typeof params['array'] != "undefined") {
    +663             this.setByDPArray(params['array']);
    +664         } else if (typeof params['uri'] != "undefined") {
    +665             this.setByOneURI(params['uri']);
    +666         }
    +667     }
    +668 };
    +669 YAHOO.lang.extend(KJUR.asn1.x509.CRLDistributionPoints, KJUR.asn1.x509.Extension);
    +670 
    +671 /**
    +672  * KeyUsage ASN.1 structure class
    +673  * @name KJUR.asn1.x509.ExtKeyUsage
    +674  * @class ExtKeyUsage ASN.1 structure class
    +675  * @param {Array} params associative array of parameters
    +676  * @extends KJUR.asn1.x509.Extension
    +677  * @description
    +678  * @example
    +679  * e1 = new KJUR.asn1.x509.ExtKeyUsage({
    +680  *   critical: true,
    +681  *   array: [
    +682  *     {oid: '2.5.29.37.0'},  // anyExtendedKeyUsage
    +683  *     {name: 'clientAuth'}
    +684  *   ]
    +685  * });
    +686  * // id-ce-extKeyUsage OBJECT IDENTIFIER ::= { id-ce 37 }
    +687  * // ExtKeyUsageSyntax ::= SEQUENCE SIZE (1..MAX) OF KeyPurposeId
    +688  * // KeyPurposeId ::= OBJECT IDENTIFIER
    +689  */
    +690 KJUR.asn1.x509.ExtKeyUsage = function(params) {
    +691     KJUR.asn1.x509.ExtKeyUsage.superclass.constructor.call(this, params);
    +692 
    +693     this.setPurposeArray = function(purposeArray) {
    +694         this.asn1ExtnValue = new KJUR.asn1.DERSequence();
    +695         for (var i = 0; i < purposeArray.length; i++) {
    +696             var o = new KJUR.asn1.DERObjectIdentifier(purposeArray[i]);
    +697             this.asn1ExtnValue.appendASN1Object(o);
    +698         }
    +699     };
    +700 
    +701     this.getExtnValueHex = function() {
    +702         return this.asn1ExtnValue.getEncodedHex();
    +703     };
    +704 
    +705     this.oid = "2.5.29.37";
    +706     if (typeof params != "undefined") {
    +707         if (typeof params['array'] != "undefined") {
    +708             this.setPurposeArray(params['array']);
    +709         }
    +710     }
    +711 };
    +712 YAHOO.lang.extend(KJUR.asn1.x509.ExtKeyUsage, KJUR.asn1.x509.Extension);
    +713 
    +714 /**
    +715  * AuthorityKeyIdentifier ASN.1 structure class
    +716  * @name KJUR.asn1.x509.AuthorityKeyIdentifier
    +717  * @class AuthorityKeyIdentifier ASN.1 structure class
    +718  * @param {Array} params associative array of parameters (ex. {'uri': 'http://a.com/', 'critical': true})
    +719  * @extends KJUR.asn1.x509.Extension
    +720  * @since asn1x509 1.0.8
    +721  * @description
    +722  * <pre>
    +723  * d-ce-authorityKeyIdentifier OBJECT IDENTIFIER ::=  { id-ce 35 }
    +724  * AuthorityKeyIdentifier ::= SEQUENCE {
    +725  *    keyIdentifier             [0] KeyIdentifier           OPTIONAL,
    +726  *    authorityCertIssuer       [1] GeneralNames            OPTIONAL,
    +727  *    authorityCertSerialNumber [2] CertificateSerialNumber OPTIONAL  }
    +728  * KeyIdentifier ::= OCTET STRING
    +729  * </pre>
    +730  * @example
    +731  * e1 = new KJUR.asn1.x509.AuthorityKeyIdentifier({
    +732  *   critical: true,
    +733  *   kid:    {hex: '89ab'},
    +734  *   issuer: {str: '/C=US/CN=a'},
    +735  *   sn:     {hex: '1234'}
    +736  * });
    +737  */
    +738 KJUR.asn1.x509.AuthorityKeyIdentifier = function(params) {
    +739     KJUR.asn1.x509.AuthorityKeyIdentifier.superclass.constructor.call(this, params);
    +740     this.asn1KID = null;
    +741     this.asn1CertIssuer = null;
    +742     this.asn1CertSN = null;
    +743 
    +744     this.getExtnValueHex = function() {
    +745         var a = new Array();
    +746         if (this.asn1KID)
    +747             a.push(new KJUR.asn1.DERTaggedObject({'explicit': false,
    +748                                                   'tag': '80',
    +749                                                   'obj': this.asn1KID}));
    +750         if (this.asn1CertIssuer)
    +751             a.push(new KJUR.asn1.DERTaggedObject({'explicit': false,
    +752                                                   'tag': 'a1',
    +753                                                   'obj': this.asn1CertIssuer}));
    +754         if (this.asn1CertSN)
    +755             a.push(new KJUR.asn1.DERTaggedObject({'explicit': false,
    +756                                                   'tag': '82',
    +757                                                   'obj': this.asn1CertSN}));
    +758 
    +759         var asn1Seq = new KJUR.asn1.DERSequence({'array': a});
    +760         this.asn1ExtnValue = asn1Seq;
    +761         return this.asn1ExtnValue.getEncodedHex();
    +762     };
    +763 
    +764     /**
    +765      * set keyIdentifier value by DERInteger parameter
    +766      * @name setKIDByParam
    +767      * @memberOf KJUR.asn1.x509.AuthorityKeyIdentifier
    +768      * @function
    +769      * @param {Array} param array of {@link KJUR.asn1.DERInteger} parameter
    +770      * @since asn1x509 1.0.8
    +771      * @description
    +772      * NOTE: Automatic keyIdentifier value calculation by an issuer
    +773      * public key will be supported in future version.
    +774      */
    +775     this.setKIDByParam = function(param) {
    +776         this.asn1KID = new KJUR.asn1.DEROctetString(param);
    +777     };
    +778 
    +779     /**
    +780      * set authorityCertIssuer value by X500Name parameter
    +781      * @name setCertIssuerByParam
    +782      * @memberOf KJUR.asn1.x509.AuthorityKeyIdentifier#
    +783      * @function
    +784      * @param {Array} param array of {@link KJUR.asn1.x509.X500Name} parameter
    +785      * @since asn1x509 1.0.8
    +786      * @description
    +787      * NOTE: Automatic authorityCertIssuer name setting by an issuer
    +788      * certificate will be supported in future version.
    +789      */
    +790     this.setCertIssuerByParam = function(param) {
    +791         this.asn1CertIssuer = new KJUR.asn1.x509.X500Name(param);
    +792     };
    +793 
    +794     /**
    +795      * set authorityCertSerialNumber value by DERInteger parameter
    +796      * @name setCertSerialNumberByParam
    +797      * @memberOf KJUR.asn1.x509.AuthorityKeyIdentifier#
    +798      * @function
    +799      * @param {Array} param array of {@link KJUR.asn1.DERInteger} parameter
    +800      * @since asn1x509 1.0.8
    +801      * @description
    +802      * NOTE: Automatic authorityCertSerialNumber setting by an issuer
    +803      * certificate will be supported in future version.
    +804      */
    +805     this.setCertSNByParam = function(param) {
    +806         this.asn1CertSN = new KJUR.asn1.DERInteger(param);
    +807     };
    +808 
    +809     this.oid = "2.5.29.35";
    +810     if (typeof params != "undefined") {
    +811         if (typeof params['kid'] != "undefined") {
    +812             this.setKIDByParam(params['kid']);
    +813         }
    +814         if (typeof params['issuer'] != "undefined") {
    +815             this.setCertIssuerByParam(params['issuer']);
    +816         }
    +817         if (typeof params['sn'] != "undefined") {
    +818             this.setCertSNByParam(params['sn']);
    +819         }
    +820     }
    +821 };
    +822 YAHOO.lang.extend(KJUR.asn1.x509.AuthorityKeyIdentifier, KJUR.asn1.x509.Extension);
    +823 
    +824 /**
    +825  * AuthorityInfoAccess ASN.1 structure class
    +826  * @name KJUR.asn1.x509.AuthorityInfoAccess
    +827  * @class AuthorityInfoAccess ASN.1 structure class
    +828  * @param {Array} params associative array of parameters
    +829  * @extends KJUR.asn1.x509.Extension
    +830  * @since asn1x509 1.0.8
    +831  * @description
    +832  * <pre>
    +833  * id-pe OBJECT IDENTIFIER  ::=  { id-pkix 1 }
    +834  * id-pe-authorityInfoAccess OBJECT IDENTIFIER ::= { id-pe 1 }
    +835  * AuthorityInfoAccessSyntax  ::=
    +836  *         SEQUENCE SIZE (1..MAX) OF AccessDescription
    +837  * AccessDescription  ::=  SEQUENCE {
    +838  *         accessMethod          OBJECT IDENTIFIER,
    +839  *         accessLocation        GeneralName  }
    +840  * id-ad OBJECT IDENTIFIER ::= { id-pkix 48 }
    +841  * id-ad-caIssuers OBJECT IDENTIFIER ::= { id-ad 2 }
    +842  * id-ad-ocsp OBJECT IDENTIFIER ::= { id-ad 1 }
    +843  * </pre>
    +844  * @example
    +845  * e1 = new KJUR.asn1.x509.AuthorityInfoAccess({
    +846  *   array: [{
    +847  *     accessMethod:{'oid': '1.3.6.1.5.5.7.48.1'},
    +848  *     accessLocation:{'uri': 'http://ocsp.cacert.org'}
    +849  *   }]
    +850  * });
    +851  */
    +852 KJUR.asn1.x509.AuthorityInfoAccess = function(params) {
    +853     KJUR.asn1.x509.AuthorityInfoAccess.superclass.constructor.call(this, params);
    +854 
    +855     this.setAccessDescriptionArray = function(accessDescriptionArray) {
    +856         var array = new Array();
    +857         for (var i = 0; i < accessDescriptionArray.length; i++) {
    +858             var o = new KJUR.asn1.DERObjectIdentifier(accessDescriptionArray[i].accessMethod);
    +859             var gn = new KJUR.asn1.x509.GeneralName(accessDescriptionArray[i].accessLocation);
    +860             var accessDescription = new KJUR.asn1.DERSequence({'array':[o, gn]});
    +861             array.push(accessDescription);
    +862         }
    +863         this.asn1ExtnValue = new KJUR.asn1.DERSequence({'array':array});
    +864     };
    +865 
    +866     this.getExtnValueHex = function() {
    +867         return this.asn1ExtnValue.getEncodedHex();
    +868     };
    +869 
    +870     this.oid = "1.3.6.1.5.5.7.1.1";
    +871     if (typeof params != "undefined") {
    +872         if (typeof params['array'] != "undefined") {
    +873             this.setAccessDescriptionArray(params['array']);
    +874         }
    +875     }
    +876 };
    +877 YAHOO.lang.extend(KJUR.asn1.x509.AuthorityInfoAccess, KJUR.asn1.x509.Extension);
    +878 
    +879 /**
    +880  * SubjectAltName ASN.1 structure class<br/>
    +881  * @name KJUR.asn1.x509.SubjectAltName
    +882  * @class SubjectAltName ASN.1 structure class
    +883  * @param {Array} params associative array of parameters
    +884  * @extends KJUR.asn1.x509.Extension
    +885  * @since jsrsasign 6.2.3 asn1x509 1.0.19
    +886  * @see KJUR.asn1.x509.GeneralNames
    +887  * @see KJUR.asn1.x509.GeneralName
    +888  * @description
    +889  * This class provides X.509v3 SubjectAltName extension.
    +890  * <pre>
    +891  * id-ce-subjectAltName OBJECT IDENTIFIER ::=  { id-ce 17 }
    +892  * SubjectAltName ::= GeneralNames
    +893  * GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName
    +894  * GeneralName ::= CHOICE {
    +895  *   otherName                  [0] OtherName,
    +896  *   rfc822Name                 [1] IA5String,
    +897  *   dNSName                    [2] IA5String,
    +898  *   x400Address                [3] ORAddress,
    +899  *   directoryName              [4] Name,
    +900  *   ediPartyName               [5] EDIPartyName,
    +901  *   uniformResourceIdentifier  [6] IA5String,
    +902  *   iPAddress                  [7] OCTET STRING,
    +903  *   registeredID               [8] OBJECT IDENTIFIER }
    +904  * </pre>
    +905  * @example
    +906  * e1 = new KJUR.asn1.x509.SubjectAltName({
    +907  *   critical: true,
    +908  *   array: [{uri: 'http://aaa.com/'}, {uri: 'http://bbb.com/'}]
    +909  * });
    +910  */
    +911 KJUR.asn1.x509.SubjectAltName = function(params) {
    +912     KJUR.asn1.x509.SubjectAltName.superclass.constructor.call(this, params)
     913 
    -914         sig = new KJUR.crypto.Signature({'alg': 'SHA1withRSA', 'prov': 'cryptojs/jsrsa'});
    -915         sig.initSign(this.rsaPrvKey);
    -916         sig.updateHex(this.asn1TBSCertList.getEncodedHex());
    -917         this.hexSig = sig.sign();
    -918 
    -919         this.asn1Sig = new KJUR.asn1.DERBitString({'hex': '00' + this.hexSig});
    -920 
    -921         var seq = new KJUR.asn1.DERSequence({'array': [this.asn1TBSCertList,
    -922                                                        this.asn1SignatureAlg,
    -923                                                        this.asn1Sig]});
    -924         this.hTLV = seq.getEncodedHex();
    -925         this.isModified = false;
    -926     };
    -927 
    -928     this.getEncodedHex = function() {
    -929         if (this.isModified == false && this.hTLV != null) return this.hTLV;
    -930         throw "not signed yet";
    -931     };
    -932 
    -933     /**
    -934      * get PEM formatted CRL string after signed
    -935      * @name getPEMString
    -936      * @memberOf KJUR.asn1.x509.CRL
    -937      * @function
    -938      * @return PEM formatted string of certificate
    -939      * @description
    -940      * @example
    -941      * var cert = new KJUR.asn1.x509.CRL({'tbsobj': tbs, 'rsaprvkey': prvKey});
    -942      * cert.sign();
    -943      * var sPEM =  cert.getPEMString();
    -944      */
    -945     this.getPEMString = function() {
    -946         var hCert = this.getEncodedHex();
    -947         var wCert = CryptoJS.enc.Hex.parse(hCert);
    -948         var b64Cert = CryptoJS.enc.Base64.stringify(wCert);
    -949         var pemBody = b64Cert.replace(/(.{64})/g, "$1\r\n");
    -950         return "-----BEGIN X509 CRL-----\r\n" + pemBody + "\r\n-----END X509 CRL-----\r\n";
    -951     };
    -952 
    -953     if (typeof params != "undefined") {
    -954         if (typeof params['tbsobj'] != "undefined") {
    -955             this.asn1TBSCertList = params['tbsobj'];
    -956         }
    -957         if (typeof params['rsaprvkey'] != "undefined") {
    -958             this.rsaPrvKey = params['rsaprvkey'];
    -959         }
    -960         if ((typeof params['rsaprvpem'] != "undefined") &&
    -961             (typeof params['rsaprvpas'] != "undefined")) {
    -962             this.setRsaPrvKeyByPEMandPass(params['rsaprvpem'], params['rsaprvpas']);
    -963         }
    -964     }
    -965 };
    -966 YAHOO.lang.extend(KJUR.asn1.x509.CRL, KJUR.asn1.ASN1Object);
    -967 
    -968 /**
    -969  * ASN.1 TBSCertList structure class for CRL
    -970  * @name KJUR.asn1.x509.TBSCertList
    -971  * @class ASN.1 TBSCertList structure class for CRL
    -972  * @param {Array} params associative array of parameters (ex. {})
    -973  * @extends KJUR.asn1.ASN1Object
    -974  * @since 1.0.3
    -975  * @description
    -976  * <br/>
    -977  * <h4>EXAMPLE</h4>
    -978  * @example
    -979  *  var o = new KJUR.asn1.x509.TBSCertList();
    -980  *  o.setSignatureAlgByParam({'name': 'SHA1withRSA'});
    -981  *  o.setIssuerByParam({'str': '/C=US/O=a'});
    -982  *  o.setNotThisUpdateByParam({'str': '130504235959Z'});
    -983  *  o.setNotNextUpdateByParam({'str': '140504235959Z'});
    -984  *  o.addRevokedCert({'int': 4}, {'str':'130514235959Z'}));
    -985  *  o.addRevokedCert({'hex': '0f34dd'}, {'str':'130514235959Z'}));
    -986  *
    -987  * // TBSCertList  ::=  SEQUENCE  {
    -988  * //        version                 Version OPTIONAL,
    -989  * //                                     -- if present, MUST be v2
    -990  * //        signature               AlgorithmIdentifier,
    -991  * //        issuer                  Name,
    -992  * //        thisUpdate              Time,
    -993  * //        nextUpdate              Time OPTIONAL,
    -994  * //        revokedCertificates     SEQUENCE OF SEQUENCE  {
    -995  * //             userCertificate         CertificateSerialNumber,
    -996  * //             revocationDate          Time,
    -997  * //             crlEntryExtensions      Extensions OPTIONAL
    -998  * //                                      -- if present, version MUST be v2
    -999  * //                                  }  OPTIONAL,
    -1000  * //        crlExtensions           [0]  EXPLICIT Extensions OPTIONAL
    -1001  */
    -1002 KJUR.asn1.x509.TBSCertList = function(params) {
    -1003     KJUR.asn1.x509.TBSCertList.superclass.constructor.call(this);
    -1004     var aRevokedCert = null;
    -1005 
    -1006     /**
    -1007      * set signature algorithm field by parameter
    -1008      * @name setSignatureAlgByParam
    -1009      * @memberOf KJUR.asn1.x509.TBSCertList
    -1010      * @function
    -1011      * @param {Array} algIdParam AlgorithmIdentifier parameter
    -1012      * @description
    -1013      * @example
    -1014      * tbsc.setSignatureAlgByParam({'name': 'SHA1withRSA'});
    -1015      */
    -1016     this.setSignatureAlgByParam = function(algIdParam) {
    -1017         this.asn1SignatureAlg = new KJUR.asn1.x509.AlgorithmIdentifier(algIdParam);
    -1018     };
    -1019 
    -1020     /**
    -1021      * set issuer name field by parameter
    -1022      * @name setIssuerByParam
    -1023      * @memberOf KJUR.asn1.x509.TBSCertList
    -1024      * @function
    -1025      * @param {Array} x500NameParam X500Name parameter
    -1026      * @description
    -1027      * @example
    -1028      * tbsc.setIssuerParam({'str': '/C=US/CN=b'});
    -1029      * @see KJUR.asn1.x509.X500Name
    -1030      */
    -1031     this.setIssuerByParam = function(x500NameParam) {
    -1032         this.asn1Issuer = new KJUR.asn1.x509.X500Name(x500NameParam);
    -1033     };
    -1034 
    -1035     /**
    -1036      * set thisUpdate field by parameter
    -1037      * @name setThisUpdateByParam
    -1038      * @memberOf KJUR.asn1.x509.TBSCertList
    -1039      * @function
    -1040      * @param {Array} timeParam Time parameter
    -1041      * @description
    -1042      * @example
    -1043      * tbsc.setThisUpdateByParam({'str': '130508235959Z'});
    -1044      * @see KJUR.asn1.x509.Time
    -1045      */
    -1046     this.setThisUpdateByParam = function(timeParam) {
    -1047         this.asn1ThisUpdate = new KJUR.asn1.x509.Time(timeParam);
    -1048     };
    -1049 
    -1050     /**
    -1051      * set nextUpdate field by parameter
    -1052      * @name setNextUpdateByParam
    -1053      * @memberOf KJUR.asn1.x509.TBSCertList
    -1054      * @function
    -1055      * @param {Array} timeParam Time parameter
    -1056      * @description
    -1057      * @example
    -1058      * tbsc.setNextUpdateByParam({'str': '130508235959Z'});
    -1059      * @see KJUR.asn1.x509.Time
    -1060      */
    -1061     this.setNextUpdateByParam = function(timeParam) {
    -1062         this.asn1NextUpdate = new KJUR.asn1.x509.Time(timeParam);
    -1063     };
    -1064 
    -1065     /**
    -1066      * add revoked certficate by parameter
    -1067      * @name addRevokedCert
    -1068      * @memberOf KJUR.asn1.x509.TBSCertList
    -1069      * @function
    -1070      * @param {Array} snParam DERInteger parameter for certificate serial number
    -1071      * @param {Array} timeParam Time parameter for revocation date
    -1072      * @description
    -1073      * @example
    -1074      * tbsc.addRevokedCert({'int': 3}, {'str': '130508235959Z'});
    -1075      * @see KJUR.asn1.x509.Time
    -1076      */
    -1077     this.addRevokedCert = function(snParam, timeParam) {
    -1078         var param = {};
    -1079         if (snParam != undefined && snParam != null) param['sn'] = snParam;
    -1080         if (timeParam != undefined && timeParam != null) param['time'] = timeParam;
    -1081         var o = new KJUR.asn1.x509.CRLEntry(param);
    -1082         this.aRevokedCert.push(o);
    -1083     };
    -1084 
    -1085     this.getEncodedHex = function() {
    -1086         this.asn1Array = new Array();
    -1087 
    -1088         if (this.asn1Version != null) this.asn1Array.push(this.asn1Version);
    -1089         this.asn1Array.push(this.asn1SignatureAlg);
    -1090         this.asn1Array.push(this.asn1Issuer);
    -1091         this.asn1Array.push(this.asn1ThisUpdate);
    -1092         if (this.asn1NextUpdate != null) this.asn1Array.push(this.asn1NextUpdate);
    -1093 
    -1094         if (this.aRevokedCert.length > 0) {
    -1095             var seq = new KJUR.asn1.DERSequence({'array': this.aRevokedCert});
    -1096             this.asn1Array.push(seq);
    -1097         }
    -1098 
    -1099         var o = new KJUR.asn1.DERSequence({"array": this.asn1Array});
    -1100         this.hTLV = o.getEncodedHex();
    -1101         this.isModified = false;
    -1102         return this.hTLV;
    -1103     };
    -1104 
    -1105     this._initialize = function() {
    -1106         this.asn1Version = null;
    -1107         this.asn1SignatureAlg = null;
    -1108         this.asn1Issuer = null;
    -1109         this.asn1ThisUpdate = null;
    -1110         this.asn1NextUpdate = null;
    -1111         this.aRevokedCert = new Array();
    -1112     };
    -1113 
    -1114     this._initialize();
    -1115 };
    -1116 YAHOO.lang.extend(KJUR.asn1.x509.TBSCertList, KJUR.asn1.ASN1Object);
    -1117 
    -1118 /**
    -1119  * ASN.1 CRLEntry structure class for CRL
    -1120  * @name KJUR.asn1.x509.CRLEntry
    -1121  * @class ASN.1 CRLEntry structure class for CRL
    -1122  * @param {Array} params associative array of parameters (ex. {})
    -1123  * @extends KJUR.asn1.ASN1Object
    -1124  * @since 1.0.3
    -1125  * @description
    -1126  * @example
    -1127  * var e = new KJUR.asn1.x509.CRLEntry({'time': {'str': '130514235959Z'}, 'sn': {'int': 234}});
    +914     this.setNameArray = function(paramsArray) {
    +915 	this.asn1ExtnValue = new KJUR.asn1.x509.GeneralNames(paramsArray);
    +916     };
    +917 
    +918     this.getExtnValueHex = function() {
    +919         return this.asn1ExtnValue.getEncodedHex();
    +920     };
    +921 
    +922     this.oid = "2.5.29.17";
    +923     if (params !== undefined) {
    +924         if (params.array !== undefined) {
    +925             this.setNameArray(params.array);
    +926         }
    +927     }
    +928 };
    +929 YAHOO.lang.extend(KJUR.asn1.x509.SubjectAltName, KJUR.asn1.x509.Extension);
    +930 
    +931 /**
    +932  * IssuerAltName ASN.1 structure class<br/>
    +933  * @name KJUR.asn1.x509.IssuerAltName
    +934  * @class IssuerAltName ASN.1 structure class
    +935  * @param {Array} params associative array of parameters
    +936  * @extends KJUR.asn1.x509.Extension
    +937  * @since jsrsasign 6.2.3 asn1x509 1.0.19
    +938  * @see KJUR.asn1.x509.GeneralNames
    +939  * @see KJUR.asn1.x509.GeneralName
    +940  * @description
    +941  * This class provides X.509v3 IssuerAltName extension.
    +942  * <pre>
    +943  * id-ce-subjectAltName OBJECT IDENTIFIER ::=  { id-ce 18 }
    +944  * IssuerAltName ::= GeneralNames
    +945  * GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName
    +946  * GeneralName ::= CHOICE {
    +947  *   otherName                  [0] OtherName,
    +948  *   rfc822Name                 [1] IA5String,
    +949  *   dNSName                    [2] IA5String,
    +950  *   x400Address                [3] ORAddress,
    +951  *   directoryName              [4] Name,
    +952  *   ediPartyName               [5] EDIPartyName,
    +953  *   uniformResourceIdentifier  [6] IA5String,
    +954  *   iPAddress                  [7] OCTET STRING,
    +955  *   registeredID               [8] OBJECT IDENTIFIER }
    +956  * </pre>
    +957  * @example
    +958  * e1 = new KJUR.asn1.x509.IssuerAltName({
    +959  *   critical: true,
    +960  *   array: [{uri: 'http://aaa.com/'}, {uri: 'http://bbb.com/'}]
    +961  * });
    +962  */
    +963 KJUR.asn1.x509.IssuerAltName = function(params) {
    +964     KJUR.asn1.x509.IssuerAltName.superclass.constructor.call(this, params)
    +965 
    +966     this.setNameArray = function(paramsArray) {
    +967 	this.asn1ExtnValue = new KJUR.asn1.x509.GeneralNames(paramsArray);
    +968     };
    +969 
    +970     this.getExtnValueHex = function() {
    +971         return this.asn1ExtnValue.getEncodedHex();
    +972     };
    +973 
    +974     this.oid = "2.5.29.18";
    +975     if (params !== undefined) {
    +976         if (params.array !== undefined) {
    +977             this.setNameArray(params.array);
    +978         }
    +979     }
    +980 };
    +981 YAHOO.lang.extend(KJUR.asn1.x509.IssuerAltName, KJUR.asn1.x509.Extension);
    +982 
    +983 // === END   X.509v3 Extensions Related =======================================
    +984 
    +985 // === BEGIN CRL Related ===================================================
    +986 /**
    +987  * X.509 CRL class to sign and generate hex encoded CRL
    +988  * @name KJUR.asn1.x509.CRL
    +989  * @class X.509 CRL class to sign and generate hex encoded certificate
    +990  * @param {Array} params associative array of parameters (ex. {'tbsobj': obj, 'rsaprvkey': key})
    +991  * @extends KJUR.asn1.ASN1Object
    +992  * @since 1.0.3
    +993  * @description
    +994  * <br/>
    +995  * As for argument 'params' for constructor, you can specify one of
    +996  * following properties:
    +997  * <ul>
    +998  * <li>tbsobj - specify {@link KJUR.asn1.x509.TBSCertList} object to be signed</li>
    +999  * <li>rsaprvkey - specify {@link RSAKey} object CA private key</li>
    +1000  * </ul>
    +1001  * NOTE: 'params' can be omitted.
    +1002  * <h4>EXAMPLE</h4>
    +1003  * @example
    +1004  * var prvKey = new RSAKey(); // CA's private key
    +1005  * prvKey.readPrivateKeyFromASN1HexString("3080...");
    +1006  * var crl = new KJUR.asn1x509.CRL({'tbsobj': tbs, 'rsaprvkey': prvKey});
    +1007  * crl.sign(); // issue CRL by CA's private key
    +1008  * var hCRL = crl.getEncodedHex();
    +1009  *
    +1010  * // CertificateList  ::=  SEQUENCE  {
    +1011  * //     tbsCertList          TBSCertList,
    +1012  * //     signatureAlgorithm   AlgorithmIdentifier,
    +1013  * //     signatureValue       BIT STRING  }
    +1014  */
    +1015 KJUR.asn1.x509.CRL = function(params) {
    +1016     KJUR.asn1.x509.CRL.superclass.constructor.call(this);
    +1017 
    +1018     var asn1TBSCertList = null;
    +1019     var asn1SignatureAlg = null;
    +1020     var asn1Sig = null;
    +1021     var hexSig = null;
    +1022     var rsaPrvKey = null;
    +1023 
    +1024     /**
    +1025      * set PKCS#5 encrypted RSA PEM private key as CA key
    +1026      * @name setRsaPrvKeyByPEMandPass
    +1027      * @memberOf KJUR.asn1.x509.CRL
    +1028      * @function
    +1029      * @param {String} rsaPEM string of PKCS#5 encrypted RSA PEM private key
    +1030      * @param {String} passPEM passcode string to decrypt private key
    +1031      * @description
    +1032      * <br/>
    +1033      * <h4>EXAMPLES</h4>
    +1034      * @example
    +1035      */
    +1036     this.setRsaPrvKeyByPEMandPass = function(rsaPEM, passPEM) {
    +1037         var caKeyHex = PKCS5PKEY.getDecryptedKeyHex(rsaPEM, passPEM);
    +1038         var caKey = new RSAKey();
    +1039         caKey.readPrivateKeyFromASN1HexString(caKeyHex);
    +1040         this.rsaPrvKey = caKey;
    +1041     };
    +1042 
    +1043     /**
    +1044      * sign TBSCertList and set signature value internally
    +1045      * @name sign
    +1046      * @memberOf KJUR.asn1.x509.CRL
    +1047      * @function
    +1048      * @description
    +1049      * @example
    +1050      * var cert = new KJUR.asn1.x509.CRL({'tbsobj': tbs, 'rsaprvkey': prvKey});
    +1051      * cert.sign();
    +1052      */
    +1053     this.sign = function() {
    +1054         this.asn1SignatureAlg = this.asn1TBSCertList.asn1SignatureAlg;
    +1055 
    +1056         sig = new KJUR.crypto.Signature({'alg': 'SHA1withRSA', 'prov': 'cryptojs/jsrsa'});
    +1057         sig.initSign(this.rsaPrvKey);
    +1058         sig.updateHex(this.asn1TBSCertList.getEncodedHex());
    +1059         this.hexSig = sig.sign();
    +1060 
    +1061         this.asn1Sig = new KJUR.asn1.DERBitString({'hex': '00' + this.hexSig});
    +1062 
    +1063         var seq = new KJUR.asn1.DERSequence({'array': [this.asn1TBSCertList,
    +1064                                                        this.asn1SignatureAlg,
    +1065                                                        this.asn1Sig]});
    +1066         this.hTLV = seq.getEncodedHex();
    +1067         this.isModified = false;
    +1068     };
    +1069 
    +1070     this.getEncodedHex = function() {
    +1071         if (this.isModified == false && this.hTLV != null) return this.hTLV;
    +1072         throw "not signed yet";
    +1073     };
    +1074 
    +1075     /**
    +1076      * get PEM formatted CRL string after signed
    +1077      * @name getPEMString
    +1078      * @memberOf KJUR.asn1.x509.CRL
    +1079      * @function
    +1080      * @return PEM formatted string of certificate
    +1081      * @description
    +1082      * @example
    +1083      * var cert = new KJUR.asn1.x509.CRL({'tbsobj': tbs, 'rsaprvkey': prvKey});
    +1084      * cert.sign();
    +1085      * var sPEM =  cert.getPEMString();
    +1086      */
    +1087     this.getPEMString = function() {
    +1088         var hCert = this.getEncodedHex();
    +1089         var wCert = CryptoJS.enc.Hex.parse(hCert);
    +1090         var b64Cert = CryptoJS.enc.Base64.stringify(wCert);
    +1091         var pemBody = b64Cert.replace(/(.{64})/g, "$1\r\n");
    +1092         return "-----BEGIN X509 CRL-----\r\n" + pemBody + "\r\n-----END X509 CRL-----\r\n";
    +1093     };
    +1094 
    +1095     if (typeof params != "undefined") {
    +1096         if (typeof params['tbsobj'] != "undefined") {
    +1097             this.asn1TBSCertList = params['tbsobj'];
    +1098         }
    +1099         if (typeof params['rsaprvkey'] != "undefined") {
    +1100             this.rsaPrvKey = params['rsaprvkey'];
    +1101         }
    +1102         if ((typeof params['rsaprvpem'] != "undefined") &&
    +1103             (typeof params['rsaprvpas'] != "undefined")) {
    +1104             this.setRsaPrvKeyByPEMandPass(params['rsaprvpem'], params['rsaprvpas']);
    +1105         }
    +1106     }
    +1107 };
    +1108 YAHOO.lang.extend(KJUR.asn1.x509.CRL, KJUR.asn1.ASN1Object);
    +1109 
    +1110 /**
    +1111  * ASN.1 TBSCertList structure class for CRL
    +1112  * @name KJUR.asn1.x509.TBSCertList
    +1113  * @class ASN.1 TBSCertList structure class for CRL
    +1114  * @param {Array} params associative array of parameters (ex. {})
    +1115  * @extends KJUR.asn1.ASN1Object
    +1116  * @since 1.0.3
    +1117  * @description
    +1118  * <br/>
    +1119  * <h4>EXAMPLE</h4>
    +1120  * @example
    +1121  *  var o = new KJUR.asn1.x509.TBSCertList();
    +1122  *  o.setSignatureAlgByParam({'name': 'SHA1withRSA'});
    +1123  *  o.setIssuerByParam({'str': '/C=US/O=a'});
    +1124  *  o.setNotThisUpdateByParam({'str': '130504235959Z'});
    +1125  *  o.setNotNextUpdateByParam({'str': '140504235959Z'});
    +1126  *  o.addRevokedCert({'int': 4}, {'str':'130514235959Z'}));
    +1127  *  o.addRevokedCert({'hex': '0f34dd'}, {'str':'130514235959Z'}));
     1128  *
    -1129  * // revokedCertificates     SEQUENCE OF SEQUENCE  {
    -1130  * //     userCertificate         CertificateSerialNumber,
    -1131  * //     revocationDate          Time,
    -1132  * //     crlEntryExtensions      Extensions OPTIONAL
    -1133  * //                             -- if present, version MUST be v2 }
    -1134  */
    -1135 KJUR.asn1.x509.CRLEntry = function(params) {
    -1136     KJUR.asn1.x509.CRLEntry.superclass.constructor.call(this);
    -1137     var sn = null;
    -1138     var time = null;
    -1139 
    -1140     /**
    -1141      * set DERInteger parameter for serial number of revoked certificate
    -1142      * @name setCertSerial
    -1143      * @memberOf KJUR.asn1.x509.CRLEntry
    -1144      * @function
    -1145      * @param {Array} intParam DERInteger parameter for certificate serial number
    -1146      * @description
    -1147      * @example
    -1148      * entry.setCertSerial({'int': 3});
    -1149      */
    -1150     this.setCertSerial = function(intParam) {
    -1151         this.sn = new KJUR.asn1.DERInteger(intParam);
    -1152     };
    -1153 
    -1154     /**
    -1155      * set Time parameter for revocation date
    -1156      * @name setRevocationDate
    -1157      * @memberOf KJUR.asn1.x509.CRLEntry
    -1158      * @function
    -1159      * @param {Array} timeParam Time parameter for revocation date
    -1160      * @description
    -1161      * @example
    -1162      * entry.setRevocationDate({'str': '130508235959Z'});
    -1163      */
    -1164     this.setRevocationDate = function(timeParam) {
    -1165         this.time = new KJUR.asn1.x509.Time(timeParam);
    -1166     };
    -1167 
    -1168     this.getEncodedHex = function() {
    -1169         var o = new KJUR.asn1.DERSequence({"array": [this.sn, this.time]});
    -1170         this.TLV = o.getEncodedHex();
    -1171         return this.TLV;
    -1172     };
    -1173 
    -1174     if (typeof params != "undefined") {
    -1175         if (typeof params['time'] != "undefined") {
    -1176             this.setRevocationDate(params['time']);
    -1177         }
    -1178         if (typeof params['sn'] != "undefined") {
    -1179             this.setCertSerial(params['sn']);
    -1180         }
    -1181     }
    -1182 };
    -1183 YAHOO.lang.extend(KJUR.asn1.x509.CRLEntry, KJUR.asn1.ASN1Object);
    -1184 
    -1185 // === END   CRL Related ===================================================
    -1186 
    -1187 // === BEGIN X500Name Related =================================================
    -1188 /**
    -1189  * X500Name ASN.1 structure class
    -1190  * @name KJUR.asn1.x509.X500Name
    -1191  * @class X500Name ASN.1 structure class
    -1192  * @param {Array} params associative array of parameters (ex. {'str': '/C=US/O=a'})
    -1193  * @extends KJUR.asn1.ASN1Object
    -1194  * @see KJUR.asn1.x509.X500Name
    -1195  * @see KJUR.asn1.x509.RDN
    -1196  * @see KJUR.asn1.x509.AttributeTypeAndValue
    -1197  * @description
    -1198  * This class provides DistinguishedName ASN.1 class structure
    -1199  * defined in <a href="https://tools.ietf.org/html/rfc2253#section-2">RFC 2253 section 2</a>.
    -1200  * <blockquote><pre>
    -1201  * DistinguishedName ::= RDNSequence
    -1202  *
    -1203  * RDNSequence ::= SEQUENCE OF RelativeDistinguishedName
    -1204  *
    -1205  * RelativeDistinguishedName ::= SET SIZE (1..MAX) OF
    -1206  *   AttributeTypeAndValue
    -1207  *
    -1208  * AttributeTypeAndValue ::= SEQUENCE {
    -1209  *   type  AttributeType,
    -1210  *   value AttributeValue }
    -1211  * </pre></blockquote>
    -1212  * <br/>
    -1213  * For string representation of distinguished name in jsrsasign,
    -1214  * OpenSSL oneline format is used. Please see <a href="https://github.com/kjur/jsrsasign/wiki/NOTE-distinguished-name-representation-in-jsrsasign">wiki article</a> for it.
    -1215  * <br/>
    -1216  * NOTE: Multi-valued RDN is supported since jsrsasign 6.2.1 asn1x509 1.0.17.
    -1217  * @example
    -1218  * // 1. construct with string
    -1219  * o = new KJUR.asn1.x509.X500Name({str: "/C=US/O=aaa/OU=bbb/CN=foo@example.com"});
    -1220  * o = new KJUR.asn1.x509.X500Name({str: "/C=US/O=aaa+CN=contact@example.com"}); // multi valued
    -1221  * // 2. construct by object
    -1222  * o = new KJUR.asn1.x509.X500Name({C: "US", O: "aaa", CN: "http://example.com/"});
    -1223  */
    -1224 KJUR.asn1.x509.X500Name = function(params) {
    -1225     KJUR.asn1.x509.X500Name.superclass.constructor.call(this);
    -1226     this.asn1Array = new Array();
    -1227 
    -1228     /**
    -1229      * set DN by OpenSSL oneline distinguished name string<br/>
    -1230      * @name setByString
    -1231      * @memberOf KJUR.asn1.x509.X500Name#
    -1232      * @function
    -1233      * @param {String} dnStr distinguished name by string (ex. /C=US/O=aaa)
    -1234      * @description
    -1235      * @example
    -1236      * name = new KJUR.asn1.x509.X500Name();
    -1237      * name.setByString("/C=US/O=aaa/OU=bbb/CN=foo@example.com");
    -1238      */
    -1239     this.setByString = function(dnStr) {
    -1240         var a = dnStr.split('/');
    -1241         a.shift();
    -1242         for (var i = 0; i < a.length; i++) {
    -1243             this.asn1Array.push(new KJUR.asn1.x509.RDN({'str':a[i]}));
    -1244         }
    +1129  * // TBSCertList  ::=  SEQUENCE  {
    +1130  * //        version                 Version OPTIONAL,
    +1131  * //                                     -- if present, MUST be v2
    +1132  * //        signature               AlgorithmIdentifier,
    +1133  * //        issuer                  Name,
    +1134  * //        thisUpdate              Time,
    +1135  * //        nextUpdate              Time OPTIONAL,
    +1136  * //        revokedCertificates     SEQUENCE OF SEQUENCE  {
    +1137  * //             userCertificate         CertificateSerialNumber,
    +1138  * //             revocationDate          Time,
    +1139  * //             crlEntryExtensions      Extensions OPTIONAL
    +1140  * //                                      -- if present, version MUST be v2
    +1141  * //                                  }  OPTIONAL,
    +1142  * //        crlExtensions           [0]  EXPLICIT Extensions OPTIONAL
    +1143  */
    +1144 KJUR.asn1.x509.TBSCertList = function(params) {
    +1145     KJUR.asn1.x509.TBSCertList.superclass.constructor.call(this);
    +1146     var aRevokedCert = null;
    +1147 
    +1148     /**
    +1149      * set signature algorithm field by parameter
    +1150      * @name setSignatureAlgByParam
    +1151      * @memberOf KJUR.asn1.x509.TBSCertList
    +1152      * @function
    +1153      * @param {Array} algIdParam AlgorithmIdentifier parameter
    +1154      * @description
    +1155      * @example
    +1156      * tbsc.setSignatureAlgByParam({'name': 'SHA1withRSA'});
    +1157      */
    +1158     this.setSignatureAlgByParam = function(algIdParam) {
    +1159         this.asn1SignatureAlg = new KJUR.asn1.x509.AlgorithmIdentifier(algIdParam);
    +1160     };
    +1161 
    +1162     /**
    +1163      * set issuer name field by parameter
    +1164      * @name setIssuerByParam
    +1165      * @memberOf KJUR.asn1.x509.TBSCertList
    +1166      * @function
    +1167      * @param {Array} x500NameParam X500Name parameter
    +1168      * @description
    +1169      * @example
    +1170      * tbsc.setIssuerParam({'str': '/C=US/CN=b'});
    +1171      * @see KJUR.asn1.x509.X500Name
    +1172      */
    +1173     this.setIssuerByParam = function(x500NameParam) {
    +1174         this.asn1Issuer = new KJUR.asn1.x509.X500Name(x500NameParam);
    +1175     };
    +1176 
    +1177     /**
    +1178      * set thisUpdate field by parameter
    +1179      * @name setThisUpdateByParam
    +1180      * @memberOf KJUR.asn1.x509.TBSCertList
    +1181      * @function
    +1182      * @param {Array} timeParam Time parameter
    +1183      * @description
    +1184      * @example
    +1185      * tbsc.setThisUpdateByParam({'str': '130508235959Z'});
    +1186      * @see KJUR.asn1.x509.Time
    +1187      */
    +1188     this.setThisUpdateByParam = function(timeParam) {
    +1189         this.asn1ThisUpdate = new KJUR.asn1.x509.Time(timeParam);
    +1190     };
    +1191 
    +1192     /**
    +1193      * set nextUpdate field by parameter
    +1194      * @name setNextUpdateByParam
    +1195      * @memberOf KJUR.asn1.x509.TBSCertList
    +1196      * @function
    +1197      * @param {Array} timeParam Time parameter
    +1198      * @description
    +1199      * @example
    +1200      * tbsc.setNextUpdateByParam({'str': '130508235959Z'});
    +1201      * @see KJUR.asn1.x509.Time
    +1202      */
    +1203     this.setNextUpdateByParam = function(timeParam) {
    +1204         this.asn1NextUpdate = new KJUR.asn1.x509.Time(timeParam);
    +1205     };
    +1206 
    +1207     /**
    +1208      * add revoked certficate by parameter
    +1209      * @name addRevokedCert
    +1210      * @memberOf KJUR.asn1.x509.TBSCertList
    +1211      * @function
    +1212      * @param {Array} snParam DERInteger parameter for certificate serial number
    +1213      * @param {Array} timeParam Time parameter for revocation date
    +1214      * @description
    +1215      * @example
    +1216      * tbsc.addRevokedCert({'int': 3}, {'str': '130508235959Z'});
    +1217      * @see KJUR.asn1.x509.Time
    +1218      */
    +1219     this.addRevokedCert = function(snParam, timeParam) {
    +1220         var param = {};
    +1221         if (snParam != undefined && snParam != null) param['sn'] = snParam;
    +1222         if (timeParam != undefined && timeParam != null) param['time'] = timeParam;
    +1223         var o = new KJUR.asn1.x509.CRLEntry(param);
    +1224         this.aRevokedCert.push(o);
    +1225     };
    +1226 
    +1227     this.getEncodedHex = function() {
    +1228         this.asn1Array = new Array();
    +1229 
    +1230         if (this.asn1Version != null) this.asn1Array.push(this.asn1Version);
    +1231         this.asn1Array.push(this.asn1SignatureAlg);
    +1232         this.asn1Array.push(this.asn1Issuer);
    +1233         this.asn1Array.push(this.asn1ThisUpdate);
    +1234         if (this.asn1NextUpdate != null) this.asn1Array.push(this.asn1NextUpdate);
    +1235 
    +1236         if (this.aRevokedCert.length > 0) {
    +1237             var seq = new KJUR.asn1.DERSequence({'array': this.aRevokedCert});
    +1238             this.asn1Array.push(seq);
    +1239         }
    +1240 
    +1241         var o = new KJUR.asn1.DERSequence({"array": this.asn1Array});
    +1242         this.hTLV = o.getEncodedHex();
    +1243         this.isModified = false;
    +1244         return this.hTLV;
     1245     };
     1246 
    -1247     /**
    -1248      * set DN by LDAP(RFC 2253) distinguished name string<br/>
    -1249      * @name setByLdapString
    -1250      * @memberOf KJUR.asn1.x509.X500Name#
    -1251      * @function
    -1252      * @param {String} dnStr distinguished name by LDAP string (ex. O=aaa,C=US)
    -1253      * @since jsrsasign 6.2.2 asn1x509 1.0.18
    -1254      * @description
    -1255      * @example
    -1256      * name = new KJUR.asn1.x509.X500Name();
    -1257      * name.setByLdapString("CN=foo@example.com,OU=bbb,O=aaa,C=US");
    -1258      */
    -1259     this.setByLdapString = function(dnStr) {
    -1260 	var oneline = KJUR.asn1.x509.X500Name.ldapToOneline(dnStr);
    -1261 	this.setByString(oneline);
    -1262     };
    -1263 
    -1264     /**
    -1265      * set DN by associative array<br/>
    -1266      * @name setByObject
    -1267      * @memberOf KJUR.asn1.x509.X500Name#
    -1268      * @function
    -1269      * @param {Array} dnObj associative array of DN (ex. {C: "US", O: "aaa"})
    -1270      * @since jsrsasign 4.9. asn1x509 1.0.13
    -1271      * @description
    -1272      * @example
    -1273      * name = new KJUR.asn1.x509.X500Name();
    -1274      * name.setByObject({C: "US", O: "aaa", CN="http://example.com/"1});
    -1275      */
    -1276     this.setByObject = function(dnObj) {
    -1277         // Get all the dnObject attributes and stuff them in the ASN.1 array.
    -1278         for (var x in dnObj) {
    -1279             if (dnObj.hasOwnProperty(x)) {
    -1280                 var newRDN = new KJUR.asn1.x509.RDN(
    -1281                     {'str': x + '=' + dnObj[x]});
    -1282                 // Initialize or push into the ANS1 array.
    -1283                 this.asn1Array ? this.asn1Array.push(newRDN)
    -1284                     : this.asn1Array = [newRDN];
    -1285             }
    -1286         }
    -1287     };
    -1288 
    -1289     this.getEncodedHex = function() {
    -1290         if (typeof this.hTLV == "string") return this.hTLV;
    -1291         var o = new KJUR.asn1.DERSequence({"array": this.asn1Array});
    -1292         this.hTLV = o.getEncodedHex();
    -1293         return this.hTLV;
    +1247     this._initialize = function() {
    +1248         this.asn1Version = null;
    +1249         this.asn1SignatureAlg = null;
    +1250         this.asn1Issuer = null;
    +1251         this.asn1ThisUpdate = null;
    +1252         this.asn1NextUpdate = null;
    +1253         this.aRevokedCert = new Array();
    +1254     };
    +1255 
    +1256     this._initialize();
    +1257 };
    +1258 YAHOO.lang.extend(KJUR.asn1.x509.TBSCertList, KJUR.asn1.ASN1Object);
    +1259 
    +1260 /**
    +1261  * ASN.1 CRLEntry structure class for CRL
    +1262  * @name KJUR.asn1.x509.CRLEntry
    +1263  * @class ASN.1 CRLEntry structure class for CRL
    +1264  * @param {Array} params associative array of parameters (ex. {})
    +1265  * @extends KJUR.asn1.ASN1Object
    +1266  * @since 1.0.3
    +1267  * @description
    +1268  * @example
    +1269  * var e = new KJUR.asn1.x509.CRLEntry({'time': {'str': '130514235959Z'}, 'sn': {'int': 234}});
    +1270  *
    +1271  * // revokedCertificates     SEQUENCE OF SEQUENCE  {
    +1272  * //     userCertificate         CertificateSerialNumber,
    +1273  * //     revocationDate          Time,
    +1274  * //     crlEntryExtensions      Extensions OPTIONAL
    +1275  * //                             -- if present, version MUST be v2 }
    +1276  */
    +1277 KJUR.asn1.x509.CRLEntry = function(params) {
    +1278     KJUR.asn1.x509.CRLEntry.superclass.constructor.call(this);
    +1279     var sn = null;
    +1280     var time = null;
    +1281 
    +1282     /**
    +1283      * set DERInteger parameter for serial number of revoked certificate
    +1284      * @name setCertSerial
    +1285      * @memberOf KJUR.asn1.x509.CRLEntry
    +1286      * @function
    +1287      * @param {Array} intParam DERInteger parameter for certificate serial number
    +1288      * @description
    +1289      * @example
    +1290      * entry.setCertSerial({'int': 3});
    +1291      */
    +1292     this.setCertSerial = function(intParam) {
    +1293         this.sn = new KJUR.asn1.DERInteger(intParam);
     1294     };
     1295 
    -1296     if (params !== undefined) {
    -1297         if (params.str !== undefined) {
    -1298             this.setByString(params.str);
    -1299         } else if (params.ldapstr !== undefined) {
    -1300 	    this.setByLdapString(params.ldapstr);
    -1301         // If params is an object, then set the ASN1 array just using the object
    -1302         // attributes. This is nice for fields that have lots of special
    -1303         // characters (i.e. CN: 'http://www.github.com/kjur//').
    -1304         } else if (typeof params === "object") {
    -1305             this.setByObject(params);
    -1306         }
    -1307 
    -1308         if (params.certissuer !== undefined) {
    -1309             var x = new X509();
    -1310             x.hex = X509.pemToHex(params.certissuer);
    -1311             this.hTLV = x.getIssuerHex();
    -1312         }
    -1313         if (params.certsubject !== undefined) {
    -1314             var x = new X509();
    -1315             x.hex = X509.pemToHex(params.certsubject);
    -1316             this.hTLV = x.getSubjectHex();
    -1317         }
    -1318     }
    -1319 };
    -1320 YAHOO.lang.extend(KJUR.asn1.x509.X500Name, KJUR.asn1.ASN1Object);
    -1321 
    -1322 /**
    -1323  * convert OpenSSL oneline distinguished name format string to LDAP(RFC 2253) format<br/>
    -1324  * @name onelineToLDAP
    -1325  * @memberOf KJUR.asn1.x509.X500Name
    -1326  * @function
    -1327  * @param {String} s distinguished name string in OpenSSL oneline format (ex. /C=US/O=test)
    -1328  * @return {String} distinguished name string in LDAP(RFC 2253) format (ex. O=test,C=US)
    -1329  * @since jsrsasign 6.2.2 asn1x509 1.0.18
    -1330  * @description
    -1331  * This static method converts a distinguished name string in OpenSSL oneline 
    -1332  * format to LDAP(RFC 2253) format.
    -1333  * @see <a href="https://github.com/kjur/jsrsasign/wiki/NOTE-distinguished-name-representation-in-jsrsasign">jsrsasign wiki: distinguished name string difference between OpenSSL oneline and LDAP(RFC 2253)</a>
    -1334  * @example
    -1335  * KJUR.asn1.x509.X500Name.onelineToLDAP("/C=US/O=test") → 'O=test,C=US'
    -1336  * KJUR.asn1.x509.X500Name.onelineToLDAP("/C=US/O=a,a") → 'O=a\,a,C=US'
    -1337  */
    -1338 KJUR.asn1.x509.X500Name.onelineToLDAP = function(s) {
    -1339     if (s.substr(0, 1) !== "/") throw "malformed input";
    -1340 
    -1341     var result = "";
    -1342     s = s.substr(1);
    -1343 
    -1344     var a = s.split("/");
    -1345     a.reverse();
    -1346     a = a.map(function(s) {return s.replace(/,/, "\\,")});
    -1347 
    -1348     return a.join(",");
    -1349 };
    -1350 
    -1351 /**
    -1352  * convert LDAP(RFC 2253) distinguished name format string to OpenSSL oneline format<br/>
    -1353  * @name ldapToOneline
    -1354  * @memberOf KJUR.asn1.x509.X500Name
    -1355  * @function
    -1356  * @param {String} s distinguished name string in LDAP(RFC 2253) format (ex. O=test,C=US)
    -1357  * @return {String} distinguished name string in OpenSSL oneline format (ex. /C=US/O=test)
    -1358  * @since jsrsasign 6.2.2 asn1x509 1.0.18
    -1359  * @description
    -1360  * This static method converts a distinguished name string in 
    -1361  * LDAP(RFC 2253) format to OpenSSL oneline format.
    -1362  * @see <a href="https://github.com/kjur/jsrsasign/wiki/NOTE-distinguished-name-representation-in-jsrsasign">jsrsasign wiki: distinguished name string difference between OpenSSL oneline and LDAP(RFC 2253)</a>
    -1363  * @example
    -1364  * KJUR.asn1.x509.X500Name.ldapToOneline('O=test,C=US') → '/C=US/O=test'
    -1365  * KJUR.asn1.x509.X500Name.ldapToOneline('O=a\,a,C=US') → '/C=US/O=a,a'
    -1366  * KJUR.asn1.x509.X500Name.ldapToOneline('O=a/a,C=US')  → '/C=US/O=a\/a'
    -1367  */
    -1368 KJUR.asn1.x509.X500Name.ldapToOneline = function(s) {
    -1369     var a = s.split(",");
    -1370 
    -1371     // join \,
    -1372     var isBSbefore = false;
    -1373     var a2 = [];
    -1374     for (var i = 0; a.length > 0; i++) {
    -1375 	var item = a.shift();
    -1376 	//console.log("item=" + item);
    -1377 
    -1378 	if (isBSbefore === true) {
    -1379 	    var a2last = a2.pop();
    -1380 	    var newitem = (a2last + "," + item).replace(/\\,/g, ",");
    -1381 	    a2.push(newitem);
    -1382 	    isBSbefore = false;
    -1383 	} else {
    -1384 	    a2.push(item);
    -1385 	}
    -1386 
    -1387 	if (item.substr(-1, 1) === "\\") isBSbefore = true;
    -1388     }
    -1389 
    -1390     a2 = a2.map(function(s) {return s.replace("/", "\\/")});
    -1391     a2.reverse();
    -1392     return "/" + a2.join("/");
    -1393 };
    -1394 
    -1395 /**
    -1396  * RDN (Relative Distinguished Name) ASN.1 structure class
    -1397  * @name KJUR.asn1.x509.RDN
    -1398  * @class RDN (Relative Distinguished Name) ASN.1 structure class
    -1399  * @param {Array} params associative array of parameters (ex. {'str': 'C=US'})
    -1400  * @extends KJUR.asn1.ASN1Object
    -1401  * @see KJUR.asn1.x509.X500Name
    -1402  * @see KJUR.asn1.x509.RDN
    -1403  * @see KJUR.asn1.x509.AttributeTypeAndValue
    -1404  * @description
    -1405  * This class provides RelativeDistinguishedName ASN.1 class structure
    -1406  * defined in <a href="https://tools.ietf.org/html/rfc2253#section-2">RFC 2253 section 2</a>.
    -1407  * <blockquote><pre>
    -1408  * RelativeDistinguishedName ::= SET SIZE (1..MAX) OF
    -1409  *   AttributeTypeAndValue
    -1410  *
    -1411  * AttributeTypeAndValue ::= SEQUENCE {
    -1412  *   type  AttributeType,
    -1413  *   value AttributeValue }
    -1414  * </pre></blockquote>
    -1415  * <br/>
    -1416  * NOTE: Multi-valued RDN is supported since jsrsasign 6.2.1 asn1x509 1.0.17.
    -1417  * @example
    -1418  * rdn = new KJUR.asn1.x509.RDN({str: "CN=test"});
    -1419  * rdn = new KJUR.asn1.x509.RDN({str: "O=a+O=bb+O=c"}); // multi-valued
    -1420  * rdn = new KJUR.asn1.x509.RDN({str: "O=a+O=b\\+b+O=c"}); // plus escaped
    -1421  * rdn = new KJUR.asn1.x509.RDN({str: "O=a+O=\"b+b\"+O=c"}); // double quoted
    -1422  */
    -1423 KJUR.asn1.x509.RDN = function(params) {
    -1424     KJUR.asn1.x509.RDN.superclass.constructor.call(this);
    -1425     this.asn1Array = new Array();
    -1426 
    -1427     /**
    -1428      * add one AttributeTypeAndValue by string<br/>
    -1429      * @name addByString
    -1430      * @memberOf KJUR.asn1.x509.RDN#
    -1431      * @function
    -1432      * @param {String} s string of AttributeTypeAndValue
    -1433      * @return {Object} unspecified
    -1434      * @description
    -1435      * This method add one AttributeTypeAndValue to RDN object.
    -1436      * @example
    -1437      * rdn = new KJUR.asn1.x509.RDN();
    -1438      * rdn.addByString("CN=john");
    -1439      * rdn.addByString("serialNumber=1234"); // for multi-valued RDN
    -1440      */
    -1441     this.addByString = function(s) {
    -1442         this.asn1Array.push(new KJUR.asn1.x509.AttributeTypeAndValue({'str': s}));
    -1443     };
    -1444 
    -1445     /**
    -1446      * add one AttributeTypeAndValue by multi-valued string<br/>
    -1447      * @name addByMultiValuedString
    -1448      * @memberOf KJUR.asn1.x509.RDN#
    -1449      * @function
    -1450      * @param {String} s string of multi-valued RDN
    -1451      * @return {Object} unspecified
    -1452      * @since jsrsasign 6.2.1 asn1x509 1.0.17
    -1453      * @description
    -1454      * This method add multi-valued RDN to RDN object.
    -1455      * @example
    -1456      * rdn = new KJUR.asn1.x509.RDN();
    -1457      * rdn.addByMultiValuedString("CN=john+O=test");
    -1458      * rdn.addByMultiValuedString("O=a+O=b\+b\+b+O=c"); // multi-valued RDN with quoted plus
    -1459      * rdn.addByMultiValuedString("O=a+O=\"b+b+b\"+O=c"); // multi-valued RDN with quoted quotation
    -1460      */
    -1461     this.addByMultiValuedString = function(s) {
    -1462 	var a = KJUR.asn1.x509.RDN.parseString(s);
    -1463 	for (var i = 0; i < a.length; i++) {
    -1464 	    this.addByString(a[i]);
    -1465 	}
    -1466     };
    -1467 
    -1468     this.getEncodedHex = function() {
    -1469         var o = new KJUR.asn1.DERSet({"array": this.asn1Array});
    -1470         this.TLV = o.getEncodedHex();
    -1471         return this.TLV;
    -1472     };
    -1473 
    -1474     if (typeof params != "undefined") {
    -1475         if (typeof params['str'] != "undefined") {
    -1476             this.addByMultiValuedString(params['str']);
    -1477         }
    -1478     }
    -1479 };
    -1480 YAHOO.lang.extend(KJUR.asn1.x509.RDN, KJUR.asn1.ASN1Object);
    -1481 
    -1482 /**
    -1483  * parse multi-valued RDN string and split into array of 'AttributeTypeAndValue'<br/>
    -1484  * @name parseString
    -1485  * @memberOf KJUR.asn1.x509.RDN
    -1486  * @function
    -1487  * @param {String} s multi-valued string of RDN
    -1488  * @return {Array} array of string of AttributeTypeAndValue
    -1489  * @since jsrsasign 6.2.1 asn1x509 1.0.17
    -1490  * @description
    -1491  * This static method parses multi-valued RDN string and split into
    -1492  * array of AttributeTypeAndValue.
    -1493  * @example
    -1494  * KJUR.asn1.x509.RDN.parseString("CN=john") → ["CN=john"]
    -1495  * KJUR.asn1.x509.RDN.parseString("CN=john+OU=test") → ["CN=john", "OU=test"]
    -1496  * KJUR.asn1.x509.RDN.parseString('CN="jo+hn"+OU=test') → ["CN=jo+hn", "OU=test"]
    -1497  * KJUR.asn1.x509.RDN.parseString('CN=jo\+hn+OU=test') → ["CN=jo+hn", "OU=test"]
    -1498  * KJUR.asn1.x509.RDN.parseString("CN=john+OU=test+OU=t1") → ["CN=john", "OU=test", "OU=t1"]
    -1499  */
    -1500 KJUR.asn1.x509.RDN.parseString = function(s) {
    -1501     var a = s.split(/\+/);
    -1502 
    -1503     // join \+
    -1504     var isBSbefore = false;
    -1505     var a2 = [];
    -1506     for (var i = 0; a.length > 0; i++) {
    -1507 	var item = a.shift();
    -1508 	//console.log("item=" + item);
    -1509 
    -1510 	if (isBSbefore === true) {
    -1511 	    var a2last = a2.pop();
    -1512 	    var newitem = (a2last + "+" + item).replace(/\\\+/g, "+");
    -1513 	    a2.push(newitem);
    -1514 	    isBSbefore = false;
    -1515 	} else {
    -1516 	    a2.push(item);
    -1517 	}
    -1518 
    -1519 	if (item.substr(-1, 1) === "\\") isBSbefore = true;
    -1520     }
    -1521 
    -1522     // join quote
    -1523     var beginQuote = false;
    -1524     var a3 = [];
    -1525     for (var i = 0; a2.length > 0; i++) {
    -1526 	var item = a2.shift();
    -1527 
    -1528 	if (beginQuote === true) {
    -1529 	    var a3last = a3.pop();
    -1530 	    if (item.match(/"$/)) {
    -1531 		var newitem = (a3last + "+" + item).replace(/^([^=]+)="(.*)"$/, "$1=$2");
    -1532 		a3.push(newitem);
    -1533 		beginQuote = false;
    -1534 	    } else {
    -1535 		a3.push(a3last + "+" + item);
    -1536 	    }
    -1537 	} else {
    -1538 	    a3.push(item);
    -1539 	}
    -1540 
    -1541 	if (item.match(/^[^=]+="/)) {
    -1542 	    //console.log(i + "=" + item);
    -1543 	    beginQuote = true;
    -1544 	}
    -1545     }
    -1546 
    -1547     return a3;
    -1548 };
    -1549 
    -1550 /**
    -1551  * AttributeTypeAndValue ASN.1 structure class
    -1552  * @name KJUR.asn1.x509.AttributeTypeAndValue
    -1553  * @class AttributeTypeAndValue ASN.1 structure class
    -1554  * @param {Array} params associative array of parameters (ex. {'str': 'C=US'})
    -1555  * @extends KJUR.asn1.ASN1Object
    -1556  * @description
    -1557  * @see KJUR.asn1.x509.X500Name
    -1558  * @see KJUR.asn1.x509.RDN
    -1559  * @see KJUR.asn1.x509.AttributeTypeAndValue
    -1560  * @example
    -1561  */
    -1562 KJUR.asn1.x509.AttributeTypeAndValue = function(params) {
    -1563     KJUR.asn1.x509.AttributeTypeAndValue.superclass.constructor.call(this);
    -1564     var typeObj = null;
    -1565     var valueObj = null;
    -1566     var defaultDSType = "utf8";
    -1567 
    -1568     this.setByString = function(attrTypeAndValueStr) {
    -1569         var matchResult = attrTypeAndValueStr.match(/^([^=]+)=(.+)$/);
    -1570         if (matchResult) {
    -1571             this.setByAttrTypeAndValueStr(matchResult[1], matchResult[2]);
    -1572         } else {
    -1573             throw "malformed attrTypeAndValueStr: " + attrTypeAndValueStr;
    -1574         }
    -1575     };
    -1576 
    -1577     this.setByAttrTypeAndValueStr = function(shortAttrType, valueStr) {
    -1578         this.typeObj = KJUR.asn1.x509.OID.atype2obj(shortAttrType);
    -1579         var dsType = defaultDSType;
    -1580         if (shortAttrType == "C") dsType = "prn";
    -1581         this.valueObj = this.getValueObj(dsType, valueStr);
    -1582     };
    -1583 
    -1584     this.getValueObj = function(dsType, valueStr) {
    -1585         if (dsType == "utf8")   return new KJUR.asn1.DERUTF8String({"str": valueStr});
    -1586         if (dsType == "prn")    return new KJUR.asn1.DERPrintableString({"str": valueStr});
    -1587         if (dsType == "tel")    return new KJUR.asn1.DERTeletexString({"str": valueStr});
    -1588         if (dsType == "ia5")    return new KJUR.asn1.DERIA5String({"str": valueStr});
    -1589         throw "unsupported directory string type: type=" + dsType + " value=" + valueStr;
    -1590     };
    -1591 
    -1592     this.getEncodedHex = function() {
    -1593         var o = new KJUR.asn1.DERSequence({"array": [this.typeObj, this.valueObj]});
    -1594         this.TLV = o.getEncodedHex();
    -1595         return this.TLV;
    -1596     };
    -1597 
    -1598     if (typeof params != "undefined") {
    -1599         if (typeof params['str'] != "undefined") {
    -1600             this.setByString(params['str']);
    -1601         }
    -1602     }
    -1603 };
    -1604 YAHOO.lang.extend(KJUR.asn1.x509.AttributeTypeAndValue, KJUR.asn1.ASN1Object);
    -1605 
    -1606 // === END   X500Name Related =================================================
    -1607 
    -1608 // === BEGIN Other ASN1 structure class  ======================================
    +1296     /**
    +1297      * set Time parameter for revocation date
    +1298      * @name setRevocationDate
    +1299      * @memberOf KJUR.asn1.x509.CRLEntry
    +1300      * @function
    +1301      * @param {Array} timeParam Time parameter for revocation date
    +1302      * @description
    +1303      * @example
    +1304      * entry.setRevocationDate({'str': '130508235959Z'});
    +1305      */
    +1306     this.setRevocationDate = function(timeParam) {
    +1307         this.time = new KJUR.asn1.x509.Time(timeParam);
    +1308     };
    +1309 
    +1310     this.getEncodedHex = function() {
    +1311         var o = new KJUR.asn1.DERSequence({"array": [this.sn, this.time]});
    +1312         this.TLV = o.getEncodedHex();
    +1313         return this.TLV;
    +1314     };
    +1315 
    +1316     if (typeof params != "undefined") {
    +1317         if (typeof params['time'] != "undefined") {
    +1318             this.setRevocationDate(params['time']);
    +1319         }
    +1320         if (typeof params['sn'] != "undefined") {
    +1321             this.setCertSerial(params['sn']);
    +1322         }
    +1323     }
    +1324 };
    +1325 YAHOO.lang.extend(KJUR.asn1.x509.CRLEntry, KJUR.asn1.ASN1Object);
    +1326 
    +1327 // === END   CRL Related ===================================================
    +1328 
    +1329 // === BEGIN X500Name Related =================================================
    +1330 /**
    +1331  * X500Name ASN.1 structure class
    +1332  * @name KJUR.asn1.x509.X500Name
    +1333  * @class X500Name ASN.1 structure class
    +1334  * @param {Array} params associative array of parameters (ex. {'str': '/C=US/O=a'})
    +1335  * @extends KJUR.asn1.ASN1Object
    +1336  * @see KJUR.asn1.x509.X500Name
    +1337  * @see KJUR.asn1.x509.RDN
    +1338  * @see KJUR.asn1.x509.AttributeTypeAndValue
    +1339  * @description
    +1340  * This class provides DistinguishedName ASN.1 class structure
    +1341  * defined in <a href="https://tools.ietf.org/html/rfc2253#section-2">RFC 2253 section 2</a>.
    +1342  * <blockquote><pre>
    +1343  * DistinguishedName ::= RDNSequence
    +1344  *
    +1345  * RDNSequence ::= SEQUENCE OF RelativeDistinguishedName
    +1346  *
    +1347  * RelativeDistinguishedName ::= SET SIZE (1..MAX) OF
    +1348  *   AttributeTypeAndValue
    +1349  *
    +1350  * AttributeTypeAndValue ::= SEQUENCE {
    +1351  *   type  AttributeType,
    +1352  *   value AttributeValue }
    +1353  * </pre></blockquote>
    +1354  * <br/>
    +1355  * For string representation of distinguished name in jsrsasign,
    +1356  * OpenSSL oneline format is used. Please see <a href="https://github.com/kjur/jsrsasign/wiki/NOTE-distinguished-name-representation-in-jsrsasign">wiki article</a> for it.
    +1357  * <br/>
    +1358  * NOTE: Multi-valued RDN is supported since jsrsasign 6.2.1 asn1x509 1.0.17.
    +1359  * @example
    +1360  * // 1. construct with string
    +1361  * o = new KJUR.asn1.x509.X500Name({str: "/C=US/O=aaa/OU=bbb/CN=foo@example.com"});
    +1362  * o = new KJUR.asn1.x509.X500Name({str: "/C=US/O=aaa+CN=contact@example.com"}); // multi valued
    +1363  * // 2. construct by object
    +1364  * o = new KJUR.asn1.x509.X500Name({C: "US", O: "aaa", CN: "http://example.com/"});
    +1365  */
    +1366 KJUR.asn1.x509.X500Name = function(params) {
    +1367     KJUR.asn1.x509.X500Name.superclass.constructor.call(this);
    +1368     this.asn1Array = new Array();
    +1369 
    +1370     /**
    +1371      * set DN by OpenSSL oneline distinguished name string<br/>
    +1372      * @name setByString
    +1373      * @memberOf KJUR.asn1.x509.X500Name#
    +1374      * @function
    +1375      * @param {String} dnStr distinguished name by string (ex. /C=US/O=aaa)
    +1376      * @description
    +1377      * @example
    +1378      * name = new KJUR.asn1.x509.X500Name();
    +1379      * name.setByString("/C=US/O=aaa/OU=bbb/CN=foo@example.com");
    +1380      */
    +1381     this.setByString = function(dnStr) {
    +1382         var a = dnStr.split('/');
    +1383         a.shift();
    +1384         for (var i = 0; i < a.length; i++) {
    +1385             this.asn1Array.push(new KJUR.asn1.x509.RDN({'str':a[i]}));
    +1386         }
    +1387     };
    +1388 
    +1389     /**
    +1390      * set DN by LDAP(RFC 2253) distinguished name string<br/>
    +1391      * @name setByLdapString
    +1392      * @memberOf KJUR.asn1.x509.X500Name#
    +1393      * @function
    +1394      * @param {String} dnStr distinguished name by LDAP string (ex. O=aaa,C=US)
    +1395      * @since jsrsasign 6.2.2 asn1x509 1.0.18
    +1396      * @description
    +1397      * @example
    +1398      * name = new KJUR.asn1.x509.X500Name();
    +1399      * name.setByLdapString("CN=foo@example.com,OU=bbb,O=aaa,C=US");
    +1400      */
    +1401     this.setByLdapString = function(dnStr) {
    +1402 	var oneline = KJUR.asn1.x509.X500Name.ldapToOneline(dnStr);
    +1403 	this.setByString(oneline);
    +1404     };
    +1405 
    +1406     /**
    +1407      * set DN by associative array<br/>
    +1408      * @name setByObject
    +1409      * @memberOf KJUR.asn1.x509.X500Name#
    +1410      * @function
    +1411      * @param {Array} dnObj associative array of DN (ex. {C: "US", O: "aaa"})
    +1412      * @since jsrsasign 4.9. asn1x509 1.0.13
    +1413      * @description
    +1414      * @example
    +1415      * name = new KJUR.asn1.x509.X500Name();
    +1416      * name.setByObject({C: "US", O: "aaa", CN="http://example.com/"1});
    +1417      */
    +1418     this.setByObject = function(dnObj) {
    +1419         // Get all the dnObject attributes and stuff them in the ASN.1 array.
    +1420         for (var x in dnObj) {
    +1421             if (dnObj.hasOwnProperty(x)) {
    +1422                 var newRDN = new KJUR.asn1.x509.RDN(
    +1423                     {'str': x + '=' + dnObj[x]});
    +1424                 // Initialize or push into the ANS1 array.
    +1425                 this.asn1Array ? this.asn1Array.push(newRDN)
    +1426                     : this.asn1Array = [newRDN];
    +1427             }
    +1428         }
    +1429     };
    +1430 
    +1431     this.getEncodedHex = function() {
    +1432         if (typeof this.hTLV == "string") return this.hTLV;
    +1433         var o = new KJUR.asn1.DERSequence({"array": this.asn1Array});
    +1434         this.hTLV = o.getEncodedHex();
    +1435         return this.hTLV;
    +1436     };
    +1437 
    +1438     if (params !== undefined) {
    +1439         if (params.str !== undefined) {
    +1440             this.setByString(params.str);
    +1441         } else if (params.ldapstr !== undefined) {
    +1442 	    this.setByLdapString(params.ldapstr);
    +1443         // If params is an object, then set the ASN1 array just using the object
    +1444         // attributes. This is nice for fields that have lots of special
    +1445         // characters (i.e. CN: 'http://www.github.com/kjur//').
    +1446         } else if (typeof params === "object") {
    +1447             this.setByObject(params);
    +1448         }
    +1449 
    +1450         if (params.certissuer !== undefined) {
    +1451             var x = new X509();
    +1452             x.hex = X509.pemToHex(params.certissuer);
    +1453             this.hTLV = x.getIssuerHex();
    +1454         }
    +1455         if (params.certsubject !== undefined) {
    +1456             var x = new X509();
    +1457             x.hex = X509.pemToHex(params.certsubject);
    +1458             this.hTLV = x.getSubjectHex();
    +1459         }
    +1460     }
    +1461 };
    +1462 YAHOO.lang.extend(KJUR.asn1.x509.X500Name, KJUR.asn1.ASN1Object);
    +1463 
    +1464 /**
    +1465  * convert OpenSSL oneline distinguished name format string to LDAP(RFC 2253) format<br/>
    +1466  * @name onelineToLDAP
    +1467  * @memberOf KJUR.asn1.x509.X500Name
    +1468  * @function
    +1469  * @param {String} s distinguished name string in OpenSSL oneline format (ex. /C=US/O=test)
    +1470  * @return {String} distinguished name string in LDAP(RFC 2253) format (ex. O=test,C=US)
    +1471  * @since jsrsasign 6.2.2 asn1x509 1.0.18
    +1472  * @description
    +1473  * This static method converts a distinguished name string in OpenSSL oneline 
    +1474  * format to LDAP(RFC 2253) format.
    +1475  * @see <a href="https://github.com/kjur/jsrsasign/wiki/NOTE-distinguished-name-representation-in-jsrsasign">jsrsasign wiki: distinguished name string difference between OpenSSL oneline and LDAP(RFC 2253)</a>
    +1476  * @example
    +1477  * KJUR.asn1.x509.X500Name.onelineToLDAP("/C=US/O=test") → 'O=test,C=US'
    +1478  * KJUR.asn1.x509.X500Name.onelineToLDAP("/C=US/O=a,a") → 'O=a\,a,C=US'
    +1479  */
    +1480 KJUR.asn1.x509.X500Name.onelineToLDAP = function(s) {
    +1481     if (s.substr(0, 1) !== "/") throw "malformed input";
    +1482 
    +1483     var result = "";
    +1484     s = s.substr(1);
    +1485 
    +1486     var a = s.split("/");
    +1487     a.reverse();
    +1488     a = a.map(function(s) {return s.replace(/,/, "\\,")});
    +1489 
    +1490     return a.join(",");
    +1491 };
    +1492 
    +1493 /**
    +1494  * convert LDAP(RFC 2253) distinguished name format string to OpenSSL oneline format<br/>
    +1495  * @name ldapToOneline
    +1496  * @memberOf KJUR.asn1.x509.X500Name
    +1497  * @function
    +1498  * @param {String} s distinguished name string in LDAP(RFC 2253) format (ex. O=test,C=US)
    +1499  * @return {String} distinguished name string in OpenSSL oneline format (ex. /C=US/O=test)
    +1500  * @since jsrsasign 6.2.2 asn1x509 1.0.18
    +1501  * @description
    +1502  * This static method converts a distinguished name string in 
    +1503  * LDAP(RFC 2253) format to OpenSSL oneline format.
    +1504  * @see <a href="https://github.com/kjur/jsrsasign/wiki/NOTE-distinguished-name-representation-in-jsrsasign">jsrsasign wiki: distinguished name string difference between OpenSSL oneline and LDAP(RFC 2253)</a>
    +1505  * @example
    +1506  * KJUR.asn1.x509.X500Name.ldapToOneline('O=test,C=US') → '/C=US/O=test'
    +1507  * KJUR.asn1.x509.X500Name.ldapToOneline('O=a\,a,C=US') → '/C=US/O=a,a'
    +1508  * KJUR.asn1.x509.X500Name.ldapToOneline('O=a/a,C=US')  → '/C=US/O=a\/a'
    +1509  */
    +1510 KJUR.asn1.x509.X500Name.ldapToOneline = function(s) {
    +1511     var a = s.split(",");
    +1512 
    +1513     // join \,
    +1514     var isBSbefore = false;
    +1515     var a2 = [];
    +1516     for (var i = 0; a.length > 0; i++) {
    +1517 	var item = a.shift();
    +1518 	//console.log("item=" + item);
    +1519 
    +1520 	if (isBSbefore === true) {
    +1521 	    var a2last = a2.pop();
    +1522 	    var newitem = (a2last + "," + item).replace(/\\,/g, ",");
    +1523 	    a2.push(newitem);
    +1524 	    isBSbefore = false;
    +1525 	} else {
    +1526 	    a2.push(item);
    +1527 	}
    +1528 
    +1529 	if (item.substr(-1, 1) === "\\") isBSbefore = true;
    +1530     }
    +1531 
    +1532     a2 = a2.map(function(s) {return s.replace("/", "\\/")});
    +1533     a2.reverse();
    +1534     return "/" + a2.join("/");
    +1535 };
    +1536 
    +1537 /**
    +1538  * RDN (Relative Distinguished Name) ASN.1 structure class
    +1539  * @name KJUR.asn1.x509.RDN
    +1540  * @class RDN (Relative Distinguished Name) ASN.1 structure class
    +1541  * @param {Array} params associative array of parameters (ex. {'str': 'C=US'})
    +1542  * @extends KJUR.asn1.ASN1Object
    +1543  * @see KJUR.asn1.x509.X500Name
    +1544  * @see KJUR.asn1.x509.RDN
    +1545  * @see KJUR.asn1.x509.AttributeTypeAndValue
    +1546  * @description
    +1547  * This class provides RelativeDistinguishedName ASN.1 class structure
    +1548  * defined in <a href="https://tools.ietf.org/html/rfc2253#section-2">RFC 2253 section 2</a>.
    +1549  * <blockquote><pre>
    +1550  * RelativeDistinguishedName ::= SET SIZE (1..MAX) OF
    +1551  *   AttributeTypeAndValue
    +1552  *
    +1553  * AttributeTypeAndValue ::= SEQUENCE {
    +1554  *   type  AttributeType,
    +1555  *   value AttributeValue }
    +1556  * </pre></blockquote>
    +1557  * <br/>
    +1558  * NOTE: Multi-valued RDN is supported since jsrsasign 6.2.1 asn1x509 1.0.17.
    +1559  * @example
    +1560  * rdn = new KJUR.asn1.x509.RDN({str: "CN=test"});
    +1561  * rdn = new KJUR.asn1.x509.RDN({str: "O=a+O=bb+O=c"}); // multi-valued
    +1562  * rdn = new KJUR.asn1.x509.RDN({str: "O=a+O=b\\+b+O=c"}); // plus escaped
    +1563  * rdn = new KJUR.asn1.x509.RDN({str: "O=a+O=\"b+b\"+O=c"}); // double quoted
    +1564  */
    +1565 KJUR.asn1.x509.RDN = function(params) {
    +1566     KJUR.asn1.x509.RDN.superclass.constructor.call(this);
    +1567     this.asn1Array = new Array();
    +1568 
    +1569     /**
    +1570      * add one AttributeTypeAndValue by string<br/>
    +1571      * @name addByString
    +1572      * @memberOf KJUR.asn1.x509.RDN#
    +1573      * @function
    +1574      * @param {String} s string of AttributeTypeAndValue
    +1575      * @return {Object} unspecified
    +1576      * @description
    +1577      * This method add one AttributeTypeAndValue to RDN object.
    +1578      * @example
    +1579      * rdn = new KJUR.asn1.x509.RDN();
    +1580      * rdn.addByString("CN=john");
    +1581      * rdn.addByString("serialNumber=1234"); // for multi-valued RDN
    +1582      */
    +1583     this.addByString = function(s) {
    +1584         this.asn1Array.push(new KJUR.asn1.x509.AttributeTypeAndValue({'str': s}));
    +1585     };
    +1586 
    +1587     /**
    +1588      * add one AttributeTypeAndValue by multi-valued string<br/>
    +1589      * @name addByMultiValuedString
    +1590      * @memberOf KJUR.asn1.x509.RDN#
    +1591      * @function
    +1592      * @param {String} s string of multi-valued RDN
    +1593      * @return {Object} unspecified
    +1594      * @since jsrsasign 6.2.1 asn1x509 1.0.17
    +1595      * @description
    +1596      * This method add multi-valued RDN to RDN object.
    +1597      * @example
    +1598      * rdn = new KJUR.asn1.x509.RDN();
    +1599      * rdn.addByMultiValuedString("CN=john+O=test");
    +1600      * rdn.addByMultiValuedString("O=a+O=b\+b\+b+O=c"); // multi-valued RDN with quoted plus
    +1601      * rdn.addByMultiValuedString("O=a+O=\"b+b+b\"+O=c"); // multi-valued RDN with quoted quotation
    +1602      */
    +1603     this.addByMultiValuedString = function(s) {
    +1604 	var a = KJUR.asn1.x509.RDN.parseString(s);
    +1605 	for (var i = 0; i < a.length; i++) {
    +1606 	    this.addByString(a[i]);
    +1607 	}
    +1608     };
     1609 
    -1610 /**
    -1611  * SubjectPublicKeyInfo ASN.1 structure class
    -1612  * @name KJUR.asn1.x509.SubjectPublicKeyInfo
    -1613  * @class SubjectPublicKeyInfo ASN.1 structure class
    -1614  * @param {Object} params parameter for subject public key
    -1615  * @extends KJUR.asn1.ASN1Object
    -1616  * @description
    -1617  * <br/>
    -1618  * As for argument 'params' for constructor, you can specify one of
    -1619  * following properties:
    -1620  * <ul>
    -1621  * <li>{@link RSAKey} object</li>
    -1622  * <li>{@link KJUR.crypto.ECDSA} object</li>
    -1623  * <li>{@link KJUR.crypto.DSA} object</li>
    -1624  * <li>(DEPRECATED)rsakey - specify {@link RSAKey} object of subject public key</li>
    -1625  * <li>(DEPRECATED)rsapem - specify a string of PEM public key of RSA key</li>
    -1626  * </ul>
    -1627  * NOTE1: 'params' can be omitted.<br/>
    -1628  * NOTE2: DSA/ECDSA key object is also supported since asn1x509 1.0.6.<br/>
    -1629  * <h4>EXAMPLE</h4>
    -1630  * @example
    -1631  * var spki = new KJUR.asn1.x509.SubjectPublicKeyInfo(RSAKey_object);
    -1632  * var spki = new KJUR.asn1.x509.SubjectPublicKeyInfo(KJURcryptoECDSA_object);
    -1633  * var spki = new KJUR.asn1.x509.SubjectPublicKeyInfo(KJURcryptoDSA_object);
    -1634  */
    -1635 KJUR.asn1.x509.SubjectPublicKeyInfo = function(params) {
    -1636     KJUR.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call(this);
    -1637     var asn1AlgId = null;
    -1638     var asn1SubjPKey = null;
    -1639     var rsaKey = null;
    -1640 
    -1641     /**
    -1642      * (DEPRECATED) set RSAKey object as subject public key
    -1643      * @name setRSAKey
    -1644      * @memberOf KJUR.asn1.x509.SubjectPublicKeyInfo
    -1645      * @function
    -1646      * @param {RSAKey} rsaKey {@link RSAKey} object for RSA public key
    -1647      * @description
    -1648      * @deprecated
    -1649      * @example
    -1650      * spki.setRSAKey(rsaKey);
    -1651      */
    -1652     this.setRSAKey = function(rsaKey) {
    -1653         if (! RSAKey.prototype.isPrototypeOf(rsaKey))
    -1654             throw "argument is not RSAKey instance";
    -1655         this.rsaKey = rsaKey;
    -1656         var asn1RsaN = new KJUR.asn1.DERInteger({'bigint': rsaKey.n});
    -1657         var asn1RsaE = new KJUR.asn1.DERInteger({'int': rsaKey.e});
    -1658         var asn1RsaPub = new KJUR.asn1.DERSequence({'array': [asn1RsaN, asn1RsaE]});
    -1659         var rsaKeyHex = asn1RsaPub.getEncodedHex();
    -1660         this.asn1AlgId = new KJUR.asn1.x509.AlgorithmIdentifier({'name':'rsaEncryption'});
    -1661         this.asn1SubjPKey = new KJUR.asn1.DERBitString({'hex':'00'+rsaKeyHex});
    -1662     };
    +1610     this.getEncodedHex = function() {
    +1611         var o = new KJUR.asn1.DERSet({"array": this.asn1Array});
    +1612         this.TLV = o.getEncodedHex();
    +1613         return this.TLV;
    +1614     };
    +1615 
    +1616     if (typeof params != "undefined") {
    +1617         if (typeof params['str'] != "undefined") {
    +1618             this.addByMultiValuedString(params['str']);
    +1619         }
    +1620     }
    +1621 };
    +1622 YAHOO.lang.extend(KJUR.asn1.x509.RDN, KJUR.asn1.ASN1Object);
    +1623 
    +1624 /**
    +1625  * parse multi-valued RDN string and split into array of 'AttributeTypeAndValue'<br/>
    +1626  * @name parseString
    +1627  * @memberOf KJUR.asn1.x509.RDN
    +1628  * @function
    +1629  * @param {String} s multi-valued string of RDN
    +1630  * @return {Array} array of string of AttributeTypeAndValue
    +1631  * @since jsrsasign 6.2.1 asn1x509 1.0.17
    +1632  * @description
    +1633  * This static method parses multi-valued RDN string and split into
    +1634  * array of AttributeTypeAndValue.
    +1635  * @example
    +1636  * KJUR.asn1.x509.RDN.parseString("CN=john") → ["CN=john"]
    +1637  * KJUR.asn1.x509.RDN.parseString("CN=john+OU=test") → ["CN=john", "OU=test"]
    +1638  * KJUR.asn1.x509.RDN.parseString('CN="jo+hn"+OU=test') → ["CN=jo+hn", "OU=test"]
    +1639  * KJUR.asn1.x509.RDN.parseString('CN=jo\+hn+OU=test') → ["CN=jo+hn", "OU=test"]
    +1640  * KJUR.asn1.x509.RDN.parseString("CN=john+OU=test+OU=t1") → ["CN=john", "OU=test", "OU=t1"]
    +1641  */
    +1642 KJUR.asn1.x509.RDN.parseString = function(s) {
    +1643     var a = s.split(/\+/);
    +1644 
    +1645     // join \+
    +1646     var isBSbefore = false;
    +1647     var a2 = [];
    +1648     for (var i = 0; a.length > 0; i++) {
    +1649 	var item = a.shift();
    +1650 	//console.log("item=" + item);
    +1651 
    +1652 	if (isBSbefore === true) {
    +1653 	    var a2last = a2.pop();
    +1654 	    var newitem = (a2last + "+" + item).replace(/\\\+/g, "+");
    +1655 	    a2.push(newitem);
    +1656 	    isBSbefore = false;
    +1657 	} else {
    +1658 	    a2.push(item);
    +1659 	}
    +1660 
    +1661 	if (item.substr(-1, 1) === "\\") isBSbefore = true;
    +1662     }
     1663 
    -1664     /**
    -1665      * (DEPRECATED) set a PEM formatted RSA public key string as RSA public key
    -1666      * @name setRSAPEM
    -1667      * @memberOf KJUR.asn1.x509.SubjectPublicKeyInfo
    -1668      * @function
    -1669      * @param {String} rsaPubPEM PEM formatted RSA public key string
    -1670      * @deprecated
    -1671      * @description
    -1672      * @example
    -1673      * spki.setRSAPEM(rsaPubPEM);
    -1674      */
    -1675     this.setRSAPEM = function(rsaPubPEM) {
    -1676         if (rsaPubPEM.match(/-----BEGIN PUBLIC KEY-----/)) {
    -1677             var s = rsaPubPEM;
    -1678             s = s.replace(/^-----[^-]+-----/, '');
    -1679             s = s.replace(/-----[^-]+-----\s*$/, '');
    -1680             var rsaB64 = s.replace(/\s+/g, '');
    -1681             var rsaWA = CryptoJS.enc.Base64.parse(rsaB64);
    -1682             var rsaP8Hex = CryptoJS.enc.Hex.stringify(rsaWA);
    -1683             var a = _rsapem_getHexValueArrayOfChildrenFromHex(rsaP8Hex);
    -1684             var hBitStrVal = a[1];
    -1685             var rsaHex = hBitStrVal.substr(2);
    -1686             var a3 = _rsapem_getHexValueArrayOfChildrenFromHex(rsaHex);
    -1687             var rsaKey = new RSAKey();
    -1688             rsaKey.setPublic(a3[0], a3[1]);
    -1689             this.setRSAKey(rsaKey);
    -1690         } else {
    -1691             throw "key not supported";
    -1692         }
    -1693     };
    -1694 
    -1695     /*
    -1696      * @since asn1x509 1.0.7
    -1697      */
    -1698     this.getASN1Object = function() {
    -1699         if (this.asn1AlgId == null || this.asn1SubjPKey == null)
    -1700             throw "algId and/or subjPubKey not set";
    -1701         var o = new KJUR.asn1.DERSequence({'array':
    -1702                                            [this.asn1AlgId, this.asn1SubjPKey]});
    -1703         return o;
    -1704     };
    -1705 
    -1706     this.getEncodedHex = function() {
    -1707         var o = this.getASN1Object();
    -1708         this.hTLV = o.getEncodedHex();
    -1709         return this.hTLV;
    -1710     };
    -1711 
    -1712     this._setRSAKey = function(key) {
    -1713         var asn1RsaPub = KJUR.asn1.ASN1Util.newObject({
    -1714             'seq': [{'int': {'bigint': key.n}}, {'int': {'int': key.e}}]
    -1715         });
    -1716         var rsaKeyHex = asn1RsaPub.getEncodedHex();
    -1717         this.asn1AlgId = new KJUR.asn1.x509.AlgorithmIdentifier({'name':'rsaEncryption'});
    -1718         this.asn1SubjPKey = new KJUR.asn1.DERBitString({'hex':'00'+rsaKeyHex});
    -1719     };
    -1720 
    -1721     this._setEC = function(key) {
    -1722         var asn1Params = new KJUR.asn1.DERObjectIdentifier({'name': key.curveName});
    -1723         this.asn1AlgId =
    -1724             new KJUR.asn1.x509.AlgorithmIdentifier({'name': 'ecPublicKey',
    -1725                                                     'asn1params': asn1Params});
    -1726         this.asn1SubjPKey = new KJUR.asn1.DERBitString({'hex': '00' + key.pubKeyHex});
    -1727     };
    -1728 
    -1729     this._setDSA = function(key) {
    -1730         var asn1Params = new KJUR.asn1.ASN1Util.newObject({
    -1731             'seq': [{'int': {'bigint': key.p}},
    -1732                     {'int': {'bigint': key.q}},
    -1733                     {'int': {'bigint': key.g}}]
    -1734         });
    -1735         this.asn1AlgId =
    -1736             new KJUR.asn1.x509.AlgorithmIdentifier({'name': 'dsa',
    -1737                                                     'asn1params': asn1Params});
    -1738         var pubInt = new KJUR.asn1.DERInteger({'bigint': key.y});
    -1739         this.asn1SubjPKey = new KJUR.asn1.DERBitString({'hex': '00' + pubInt.getEncodedHex()});
    -1740     };
    -1741 
    -1742     if (typeof params != "undefined") {
    -1743         if (typeof RSAKey != 'undefined' && params instanceof RSAKey) {
    -1744             this._setRSAKey(params);
    -1745         } else if (typeof KJUR.crypto.ECDSA != 'undefined' &&
    -1746                    params instanceof KJUR.crypto.ECDSA) {
    -1747             this._setEC(params);
    -1748         } else if (typeof KJUR.crypto.DSA != 'undefined' &&
    -1749                    params instanceof KJUR.crypto.DSA) {
    -1750             this._setDSA(params);
    -1751         } else if (typeof params['rsakey'] != "undefined") {
    -1752             this.setRSAKey(params['rsakey']);
    -1753         } else if (typeof params['rsapem'] != "undefined") {
    -1754             this.setRSAPEM(params['rsapem']);
    -1755         }
    -1756     }
    -1757 };
    -1758 YAHOO.lang.extend(KJUR.asn1.x509.SubjectPublicKeyInfo, KJUR.asn1.ASN1Object);
    -1759 
    -1760 /**
    -1761  * Time ASN.1 structure class
    -1762  * @name KJUR.asn1.x509.Time
    -1763  * @class Time ASN.1 structure class
    -1764  * @param {Array} params associative array of parameters (ex. {'str': '130508235959Z'})
    -1765  * @extends KJUR.asn1.ASN1Object
    -1766  * @description
    -1767  * <br/>
    -1768  * <h4>EXAMPLES</h4>
    -1769  * @example
    -1770  * var t1 = new KJUR.asn1.x509.Time{'str': '130508235959Z'} // UTCTime by default
    -1771  * var t2 = new KJUR.asn1.x509.Time{'type': 'gen',  'str': '20130508235959Z'} // GeneralizedTime
    -1772  */
    -1773 KJUR.asn1.x509.Time = function(params) {
    -1774     KJUR.asn1.x509.Time.superclass.constructor.call(this);
    -1775     var type = null;
    -1776     var timeParams = null;
    -1777 
    -1778     this.setTimeParams = function(timeParams) {
    -1779         this.timeParams = timeParams;
    -1780     }
    -1781 
    -1782     this.getEncodedHex = function() {
    -1783         var o = null;
    -1784 
    -1785         if (this.timeParams != null) {
    -1786             if (this.type == "utc") {
    -1787                 o = new KJUR.asn1.DERUTCTime(this.timeParams);
    -1788             } else {
    -1789                 o = new KJUR.asn1.DERGeneralizedTime(this.timeParams);
    -1790             }
    -1791         } else {
    -1792             if (this.type == "utc") {
    -1793                 o = new KJUR.asn1.DERUTCTime();
    -1794             } else {
    -1795                 o = new KJUR.asn1.DERGeneralizedTime();
    -1796             }
    -1797         }
    -1798         this.TLV = o.getEncodedHex();
    -1799         return this.TLV;
    -1800     };
    -1801 
    -1802     this.type = "utc";
    -1803     if (typeof params != "undefined") {
    -1804         if (typeof params.type != "undefined") {
    -1805             this.type = params.type;
    -1806         } else {
    -1807             if (typeof params.str != "undefined") {
    -1808                 if (params.str.match(/^[0-9]{12}Z$/)) this.type = "utc";
    -1809                 if (params.str.match(/^[0-9]{14}Z$/)) this.type = "gen";
    -1810             }
    -1811         }
    -1812         this.timeParams = params;
    -1813     }
    -1814 };
    -1815 YAHOO.lang.extend(KJUR.asn1.x509.Time, KJUR.asn1.ASN1Object);
    -1816 
    -1817 /**
    -1818  * AlgorithmIdentifier ASN.1 structure class
    -1819  * @name KJUR.asn1.x509.AlgorithmIdentifier
    -1820  * @class AlgorithmIdentifier ASN.1 structure class
    -1821  * @param {Array} params associative array of parameters (ex. {'name': 'SHA1withRSA'})
    -1822  * @extends KJUR.asn1.ASN1Object
    -1823  * @description
    -1824  * @example
    -1825  * algId1 = new KJUR.asn1.x509.AlgorithmIdentifier({name: "sha1"});
    -1826  */
    -1827 KJUR.asn1.x509.AlgorithmIdentifier = function(params) {
    -1828     KJUR.asn1.x509.AlgorithmIdentifier.superclass.constructor.call(this);
    -1829     var nameAlg = null;
    -1830     var asn1Alg = null;
    -1831     var asn1Params = null;
    -1832     var paramEmpty = false;
    -1833 
    -1834     this.getEncodedHex = function() {
    -1835         if (this.nameAlg == null && this.asn1Alg == null) {
    -1836             throw "algorithm not specified";
    -1837         }
    -1838         if (this.nameAlg != null && this.asn1Alg == null) {
    -1839             this.asn1Alg = KJUR.asn1.x509.OID.name2obj(this.nameAlg);
    -1840         }
    -1841         var a = [this.asn1Alg];
    -1842         if (! this.paramEmpty) a.push(this.asn1Params);
    -1843         var o = new KJUR.asn1.DERSequence({'array': a});
    -1844         this.hTLV = o.getEncodedHex();
    -1845         return this.hTLV;
    +1664     // join quote
    +1665     var beginQuote = false;
    +1666     var a3 = [];
    +1667     for (var i = 0; a2.length > 0; i++) {
    +1668 	var item = a2.shift();
    +1669 
    +1670 	if (beginQuote === true) {
    +1671 	    var a3last = a3.pop();
    +1672 	    if (item.match(/"$/)) {
    +1673 		var newitem = (a3last + "+" + item).replace(/^([^=]+)="(.*)"$/, "$1=$2");
    +1674 		a3.push(newitem);
    +1675 		beginQuote = false;
    +1676 	    } else {
    +1677 		a3.push(a3last + "+" + item);
    +1678 	    }
    +1679 	} else {
    +1680 	    a3.push(item);
    +1681 	}
    +1682 
    +1683 	if (item.match(/^[^=]+="/)) {
    +1684 	    //console.log(i + "=" + item);
    +1685 	    beginQuote = true;
    +1686 	}
    +1687     }
    +1688 
    +1689     return a3;
    +1690 };
    +1691 
    +1692 /**
    +1693  * AttributeTypeAndValue ASN.1 structure class
    +1694  * @name KJUR.asn1.x509.AttributeTypeAndValue
    +1695  * @class AttributeTypeAndValue ASN.1 structure class
    +1696  * @param {Array} params associative array of parameters (ex. {'str': 'C=US'})
    +1697  * @extends KJUR.asn1.ASN1Object
    +1698  * @description
    +1699  * @see KJUR.asn1.x509.X500Name
    +1700  * @see KJUR.asn1.x509.RDN
    +1701  * @see KJUR.asn1.x509.AttributeTypeAndValue
    +1702  * @example
    +1703  */
    +1704 KJUR.asn1.x509.AttributeTypeAndValue = function(params) {
    +1705     KJUR.asn1.x509.AttributeTypeAndValue.superclass.constructor.call(this);
    +1706     var typeObj = null;
    +1707     var valueObj = null;
    +1708     var defaultDSType = "utf8";
    +1709 
    +1710     this.setByString = function(attrTypeAndValueStr) {
    +1711         var matchResult = attrTypeAndValueStr.match(/^([^=]+)=(.+)$/);
    +1712         if (matchResult) {
    +1713             this.setByAttrTypeAndValueStr(matchResult[1], matchResult[2]);
    +1714         } else {
    +1715             throw "malformed attrTypeAndValueStr: " + attrTypeAndValueStr;
    +1716         }
    +1717     };
    +1718 
    +1719     this.setByAttrTypeAndValueStr = function(shortAttrType, valueStr) {
    +1720         this.typeObj = KJUR.asn1.x509.OID.atype2obj(shortAttrType);
    +1721         var dsType = defaultDSType;
    +1722         if (shortAttrType == "C") dsType = "prn";
    +1723         this.valueObj = this.getValueObj(dsType, valueStr);
    +1724     };
    +1725 
    +1726     this.getValueObj = function(dsType, valueStr) {
    +1727         if (dsType == "utf8")   return new KJUR.asn1.DERUTF8String({"str": valueStr});
    +1728         if (dsType == "prn")    return new KJUR.asn1.DERPrintableString({"str": valueStr});
    +1729         if (dsType == "tel")    return new KJUR.asn1.DERTeletexString({"str": valueStr});
    +1730         if (dsType == "ia5")    return new KJUR.asn1.DERIA5String({"str": valueStr});
    +1731         throw "unsupported directory string type: type=" + dsType + " value=" + valueStr;
    +1732     };
    +1733 
    +1734     this.getEncodedHex = function() {
    +1735         var o = new KJUR.asn1.DERSequence({"array": [this.typeObj, this.valueObj]});
    +1736         this.TLV = o.getEncodedHex();
    +1737         return this.TLV;
    +1738     };
    +1739 
    +1740     if (typeof params != "undefined") {
    +1741         if (typeof params['str'] != "undefined") {
    +1742             this.setByString(params['str']);
    +1743         }
    +1744     }
    +1745 };
    +1746 YAHOO.lang.extend(KJUR.asn1.x509.AttributeTypeAndValue, KJUR.asn1.ASN1Object);
    +1747 
    +1748 // === END   X500Name Related =================================================
    +1749 
    +1750 // === BEGIN Other ASN1 structure class  ======================================
    +1751 
    +1752 /**
    +1753  * SubjectPublicKeyInfo ASN.1 structure class
    +1754  * @name KJUR.asn1.x509.SubjectPublicKeyInfo
    +1755  * @class SubjectPublicKeyInfo ASN.1 structure class
    +1756  * @param {Object} params parameter for subject public key
    +1757  * @extends KJUR.asn1.ASN1Object
    +1758  * @description
    +1759  * <br/>
    +1760  * As for argument 'params' for constructor, you can specify one of
    +1761  * following properties:
    +1762  * <ul>
    +1763  * <li>{@link RSAKey} object</li>
    +1764  * <li>{@link KJUR.crypto.ECDSA} object</li>
    +1765  * <li>{@link KJUR.crypto.DSA} object</li>
    +1766  * <li>(DEPRECATED)rsakey - specify {@link RSAKey} object of subject public key</li>
    +1767  * <li>(DEPRECATED)rsapem - specify a string of PEM public key of RSA key</li>
    +1768  * </ul>
    +1769  * NOTE1: 'params' can be omitted.<br/>
    +1770  * NOTE2: DSA/ECDSA key object is also supported since asn1x509 1.0.6.<br/>
    +1771  * <h4>EXAMPLE</h4>
    +1772  * @example
    +1773  * var spki = new KJUR.asn1.x509.SubjectPublicKeyInfo(RSAKey_object);
    +1774  * var spki = new KJUR.asn1.x509.SubjectPublicKeyInfo(KJURcryptoECDSA_object);
    +1775  * var spki = new KJUR.asn1.x509.SubjectPublicKeyInfo(KJURcryptoDSA_object);
    +1776  */
    +1777 KJUR.asn1.x509.SubjectPublicKeyInfo = function(params) {
    +1778     KJUR.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call(this);
    +1779     var asn1AlgId = null;
    +1780     var asn1SubjPKey = null;
    +1781     var rsaKey = null;
    +1782 
    +1783     /**
    +1784      * (DEPRECATED) set RSAKey object as subject public key
    +1785      * @name setRSAKey
    +1786      * @memberOf KJUR.asn1.x509.SubjectPublicKeyInfo
    +1787      * @function
    +1788      * @param {RSAKey} rsaKey {@link RSAKey} object for RSA public key
    +1789      * @description
    +1790      * @deprecated
    +1791      * @example
    +1792      * spki.setRSAKey(rsaKey);
    +1793      */
    +1794     this.setRSAKey = function(rsaKey) {
    +1795         if (! RSAKey.prototype.isPrototypeOf(rsaKey))
    +1796             throw "argument is not RSAKey instance";
    +1797         this.rsaKey = rsaKey;
    +1798         var asn1RsaN = new KJUR.asn1.DERInteger({'bigint': rsaKey.n});
    +1799         var asn1RsaE = new KJUR.asn1.DERInteger({'int': rsaKey.e});
    +1800         var asn1RsaPub = new KJUR.asn1.DERSequence({'array': [asn1RsaN, asn1RsaE]});
    +1801         var rsaKeyHex = asn1RsaPub.getEncodedHex();
    +1802         this.asn1AlgId = new KJUR.asn1.x509.AlgorithmIdentifier({'name':'rsaEncryption'});
    +1803         this.asn1SubjPKey = new KJUR.asn1.DERBitString({'hex':'00'+rsaKeyHex});
    +1804     };
    +1805 
    +1806     /**
    +1807      * (DEPRECATED) set a PEM formatted RSA public key string as RSA public key
    +1808      * @name setRSAPEM
    +1809      * @memberOf KJUR.asn1.x509.SubjectPublicKeyInfo
    +1810      * @function
    +1811      * @param {String} rsaPubPEM PEM formatted RSA public key string
    +1812      * @deprecated
    +1813      * @description
    +1814      * @example
    +1815      * spki.setRSAPEM(rsaPubPEM);
    +1816      */
    +1817     this.setRSAPEM = function(rsaPubPEM) {
    +1818         if (rsaPubPEM.match(/-----BEGIN PUBLIC KEY-----/)) {
    +1819             var s = rsaPubPEM;
    +1820             s = s.replace(/^-----[^-]+-----/, '');
    +1821             s = s.replace(/-----[^-]+-----\s*$/, '');
    +1822             var rsaB64 = s.replace(/\s+/g, '');
    +1823             var rsaWA = CryptoJS.enc.Base64.parse(rsaB64);
    +1824             var rsaP8Hex = CryptoJS.enc.Hex.stringify(rsaWA);
    +1825             var a = _rsapem_getHexValueArrayOfChildrenFromHex(rsaP8Hex);
    +1826             var hBitStrVal = a[1];
    +1827             var rsaHex = hBitStrVal.substr(2);
    +1828             var a3 = _rsapem_getHexValueArrayOfChildrenFromHex(rsaHex);
    +1829             var rsaKey = new RSAKey();
    +1830             rsaKey.setPublic(a3[0], a3[1]);
    +1831             this.setRSAKey(rsaKey);
    +1832         } else {
    +1833             throw "key not supported";
    +1834         }
    +1835     };
    +1836 
    +1837     /*
    +1838      * @since asn1x509 1.0.7
    +1839      */
    +1840     this.getASN1Object = function() {
    +1841         if (this.asn1AlgId == null || this.asn1SubjPKey == null)
    +1842             throw "algId and/or subjPubKey not set";
    +1843         var o = new KJUR.asn1.DERSequence({'array':
    +1844                                            [this.asn1AlgId, this.asn1SubjPKey]});
    +1845         return o;
     1846     };
     1847 
    -1848     if (typeof params != "undefined") {
    -1849         if (typeof params['name'] != "undefined") {
    -1850             this.nameAlg = params['name'];
    -1851         }
    -1852         if (typeof params['asn1params'] != "undefined") {
    -1853             this.asn1Params = params['asn1params'];
    -1854         }
    -1855         if (typeof params['paramempty'] != "undefined") {
    -1856             this.paramEmpty = params['paramempty'];
    -1857         }
    -1858     }
    -1859     if (this.asn1Params == null) {
    -1860         this.asn1Params = new KJUR.asn1.DERNull();
    -1861     }
    -1862 };
    -1863 YAHOO.lang.extend(KJUR.asn1.x509.AlgorithmIdentifier, KJUR.asn1.ASN1Object);
    -1864 
    -1865 /**
    -1866  * GeneralName ASN.1 structure class<br/>
    -1867  * @name KJUR.asn1.x509.GeneralName
    -1868  * @class GeneralName ASN.1 structure class
    -1869  * @description
    -1870  * <br/>
    -1871  * As for argument 'params' for constructor, you can specify one of
    -1872  * following properties:
    -1873  * <ul>
    -1874  * <li>rfc822 - rfc822Name[1] (ex. user1@foo.com)</li>
    -1875  * <li>dns - dNSName[2] (ex. foo.com)</li>
    -1876  * <li>uri - uniformResourceIdentifier[6] (ex. http://foo.com/)</li>
    -1877  * <li>certissuer - directoryName[4] (PEM or hex string of cert)</li>
    -1878  * <li>certsubj - directoryName[4] (PEM or hex string of cert)</li>
    -1879  * </ul>
    -1880  * NOTE1: certissuer and certsubj is supported since asn1x509 1.0.10.
    -1881  *
    -1882  * Here is definition of the ASN.1 syntax:
    -1883  * <pre>
    -1884  * -- NOTE: under the CHOICE, it will always be explicit.
    -1885  * GeneralName ::= CHOICE {
    -1886  *         otherName                       [0]     OtherName,
    -1887  *         rfc822Name                      [1]     IA5String,
    -1888  *         dNSName                         [2]     IA5String,
    -1889  *         x400Address                     [3]     ORAddress,
    -1890  *         directoryName                   [4]     Name,
    -1891  *         ediPartyName                    [5]     EDIPartyName,
    -1892  *         uniformResourceIdentifier       [6]     IA5String,
    -1893  *         iPAddress                       [7]     OCTET STRING,
    -1894  *         registeredID                    [8]     OBJECT IDENTIFIER }
    -1895  * </pre>
    -1896  *
    -1897  *
    -1898  *
    -1899  * @example
    -1900  * gn = new KJUR.asn1.x509.GeneralName({rfc822:      'test@aaa.com'});
    -1901  * gn = new KJUR.asn1.x509.GeneralName({dns:         'aaa.com'});
    -1902  * gn = new KJUR.asn1.x509.GeneralName({uri:         'http://aaa.com/'});
    -1903  * gn = new KJUR.asn1.x509.GeneralName({certissuer:  certPEM});
    -1904  * gn = new KJUR.asn1.x509.GeneralName({certsubj:    certPEM});
    -1905  */
    -1906 KJUR.asn1.x509.GeneralName = function(params) {
    -1907     KJUR.asn1.x509.GeneralName.superclass.constructor.call(this);
    -1908     var asn1Obj = null;
    -1909     var type = null;
    -1910     var pTag = {rfc822: '81', dns: '82', dn: 'a4',  uri: '86'};
    -1911     this.explicit = false;
    -1912 
    -1913     this.setByParam = function(params) {
    -1914         var str = null;
    -1915         var v = null;
    -1916 
    -1917 	if (typeof params == "undefined") return;
    -1918 
    -1919         if (typeof params.rfc822 != "undefined") {
    -1920             this.type = 'rfc822';
    -1921             v = new KJUR.asn1.DERIA5String({'str': params[this.type]});
    -1922         }
    +1848     this.getEncodedHex = function() {
    +1849         var o = this.getASN1Object();
    +1850         this.hTLV = o.getEncodedHex();
    +1851         return this.hTLV;
    +1852     };
    +1853 
    +1854     this._setRSAKey = function(key) {
    +1855         var asn1RsaPub = KJUR.asn1.ASN1Util.newObject({
    +1856             'seq': [{'int': {'bigint': key.n}}, {'int': {'int': key.e}}]
    +1857         });
    +1858         var rsaKeyHex = asn1RsaPub.getEncodedHex();
    +1859         this.asn1AlgId = new KJUR.asn1.x509.AlgorithmIdentifier({'name':'rsaEncryption'});
    +1860         this.asn1SubjPKey = new KJUR.asn1.DERBitString({'hex':'00'+rsaKeyHex});
    +1861     };
    +1862 
    +1863     this._setEC = function(key) {
    +1864         var asn1Params = new KJUR.asn1.DERObjectIdentifier({'name': key.curveName});
    +1865         this.asn1AlgId =
    +1866             new KJUR.asn1.x509.AlgorithmIdentifier({'name': 'ecPublicKey',
    +1867                                                     'asn1params': asn1Params});
    +1868         this.asn1SubjPKey = new KJUR.asn1.DERBitString({'hex': '00' + key.pubKeyHex});
    +1869     };
    +1870 
    +1871     this._setDSA = function(key) {
    +1872         var asn1Params = new KJUR.asn1.ASN1Util.newObject({
    +1873             'seq': [{'int': {'bigint': key.p}},
    +1874                     {'int': {'bigint': key.q}},
    +1875                     {'int': {'bigint': key.g}}]
    +1876         });
    +1877         this.asn1AlgId =
    +1878             new KJUR.asn1.x509.AlgorithmIdentifier({'name': 'dsa',
    +1879                                                     'asn1params': asn1Params});
    +1880         var pubInt = new KJUR.asn1.DERInteger({'bigint': key.y});
    +1881         this.asn1SubjPKey = new KJUR.asn1.DERBitString({'hex': '00' + pubInt.getEncodedHex()});
    +1882     };
    +1883 
    +1884     if (typeof params != "undefined") {
    +1885         if (typeof RSAKey != 'undefined' && params instanceof RSAKey) {
    +1886             this._setRSAKey(params);
    +1887         } else if (typeof KJUR.crypto.ECDSA != 'undefined' &&
    +1888                    params instanceof KJUR.crypto.ECDSA) {
    +1889             this._setEC(params);
    +1890         } else if (typeof KJUR.crypto.DSA != 'undefined' &&
    +1891                    params instanceof KJUR.crypto.DSA) {
    +1892             this._setDSA(params);
    +1893         } else if (typeof params['rsakey'] != "undefined") {
    +1894             this.setRSAKey(params['rsakey']);
    +1895         } else if (typeof params['rsapem'] != "undefined") {
    +1896             this.setRSAPEM(params['rsapem']);
    +1897         }
    +1898     }
    +1899 };
    +1900 YAHOO.lang.extend(KJUR.asn1.x509.SubjectPublicKeyInfo, KJUR.asn1.ASN1Object);
    +1901 
    +1902 /**
    +1903  * Time ASN.1 structure class
    +1904  * @name KJUR.asn1.x509.Time
    +1905  * @class Time ASN.1 structure class
    +1906  * @param {Array} params associative array of parameters (ex. {'str': '130508235959Z'})
    +1907  * @extends KJUR.asn1.ASN1Object
    +1908  * @description
    +1909  * <br/>
    +1910  * <h4>EXAMPLES</h4>
    +1911  * @example
    +1912  * var t1 = new KJUR.asn1.x509.Time{'str': '130508235959Z'} // UTCTime by default
    +1913  * var t2 = new KJUR.asn1.x509.Time{'type': 'gen',  'str': '20130508235959Z'} // GeneralizedTime
    +1914  */
    +1915 KJUR.asn1.x509.Time = function(params) {
    +1916     KJUR.asn1.x509.Time.superclass.constructor.call(this);
    +1917     var type = null;
    +1918     var timeParams = null;
    +1919 
    +1920     this.setTimeParams = function(timeParams) {
    +1921         this.timeParams = timeParams;
    +1922     }
     1923 
    -1924         if (typeof params.dns != "undefined") {
    -1925             this.type = 'dns';
    -1926             v = new KJUR.asn1.DERIA5String({'str': params[this.type]});
    -1927         }
    -1928 
    -1929         if (typeof params.uri != "undefined") {
    -1930             this.type = 'uri';
    -1931             v = new KJUR.asn1.DERIA5String({'str': params[this.type]});
    -1932         }
    -1933 
    -1934 	if (typeof params.certissuer != "undefined") {
    -1935 	    this.type = 'dn';
    -1936 	    this.explicit = true;
    -1937 	    var certStr = params.certissuer;
    -1938 	    var certHex = null;
    -1939 
    -1940 	    if (certStr.match(/^[0-9A-Fa-f]+$/)) {
    -1941 		certHex == certStr;
    -1942             }
    +1924     this.getEncodedHex = function() {
    +1925         var o = null;
    +1926 
    +1927         if (this.timeParams != null) {
    +1928             if (this.type == "utc") {
    +1929                 o = new KJUR.asn1.DERUTCTime(this.timeParams);
    +1930             } else {
    +1931                 o = new KJUR.asn1.DERGeneralizedTime(this.timeParams);
    +1932             }
    +1933         } else {
    +1934             if (this.type == "utc") {
    +1935                 o = new KJUR.asn1.DERUTCTime();
    +1936             } else {
    +1937                 o = new KJUR.asn1.DERGeneralizedTime();
    +1938             }
    +1939         }
    +1940         this.TLV = o.getEncodedHex();
    +1941         return this.TLV;
    +1942     };
     1943 
    -1944 	    if (certStr.indexOf("-----BEGIN ") != -1) {
    -1945 		certHex = X509.pemToHex(certStr);
    -1946 	    }
    -1947 
    -1948 	    if (certHex == null) throw "certissuer param not cert";
    -1949 	    var x = new X509();
    -1950 	    x.hex = certHex;
    -1951 	    var dnHex = x.getIssuerHex();
    -1952 	    v = new KJUR.asn1.ASN1Object();
    -1953 	    v.hTLV = dnHex;
    -1954 	}
    -1955 
    -1956 	if (typeof params.certsubj != "undefined") {
    -1957 	    this.type = 'dn';
    -1958 	    this.explicit = true;
    -1959 	    var certStr = params.certsubj;
    -1960 	    var certHex = null;
    -1961 	    if (certStr.match(/^[0-9A-Fa-f]+$/)) {
    -1962 		certHex == certStr;
    -1963             }
    -1964 	    if (certStr.indexOf("-----BEGIN ") != -1) {
    -1965 		certHex = X509.pemToHex(certStr);
    -1966 	    }
    -1967 	    if (certHex == null) throw "certsubj param not cert";
    -1968 	    var x = new X509();
    -1969 	    x.hex = certHex;
    -1970 	    var dnHex = x.getSubjectHex();
    -1971 	    v = new KJUR.asn1.ASN1Object();
    -1972 	    v.hTLV = dnHex;
    -1973 	}
    -1974 
    -1975         if (this.type == null)
    -1976             throw "unsupported type in params=" + params;
    -1977         this.asn1Obj = new KJUR.asn1.DERTaggedObject({'explicit': this.explicit,
    -1978                                                       'tag': pTag[this.type],
    -1979                                                       'obj': v});
    -1980     };
    -1981 
    -1982     this.getEncodedHex = function() {
    -1983         return this.asn1Obj.getEncodedHex();
    -1984     }
    -1985 
    -1986     if (typeof params != "undefined") {
    -1987         this.setByParam(params);
    -1988     }
    +1944     this.type = "utc";
    +1945     if (typeof params != "undefined") {
    +1946         if (typeof params.type != "undefined") {
    +1947             this.type = params.type;
    +1948         } else {
    +1949             if (typeof params.str != "undefined") {
    +1950                 if (params.str.match(/^[0-9]{12}Z$/)) this.type = "utc";
    +1951                 if (params.str.match(/^[0-9]{14}Z$/)) this.type = "gen";
    +1952             }
    +1953         }
    +1954         this.timeParams = params;
    +1955     }
    +1956 };
    +1957 YAHOO.lang.extend(KJUR.asn1.x509.Time, KJUR.asn1.ASN1Object);
    +1958 
    +1959 /**
    +1960  * AlgorithmIdentifier ASN.1 structure class
    +1961  * @name KJUR.asn1.x509.AlgorithmIdentifier
    +1962  * @class AlgorithmIdentifier ASN.1 structure class
    +1963  * @param {Array} params associative array of parameters (ex. {'name': 'SHA1withRSA'})
    +1964  * @extends KJUR.asn1.ASN1Object
    +1965  * @description
    +1966  * @example
    +1967  * algId1 = new KJUR.asn1.x509.AlgorithmIdentifier({name: "sha1"});
    +1968  */
    +1969 KJUR.asn1.x509.AlgorithmIdentifier = function(params) {
    +1970     KJUR.asn1.x509.AlgorithmIdentifier.superclass.constructor.call(this);
    +1971     var nameAlg = null;
    +1972     var asn1Alg = null;
    +1973     var asn1Params = null;
    +1974     var paramEmpty = false;
    +1975 
    +1976     this.getEncodedHex = function() {
    +1977         if (this.nameAlg == null && this.asn1Alg == null) {
    +1978             throw "algorithm not specified";
    +1979         }
    +1980         if (this.nameAlg != null && this.asn1Alg == null) {
    +1981             this.asn1Alg = KJUR.asn1.x509.OID.name2obj(this.nameAlg);
    +1982         }
    +1983         var a = [this.asn1Alg];
    +1984         if (! this.paramEmpty) a.push(this.asn1Params);
    +1985         var o = new KJUR.asn1.DERSequence({'array': a});
    +1986         this.hTLV = o.getEncodedHex();
    +1987         return this.hTLV;
    +1988     };
     1989 
    -1990 };
    -1991 YAHOO.lang.extend(KJUR.asn1.x509.GeneralName, KJUR.asn1.ASN1Object);
    -1992 
    -1993 /**
    -1994  * GeneralNames ASN.1 structure class<br/>
    -1995  * @name KJUR.asn1.x509.GeneralNames
    -1996  * @class GeneralNames ASN.1 structure class
    -1997  * @description
    -1998  * <br/>
    -1999  * <h4>EXAMPLE AND ASN.1 SYNTAX</h4>
    -2000  * @example
    -2001  * gns = new KJUR.asn1.x509.GeneralNames([{'uri': 'http://aaa.com/'}, {'uri': 'http://bbb.com/'}]);
    -2002  *
    -2003  * GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName
    -2004  */
    -2005 KJUR.asn1.x509.GeneralNames = function(paramsArray) {
    -2006     KJUR.asn1.x509.GeneralNames.superclass.constructor.call(this);
    -2007     var asn1Array = null;
    -2008 
    -2009     /**
    -2010      * set a array of {@link KJUR.asn1.x509.GeneralName} parameters<br/>
    -2011      * @name setByParamArray
    -2012      * @memberOf KJUR.asn1.x509.GeneralNames#
    -2013      * @function
    -2014      * @param {Array} paramsArray Array of {@link KJUR.asn1.x509.GeneralNames}
    -2015      * @description
    -2016      * <br/>
    -2017      * <h4>EXAMPLES</h4>
    -2018      * @example
    -2019      * gns = new KJUR.asn1.x509.GeneralNames();
    -2020      * gns.setByParamArray([{uri: 'http://aaa.com/'}, {uri: 'http://bbb.com/'}]);
    -2021      */
    -2022     this.setByParamArray = function(paramsArray) {
    -2023         for (var i = 0; i < paramsArray.length; i++) {
    -2024             var o = new KJUR.asn1.x509.GeneralName(paramsArray[i]);
    -2025             this.asn1Array.push(o);
    -2026         }
    -2027     };
    -2028 
    -2029     this.getEncodedHex = function() {
    -2030         var o = new KJUR.asn1.DERSequence({'array': this.asn1Array});
    -2031         return o.getEncodedHex();
    -2032     };
    -2033 
    -2034     this.asn1Array = new Array();
    -2035     if (typeof paramsArray != "undefined") {
    -2036         this.setByParamArray(paramsArray);
    -2037     }
    -2038 };
    -2039 YAHOO.lang.extend(KJUR.asn1.x509.GeneralNames, KJUR.asn1.ASN1Object);
    -2040 
    -2041 /**
    -2042  * DistributionPointName ASN.1 structure class
    -2043  * @name KJUR.asn1.x509.DistributionPointName
    -2044  * @class DistributionPointName ASN.1 structure class
    -2045  * @description
    -2046  * @example
    -2047  */
    -2048 KJUR.asn1.x509.DistributionPointName = function(gnOrRdn) {
    -2049     KJUR.asn1.x509.DistributionPointName.superclass.constructor.call(this);
    -2050     var asn1Obj = null;
    -2051     var type = null;
    -2052     var tag = null;
    -2053     var asn1V = null;
    -2054 
    -2055     this.getEncodedHex = function() {
    -2056         if (this.type != "full")
    -2057             throw "currently type shall be 'full': " + this.type;
    -2058         this.asn1Obj = new KJUR.asn1.DERTaggedObject({'explicit': false,
    -2059                                                       'tag': this.tag,
    -2060                                                       'obj': this.asn1V});
    -2061         this.hTLV = this.asn1Obj.getEncodedHex();
    -2062         return this.hTLV;
    -2063     };
    -2064 
    -2065     if (typeof gnOrRdn != "undefined") {
    -2066         if (KJUR.asn1.x509.GeneralNames.prototype.isPrototypeOf(gnOrRdn)) {
    -2067             this.type = "full";
    -2068             this.tag = "a0";
    -2069             this.asn1V = gnOrRdn;
    -2070         } else {
    -2071             throw "This class supports GeneralNames only as argument";
    +1990     if (typeof params != "undefined") {
    +1991         if (typeof params['name'] != "undefined") {
    +1992             this.nameAlg = params['name'];
    +1993         }
    +1994         if (typeof params['asn1params'] != "undefined") {
    +1995             this.asn1Params = params['asn1params'];
    +1996         }
    +1997         if (typeof params['paramempty'] != "undefined") {
    +1998             this.paramEmpty = params['paramempty'];
    +1999         }
    +2000     }
    +2001     if (this.asn1Params == null) {
    +2002         this.asn1Params = new KJUR.asn1.DERNull();
    +2003     }
    +2004 };
    +2005 YAHOO.lang.extend(KJUR.asn1.x509.AlgorithmIdentifier, KJUR.asn1.ASN1Object);
    +2006 
    +2007 /**
    +2008  * GeneralName ASN.1 structure class<br/>
    +2009  * @name KJUR.asn1.x509.GeneralName
    +2010  * @class GeneralName ASN.1 structure class
    +2011  * @description
    +2012  * <br/>
    +2013  * As for argument 'params' for constructor, you can specify one of
    +2014  * following properties:
    +2015  * <ul>
    +2016  * <li>rfc822 - rfc822Name[1] (ex. user1@foo.com)</li>
    +2017  * <li>dns - dNSName[2] (ex. foo.com)</li>
    +2018  * <li>uri - uniformResourceIdentifier[6] (ex. http://foo.com/)</li>
    +2019  * <li>dn - directoryName[4] (ex. /C=US/O=Test)</li>
    +2020  * <li>ldapdn - directoryName[4] (ex. O=Test,C=US)</li>
    +2021  * <li>certissuer - directoryName[4] (PEM or hex string of cert)</li>
    +2022  * <li>certsubj - directoryName[4] (PEM or hex string of cert)</li>
    +2023  * </ul>
    +2024  * NOTE1: certissuer and certsubj were supported since asn1x509 1.0.10.<br/>
    +2025  * NOTE2: dn and ldapdn were supported since jsrsasign 6.2.3 asn1x509 1.0.19.<br/>
    +2026  *
    +2027  * Here is definition of the ASN.1 syntax:
    +2028  * <pre>
    +2029  * -- NOTE: under the CHOICE, it will always be explicit.
    +2030  * GeneralName ::= CHOICE {
    +2031  *   otherName                  [0] OtherName,
    +2032  *   rfc822Name                 [1] IA5String,
    +2033  *   dNSName                    [2] IA5String,
    +2034  *   x400Address                [3] ORAddress,
    +2035  *   directoryName              [4] Name,
    +2036  *   ediPartyName               [5] EDIPartyName,
    +2037  *   uniformResourceIdentifier  [6] IA5String,
    +2038  *   iPAddress                  [7] OCTET STRING,
    +2039  *   registeredID               [8] OBJECT IDENTIFIER }
    +2040  * </pre>
    +2041  *
    +2042  * @example
    +2043  * gn = new KJUR.asn1.x509.GeneralName({rfc822:     'test@aaa.com'});
    +2044  * gn = new KJUR.asn1.x509.GeneralName({dns:        'aaa.com'});
    +2045  * gn = new KJUR.asn1.x509.GeneralName({uri:        'http://aaa.com/'});
    +2046  * gn = new KJUR.asn1.x509.GeneralName({dn:         '/C=US/O=Test'});
    +2047  * gn = new KJUR.asn1.x509.GeneralName({ldapdn:     'O=Test,C=US'});
    +2048  * gn = new KJUR.asn1.x509.GeneralName({certissuer: certPEM});
    +2049  * gn = new KJUR.asn1.x509.GeneralName({certsubj:   certPEM});
    +2050  */
    +2051 KJUR.asn1.x509.GeneralName = function(params) {
    +2052     KJUR.asn1.x509.GeneralName.superclass.constructor.call(this);
    +2053     var asn1Obj = null;
    +2054     var type = null;
    +2055     var pTag = {rfc822: '81', dns: '82', dn: 'a4',  uri: '86'};
    +2056     this.explicit = false;
    +2057 
    +2058     this.setByParam = function(params) {
    +2059         var str = null;
    +2060         var v = null;
    +2061 
    +2062 	if (params === undefined) return;
    +2063 
    +2064         if (params.rfc822 !== undefined) {
    +2065             this.type = 'rfc822';
    +2066             v = new KJUR.asn1.DERIA5String({str: params[this.type]});
    +2067         }
    +2068 
    +2069         if (params.dns !== undefined) {
    +2070             this.type = 'dns';
    +2071             v = new KJUR.asn1.DERIA5String({str: params[this.type]});
     2072         }
    -2073     }
    -2074 };
    -2075 YAHOO.lang.extend(KJUR.asn1.x509.DistributionPointName, KJUR.asn1.ASN1Object);
    -2076 
    -2077 /**
    -2078  * DistributionPoint ASN.1 structure class
    -2079  * @name KJUR.asn1.x509.DistributionPoint
    -2080  * @class DistributionPoint ASN.1 structure class
    -2081  * @description
    -2082  * @example
    -2083  */
    -2084 KJUR.asn1.x509.DistributionPoint = function(params) {
    -2085     KJUR.asn1.x509.DistributionPoint.superclass.constructor.call(this);
    -2086     var asn1DP = null;
    -2087 
    -2088     this.getEncodedHex = function() {
    -2089         var seq = new KJUR.asn1.DERSequence();
    -2090         if (this.asn1DP != null) {
    -2091             var o1 = new KJUR.asn1.DERTaggedObject({'explicit': true,
    -2092                                                     'tag': 'a0',
    -2093                                                     'obj': this.asn1DP});
    -2094             seq.appendASN1Object(o1);
    -2095         }
    -2096         this.hTLV = seq.getEncodedHex();
    -2097         return this.hTLV;
    -2098     };
    -2099 
    -2100     if (typeof params != "undefined") {
    -2101         if (typeof params['dpobj'] != "undefined") {
    -2102             this.asn1DP = params['dpobj'];
    -2103         }
    -2104     }
    -2105 };
    -2106 YAHOO.lang.extend(KJUR.asn1.x509.DistributionPoint, KJUR.asn1.ASN1Object);
    -2107 
    -2108 /**
    -2109  * static object for OID
    -2110  * @name KJUR.asn1.x509.OID
    -2111  * @class static object for OID
    -2112  * @property {Assoc Array} atype2oidList for short attribute type name and oid (ex. 'C' and '2.5.4.6')
    -2113  * @property {Assoc Array} name2oidList for oid name and oid (ex. 'keyUsage' and '2.5.29.15')
    -2114  * @property {Assoc Array} objCache for caching name and DERObjectIdentifier object
    -2115  * @description
    -2116  * This class defines OID name and values.
    -2117  * AttributeType names registered in OID.atype2oidList are following:
    -2118  * <table style="border-width: thin; border-style: solid; witdh: 100%">
    -2119  * <tr><th>short</th><th>long</th><th>OID</th></tr>
    -2120  * <tr><td>CN</td>commonName<td></td><td>2.5.4.3</td></tr>
    -2121  * <tr><td>L</td><td>localityName</td><td>2.5.4.7</td></tr>
    -2122  * <tr><td>ST</td><td>stateOrProvinceName</td><td>2.5.4.8</td></tr>
    -2123  * <tr><td>O</td><td>organizationName</td><td>2.5.4.10</td></tr>
    -2124  * <tr><td>OU</td><td>organizationalUnitName</td><td>2.5.4.11</td></tr>
    -2125  * <tr><td>C</td><td></td>countryName<td>2.5.4.6</td></tr>
    -2126  * <tr><td>STREET</td>streetAddress<td></td><td>2.5.4.6</td></tr>
    -2127  * <tr><td>DC</td><td>domainComponent</td><td>0.9.2342.19200300.100.1.25</td></tr>
    -2128  * <tr><td>UID</td><td>userId</td><td>0.9.2342.19200300.100.1.1</td></tr>
    -2129  * <tr><td>SN</td><td>surname</td><td>2.5.4.4</td></tr>
    -2130  * <tr><td>DN</td><td>distinguishedName</td><td>2.5.4.49</td></tr>
    -2131  * <tr><td>E</td><td>emailAddress</td><td>1.2.840.113549.1.9.1</td></tr>
    -2132  * <tr><td></td><td>businessCategory</td><td>2.5.4.15</td></tr>
    -2133  * <tr><td></td><td>postalCode</td><td>2.5.4.17</td></tr>
    -2134  * <tr><td></td><td>jurisdictionOfIncorporationL</td><td>1.3.6.1.4.1.311.60.2.1.1</td></tr>
    -2135  * <tr><td></td><td>jurisdictionOfIncorporationSP</td><td>1.3.6.1.4.1.311.60.2.1.2</td></tr>
    -2136  * <tr><td></td><td>jurisdictionOfIncorporationC</td><td>1.3.6.1.4.1.311.60.2.1.3</td></tr>
    -2137  * </table>
    -2138  *
    -2139  * @example
    -2140  */
    -2141 KJUR.asn1.x509.OID = new function(params) {
    -2142     this.atype2oidList = {
    -2143 	// RFC 4514 AttributeType name string (MUST recognized)
    -2144         'CN':		'2.5.4.3',
    -2145         'L':		'2.5.4.7',
    -2146         'ST':		'2.5.4.8',
    -2147         'O':		'2.5.4.10',
    -2148         'OU':		'2.5.4.11',
    -2149         'C':		'2.5.4.6',
    -2150         'STREET':	'2.5.4.9',
    -2151         'DC':		'0.9.2342.19200300.100.1.25',
    -2152         'UID':		'0.9.2342.19200300.100.1.1',
    -2153 	// other AttributeType name string
    -2154 	// http://blog.livedoor.jp/k_urushima/archives/656114.html
    -2155         'SN':		'2.5.4.4', // surname
    -2156         'DN':		'2.5.4.49', // distinguishedName
    -2157         'E':		'1.2.840.113549.1.9.1', // emailAddress in MS.NET or Bouncy
    -2158 	// other AttributeType name string (no short name)
    -2159 	'businessCategory':		'2.5.4.15',
    -2160 	'postalCode':			'2.5.4.17',
    -2161 	'jurisdictionOfIncorporationL':	'1.3.6.1.4.1.311.60.2.1.1',
    -2162 	'jurisdictionOfIncorporationSP':'1.3.6.1.4.1.311.60.2.1.2',
    -2163 	'jurisdictionOfIncorporationC':	'1.3.6.1.4.1.311.60.2.1.3'
    -2164     };
    -2165     this.name2oidList = {
    -2166         'sha1':                 '1.3.14.3.2.26',
    -2167         'sha256':               '2.16.840.1.101.3.4.2.1',
    -2168         'sha384':               '2.16.840.1.101.3.4.2.2',
    -2169         'sha512':               '2.16.840.1.101.3.4.2.3',
    -2170         'sha224':               '2.16.840.1.101.3.4.2.4',
    -2171         'md5':                  '1.2.840.113549.2.5',
    -2172         'md2':                  '1.3.14.7.2.2.1',
    -2173         'ripemd160':            '1.3.36.3.2.1',
    -2174 
    -2175         'MD2withRSA':           '1.2.840.113549.1.1.2',
    -2176         'MD4withRSA':           '1.2.840.113549.1.1.3',
    -2177         'MD5withRSA':           '1.2.840.113549.1.1.4',
    -2178         'SHA1withRSA':          '1.2.840.113549.1.1.5',
    -2179         'SHA224withRSA':        '1.2.840.113549.1.1.14',
    -2180         'SHA256withRSA':        '1.2.840.113549.1.1.11',
    -2181         'SHA384withRSA':        '1.2.840.113549.1.1.12',
    -2182         'SHA512withRSA':        '1.2.840.113549.1.1.13',
    +2073 
    +2074         if (params.uri !== undefined) {
    +2075             this.type = 'uri';
    +2076             v = new KJUR.asn1.DERIA5String({str: params[this.type]});
    +2077         }
    +2078 
    +2079         if (params.dn !== undefined) {
    +2080 	    this.type = 'dn';
    +2081 	    v = new KJUR.asn1.x509.X500Name({str: params.dn});
    +2082 	}
    +2083 
    +2084         if (params.ldapdn !== undefined) {
    +2085 	    this.type = 'dn';
    +2086 	    v = new KJUR.asn1.x509.X500Name({ldapstr: params.ldapdn});
    +2087 	}
    +2088 
    +2089 	if (params.certissuer !== undefined) {
    +2090 	    this.type = 'dn';
    +2091 	    this.explicit = true;
    +2092 	    var certStr = params.certissuer;
    +2093 	    var certHex = null;
    +2094 
    +2095 	    if (certStr.match(/^[0-9A-Fa-f]+$/)) {
    +2096 		certHex == certStr;
    +2097             }
    +2098 
    +2099 	    if (certStr.indexOf("-----BEGIN ") != -1) {
    +2100 		certHex = X509.pemToHex(certStr);
    +2101 	    }
    +2102 
    +2103 	    if (certHex == null) throw "certissuer param not cert";
    +2104 	    var x = new X509();
    +2105 	    x.hex = certHex;
    +2106 	    var dnHex = x.getIssuerHex();
    +2107 	    v = new KJUR.asn1.ASN1Object();
    +2108 	    v.hTLV = dnHex;
    +2109 	}
    +2110 
    +2111 	if (params.certsubj !== undefined) {
    +2112 	    this.type = 'dn';
    +2113 	    this.explicit = true;
    +2114 	    var certStr = params.certsubj;
    +2115 	    var certHex = null;
    +2116 	    if (certStr.match(/^[0-9A-Fa-f]+$/)) {
    +2117 		certHex == certStr;
    +2118             }
    +2119 	    if (certStr.indexOf("-----BEGIN ") != -1) {
    +2120 		certHex = X509.pemToHex(certStr);
    +2121 	    }
    +2122 	    if (certHex == null) throw "certsubj param not cert";
    +2123 	    var x = new X509();
    +2124 	    x.hex = certHex;
    +2125 	    var dnHex = x.getSubjectHex();
    +2126 	    v = new KJUR.asn1.ASN1Object();
    +2127 	    v.hTLV = dnHex;
    +2128 	}
    +2129 
    +2130         if (this.type == null)
    +2131             throw "unsupported type in params=" + params;
    +2132         this.asn1Obj = new KJUR.asn1.DERTaggedObject({'explicit': this.explicit,
    +2133                                                       'tag': pTag[this.type],
    +2134                                                       'obj': v});
    +2135     };
    +2136 
    +2137     this.getEncodedHex = function() {
    +2138         return this.asn1Obj.getEncodedHex();
    +2139     }
    +2140 
    +2141     if (params !== undefined) {
    +2142         this.setByParam(params);
    +2143     }
    +2144 
    +2145 };
    +2146 YAHOO.lang.extend(KJUR.asn1.x509.GeneralName, KJUR.asn1.ASN1Object);
    +2147 
    +2148 /**
    +2149  * GeneralNames ASN.1 structure class<br/>
    +2150  * @name KJUR.asn1.x509.GeneralNames
    +2151  * @class GeneralNames ASN.1 structure class
    +2152  * @description
    +2153  * <br/>
    +2154  * <h4>EXAMPLE AND ASN.1 SYNTAX</h4>
    +2155  * @example
    +2156  * gns = new KJUR.asn1.x509.GeneralNames([{'uri': 'http://aaa.com/'}, {'uri': 'http://bbb.com/'}]);
    +2157  *
    +2158  * GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName
    +2159  */
    +2160 KJUR.asn1.x509.GeneralNames = function(paramsArray) {
    +2161     KJUR.asn1.x509.GeneralNames.superclass.constructor.call(this);
    +2162     var asn1Array = null;
    +2163 
    +2164     /**
    +2165      * set a array of {@link KJUR.asn1.x509.GeneralName} parameters<br/>
    +2166      * @name setByParamArray
    +2167      * @memberOf KJUR.asn1.x509.GeneralNames#
    +2168      * @function
    +2169      * @param {Array} paramsArray Array of {@link KJUR.asn1.x509.GeneralNames}
    +2170      * @description
    +2171      * <br/>
    +2172      * <h4>EXAMPLES</h4>
    +2173      * @example
    +2174      * gns = new KJUR.asn1.x509.GeneralNames();
    +2175      * gns.setByParamArray([{uri: 'http://aaa.com/'}, {uri: 'http://bbb.com/'}]);
    +2176      */
    +2177     this.setByParamArray = function(paramsArray) {
    +2178         for (var i = 0; i < paramsArray.length; i++) {
    +2179             var o = new KJUR.asn1.x509.GeneralName(paramsArray[i]);
    +2180             this.asn1Array.push(o);
    +2181         }
    +2182     };
     2183 
    -2184         'SHA1withECDSA':        '1.2.840.10045.4.1',
    -2185         'SHA224withECDSA':      '1.2.840.10045.4.3.1',
    -2186         'SHA256withECDSA':      '1.2.840.10045.4.3.2',
    -2187         'SHA384withECDSA':      '1.2.840.10045.4.3.3',
    -2188         'SHA512withECDSA':      '1.2.840.10045.4.3.4',
    -2189 
    -2190         'dsa':                  '1.2.840.10040.4.1',
    -2191         'SHA1withDSA':          '1.2.840.10040.4.3',
    -2192         'SHA224withDSA':        '2.16.840.1.101.3.4.3.1',
    -2193         'SHA256withDSA':        '2.16.840.1.101.3.4.3.2',
    -2194 
    -2195         'rsaEncryption':        '1.2.840.113549.1.1.1',
    -2196 
    -2197 	// X.500 AttributeType defined in RFC 4514
    -2198         'commonName':			'2.5.4.3',
    -2199         'localityName':			'2.5.4.7',
    -2200         'stateOrProvinceName':		'2.5.4.8',
    -2201         'organizationName':		'2.5.4.10',
    -2202         'organizationalUnitName':	'2.5.4.11',
    -2203         'countryName':			'2.5.4.6',
    -2204         'streetAddress':		'2.5.4.9',
    -2205         'domainComponent':		'0.9.2342.19200300.100.1.25',
    -2206         'userId':			'0.9.2342.19200300.100.1.1',
    -2207 	// other AttributeType name string
    -2208 	'surname':			'2.5.4.4',
    -2209 	'distinguishedName':		'2.5.4.49',
    -2210 	'emailAddress':			'1.2.840.113549.1.9.1',
    -2211 	// other AttributeType name string (no short name)
    -2212 	'businessCategory':		'2.5.4.15',
    -2213 	'postalCode':			'2.5.4.17',
    -2214 	'jurisdictionOfIncorporationL':	'1.3.6.1.4.1.311.60.2.1.1',
    -2215 	'jurisdictionOfIncorporationSP':'1.3.6.1.4.1.311.60.2.1.2',
    -2216 	'jurisdictionOfIncorporationC':	'1.3.6.1.4.1.311.60.2.1.3',
    -2217 
    -2218         'subjectKeyIdentifier': '2.5.29.14',
    -2219         'keyUsage':             '2.5.29.15',
    -2220         'subjectAltName':       '2.5.29.17',
    -2221         'basicConstraints':     '2.5.29.19',
    -2222         'nameConstraints':      '2.5.29.30',
    -2223         'cRLDistributionPoints':'2.5.29.31',
    -2224         'certificatePolicies':  '2.5.29.32',
    -2225         'authorityKeyIdentifier':'2.5.29.35',
    -2226         'policyConstraints':    '2.5.29.36',
    -2227         'extKeyUsage':          '2.5.29.37',
    -2228         'authorityInfoAccess':  '1.3.6.1.5.5.7.1.1',
    -2229         'ocsp':                 '1.3.6.1.5.5.7.48.1',
    -2230         'caIssuers':            '1.3.6.1.5.5.7.48.2',
    +2184     this.getEncodedHex = function() {
    +2185         var o = new KJUR.asn1.DERSequence({'array': this.asn1Array});
    +2186         return o.getEncodedHex();
    +2187     };
    +2188 
    +2189     this.asn1Array = new Array();
    +2190     if (typeof paramsArray != "undefined") {
    +2191         this.setByParamArray(paramsArray);
    +2192     }
    +2193 };
    +2194 YAHOO.lang.extend(KJUR.asn1.x509.GeneralNames, KJUR.asn1.ASN1Object);
    +2195 
    +2196 /**
    +2197  * DistributionPointName ASN.1 structure class
    +2198  * @name KJUR.asn1.x509.DistributionPointName
    +2199  * @class DistributionPointName ASN.1 structure class
    +2200  * @description
    +2201  * @example
    +2202  */
    +2203 KJUR.asn1.x509.DistributionPointName = function(gnOrRdn) {
    +2204     KJUR.asn1.x509.DistributionPointName.superclass.constructor.call(this);
    +2205     var asn1Obj = null;
    +2206     var type = null;
    +2207     var tag = null;
    +2208     var asn1V = null;
    +2209 
    +2210     this.getEncodedHex = function() {
    +2211         if (this.type != "full")
    +2212             throw "currently type shall be 'full': " + this.type;
    +2213         this.asn1Obj = new KJUR.asn1.DERTaggedObject({'explicit': false,
    +2214                                                       'tag': this.tag,
    +2215                                                       'obj': this.asn1V});
    +2216         this.hTLV = this.asn1Obj.getEncodedHex();
    +2217         return this.hTLV;
    +2218     };
    +2219 
    +2220     if (typeof gnOrRdn != "undefined") {
    +2221         if (KJUR.asn1.x509.GeneralNames.prototype.isPrototypeOf(gnOrRdn)) {
    +2222             this.type = "full";
    +2223             this.tag = "a0";
    +2224             this.asn1V = gnOrRdn;
    +2225         } else {
    +2226             throw "This class supports GeneralNames only as argument";
    +2227         }
    +2228     }
    +2229 };
    +2230 YAHOO.lang.extend(KJUR.asn1.x509.DistributionPointName, KJUR.asn1.ASN1Object);
     2231 
    -2232         'anyExtendedKeyUsage':  '2.5.29.37.0',
    -2233         'serverAuth':           '1.3.6.1.5.5.7.3.1',
    -2234         'clientAuth':           '1.3.6.1.5.5.7.3.2',
    -2235         'codeSigning':          '1.3.6.1.5.5.7.3.3',
    -2236         'emailProtection':      '1.3.6.1.5.5.7.3.4',
    -2237         'timeStamping':         '1.3.6.1.5.5.7.3.8',
    -2238         'ocspSigning':          '1.3.6.1.5.5.7.3.9',
    -2239 
    -2240         'ecPublicKey':          '1.2.840.10045.2.1',
    -2241         'secp256r1':            '1.2.840.10045.3.1.7',
    -2242         'secp256k1':            '1.3.132.0.10',
    -2243         'secp384r1':            '1.3.132.0.34',
    -2244 
    -2245         'pkcs5PBES2':           '1.2.840.113549.1.5.13',
    -2246         'pkcs5PBKDF2':          '1.2.840.113549.1.5.12',
    -2247 
    -2248         'des-EDE3-CBC':         '1.2.840.113549.3.7',
    -2249 
    -2250         'data':                 '1.2.840.113549.1.7.1', // CMS data
    -2251         'signed-data':          '1.2.840.113549.1.7.2', // CMS signed-data
    -2252         'enveloped-data':       '1.2.840.113549.1.7.3', // CMS enveloped-data
    -2253         'digested-data':        '1.2.840.113549.1.7.5', // CMS digested-data
    -2254         'encrypted-data':       '1.2.840.113549.1.7.6', // CMS encrypted-data
    -2255         'authenticated-data':   '1.2.840.113549.1.9.16.1.2', // CMS authenticated-data
    -2256         'tstinfo':              '1.2.840.113549.1.9.16.1.4', // RFC3161 TSTInfo
    -2257     };
    -2258 
    -2259     this.objCache = {};
    -2260 
    -2261     /**
    -2262      * get DERObjectIdentifier by registered OID name
    -2263      * @name name2obj
    -2264      * @memberOf KJUR.asn1.x509.OID
    -2265      * @function
    -2266      * @param {String} name OID
    -2267      * @description
    -2268      * @example
    -2269      * var asn1ObjOID = OID.name2obj('SHA1withRSA');
    -2270      */
    -2271     this.name2obj = function(name) {
    -2272         if (typeof this.objCache[name] != "undefined")
    -2273             return this.objCache[name];
    -2274         if (typeof this.name2oidList[name] == "undefined")
    -2275             throw "Name of ObjectIdentifier not defined: " + name;
    -2276         var oid = this.name2oidList[name];
    -2277         var obj = new KJUR.asn1.DERObjectIdentifier({'oid': oid});
    -2278         this.objCache[name] = obj;
    -2279         return obj;
    -2280     };
    -2281 
    -2282     /**
    -2283      * get DERObjectIdentifier by registered attribute type name such like 'C' or 'CN'<br/>
    -2284      * @name atype2obj
    -2285      * @memberOf KJUR.asn1.x509.OID
    -2286      * @function
    -2287      * @param {String} atype short attribute type name such like 'C' or 'CN'
    -2288      * @description
    -2289      * @example
    -2290      * KJUR.asn1.x509.OID.atype2obj('CN') → 2.5.4.3
    -2291      * KJUR.asn1.x509.OID.atype2obj('OU') → 2.5.4.11
    -2292      */
    -2293     this.atype2obj = function(atype) {
    -2294         if (typeof this.objCache[atype] != "undefined")
    -2295             return this.objCache[atype];
    -2296         if (typeof this.atype2oidList[atype] == "undefined")
    -2297             throw "AttributeType name undefined: " + atype;
    -2298         var oid = this.atype2oidList[atype];
    -2299         var obj = new KJUR.asn1.DERObjectIdentifier({'oid': oid});
    -2300         this.objCache[atype] = obj;
    -2301         return obj;
    -2302     };
    -2303 };
    -2304 
    -2305 /**
    -2306  * convert OID to name<br/>
    -2307  * @name oid2name
    -2308  * @memberOf KJUR.asn1.x509.OID
    -2309  * @function
    -2310  * @param {String} oid dot noted Object Identifer string (ex. 1.2.3.4)
    -2311  * @return {String} OID name if registered otherwise empty string
    -2312  * @since asn1x509 1.0.9
    -2313  * @description
    -2314  * This static method converts OID string to its name.
    -2315  * If OID is undefined then it returns empty string (i.e. '').
    -2316  * @example
    -2317  * KJUR.asn1.x509.OID.oid2name("1.3.6.1.5.5.7.1.1") → 'authorityInfoAccess'
    -2318  */
    -2319 KJUR.asn1.x509.OID.oid2name = function(oid) {
    -2320     var list = KJUR.asn1.x509.OID.name2oidList;
    -2321     for (var name in list) {
    -2322         if (list[name] == oid) return name;
    -2323     }
    -2324     return '';
    -2325 };
    -2326 
    -2327 /**
    -2328  * convert OID to AttributeType name<br/>
    -2329  * @name oid2atype
    -2330  * @memberOf KJUR.asn1.x509.OID
    -2331  * @function
    -2332  * @param {String} oid dot noted Object Identifer string (ex. 1.2.3.4)
    -2333  * @return {String} OID AttributeType name if registered otherwise oid
    -2334  * @since jsrsasign 6.2.2 asn1x509 1.0.18
    -2335  * @description
    -2336  * This static method converts OID string to its AttributeType name.
    -2337  * If OID is not defined in OID.atype2oidList associative array then it returns OID
    -2338  * specified as argument.
    -2339  * @example
    -2340  * KJUR.asn1.x509.OID.oid2atype("2.5.4.3") → CN
    -2341  * KJUR.asn1.x509.OID.oid2atype("1.3.6.1.4.1.311.60.2.1.3") → jurisdictionOfIncorporationC
    -2342  * KJUR.asn1.x509.OID.oid2atype("0.1.2.3.4") → 0.1.2.3.4 // unregistered OID
    -2343  */
    -2344 KJUR.asn1.x509.OID.oid2atype = function(oid) {
    -2345     var list = KJUR.asn1.x509.OID.atype2oidList;
    -2346     for (var atype in list) {
    -2347         if (list[atype] == oid) return atype;
    -2348     }
    -2349     return oid;
    -2350 };
    +2232 /**
    +2233  * DistributionPoint ASN.1 structure class
    +2234  * @name KJUR.asn1.x509.DistributionPoint
    +2235  * @class DistributionPoint ASN.1 structure class
    +2236  * @description
    +2237  * @example
    +2238  */
    +2239 KJUR.asn1.x509.DistributionPoint = function(params) {
    +2240     KJUR.asn1.x509.DistributionPoint.superclass.constructor.call(this);
    +2241     var asn1DP = null;
    +2242 
    +2243     this.getEncodedHex = function() {
    +2244         var seq = new KJUR.asn1.DERSequence();
    +2245         if (this.asn1DP != null) {
    +2246             var o1 = new KJUR.asn1.DERTaggedObject({'explicit': true,
    +2247                                                     'tag': 'a0',
    +2248                                                     'obj': this.asn1DP});
    +2249             seq.appendASN1Object(o1);
    +2250         }
    +2251         this.hTLV = seq.getEncodedHex();
    +2252         return this.hTLV;
    +2253     };
    +2254 
    +2255     if (typeof params != "undefined") {
    +2256         if (typeof params['dpobj'] != "undefined") {
    +2257             this.asn1DP = params['dpobj'];
    +2258         }
    +2259     }
    +2260 };
    +2261 YAHOO.lang.extend(KJUR.asn1.x509.DistributionPoint, KJUR.asn1.ASN1Object);
    +2262 
    +2263 /**
    +2264  * static object for OID
    +2265  * @name KJUR.asn1.x509.OID
    +2266  * @class static object for OID
    +2267  * @property {Assoc Array} atype2oidList for short attribute type name and oid (ex. 'C' and '2.5.4.6')
    +2268  * @property {Assoc Array} name2oidList for oid name and oid (ex. 'keyUsage' and '2.5.29.15')
    +2269  * @property {Assoc Array} objCache for caching name and DERObjectIdentifier object
    +2270  * @description
    +2271  * This class defines OID name and values.
    +2272  * AttributeType names registered in OID.atype2oidList are following:
    +2273  * <table style="border-width: thin; border-style: solid; witdh: 100%">
    +2274  * <tr><th>short</th><th>long</th><th>OID</th></tr>
    +2275  * <tr><td>CN</td>commonName<td></td><td>2.5.4.3</td></tr>
    +2276  * <tr><td>L</td><td>localityName</td><td>2.5.4.7</td></tr>
    +2277  * <tr><td>ST</td><td>stateOrProvinceName</td><td>2.5.4.8</td></tr>
    +2278  * <tr><td>O</td><td>organizationName</td><td>2.5.4.10</td></tr>
    +2279  * <tr><td>OU</td><td>organizationalUnitName</td><td>2.5.4.11</td></tr>
    +2280  * <tr><td>C</td><td></td>countryName<td>2.5.4.6</td></tr>
    +2281  * <tr><td>STREET</td>streetAddress<td></td><td>2.5.4.6</td></tr>
    +2282  * <tr><td>DC</td><td>domainComponent</td><td>0.9.2342.19200300.100.1.25</td></tr>
    +2283  * <tr><td>UID</td><td>userId</td><td>0.9.2342.19200300.100.1.1</td></tr>
    +2284  * <tr><td>SN</td><td>surname</td><td>2.5.4.4</td></tr>
    +2285  * <tr><td>DN</td><td>distinguishedName</td><td>2.5.4.49</td></tr>
    +2286  * <tr><td>E</td><td>emailAddress</td><td>1.2.840.113549.1.9.1</td></tr>
    +2287  * <tr><td></td><td>businessCategory</td><td>2.5.4.15</td></tr>
    +2288  * <tr><td></td><td>postalCode</td><td>2.5.4.17</td></tr>
    +2289  * <tr><td></td><td>jurisdictionOfIncorporationL</td><td>1.3.6.1.4.1.311.60.2.1.1</td></tr>
    +2290  * <tr><td></td><td>jurisdictionOfIncorporationSP</td><td>1.3.6.1.4.1.311.60.2.1.2</td></tr>
    +2291  * <tr><td></td><td>jurisdictionOfIncorporationC</td><td>1.3.6.1.4.1.311.60.2.1.3</td></tr>
    +2292  * </table>
    +2293  *
    +2294  * @example
    +2295  */
    +2296 KJUR.asn1.x509.OID = new function(params) {
    +2297     this.atype2oidList = {
    +2298 	// RFC 4514 AttributeType name string (MUST recognized)
    +2299         'CN':		'2.5.4.3',
    +2300         'L':		'2.5.4.7',
    +2301         'ST':		'2.5.4.8',
    +2302         'O':		'2.5.4.10',
    +2303         'OU':		'2.5.4.11',
    +2304         'C':		'2.5.4.6',
    +2305         'STREET':	'2.5.4.9',
    +2306         'DC':		'0.9.2342.19200300.100.1.25',
    +2307         'UID':		'0.9.2342.19200300.100.1.1',
    +2308 	// other AttributeType name string
    +2309 	// http://blog.livedoor.jp/k_urushima/archives/656114.html
    +2310         'SN':		'2.5.4.4', // surname
    +2311         'DN':		'2.5.4.49', // distinguishedName
    +2312         'E':		'1.2.840.113549.1.9.1', // emailAddress in MS.NET or Bouncy
    +2313 	// other AttributeType name string (no short name)
    +2314 	'businessCategory':		'2.5.4.15',
    +2315 	'postalCode':			'2.5.4.17',
    +2316 	'jurisdictionOfIncorporationL':	'1.3.6.1.4.1.311.60.2.1.1',
    +2317 	'jurisdictionOfIncorporationSP':'1.3.6.1.4.1.311.60.2.1.2',
    +2318 	'jurisdictionOfIncorporationC':	'1.3.6.1.4.1.311.60.2.1.3'
    +2319     };
    +2320     this.name2oidList = {
    +2321         'sha1':                 '1.3.14.3.2.26',
    +2322         'sha256':               '2.16.840.1.101.3.4.2.1',
    +2323         'sha384':               '2.16.840.1.101.3.4.2.2',
    +2324         'sha512':               '2.16.840.1.101.3.4.2.3',
    +2325         'sha224':               '2.16.840.1.101.3.4.2.4',
    +2326         'md5':                  '1.2.840.113549.2.5',
    +2327         'md2':                  '1.3.14.7.2.2.1',
    +2328         'ripemd160':            '1.3.36.3.2.1',
    +2329 
    +2330         'MD2withRSA':           '1.2.840.113549.1.1.2',
    +2331         'MD4withRSA':           '1.2.840.113549.1.1.3',
    +2332         'MD5withRSA':           '1.2.840.113549.1.1.4',
    +2333         'SHA1withRSA':          '1.2.840.113549.1.1.5',
    +2334         'SHA224withRSA':        '1.2.840.113549.1.1.14',
    +2335         'SHA256withRSA':        '1.2.840.113549.1.1.11',
    +2336         'SHA384withRSA':        '1.2.840.113549.1.1.12',
    +2337         'SHA512withRSA':        '1.2.840.113549.1.1.13',
    +2338 
    +2339         'SHA1withECDSA':        '1.2.840.10045.4.1',
    +2340         'SHA224withECDSA':      '1.2.840.10045.4.3.1',
    +2341         'SHA256withECDSA':      '1.2.840.10045.4.3.2',
    +2342         'SHA384withECDSA':      '1.2.840.10045.4.3.3',
    +2343         'SHA512withECDSA':      '1.2.840.10045.4.3.4',
    +2344 
    +2345         'dsa':                  '1.2.840.10040.4.1',
    +2346         'SHA1withDSA':          '1.2.840.10040.4.3',
    +2347         'SHA224withDSA':        '2.16.840.1.101.3.4.3.1',
    +2348         'SHA256withDSA':        '2.16.840.1.101.3.4.3.2',
    +2349 
    +2350         'rsaEncryption':        '1.2.840.113549.1.1.1',
     2351 
    -2352 /**
    -2353  * convert OID name to OID value<br/>
    -2354  * @name name2oid
    -2355  * @memberOf KJUR.asn1.x509.OID
    -2356  * @function
    -2357  * @param {String} OID name
    -2358  * @return {String} dot noted Object Identifer string (ex. 1.2.3.4)
    -2359  * @since asn1x509 1.0.11
    -2360  * @description
    -2361  * This static method converts from OID name to OID string.
    -2362  * If OID is undefined then it returns empty string (i.e. '').
    -2363  * @example
    -2364  * KJUR.asn1.x509.OID.name2oid("authorityInfoAccess") → 1.3.6.1.5.5.7.1.1
    -2365  */
    -2366 KJUR.asn1.x509.OID.name2oid = function(name) {
    -2367     var list = KJUR.asn1.x509.OID.name2oidList;
    -2368     if (list[name] === undefined) return '';
    -2369     return list[name];
    -2370 };
    -2371 
    -2372 /**
    -2373  * X.509 certificate and CRL utilities class
    -2374  * @name KJUR.asn1.x509.X509Util
    -2375  * @class X.509 certificate and CRL utilities class
    -2376  */
    -2377 KJUR.asn1.x509.X509Util = new function() {
    -2378     /**
    -2379      * get PKCS#8 PEM public key string from RSAKey object
    -2380      * @name getPKCS8PubKeyPEMfromRSAKey
    -2381      * @memberOf KJUR.asn1.x509.X509Util
    -2382      * @function
    -2383      * @param {RSAKey} rsaKey RSA public key of {@link RSAKey} object
    -2384      * @description
    -2385      * @example
    -2386      * var pem = KJUR.asn1.x509.X509Util.getPKCS8PubKeyPEMfromRSAKey(pubKey);
    -2387      */
    -2388     this.getPKCS8PubKeyPEMfromRSAKey = function(rsaKey) {
    -2389         var pem = null;
    -2390         var hN = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(rsaKey.n);
    -2391         var hE = KJUR.asn1.ASN1Util.integerToByteHex(rsaKey.e);
    -2392         var iN = new KJUR.asn1.DERInteger({hex: hN});
    -2393         var iE = new KJUR.asn1.DERInteger({hex: hE});
    -2394         var asn1PubKey = new KJUR.asn1.DERSequence({array: [iN, iE]});
    -2395         var hPubKey = asn1PubKey.getEncodedHex();
    -2396         var o1 = new KJUR.asn1.x509.AlgorithmIdentifier({name: 'rsaEncryption'});
    -2397         var o2 = new KJUR.asn1.DERBitString({hex: '00' + hPubKey});
    -2398         var seq = new KJUR.asn1.DERSequence({array: [o1, o2]});
    -2399         var hP8 = seq.getEncodedHex();
    -2400         var pem = KJUR.asn1.ASN1Util.getPEMStringFromHex(hP8, "PUBLIC KEY");
    -2401         return pem;
    -2402     };
    -2403 };
    -2404 /**
    -2405  * issue a certificate in PEM format
    -2406  * @name newCertPEM
    -2407  * @memberOf KJUR.asn1.x509.X509Util
    -2408  * @function
    -2409  * @param {Array} param parameter to issue a certificate
    -2410  * @since asn1x509 1.0.6
    -2411  * @description
    -2412  * This method can issue a certificate by a simple
    -2413  * JSON object.
    -2414  * Signature value will be provided by signing with
    -2415  * private key using 'cakey' parameter or
    -2416  * hexa decimal signature value by 'sighex' parameter.
    -2417  *
    -2418  * NOTE: When using DSA or ECDSA CA signing key,
    -2419  * use 'paramempty' in 'sigalg' to ommit parameter field
    -2420  * of AlgorithmIdentifer. In case of RSA, parameter
    -2421  * NULL will be specified by default.
    -2422  *
    -2423  * @example
    -2424  * var certPEM = KJUR.asn1.x509.X509Util.newCertPEM(
    -2425  * { serial: {int: 4},
    -2426  *   sigalg: {name: 'SHA1withECDSA', paramempty: true},
    -2427  *   issuer: {str: '/C=US/O=a'},
    -2428  *   notbefore: {'str': '130504235959Z'},
    -2429  *   notafter: {'str': '140504235959Z'},
    -2430  *   subject: {str: '/C=US/O=b'},
    -2431  *   sbjpubkey: pubKeyPEM,
    -2432  *   ext: [
    -2433  *     {basicConstraints: {cA: true, critical: true}},
    -2434  *     {keyUsage: {bin: '11'}},
    -2435  *   ],
    -2436  *   cakey: [prvkey, pass]}
    -2437  * );
    -2438  * // -- or --
    -2439  * var certPEM = KJUR.asn1.x509.X509Util.newCertPEM(
    -2440  * { serial: {int: 1},
    -2441  *   sigalg: {name: 'SHA1withRSA', paramempty: true},
    -2442  *   issuer: {str: '/C=US/O=T1'},
    -2443  *   notbefore: {'str': '130504235959Z'},
    -2444  *   notafter: {'str': '140504235959Z'},
    -2445  *   subject: {str: '/C=US/O=T1'},
    -2446  *   sbjpubkey: pubKeyObj,
    -2447  *   sighex: '0102030405..'}
    -2448  * );
    -2449  * // for the issuer and subject field, another
    -2450  * // representation is also available
    -2451  * var certPEM = KJUR.asn1.x509.X509Util.newCertPEM(
    -2452  * { serial: {int: 1},
    -2453  *   sigalg: {name: 'SHA1withRSA', paramempty: true},
    -2454  *   issuer: {C: "US", O: "T1"},
    -2455  *   notbefore: {'str': '130504235959Z'},
    -2456  *   notafter: {'str': '140504235959Z'},
    -2457  *   subject: {C: "US", O: "T1", CN: "http://example.com/"},
    -2458  *   sbjpubkey: pubKeyObj,
    -2459  *   sighex: '0102030405..'}
    -2460  * );
    -2461  */
    -2462 KJUR.asn1.x509.X509Util.newCertPEM = function(param) {
    -2463     var ns1 = KJUR.asn1.x509;
    -2464     var o = new ns1.TBSCertificate();
    -2465 
    -2466     if (param.serial !== undefined)
    -2467         o.setSerialNumberByParam(param.serial);
    -2468     else
    -2469         throw "serial number undefined.";
    -2470 
    -2471     if (typeof param.sigalg.name == 'string')
    -2472         o.setSignatureAlgByParam(param.sigalg);
    -2473     else
    -2474         throw "unproper signature algorithm name";
    -2475 
    -2476     if (param.issuer !== undefined)
    -2477         o.setIssuerByParam(param.issuer);
    -2478     else
    -2479         throw "issuer name undefined.";
    -2480 
    -2481     if (param.notbefore !== undefined)
    -2482         o.setNotBeforeByParam(param.notbefore);
    -2483     else
    -2484         throw "notbefore undefined.";
    -2485 
    -2486     if (param.notafter !== undefined)
    -2487         o.setNotAfterByParam(param.notafter);
    -2488     else
    -2489         throw "notafter undefined.";
    -2490 
    -2491     if (param.subject !== undefined)
    -2492         o.setSubjectByParam(param.subject);
    -2493     else
    -2494         throw "subject name undefined.";
    -2495 
    -2496     if (param.sbjpubkey !== undefined)
    -2497         o.setSubjectPublicKeyByGetKey(param.sbjpubkey);
    -2498     else
    -2499         throw "subject public key undefined.";
    -2500 
    -2501     if (param.ext !== undefined && param.ext.length !== undefined) {
    -2502         for (var i = 0; i < param.ext.length; i++) {
    -2503             for (key in param.ext[i]) {
    -2504                 o.appendExtensionByName(key, param.ext[i][key]);
    -2505             }
    -2506         }
    -2507     }
    -2508 
    -2509     // set signature
    -2510     if (param.cakey === undefined && param.sighex === undefined)
    -2511         throw "param cakey and sighex undefined.";
    -2512 
    -2513     var caKey = null;
    -2514     var cert = null;
    -2515 
    -2516     if (param.cakey) {
    -2517         caKey = KEYUTIL.getKey.apply(null, param.cakey);
    -2518         cert = new ns1.Certificate({'tbscertobj': o, 'prvkeyobj': caKey});
    -2519         cert.sign();
    -2520     }
    -2521 
    -2522     if (param.sighex) {
    -2523         cert = new ns1.Certificate({'tbscertobj': o});
    -2524         cert.setSignatureHex(param.sighex);
    -2525     }
    -2526 
    -2527     return cert.getPEMString();
    -2528 };
    -2529 
    -2530 /*
    -2531   org.bouncycastle.asn1.x500
    -2532   AttributeTypeAndValue
    -2533   DirectoryString
    -2534   RDN
    -2535   X500Name
    -2536   X500NameBuilder
    -2537 
    -2538   org.bouncycastleasn1.x509
    -2539   TBSCertificate
    -2540 */
    -2541 
    \ No newline at end of file +2352
    // X.500 AttributeType defined in RFC 4514 +2353 'commonName': '2.5.4.3', +2354 'localityName': '2.5.4.7', +2355 'stateOrProvinceName': '2.5.4.8', +2356 'organizationName': '2.5.4.10', +2357 'organizationalUnitName': '2.5.4.11', +2358 'countryName': '2.5.4.6', +2359 'streetAddress': '2.5.4.9', +2360 'domainComponent': '0.9.2342.19200300.100.1.25', +2361 'userId': '0.9.2342.19200300.100.1.1', +2362 // other AttributeType name string +2363 'surname': '2.5.4.4', +2364 'distinguishedName': '2.5.4.49', +2365 'emailAddress': '1.2.840.113549.1.9.1', +2366 // other AttributeType name string (no short name) +2367 'businessCategory': '2.5.4.15', +2368 'postalCode': '2.5.4.17', +2369 'jurisdictionOfIncorporationL': '1.3.6.1.4.1.311.60.2.1.1', +2370 'jurisdictionOfIncorporationSP':'1.3.6.1.4.1.311.60.2.1.2', +2371 'jurisdictionOfIncorporationC': '1.3.6.1.4.1.311.60.2.1.3', +2372 +2373 'subjectKeyIdentifier': '2.5.29.14', +2374 'keyUsage': '2.5.29.15', +2375 'subjectAltName': '2.5.29.17', +2376 'issuerAltName': '2.5.29.18', +2377 'basicConstraints': '2.5.29.19', +2378 'nameConstraints': '2.5.29.30', +2379 'cRLDistributionPoints':'2.5.29.31', +2380 'certificatePolicies': '2.5.29.32', +2381 'authorityKeyIdentifier':'2.5.29.35', +2382 'policyConstraints': '2.5.29.36', +2383 'extKeyUsage': '2.5.29.37', +2384 'authorityInfoAccess': '1.3.6.1.5.5.7.1.1', +2385 'ocsp': '1.3.6.1.5.5.7.48.1', +2386 'caIssuers': '1.3.6.1.5.5.7.48.2', +2387 +2388 'anyExtendedKeyUsage': '2.5.29.37.0', +2389 'serverAuth': '1.3.6.1.5.5.7.3.1', +2390 'clientAuth': '1.3.6.1.5.5.7.3.2', +2391 'codeSigning': '1.3.6.1.5.5.7.3.3', +2392 'emailProtection': '1.3.6.1.5.5.7.3.4', +2393 'timeStamping': '1.3.6.1.5.5.7.3.8', +2394 'ocspSigning': '1.3.6.1.5.5.7.3.9', +2395 +2396 'ecPublicKey': '1.2.840.10045.2.1', +2397 'secp256r1': '1.2.840.10045.3.1.7', +2398 'secp256k1': '1.3.132.0.10', +2399 'secp384r1': '1.3.132.0.34', +2400 +2401 'pkcs5PBES2': '1.2.840.113549.1.5.13', +2402 'pkcs5PBKDF2': '1.2.840.113549.1.5.12', +2403 +2404 'des-EDE3-CBC': '1.2.840.113549.3.7', +2405 +2406 'data': '1.2.840.113549.1.7.1', // CMS data +2407 'signed-data': '1.2.840.113549.1.7.2', // CMS signed-data +2408 'enveloped-data': '1.2.840.113549.1.7.3', // CMS enveloped-data +2409 'digested-data': '1.2.840.113549.1.7.5', // CMS digested-data +2410 'encrypted-data': '1.2.840.113549.1.7.6', // CMS encrypted-data +2411 'authenticated-data': '1.2.840.113549.1.9.16.1.2', // CMS authenticated-data +2412 'tstinfo': '1.2.840.113549.1.9.16.1.4', // RFC3161 TSTInfo +2413 }; +2414 +2415 this.objCache = {}; +2416 +2417 /** +2418 * get DERObjectIdentifier by registered OID name +2419 * @name name2obj +2420 * @memberOf KJUR.asn1.x509.OID +2421 * @function +2422 * @param {String} name OID +2423 * @description +2424 * @example +2425 * var asn1ObjOID = OID.name2obj('SHA1withRSA'); +2426 */ +2427 this.name2obj = function(name) { +2428 if (typeof this.objCache[name] != "undefined") +2429 return this.objCache[name]; +2430 if (typeof this.name2oidList[name] == "undefined") +2431 throw "Name of ObjectIdentifier not defined: " + name; +2432 var oid = this.name2oidList[name]; +2433 var obj = new KJUR.asn1.DERObjectIdentifier({'oid': oid}); +2434 this.objCache[name] = obj; +2435 return obj; +2436 }; +2437 +2438 /** +2439 * get DERObjectIdentifier by registered attribute type name such like 'C' or 'CN'<br/> +2440 * @name atype2obj +2441 * @memberOf KJUR.asn1.x509.OID +2442 * @function +2443 * @param {String} atype short attribute type name such like 'C' or 'CN' +2444 * @description +2445 * @example +2446 * KJUR.asn1.x509.OID.atype2obj('CN') → 2.5.4.3 +2447 * KJUR.asn1.x509.OID.atype2obj('OU') → 2.5.4.11 +2448 */ +2449 this.atype2obj = function(atype) { +2450 if (typeof this.objCache[atype] != "undefined") +2451 return this.objCache[atype]; +2452 if (typeof this.atype2oidList[atype] == "undefined") +2453 throw "AttributeType name undefined: " + atype; +2454 var oid = this.atype2oidList[atype]; +2455 var obj = new KJUR.asn1.DERObjectIdentifier({'oid': oid}); +2456 this.objCache[atype] = obj; +2457 return obj; +2458 }; +2459 }; +2460 +2461 /** +2462 * convert OID to name<br/> +2463 * @name oid2name +2464 * @memberOf KJUR.asn1.x509.OID +2465 * @function +2466 * @param {String} oid dot noted Object Identifer string (ex. 1.2.3.4) +2467 * @return {String} OID name if registered otherwise empty string +2468 * @since asn1x509 1.0.9 +2469 * @description +2470 * This static method converts OID string to its name. +2471 * If OID is undefined then it returns empty string (i.e. ''). +2472 * @example +2473 * KJUR.asn1.x509.OID.oid2name("1.3.6.1.5.5.7.1.1") → 'authorityInfoAccess' +2474 */ +2475 KJUR.asn1.x509.OID.oid2name = function(oid) { +2476 var list = KJUR.asn1.x509.OID.name2oidList; +2477 for (var name in list) { +2478 if (list[name] == oid) return name; +2479 } +2480 return ''; +2481 }; +2482 +2483 /** +2484 * convert OID to AttributeType name<br/> +2485 * @name oid2atype +2486 * @memberOf KJUR.asn1.x509.OID +2487 * @function +2488 * @param {String} oid dot noted Object Identifer string (ex. 1.2.3.4) +2489 * @return {String} OID AttributeType name if registered otherwise oid +2490 * @since jsrsasign 6.2.2 asn1x509 1.0.18 +2491 * @description +2492 * This static method converts OID string to its AttributeType name. +2493 * If OID is not defined in OID.atype2oidList associative array then it returns OID +2494 * specified as argument. +2495 * @example +2496 * KJUR.asn1.x509.OID.oid2atype("2.5.4.3") → CN +2497 * KJUR.asn1.x509.OID.oid2atype("1.3.6.1.4.1.311.60.2.1.3") → jurisdictionOfIncorporationC +2498 * KJUR.asn1.x509.OID.oid2atype("0.1.2.3.4") → 0.1.2.3.4 // unregistered OID +2499 */ +2500 KJUR.asn1.x509.OID.oid2atype = function(oid) { +2501 var list = KJUR.asn1.x509.OID.atype2oidList; +2502 for (var atype in list) { +2503 if (list[atype] == oid) return atype; +2504 } +2505 return oid; +2506 }; +2507 +2508 /** +2509 * convert OID name to OID value<br/> +2510 * @name name2oid +2511 * @memberOf KJUR.asn1.x509.OID +2512 * @function +2513 * @param {String} OID name +2514 * @return {String} dot noted Object Identifer string (ex. 1.2.3.4) +2515 * @since asn1x509 1.0.11 +2516 * @description +2517 * This static method converts from OID name to OID string. +2518 * If OID is undefined then it returns empty string (i.e. ''). +2519 * @example +2520 * KJUR.asn1.x509.OID.name2oid("authorityInfoAccess") → 1.3.6.1.5.5.7.1.1 +2521 */ +2522 KJUR.asn1.x509.OID.name2oid = function(name) { +2523 var list = KJUR.asn1.x509.OID.name2oidList; +2524 if (list[name] === undefined) return ''; +2525 return list[name]; +2526 }; +2527 +2528 /** +2529 * X.509 certificate and CRL utilities class +2530 * @name KJUR.asn1.x509.X509Util +2531 * @class X.509 certificate and CRL utilities class +2532 */ +2533 KJUR.asn1.x509.X509Util = new function() { +2534 /** +2535 * get PKCS#8 PEM public key string from RSAKey object +2536 * @name getPKCS8PubKeyPEMfromRSAKey +2537 * @memberOf KJUR.asn1.x509.X509Util +2538 * @function +2539 * @param {RSAKey} rsaKey RSA public key of {@link RSAKey} object +2540 * @description +2541 * @example +2542 * var pem = KJUR.asn1.x509.X509Util.getPKCS8PubKeyPEMfromRSAKey(pubKey); +2543 */ +2544 this.getPKCS8PubKeyPEMfromRSAKey = function(rsaKey) { +2545 var pem = null; +2546 var hN = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(rsaKey.n); +2547 var hE = KJUR.asn1.ASN1Util.integerToByteHex(rsaKey.e); +2548 var iN = new KJUR.asn1.DERInteger({hex: hN}); +2549 var iE = new KJUR.asn1.DERInteger({hex: hE}); +2550 var asn1PubKey = new KJUR.asn1.DERSequence({array: [iN, iE]}); +2551 var hPubKey = asn1PubKey.getEncodedHex(); +2552 var o1 = new KJUR.asn1.x509.AlgorithmIdentifier({name: 'rsaEncryption'}); +2553 var o2 = new KJUR.asn1.DERBitString({hex: '00' + hPubKey}); +2554 var seq = new KJUR.asn1.DERSequence({array: [o1, o2]}); +2555 var hP8 = seq.getEncodedHex(); +2556 var pem = KJUR.asn1.ASN1Util.getPEMStringFromHex(hP8, "PUBLIC KEY"); +2557 return pem; +2558 }; +2559 }; +2560 /** +2561 * issue a certificate in PEM format +2562 * @name newCertPEM +2563 * @memberOf KJUR.asn1.x509.X509Util +2564 * @function +2565 * @param {Array} param parameter to issue a certificate +2566 * @since asn1x509 1.0.6 +2567 * @description +2568 * This method can issue a certificate by a simple +2569 * JSON object. +2570 * Signature value will be provided by signing with +2571 * private key using 'cakey' parameter or +2572 * hexa decimal signature value by 'sighex' parameter. +2573 * +2574 * NOTE: When using DSA or ECDSA CA signing key, +2575 * use 'paramempty' in 'sigalg' to ommit parameter field +2576 * of AlgorithmIdentifer. In case of RSA, parameter +2577 * NULL will be specified by default. +2578 * +2579 * @example +2580 * var certPEM = KJUR.asn1.x509.X509Util.newCertPEM( +2581 * { serial: {int: 4}, +2582 * sigalg: {name: 'SHA1withECDSA', paramempty: true}, +2583 * issuer: {str: '/C=US/O=a'}, +2584 * notbefore: {'str': '130504235959Z'}, +2585 * notafter: {'str': '140504235959Z'}, +2586 * subject: {str: '/C=US/O=b'}, +2587 * sbjpubkey: pubKeyPEM, +2588 * ext: [ +2589 * {basicConstraints: {cA: true, critical: true}}, +2590 * {keyUsage: {bin: '11'}}, +2591 * ], +2592 * cakey: [prvkey, pass]} +2593 * ); +2594 * // -- or -- +2595 * var certPEM = KJUR.asn1.x509.X509Util.newCertPEM( +2596 * { serial: {int: 1}, +2597 * sigalg: {name: 'SHA1withRSA', paramempty: true}, +2598 * issuer: {str: '/C=US/O=T1'}, +2599 * notbefore: {'str': '130504235959Z'}, +2600 * notafter: {'str': '140504235959Z'}, +2601 * subject: {str: '/C=US/O=T1'}, +2602 * sbjpubkey: pubKeyObj, +2603 * sighex: '0102030405..'} +2604 * ); +2605 * // for the issuer and subject field, another +2606 * // representation is also available +2607 * var certPEM = KJUR.asn1.x509.X509Util.newCertPEM( +2608 * { serial: {int: 1}, +2609 * sigalg: {name: 'SHA1withRSA', paramempty: true}, +2610 * issuer: {C: "US", O: "T1"}, +2611 * notbefore: {'str': '130504235959Z'}, +2612 * notafter: {'str': '140504235959Z'}, +2613 * subject: {C: "US", O: "T1", CN: "http://example.com/"}, +2614 * sbjpubkey: pubKeyObj, +2615 * sighex: '0102030405..'} +2616 * ); +2617 */ +2618 KJUR.asn1.x509.X509Util.newCertPEM = function(param) { +2619 var ns1 = KJUR.asn1.x509; +2620 var o = new ns1.TBSCertificate(); +2621 +2622 if (param.serial !== undefined) +2623 o.setSerialNumberByParam(param.serial); +2624 else +2625 throw "serial number undefined."; +2626 +2627 if (typeof param.sigalg.name == 'string') +2628 o.setSignatureAlgByParam(param.sigalg); +2629 else +2630 throw "unproper signature algorithm name"; +2631 +2632 if (param.issuer !== undefined) +2633 o.setIssuerByParam(param.issuer); +2634 else +2635 throw "issuer name undefined."; +2636 +2637 if (param.notbefore !== undefined) +2638 o.setNotBeforeByParam(param.notbefore); +2639 else +2640 throw "notbefore undefined."; +2641 +2642 if (param.notafter !== undefined) +2643 o.setNotAfterByParam(param.notafter); +2644 else +2645 throw "notafter undefined."; +2646 +2647 if (param.subject !== undefined) +2648 o.setSubjectByParam(param.subject); +2649 else +2650 throw "subject name undefined."; +2651 +2652 if (param.sbjpubkey !== undefined) +2653 o.setSubjectPublicKeyByGetKey(param.sbjpubkey); +2654 else +2655 throw "subject public key undefined."; +2656 +2657 if (param.ext !== undefined && param.ext.length !== undefined) { +2658 for (var i = 0; i < param.ext.length; i++) { +2659 for (key in param.ext[i]) { +2660 o.appendExtensionByName(key, param.ext[i][key]); +2661 } +2662 } +2663 } +2664 +2665 // set signature +2666 if (param.cakey === undefined && param.sighex === undefined) +2667 throw "param cakey and sighex undefined."; +2668 +2669 var caKey = null; +2670 var cert = null; +2671 +2672 if (param.cakey) { +2673 caKey = KEYUTIL.getKey.apply(null, param.cakey); +2674 cert = new ns1.Certificate({'tbscertobj': o, 'prvkeyobj': caKey}); +2675 cert.sign(); +2676 } +2677 +2678 if (param.sighex) { +2679 cert = new ns1.Certificate({'tbscertobj': o}); +2680 cert.setSignatureHex(param.sighex); +2681 } +2682 +2683 return cert.getPEMString(); +2684 }; +2685 +2686 /* +2687 org.bouncycastle.asn1.x500 +2688 AttributeTypeAndValue +2689 DirectoryString +2690 RDN +2691 X500Name +2692 X500NameBuilder +2693 +2694 org.bouncycastleasn1.x509 +2695 TBSCertificate +2696 */ +2697
    \ No newline at end of file diff --git a/asn1-1.0.js b/asn1-1.0.js index 74b41f8e..a16fc6e7 100644 --- a/asn1-1.0.js +++ b/asn1-1.0.js @@ -409,7 +409,7 @@ KJUR.asn1.ASN1Object = function() { /** * get hexadecimal ASN.1 TLV length(L) bytes from TLV value(V) * @name getLengthHexFromValue - * @memberOf KJUR.asn1.ASN1Object + * @memberOf KJUR.asn1.ASN1Object# * @function * @return {String} hexadecimal string of ASN.1 TLV length(L) */ @@ -440,7 +440,7 @@ KJUR.asn1.ASN1Object = function() { /** * get hexadecimal string of ASN.1 TLV bytes * @name getEncodedHex - * @memberOf KJUR.asn1.ASN1Object + * @memberOf KJUR.asn1.ASN1Object# * @function * @return {String} hexadecimal string of ASN.1 TLV */ @@ -458,7 +458,7 @@ KJUR.asn1.ASN1Object = function() { /** * get hexadecimal string of ASN.1 TLV value(V) bytes * @name getValueHex - * @memberOf KJUR.asn1.ASN1Object + * @memberOf KJUR.asn1.ASN1Object# * @function * @return {String} hexadecimal string of ASN.1 TLV value(V) bytes */ @@ -498,7 +498,7 @@ KJUR.asn1.DERAbstractString = function(params) { /** * get string value of this string object * @name getString - * @memberOf KJUR.asn1.DERAbstractString + * @memberOf KJUR.asn1.DERAbstractString# * @function * @return {String} string value of this string object */ @@ -509,7 +509,7 @@ KJUR.asn1.DERAbstractString = function(params) { /** * set value by a string * @name setString - * @memberOf KJUR.asn1.DERAbstractString + * @memberOf KJUR.asn1.DERAbstractString# * @function * @param {String} newS value by a string to set */ @@ -523,7 +523,7 @@ KJUR.asn1.DERAbstractString = function(params) { /** * set value by a hexadecimal string * @name setStringHex - * @memberOf KJUR.asn1.DERAbstractString + * @memberOf KJUR.asn1.DERAbstractString# * @function * @param {String} newHexString value by a hexadecimal string to set */ @@ -614,7 +614,7 @@ KJUR.asn1.DERAbstractTime = function(params) { /** * get string value of this string object * @name getString - * @memberOf KJUR.asn1.DERAbstractTime + * @memberOf KJUR.asn1.DERAbstractTime# * @function * @return {String} string value of this time object */ @@ -625,7 +625,7 @@ KJUR.asn1.DERAbstractTime = function(params) { /** * set value by a string * @name setString - * @memberOf KJUR.asn1.DERAbstractTime + * @memberOf KJUR.asn1.DERAbstractTime# * @function * @param {String} newS value by a string to set such like "130430235959Z" */ @@ -639,7 +639,7 @@ KJUR.asn1.DERAbstractTime = function(params) { /** * set value by a Date object * @name setByDateValue - * @memberOf KJUR.asn1.DERAbstractTime + * @memberOf KJUR.asn1.DERAbstractTime# * @function * @param {Integer} year year of date (ex. 2013) * @param {Integer} month month of date between 1 and 12 (ex. 12) @@ -677,7 +677,7 @@ KJUR.asn1.DERAbstractStructured = function(params) { /** * set value by array of ASN1Object * @name setByASN1ObjectArray - * @memberOf KJUR.asn1.DERAbstractStructured + * @memberOf KJUR.asn1.DERAbstractStructured# * @function * @param {array} asn1ObjectArray array of ASN1Object to set */ @@ -690,7 +690,7 @@ KJUR.asn1.DERAbstractStructured = function(params) { /** * append an ASN1Object to internal array * @name appendASN1Object - * @memberOf KJUR.asn1.DERAbstractStructured + * @memberOf KJUR.asn1.DERAbstractStructured# * @function * @param {ASN1Object} asn1Object to add */ @@ -754,7 +754,7 @@ KJUR.asn1.DERInteger = function(params) { /** * set value by Tom Wu's BigInteger object * @name setByBigInteger - * @memberOf KJUR.asn1.DERInteger + * @memberOf KJUR.asn1.DERInteger# * @function * @param {BigInteger} bigIntegerValue to set */ @@ -779,7 +779,7 @@ KJUR.asn1.DERInteger = function(params) { /** * set value by integer value * @name setValueHex - * @memberOf KJUR.asn1.DERInteger + * @memberOf KJUR.asn1.DERInteger# * @function * @param {String} hexadecimal string of integer value * @description @@ -863,7 +863,7 @@ KJUR.asn1.DERBitString = function(params) { /** * set ASN.1 value(V) by a hexadecimal string including unused bits * @name setHexValueIncludingUnusedBits - * @memberOf KJUR.asn1.DERBitString + * @memberOf KJUR.asn1.DERBitString# * @function * @param {String} newHexStringIncludingUnusedBits */ @@ -876,7 +876,7 @@ KJUR.asn1.DERBitString = function(params) { /** * set ASN.1 value(V) by unused bit and hexadecimal string of value * @name setUnusedBitsAndHexValue - * @memberOf KJUR.asn1.DERBitString + * @memberOf KJUR.asn1.DERBitString# * @function * @param {Integer} unusedBits * @param {String} hValue @@ -892,15 +892,18 @@ KJUR.asn1.DERBitString = function(params) { }; /** - * set ASN.1 DER BitString by binary string + * set ASN.1 DER BitString by binary string
    * @name setByBinaryString - * @memberOf KJUR.asn1.DERBitString + * @memberOf KJUR.asn1.DERBitString# * @function * @param {String} binaryString binary value string (i.e. '10111') * @description * Its unused bits will be calculated automatically by length of * 'binaryValue'.
    * NOTE: Trailing zeros '0' will be ignored. + * @example + * o = new KJUR.asn1.DERBitString(); + * o.setByBooleanArray("01011"); */ this.setByBinaryString = function(binaryString) { binaryString = binaryString.replace(/0+$/, ''); @@ -922,13 +925,16 @@ KJUR.asn1.DERBitString = function(params) { }; /** - * set ASN.1 TLV value(V) by an array of boolean + * set ASN.1 TLV value(V) by an array of boolean
    * @name setByBooleanArray - * @memberOf KJUR.asn1.DERBitString + * @memberOf KJUR.asn1.DERBitString# * @function * @param {array} booleanArray array of boolean (ex. [true, false, true]) * @description - * NOTE: Trailing falses will be ignored. + * NOTE: Trailing falses will be ignored in the ASN.1 DER Object. + * @example + * o = new KJUR.asn1.DERBitString(); + * o.setByBooleanArray([false, true, false, true, true]); */ this.setByBooleanArray = function(booleanArray) { var s = ''; @@ -943,14 +949,17 @@ KJUR.asn1.DERBitString = function(params) { }; /** - * generate an array of false with specified length + * generate an array of falses with specified length
    * @name newFalseArray * @memberOf KJUR.asn1.DERBitString * @function * @param {Integer} nLength length of array to generate - * @return {array} array of boolean faluse + * @return {array} array of boolean falses * @description * This static method may be useful to initialize boolean array. + * @example + * o = new KJUR.asn1.DERBitString(); + * o.newFalseArray(3) → [false, false, false] */ this.newFalseArray = function(nLength) { var a = new Array(nLength); @@ -1087,7 +1096,7 @@ KJUR.asn1.DERObjectIdentifier = function(params) { /** * set value by a hexadecimal string * @name setValueHex - * @memberOf KJUR.asn1.DERObjectIdentifier + * @memberOf KJUR.asn1.DERObjectIdentifier# * @function * @param {String} newHexString hexadecimal value of OID bytes */ @@ -1099,11 +1108,14 @@ KJUR.asn1.DERObjectIdentifier = function(params) { }; /** - * set value by a OID string + * set value by a OID string
    * @name setValueOidString - * @memberOf KJUR.asn1.DERObjectIdentifier + * @memberOf KJUR.asn1.DERObjectIdentifier# * @function * @param {String} oidString OID string (ex. 2.5.4.13) + * @example + * o = new KJUR.asn1.DERObjectIdentifier(); + * o.setValueOidString("2.5.4.13"); */ this.setValueOidString = function(oidString) { if (! oidString.match(/^[0-9.]+$/)) { @@ -1126,13 +1138,16 @@ KJUR.asn1.DERObjectIdentifier = function(params) { /** * set value by a OID name * @name setValueName - * @memberOf KJUR.asn1.DERObjectIdentifier + * @memberOf KJUR.asn1.DERObjectIdentifier# * @function * @param {String} oidName OID name (ex. 'serverAuth') * @since 1.0.1 * @description * OID name shall be defined in 'KJUR.asn1.x509.OID.name2oidList'. * Otherwise raise error. + * @example + * o = new KJUR.asn1.DERObjectIdentifier(); + * o.setValueName("serverAuth"); */ this.setValueName = function(oidName) { var oid = KJUR.asn1.x509.OID.name2oid(oidName); @@ -1180,6 +1195,10 @@ YAHOO.lang.extend(KJUR.asn1.DERObjectIdentifier, KJUR.asn1.ASN1Object); *
  • hex - specify initial ASN.1 value(V) by a hexadecimal string
  • * * NOTE: 'params' can be omitted. + * @example + * new KJUR.asn1.DEREnumerated(123); + * new KJUR.asn1.DEREnumerated({int: 123}); + * new KJUR.asn1.DEREnumerated({hex: '1fad'}); */ KJUR.asn1.DEREnumerated = function(params) { KJUR.asn1.DEREnumerated.superclass.constructor.call(this); @@ -1188,7 +1207,7 @@ KJUR.asn1.DEREnumerated = function(params) { /** * set value by Tom Wu's BigInteger object * @name setByBigInteger - * @memberOf KJUR.asn1.DEREnumerated + * @memberOf KJUR.asn1.DEREnumerated# * @function * @param {BigInteger} bigIntegerValue to set */ @@ -1201,7 +1220,7 @@ KJUR.asn1.DEREnumerated = function(params) { /** * set value by integer value * @name setByInteger - * @memberOf KJUR.asn1.DEREnumerated + * @memberOf KJUR.asn1.DEREnumerated# * @function * @param {Integer} integer value to set */ @@ -1213,17 +1232,13 @@ KJUR.asn1.DEREnumerated = function(params) { /** * set value by integer value * @name setValueHex - * @memberOf KJUR.asn1.DEREnumerated + * @memberOf KJUR.asn1.DEREnumerated# * @function * @param {String} hexadecimal string of integer value * @description *
    * NOTE: Value shall be represented by minimum octet length of * two's complement representation. - * @example - * new KJUR.asn1.DEREnumerated(123); - * new KJUR.asn1.DEREnumerated({int: 123}); - * new KJUR.asn1.DEREnumerated({hex: '1fad'}); */ this.setValueHex = function(newHexString) { this.hV = newHexString; @@ -1344,23 +1359,26 @@ YAHOO.lang.extend(KJUR.asn1.DERIA5String, KJUR.asn1.DERAbstractString); * NOTE: 'params' can be omitted. *

    EXAMPLES

    * @example - * var d1 = new KJUR.asn1.DERUTCTime(); + * d1 = new KJUR.asn1.DERUTCTime(); * d1.setString('130430125959Z'); * - * var d2 = new KJUR.asn1.DERUTCTime({'str': '130430125959Z'}); - * var d3 = new KJUR.asn1.DERUTCTime({'date': new Date(Date.UTC(2015, 0, 31, 0, 0, 0, 0))}); - * var d4 = new KJUR.asn1.DERUTCTime('130430125959Z'); + * d2 = new KJUR.asn1.DERUTCTime({'str': '130430125959Z'}); + * d3 = new KJUR.asn1.DERUTCTime({'date': new Date(Date.UTC(2015, 0, 31, 0, 0, 0, 0))}); + * d4 = new KJUR.asn1.DERUTCTime('130430125959Z'); */ KJUR.asn1.DERUTCTime = function(params) { KJUR.asn1.DERUTCTime.superclass.constructor.call(this, params); this.hT = "17"; /** - * set value by a Date object + * set value by a Date object
    * @name setByDate - * @memberOf KJUR.asn1.DERUTCTime + * @memberOf KJUR.asn1.DERUTCTime# * @function * @param {Date} dateObject Date object to set ASN.1 value(V) + * @example + * o = new KJUR.asn1.DERUTCTime(); + * o.setByDate(new Date("2016/12/31")); */ this.setByDate = function(dateObject) { this.hTLV = null; @@ -1422,14 +1440,15 @@ KJUR.asn1.DERGeneralizedTime = function(params) { /** * set value by a Date object * @name setByDate - * @memberOf KJUR.asn1.DERGeneralizedTime + * @memberOf KJUR.asn1.DERGeneralizedTime# * @function * @param {Date} dateObject Date object to set ASN.1 value(V) * @example * When you specify UTC time, use 'Date.UTC' method like this:
    - * var o = new DERUTCTime(); - * var date = new Date(Date.UTC(2015, 0, 31, 23, 59, 59, 0)); #2015JAN31 23:59:59 - * o.setByDate(date); + * o1 = new DERUTCTime(); + * o1.setByDate(date); + * + * date = new Date(Date.UTC(2015, 0, 31, 23, 59, 59, 0)); #2015JAN31 23:59:59 */ this.setByDate = function(dateObject) { this.hTLV = null; @@ -1570,7 +1589,7 @@ KJUR.asn1.DERTaggedObject = function(params) { /** * set value by an ASN1Object * @name setString - * @memberOf KJUR.asn1.DERTaggedObject + * @memberOf KJUR.asn1.DERTaggedObject# * @function * @param {Boolean} isExplicitFlag flag for explicit/implicit tag * @param {Integer} tagNoHex hexadecimal string of ASN.1 tag diff --git a/asn1csr-1.0.js b/asn1csr-1.0.js index dda5db3e..b32b3a6a 100644 --- a/asn1csr-1.0.js +++ b/asn1csr-1.0.js @@ -1,4 +1,4 @@ -/*! asn1csr-1.0.1.js (c) 2015-2016 Kenji Urushima | kjur.github.com/jsrsasign/license +/*! asn1csr-1.0.2.js (c) 2015-2016 Kenji Urushima | kjur.github.com/jsrsasign/license */ /* * asn1csr.js - ASN.1 DER encoder classes for PKCS#10 CSR @@ -16,7 +16,7 @@ * @fileOverview * @name asn1csr-1.0.js * @author Kenji Urushima kenji.urushima@gmail.com - * @version 1.0.1 (2016-Oct-15) + * @version 1.0.2 (2016-Nov-26) * @since jsrsasign 4.9.0 * @license MIT License */ @@ -84,9 +84,9 @@ KJUR.asn1.csr.CertificationRequest = function(params) { var prvKey = null; /** - * sign CertificationRequest and set signature value internally + * sign CertificationRequest and set signature value internally
    * @name sign - * @memberOf KJUR.asn1.csr.CertificationRequest + * @memberOf KJUR.asn1.csr.CertificationRequest# * @function * @description * This method self-signs CertificateRequestInfo with a subject's @@ -116,9 +116,9 @@ KJUR.asn1.csr.CertificationRequest = function(params) { }; /** - * get PEM formatted certificate signing request (CSR/PKCS#10) + * get PEM formatted certificate signing request (CSR/PKCS#10)
    * @name getPEMString - * @memberOf KJUR.asn1.csr.CertificationRequest + * @memberOf KJUR.asn1.csr.CertificationRequest# * @function * @return PEM formatted string of CSR/PKCS#10 * @description @@ -160,19 +160,19 @@ YAHOO.lang.extend(KJUR.asn1.csr.CertificationRequest, KJUR.asn1.ASN1Object); * @extends KJUR.asn1.ASN1Object * @since jsrsasign 4.9.0 asn1csr 1.0.0 * @description - *
    - * @example - * csri = new KJUR.asn1.csr.CertificationRequestInfo(); - * csri.setSubjectByParam({'str': '/C=US/O=Test/CN=example.com'}); - * csri.setSubjectPublicKeyByGetKey(pubKeyObj); - * + *
      * // -- DEFINITION OF ASN.1 SYNTAX --
      * // CertificationRequestInfo ::= SEQUENCE {
      * //   version       INTEGER { v1(0) } (v1,...),
      * //   subject       Name,
      * //   subjectPKInfo SubjectPublicKeyInfo{{ PKInfoAlgorithms }},
      * //   attributes    [0] Attributes{{ CRIAttributes }} }
    - *
    + * 
    + *
    + * @example + * csri = new KJUR.asn1.csr.CertificationRequestInfo(); + * csri.setSubjectByParam({'str': '/C=US/O=Test/CN=example.com'}); + * csri.setSubjectPublicKeyByGetKey(pubKeyObj); */ KJUR.asn1.csr.CertificationRequestInfo = function(params) { KJUR.asn1.csr.CertificationRequestInfo.superclass.constructor.call(this); @@ -189,7 +189,7 @@ KJUR.asn1.csr.CertificationRequestInfo = function(params) { /** * set subject name field by parameter * @name setSubjectByParam - * @memberOf KJUR.asn1.csr.CertificationRequestInfo + * @memberOf KJUR.asn1.csr.CertificationRequestInfo# * @function * @param {Array} x500NameParam X500Name parameter * @description @@ -204,7 +204,7 @@ KJUR.asn1.csr.CertificationRequestInfo = function(params) { /** * set subject public key info by RSA/ECDSA/DSA key parameter * @name setSubjectPublicKeyByGetKey - * @memberOf KJUR.asn1.csr.CertificationRequestInfo + * @memberOf KJUR.asn1.csr.CertificationRequestInfo# * @function * @param {Object} keyParam public key parameter which passed to {@link KEYUTIL.getKey} argument * @description @@ -220,6 +220,30 @@ KJUR.asn1.csr.CertificationRequestInfo = function(params) { this.asn1SubjPKey = new KJUR.asn1.x509.SubjectPublicKeyInfo(keyObj); }; + /** + * append X.509v3 extension to this object by name and parameters + * @name appendExtensionByName + * @memberOf KJUR.asn1.csr.CertificationRequestInfo# + * @function + * @param {name} name name of X.509v3 Extension object + * @param {Array} extParams parameters as argument of Extension constructor. + * @see KJUR.asn1.x509.Extension + * @description + * @example + * var o = new KJUR.asn1.csr.CertificationRequestInfo(); + * o.appendExtensionByName('BasicConstraints', {'cA':true, 'critical': true}); + * o.appendExtensionByName('KeyUsage', {'bin':'11'}); + * o.appendExtensionByName('CRLDistributionPoints', {uri: 'http://aaa.com/a.crl'}); + * o.appendExtensionByName('ExtKeyUsage', {array: [{name: 'clientAuth'}]}); + * o.appendExtensionByName('AuthorityKeyIdentifier', {kid: '1234ab..'}); + * o.appendExtensionByName('AuthorityInfoAccess', {array: [{accessMethod:{oid:...},accessLocation:{uri:...}}]}); + */ + this.appendExtensionByName = function(name, extParams) { + KJUR.asn1.x509.Extension.appendByNameToArray(name, + extParams, + this.extensionsArray); + }; + this.getEncodedHex = function() { this.asn1Array = new Array(); @@ -227,11 +251,28 @@ KJUR.asn1.csr.CertificationRequestInfo = function(params) { this.asn1Array.push(this.asn1Subject); this.asn1Array.push(this.asn1SubjPKey); - var extSeq = new KJUR.asn1.DERSequence({"array": this.extensionsArray}); - var extTagObj = new KJUR.asn1.DERTaggedObject({'explicit': false, - 'tag': 'a0', - 'obj': extSeq}); - this.asn1Array.push(extTagObj); + // extensionRequest + if (this.extensionsArray.length > 0) { + var extSeq = new KJUR.asn1.DERSequence({array: this.extensionsArray}); + var extSet = new KJUR.asn1.DERSet({array: [extSeq]}); + var extSeq2 = new KJUR.asn1.DERSequence({array: [ + new KJUR.asn1.DERObjectIdentifier({oid: "1.2.840.113549.1.9.14"}), + extSet + ]}); + var extTagObj = new KJUR.asn1.DERTaggedObject({ + explicit: true, + tag: 'a0', + obj: extSeq2 + }); + this.asn1Array.push(extTagObj); + } else { + var extTagObj = new KJUR.asn1.DERTaggedObject({ + explicit: false, + tag: 'a0', + obj: new KJUR.asn1.DERNull() + }); + this.asn1Array.push(extTagObj); + } var o = new KJUR.asn1.DERSequence({"array": this.asn1Array}); this.hTLV = o.getEncodedHex(); @@ -244,9 +285,17 @@ KJUR.asn1.csr.CertificationRequestInfo = function(params) { YAHOO.lang.extend(KJUR.asn1.csr.CertificationRequestInfo, KJUR.asn1.ASN1Object); /** - * Certification Request (CSR/PKCS#10) utilities class + * Certification Request (CSR/PKCS#10) utilities class
    * @name KJUR.asn1.csr.CSRUtil * @class Certification Request (CSR/PKCS#10) utilities class + * @description + * This class provides utility static methods for CSR/PKCS#10. + * Here is a list of methods: + *
      + *
    • {@link KJUR.asn1.csr.CSRUtil.newCSRPEM}
    • + *
    • {@link KJUR.asn1.csr.CSRUtil.getInfo}
    • + *
    + *
    */ KJUR.asn1.csr.CSRUtil = new function() { }; @@ -293,6 +342,17 @@ KJUR.asn1.csr.CSRUtil = new function() { * sigalg: "SHA256withRSA", * sbjprvkey: kp.prvKeyObj * }); + * + * // 4) by private/public key PEM with extension + * pem = KJUR.asn1.csr.CSRUtil.newCSRPEM({ + * subject: {str: '/C=US/O=Test/CN=example.com'}, + * ext: [ + * {subjectAltName: {array: [{dns: 'example.net'}]} + * ], + * sbjpubkey: pubKeyPEM, + * sigalg: "SHA256withRSA", + * sbjprvkey: prvKeyPEM + * }); */ KJUR.asn1.csr.CSRUtil.newCSRPEM = function(param) { var ns1 = KJUR.asn1.csr; @@ -306,6 +366,14 @@ KJUR.asn1.csr.CSRUtil.newCSRPEM = function(param) { csri.setSubjectByParam(param.subject); csri.setSubjectPublicKeyByGetKey(param.sbjpubkey); + if (param.ext !== undefined && param.ext.length !== undefined) { + for (var i = 0; i < param.ext.length; i++) { + for (key in param.ext[i]) { + csri.appendExtensionByName(key, param.ext[i][key]); + } + } + } + var csr = new ns1.CertificationRequest({'csrinfo': csri}); var prvKey = KEYUTIL.getKey(param.sbjprvkey); csr.sign(param.sigalg, prvKey); diff --git a/asn1x509-1.0.js b/asn1x509-1.0.js index c6dc830d..d30c6fcf 100644 --- a/asn1x509-1.0.js +++ b/asn1x509-1.0.js @@ -1,4 +1,4 @@ -/*! asn1x509-1.0.18.js (c) 2013-2016 Kenji Urushima | kjur.github.com/jsrsasign/license +/*! asn1x509-1.0.19.js (c) 2013-2016 Kenji Urushima | kjur.github.com/jsrsasign/license */ /* * asn1x509.js - ASN.1 DER encoder classes for X.509 certificate @@ -16,7 +16,7 @@ * @fileOverview * @name asn1x509-1.0.js * @author Kenji Urushima kenji.urushima@gmail.com - * @version 1.0.18 (2016-Nov-19) + * @version 1.0.19 (2016-Nov-26) * @since jsrsasign 2.1 * @license MIT License */ @@ -73,8 +73,12 @@ if (typeof KJUR.asn1 == "undefined" || !KJUR.asn1) KJUR.asn1 = {}; *
  • {@link KJUR.asn1.x509.ExtKeyUsage}
  • *
  • {@link KJUR.asn1.x509.AuthorityKeyIdentifier}
  • *
  • {@link KJUR.asn1.x509.AuthorityInfoAccess}
  • + *
  • {@link KJUR.asn1.x509.SubjectAltName}
  • + *
  • {@link KJUR.asn1.x509.IssuerAltName}
  • * - * NOTE: Please ignore method summary and document of this namespace. This caused by a bug of jsdoc2. + * NOTE1: Please ignore method summary and document of this namespace. This caused by a bug of jsdoc2.
    + * NOTE2: SubjectAltName and IssuerAltName extension were supported since + * jsrsasign 6.2.3 asn1x509 1.0.19.
    * @name KJUR.asn1.x509 * @namespace */ @@ -276,7 +280,7 @@ KJUR.asn1.x509.TBSCertificate = function(params) { /** * set serial number field by parameter * @name setSerialNumberByParam - * @memberOf KJUR.asn1.x509.TBSCertificate + * @memberOf KJUR.asn1.x509.TBSCertificate# * @function * @param {Array} intParam DERInteger param * @description @@ -290,7 +294,7 @@ KJUR.asn1.x509.TBSCertificate = function(params) { /** * set signature algorithm field by parameter * @name setSignatureAlgByParam - * @memberOf KJUR.asn1.x509.TBSCertificate + * @memberOf KJUR.asn1.x509.TBSCertificate# * @function * @param {Array} algIdParam AlgorithmIdentifier parameter * @description @@ -304,7 +308,7 @@ KJUR.asn1.x509.TBSCertificate = function(params) { /** * set issuer name field by parameter * @name setIssuerByParam - * @memberOf KJUR.asn1.x509.TBSCertificate + * @memberOf KJUR.asn1.x509.TBSCertificate# * @function * @param {Array} x500NameParam X500Name parameter * @description @@ -319,7 +323,7 @@ KJUR.asn1.x509.TBSCertificate = function(params) { /** * set notBefore field by parameter * @name setNotBeforeByParam - * @memberOf KJUR.asn1.x509.TBSCertificate + * @memberOf KJUR.asn1.x509.TBSCertificate# * @function * @param {Array} timeParam Time parameter * @description @@ -334,7 +338,7 @@ KJUR.asn1.x509.TBSCertificate = function(params) { /** * set notAfter field by parameter * @name setNotAfterByParam - * @memberOf KJUR.asn1.x509.TBSCertificate + * @memberOf KJUR.asn1.x509.TBSCertificate# * @function * @param {Array} timeParam Time parameter * @description @@ -349,7 +353,7 @@ KJUR.asn1.x509.TBSCertificate = function(params) { /** * set subject name field by parameter * @name setSubjectByParam - * @memberOf KJUR.asn1.x509.TBSCertificate + * @memberOf KJUR.asn1.x509.TBSCertificate# * @function * @param {Array} x500NameParam X500Name parameter * @description @@ -364,7 +368,7 @@ KJUR.asn1.x509.TBSCertificate = function(params) { /** * (DEPRECATED) set subject public key info field by RSA key parameter * @name setSubjectPublicKeyByParam - * @memberOf KJUR.asn1.x509.TBSCertificate + * @memberOf KJUR.asn1.x509.TBSCertificate# * @function * @param {Array} subjPKeyParam SubjectPublicKeyInfo parameter of RSA * @deprecated @@ -400,7 +404,7 @@ KJUR.asn1.x509.TBSCertificate = function(params) { /** * append X.509v3 extension to this object * @name appendExtension - * @memberOf KJUR.asn1.x509.TBSCertificate + * @memberOf KJUR.asn1.x509.TBSCertificate# * @function * @param {Extension} extObj X.509v3 Extension object * @description @@ -416,42 +420,25 @@ KJUR.asn1.x509.TBSCertificate = function(params) { /** * append X.509v3 extension to this object by name and parameters * @name appendExtensionByName - * @memberOf KJUR.asn1.x509.TBSCertificate + * @memberOf KJUR.asn1.x509.TBSCertificate# * @function * @param {name} name name of X.509v3 Extension object * @param {Array} extParams parameters as argument of Extension constructor. * @description * @example - * tbsc.appendExtensionByName('BasicConstraints', {'cA':true, 'critical': true}); - * tbsc.appendExtensionByName('KeyUsage', {'bin':'11'}); - * tbsc.appendExtensionByName('CRLDistributionPoints', {uri: 'http://aaa.com/a.crl'}); - * tbsc.appendExtensionByName('ExtKeyUsage', {array: [{name: 'clientAuth'}]}); - * tbsc.appendExtensionByName('AuthorityKeyIdentifier', {kid: '1234ab..'}); - * tbsc.appendExtensionByName('AuthorityInfoAccess', {array: [{accessMethod:{oid:...},accessLocation:{uri:...}}]}); + * var o = new KJUR.asn1.x509.TBSCertificate(); + * o.appendExtensionByName('BasicConstraints', {'cA':true, 'critical': true}); + * o.appendExtensionByName('KeyUsage', {'bin':'11'}); + * o.appendExtensionByName('CRLDistributionPoints', {uri: 'http://aaa.com/a.crl'}); + * o.appendExtensionByName('ExtKeyUsage', {array: [{name: 'clientAuth'}]}); + * o.appendExtensionByName('AuthorityKeyIdentifier', {kid: '1234ab..'}); + * o.appendExtensionByName('AuthorityInfoAccess', {array: [{accessMethod:{oid:...},accessLocation:{uri:...}}]}); * @see KJUR.asn1.x509.Extension */ this.appendExtensionByName = function(name, extParams) { - if (name.toLowerCase() == "basicconstraints") { - var extObj = new KJUR.asn1.x509.BasicConstraints(extParams); - this.appendExtension(extObj); - } else if (name.toLowerCase() == "keyusage") { - var extObj = new KJUR.asn1.x509.KeyUsage(extParams); - this.appendExtension(extObj); - } else if (name.toLowerCase() == "crldistributionpoints") { - var extObj = new KJUR.asn1.x509.CRLDistributionPoints(extParams); - this.appendExtension(extObj); - } else if (name.toLowerCase() == "extkeyusage") { - var extObj = new KJUR.asn1.x509.ExtKeyUsage(extParams); - this.appendExtension(extObj); - } else if (name.toLowerCase() == "authoritykeyidentifier") { - var extObj = new KJUR.asn1.x509.AuthorityKeyIdentifier(extParams); - this.appendExtension(extObj); - } else if (name.toLowerCase() == "authorityinfoaccess") { - var extObj = new KJUR.asn1.x509.AuthorityInfoAccess(extParams); - this.appendExtension(extObj); - } else { - throw "unsupported extension name: " + name; - } + KJUR.asn1.x509.Extension.appendByNameToArray(name, + extParams, + this.extensionsArray); }; this.getEncodedHex = function() { @@ -532,6 +519,54 @@ KJUR.asn1.x509.Extension = function(params) { }; YAHOO.lang.extend(KJUR.asn1.x509.Extension, KJUR.asn1.ASN1Object); +/** + * append X.509v3 extension to any specified array
    + * @name appendByNameToArray + * @memberOf KJUR.asn1.x509.Extension + * @function + * @param {String} name X.509v3 extension name + * @param {Object} extParams associative array of extension parameters + * @param {Array} a array to add specified extension + * @see KJUR.asn1.x509.Extension + * @since jsrsasign 6.2.3 asn1x509 1.0.19 + * @description + * This static function add a X.509v3 extension specified by name and extParams to + * array 'a' so that 'a' will be an array of X.509v3 extension objects. + * @example + * var a = new Array(); + * KJUR.asn1.x509.Extension.appendByNameToArray("BasicConstraints", {'cA':true, 'critical': true}, a); + * KJUR.asn1.x509.Extension.appendByNameToArray("KeyUsage", {'bin':'11'}, a); + */ +KJUR.asn1.x509.Extension.appendByNameToArray = function(name, extParams, a) { + if (name.toLowerCase() == "basicconstraints") { + var extObj = new KJUR.asn1.x509.BasicConstraints(extParams); + a.push(extObj); + } else if (name.toLowerCase() == "keyusage") { + var extObj = new KJUR.asn1.x509.KeyUsage(extParams); + a.push(extObj); + } else if (name.toLowerCase() == "crldistributionpoints") { + var extObj = new KJUR.asn1.x509.CRLDistributionPoints(extParams); + a.push(extObj); + } else if (name.toLowerCase() == "extkeyusage") { + var extObj = new KJUR.asn1.x509.ExtKeyUsage(extParams); + a.push(extObj); + } else if (name.toLowerCase() == "authoritykeyidentifier") { + var extObj = new KJUR.asn1.x509.AuthorityKeyIdentifier(extParams); + a.push(extObj); + } else if (name.toLowerCase() == "authorityinfoaccess") { + var extObj = new KJUR.asn1.x509.AuthorityInfoAccess(extParams); + a.push(extObj); + } else if (name.toLowerCase() == "subjectaltname") { + var extObj = new KJUR.asn1.x509.SubjectAltName(extParams); + a.push(extObj); + } else if (name.toLowerCase() == "issueraltname") { + var extObj = new KJUR.asn1.x509.IssuerAltName(extParams); + a.push(extObj); + } else { + throw "unsupported extension name: " + name; + } +}; + /** * KeyUsage ASN.1 structure class * @name KJUR.asn1.x509.KeyUsage @@ -641,12 +676,13 @@ YAHOO.lang.extend(KJUR.asn1.x509.CRLDistributionPoints, KJUR.asn1.x509.Extension * @extends KJUR.asn1.x509.Extension * @description * @example - * var e1 = - * new KJUR.asn1.x509.ExtKeyUsage({'critical': true, - * 'array': - * [{'oid': '2.5.29.37.0', // anyExtendedKeyUsage - * 'name': 'clientAuth'}]}); - * + * e1 = new KJUR.asn1.x509.ExtKeyUsage({ + * critical: true, + * array: [ + * {oid: '2.5.29.37.0'}, // anyExtendedKeyUsage + * {name: 'clientAuth'} + * ] + * }); * // id-ce-extKeyUsage OBJECT IDENTIFIER ::= { id-ce 37 } * // ExtKeyUsageSyntax ::= SEQUENCE SIZE (1..MAX) OF KeyPurposeId * // KeyPurposeId ::= OBJECT IDENTIFIER @@ -692,11 +728,12 @@ YAHOO.lang.extend(KJUR.asn1.x509.ExtKeyUsage, KJUR.asn1.x509.Extension); * KeyIdentifier ::= OCTET STRING * * @example - * var param = {'kid': {'hex': '89ab'}, - * 'issuer': {'str': '/C=US/CN=a'}, - * 'sn': {'hex': '1234'}, - * 'critical': true}); - * var e1 = new KJUR.asn1.x509.AuthorityKeyIdentifier(param); + * e1 = new KJUR.asn1.x509.AuthorityKeyIdentifier({ + * critical: true, + * kid: {hex: '89ab'}, + * issuer: {str: '/C=US/CN=a'}, + * sn: {hex: '1234'} + * }); */ KJUR.asn1.x509.AuthorityKeyIdentifier = function(params) { KJUR.asn1.x509.AuthorityKeyIdentifier.superclass.constructor.call(this, params); @@ -742,7 +779,7 @@ KJUR.asn1.x509.AuthorityKeyIdentifier = function(params) { /** * set authorityCertIssuer value by X500Name parameter * @name setCertIssuerByParam - * @memberOf KJUR.asn1.x509.AuthorityKeyIdentifier + * @memberOf KJUR.asn1.x509.AuthorityKeyIdentifier# * @function * @param {Array} param array of {@link KJUR.asn1.x509.X500Name} parameter * @since asn1x509 1.0.8 @@ -757,7 +794,7 @@ KJUR.asn1.x509.AuthorityKeyIdentifier = function(params) { /** * set authorityCertSerialNumber value by DERInteger parameter * @name setCertSerialNumberByParam - * @memberOf KJUR.asn1.x509.AuthorityKeyIdentifier + * @memberOf KJUR.asn1.x509.AuthorityKeyIdentifier# * @function * @param {Array} param array of {@link KJUR.asn1.DERInteger} parameter * @since asn1x509 1.0.8 @@ -805,11 +842,12 @@ YAHOO.lang.extend(KJUR.asn1.x509.AuthorityKeyIdentifier, KJUR.asn1.x509.Extensio * id-ad-ocsp OBJECT IDENTIFIER ::= { id-ad 1 } * * @example - * var param = {'array':[ - * { 'accessMethod':{'oid': '1.3.6.1.5.5.7.48.1'}, - * 'accessLocation':{'uri': 'http://ocsp.cacert.org'} - * } ]}; - * var e1 = new KJUR.asn1.x509.AuthorityInfoAccess(param); + * e1 = new KJUR.asn1.x509.AuthorityInfoAccess({ + * array: [{ + * accessMethod:{'oid': '1.3.6.1.5.5.7.48.1'}, + * accessLocation:{'uri': 'http://ocsp.cacert.org'} + * }] + * }); */ KJUR.asn1.x509.AuthorityInfoAccess = function(params) { KJUR.asn1.x509.AuthorityInfoAccess.superclass.constructor.call(this, params); @@ -838,6 +876,110 @@ KJUR.asn1.x509.AuthorityInfoAccess = function(params) { }; YAHOO.lang.extend(KJUR.asn1.x509.AuthorityInfoAccess, KJUR.asn1.x509.Extension); +/** + * SubjectAltName ASN.1 structure class
    + * @name KJUR.asn1.x509.SubjectAltName + * @class SubjectAltName ASN.1 structure class + * @param {Array} params associative array of parameters + * @extends KJUR.asn1.x509.Extension + * @since jsrsasign 6.2.3 asn1x509 1.0.19 + * @see KJUR.asn1.x509.GeneralNames + * @see KJUR.asn1.x509.GeneralName + * @description + * This class provides X.509v3 SubjectAltName extension. + *
    + * id-ce-subjectAltName OBJECT IDENTIFIER ::=  { id-ce 17 }
    + * SubjectAltName ::= GeneralNames
    + * GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName
    + * GeneralName ::= CHOICE {
    + *   otherName                  [0] OtherName,
    + *   rfc822Name                 [1] IA5String,
    + *   dNSName                    [2] IA5String,
    + *   x400Address                [3] ORAddress,
    + *   directoryName              [4] Name,
    + *   ediPartyName               [5] EDIPartyName,
    + *   uniformResourceIdentifier  [6] IA5String,
    + *   iPAddress                  [7] OCTET STRING,
    + *   registeredID               [8] OBJECT IDENTIFIER }
    + * 
    + * @example + * e1 = new KJUR.asn1.x509.SubjectAltName({ + * critical: true, + * array: [{uri: 'http://aaa.com/'}, {uri: 'http://bbb.com/'}] + * }); + */ +KJUR.asn1.x509.SubjectAltName = function(params) { + KJUR.asn1.x509.SubjectAltName.superclass.constructor.call(this, params) + + this.setNameArray = function(paramsArray) { + this.asn1ExtnValue = new KJUR.asn1.x509.GeneralNames(paramsArray); + }; + + this.getExtnValueHex = function() { + return this.asn1ExtnValue.getEncodedHex(); + }; + + this.oid = "2.5.29.17"; + if (params !== undefined) { + if (params.array !== undefined) { + this.setNameArray(params.array); + } + } +}; +YAHOO.lang.extend(KJUR.asn1.x509.SubjectAltName, KJUR.asn1.x509.Extension); + +/** + * IssuerAltName ASN.1 structure class
    + * @name KJUR.asn1.x509.IssuerAltName + * @class IssuerAltName ASN.1 structure class + * @param {Array} params associative array of parameters + * @extends KJUR.asn1.x509.Extension + * @since jsrsasign 6.2.3 asn1x509 1.0.19 + * @see KJUR.asn1.x509.GeneralNames + * @see KJUR.asn1.x509.GeneralName + * @description + * This class provides X.509v3 IssuerAltName extension. + *
    + * id-ce-subjectAltName OBJECT IDENTIFIER ::=  { id-ce 18 }
    + * IssuerAltName ::= GeneralNames
    + * GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName
    + * GeneralName ::= CHOICE {
    + *   otherName                  [0] OtherName,
    + *   rfc822Name                 [1] IA5String,
    + *   dNSName                    [2] IA5String,
    + *   x400Address                [3] ORAddress,
    + *   directoryName              [4] Name,
    + *   ediPartyName               [5] EDIPartyName,
    + *   uniformResourceIdentifier  [6] IA5String,
    + *   iPAddress                  [7] OCTET STRING,
    + *   registeredID               [8] OBJECT IDENTIFIER }
    + * 
    + * @example + * e1 = new KJUR.asn1.x509.IssuerAltName({ + * critical: true, + * array: [{uri: 'http://aaa.com/'}, {uri: 'http://bbb.com/'}] + * }); + */ +KJUR.asn1.x509.IssuerAltName = function(params) { + KJUR.asn1.x509.IssuerAltName.superclass.constructor.call(this, params) + + this.setNameArray = function(paramsArray) { + this.asn1ExtnValue = new KJUR.asn1.x509.GeneralNames(paramsArray); + }; + + this.getExtnValueHex = function() { + return this.asn1ExtnValue.getEncodedHex(); + }; + + this.oid = "2.5.29.18"; + if (params !== undefined) { + if (params.array !== undefined) { + this.setNameArray(params.array); + } + } +}; +YAHOO.lang.extend(KJUR.asn1.x509.IssuerAltName, KJUR.asn1.x509.Extension); + // === END X.509v3 Extensions Related ======================================= // === BEGIN CRL Related =================================================== @@ -1874,34 +2016,37 @@ YAHOO.lang.extend(KJUR.asn1.x509.AlgorithmIdentifier, KJUR.asn1.ASN1Object); *
  • rfc822 - rfc822Name[1] (ex. user1@foo.com)
  • *
  • dns - dNSName[2] (ex. foo.com)
  • *
  • uri - uniformResourceIdentifier[6] (ex. http://foo.com/)
  • + *
  • dn - directoryName[4] (ex. /C=US/O=Test)
  • + *
  • ldapdn - directoryName[4] (ex. O=Test,C=US)
  • *
  • certissuer - directoryName[4] (PEM or hex string of cert)
  • *
  • certsubj - directoryName[4] (PEM or hex string of cert)
  • * - * NOTE1: certissuer and certsubj is supported since asn1x509 1.0.10. + * NOTE1: certissuer and certsubj were supported since asn1x509 1.0.10.
    + * NOTE2: dn and ldapdn were supported since jsrsasign 6.2.3 asn1x509 1.0.19.
    * * Here is definition of the ASN.1 syntax: *
      * -- NOTE: under the CHOICE, it will always be explicit.
      * GeneralName ::= CHOICE {
    - *         otherName                       [0]     OtherName,
    - *         rfc822Name                      [1]     IA5String,
    - *         dNSName                         [2]     IA5String,
    - *         x400Address                     [3]     ORAddress,
    - *         directoryName                   [4]     Name,
    - *         ediPartyName                    [5]     EDIPartyName,
    - *         uniformResourceIdentifier       [6]     IA5String,
    - *         iPAddress                       [7]     OCTET STRING,
    - *         registeredID                    [8]     OBJECT IDENTIFIER }
    + *   otherName                  [0] OtherName,
    + *   rfc822Name                 [1] IA5String,
    + *   dNSName                    [2] IA5String,
    + *   x400Address                [3] ORAddress,
    + *   directoryName              [4] Name,
    + *   ediPartyName               [5] EDIPartyName,
    + *   uniformResourceIdentifier  [6] IA5String,
    + *   iPAddress                  [7] OCTET STRING,
    + *   registeredID               [8] OBJECT IDENTIFIER }
      * 
    * - * - * * @example - * gn = new KJUR.asn1.x509.GeneralName({rfc822: 'test@aaa.com'}); - * gn = new KJUR.asn1.x509.GeneralName({dns: 'aaa.com'}); - * gn = new KJUR.asn1.x509.GeneralName({uri: 'http://aaa.com/'}); - * gn = new KJUR.asn1.x509.GeneralName({certissuer: certPEM}); - * gn = new KJUR.asn1.x509.GeneralName({certsubj: certPEM}); + * gn = new KJUR.asn1.x509.GeneralName({rfc822: 'test@aaa.com'}); + * gn = new KJUR.asn1.x509.GeneralName({dns: 'aaa.com'}); + * gn = new KJUR.asn1.x509.GeneralName({uri: 'http://aaa.com/'}); + * gn = new KJUR.asn1.x509.GeneralName({dn: '/C=US/O=Test'}); + * gn = new KJUR.asn1.x509.GeneralName({ldapdn: 'O=Test,C=US'}); + * gn = new KJUR.asn1.x509.GeneralName({certissuer: certPEM}); + * gn = new KJUR.asn1.x509.GeneralName({certsubj: certPEM}); */ KJUR.asn1.x509.GeneralName = function(params) { KJUR.asn1.x509.GeneralName.superclass.constructor.call(this); @@ -1914,24 +2059,34 @@ KJUR.asn1.x509.GeneralName = function(params) { var str = null; var v = null; - if (typeof params == "undefined") return; + if (params === undefined) return; - if (typeof params.rfc822 != "undefined") { + if (params.rfc822 !== undefined) { this.type = 'rfc822'; - v = new KJUR.asn1.DERIA5String({'str': params[this.type]}); + v = new KJUR.asn1.DERIA5String({str: params[this.type]}); } - if (typeof params.dns != "undefined") { + if (params.dns !== undefined) { this.type = 'dns'; - v = new KJUR.asn1.DERIA5String({'str': params[this.type]}); + v = new KJUR.asn1.DERIA5String({str: params[this.type]}); } - if (typeof params.uri != "undefined") { + if (params.uri !== undefined) { this.type = 'uri'; - v = new KJUR.asn1.DERIA5String({'str': params[this.type]}); + v = new KJUR.asn1.DERIA5String({str: params[this.type]}); } - if (typeof params.certissuer != "undefined") { + if (params.dn !== undefined) { + this.type = 'dn'; + v = new KJUR.asn1.x509.X500Name({str: params.dn}); + } + + if (params.ldapdn !== undefined) { + this.type = 'dn'; + v = new KJUR.asn1.x509.X500Name({ldapstr: params.ldapdn}); + } + + if (params.certissuer !== undefined) { this.type = 'dn'; this.explicit = true; var certStr = params.certissuer; @@ -1953,7 +2108,7 @@ KJUR.asn1.x509.GeneralName = function(params) { v.hTLV = dnHex; } - if (typeof params.certsubj != "undefined") { + if (params.certsubj !== undefined) { this.type = 'dn'; this.explicit = true; var certStr = params.certsubj; @@ -1983,7 +2138,7 @@ KJUR.asn1.x509.GeneralName = function(params) { return this.asn1Obj.getEncodedHex(); } - if (typeof params != "undefined") { + if (params !== undefined) { this.setByParam(params); } @@ -2218,6 +2373,7 @@ KJUR.asn1.x509.OID = new function(params) { 'subjectKeyIdentifier': '2.5.29.14', 'keyUsage': '2.5.29.15', 'subjectAltName': '2.5.29.17', + 'issuerAltName': '2.5.29.18', 'basicConstraints': '2.5.29.19', 'nameConstraints': '2.5.29.30', 'cRLDistributionPoints':'2.5.29.31', diff --git a/bower.json b/bower.json index 37afdc21..0afa8f62 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "kjur-jsrsasign", - "version": "6.2.2", + "version": "6.2.3", "main": "jsrsasign-latest-all-min.js", "description": "The 'jsrsasign' (RSA-Sign JavaScript Library) is an opensource free cryptography library supporting RSA/RSAPSS/ECDSA/DSA signing/validation, ASN.1, PKCS#1/5/8 private/public key, X.509 certificate, CRL, OCSP, CMS SignedData, TimeStamp, CAdES, JWS and JWT in pure JavaScript.", "license": "MIT", diff --git a/jsrsasign-latest-all-min.js b/jsrsasign-latest-all-min.js index 5119316c..5c7136fe 100644 --- a/jsrsasign-latest-all-min.js +++ b/jsrsasign-latest-all-min.js @@ -1,5 +1,5 @@ /* - * jsrsasign 6.2.2 (2016-11-19) (c) 2010-2016 Kenji Urushima | kjur.github.com/jsrsasign/license + * jsrsasign 6.2.3 (2016-11-29) (c) 2010-2016 Kenji Urushima | kjur.github.com/jsrsasign/license */ /* @@ -233,9 +233,9 @@ if(typeof KJUR=="undefined"||!KJUR){KJUR={}}if(typeof KJUR.asn1=="undefined"||!K /*! asn1hex-1.1.7.js (c) 2012-2016 Kenji Urushima | kjur.github.com/jsrsasign/license */ var ASN1HEX=new function(){};ASN1HEX.getByteLengthOfL_AtObj=function(b,c){if(b.substring(c+2,c+3)!="8"){return 1}var a=parseInt(b.substring(c+3,c+4));if(a==0){return -1}if(0=(b*2))){break}if(d>=200){break}c.push(e);g=e;d++}return c};ASN1HEX.getNthChildIndex_AtObj=function(d,b,e){var c=ASN1HEX.getPosArrayOfChildren_AtObj(d,b);return c[e]};ASN1HEX.getDecendantIndexByNthList=function(e,d,c){if(c.length==0){return d}var f=c.shift();var b=ASN1HEX.getPosArrayOfChildren_AtObj(e,d);return ASN1HEX.getDecendantIndexByNthList(e,b[f],c)};ASN1HEX.getDecendantHexTLVByNthList=function(d,c,b){var a=ASN1HEX.getDecendantIndexByNthList(d,c,b);return ASN1HEX.getHexOfTLV_AtObj(d,a)};ASN1HEX.getDecendantHexVByNthList=function(d,c,b){var a=ASN1HEX.getDecendantIndexByNthList(d,c,b);return ASN1HEX.getHexOfV_AtObj(d,a)};ASN1HEX.getVbyList=function(d,c,b,e){var a=ASN1HEX.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 ASN1HEX.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};ASN1HEX.dump=function(e,c,k,g){var o=function(w,i){if(w.length<=i*2){return w}else{var v=w.substr(0,i)+"..(total "+w.length/2+"bytes).."+w.substr(w.length-i,i);return v}};if(c===undefined){c={ommit_long_octet:32}}if(k===undefined){k=0}if(g===undefined){g=""}var r=c.ommit_long_octet;if(e.substr(k,2)=="01"){var h=ASN1HEX.getHexOfV_AtObj(e,k);if(h=="00"){return g+"BOOLEAN FALSE\n"}else{return g+"BOOLEAN TRUE\n"}}if(e.substr(k,2)=="02"){var h=ASN1HEX.getHexOfV_AtObj(e,k);return g+"INTEGER "+o(h,r)+"\n"}if(e.substr(k,2)=="03"){var h=ASN1HEX.getHexOfV_AtObj(e,k);return g+"BITSTRING "+o(h,r)+"\n"}if(e.substr(k,2)=="04"){var h=ASN1HEX.getHexOfV_AtObj(e,k);if(ASN1HEX.isASN1HEX(h)){var j=g+"OCTETSTRING, encapsulates\n";j=j+ASN1HEX.dump(h,c,0,g+" ");return j}else{return g+"OCTETSTRING "+o(h,r)+"\n"}}if(e.substr(k,2)=="05"){return g+"NULL\n"}if(e.substr(k,2)=="06"){var l=ASN1HEX.getHexOfV_AtObj(e,k);var a=KJUR.asn1.ASN1Util.oidHexToInt(l);var n=KJUR.asn1.x509.OID.oid2name(a);var b=a.replace(/\./g," ");if(n!=""){return g+"ObjectIdentifier "+n+" ("+b+")\n"}else{return g+"ObjectIdentifier ("+b+")\n"}}if(e.substr(k,2)=="0c"){return g+"UTF8String '"+hextoutf8(ASN1HEX.getHexOfV_AtObj(e,k))+"'\n"}if(e.substr(k,2)=="13"){return g+"PrintableString '"+hextoutf8(ASN1HEX.getHexOfV_AtObj(e,k))+"'\n"}if(e.substr(k,2)=="14"){return g+"TeletexString '"+hextoutf8(ASN1HEX.getHexOfV_AtObj(e,k))+"'\n"}if(e.substr(k,2)=="16"){return g+"IA5String '"+hextoutf8(ASN1HEX.getHexOfV_AtObj(e,k))+"'\n"}if(e.substr(k,2)=="17"){return g+"UTCTime "+hextoutf8(ASN1HEX.getHexOfV_AtObj(e,k))+"\n"}if(e.substr(k,2)=="18"){return g+"GeneralizedTime "+hextoutf8(ASN1HEX.getHexOfV_AtObj(e,k))+"\n"}if(e.substr(k,2)=="30"){if(e.substr(k,4)=="3000"){return g+"SEQUENCE {}\n"}var j=g+"SEQUENCE\n";var d=ASN1HEX.getPosArrayOfChildren_AtObj(e,k);var f=c;if((d.length==2||d.length==3)&&e.substr(d[0],2)=="06"&&e.substr(d[d.length-1],2)=="04"){var t=ASN1HEX.getHexOfV_AtObj(e,d[0]);var a=KJUR.asn1.ASN1Util.oidHexToInt(t);var n=KJUR.asn1.x509.OID.oid2name(a);var p=JSON.parse(JSON.stringify(c));p.x509ExtName=n;f=p}for(var 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;f++){var h=c.shift();if(e===true){var d=b.pop();var j=(d+","+h).replace(/\\,/g,",");b.push(j);e=false}else{b.push(h)}if(h.substr(-1,1)==="\\"){e=true}}b=b.map(function(a){return a.replace("/","\\/")});b.reverse();return"/"+b.join("/")};KJUR.asn1.x509.RDN=function(a){KJUR.asn1.x509.RDN.superclass.constructor.call(this);this.asn1Array=new Array();this.addByString=function(b){this.asn1Array.push(new KJUR.asn1.x509.AttributeTypeAndValue({str:b}))};this.addByMultiValuedString=function(d){var b=KJUR.asn1.x509.RDN.parseString(d);for(var c=0;c0;g++){var k=j.shift();if(h===true){var f=c.pop();var d=(f+"+"+k).replace(/\\\+/g,"+");c.push(d);h=false}else{c.push(k)}if(k.substr(-1,1)==="\\"){h=true}}var l=false;var b=[];for(var g=0;c.length>0;g++){var k=c.shift();if(l===true){var e=b.pop();if(k.match(/"$/)){var d=(e+"+"+k).replace(/^([^=]+)="(.*)"$/,"$1=$2");b.push(d);l=false}else{b.push(e+"+"+k)}}else{b.push(k)}if(k.match(/^[^=]+="/)){l=true}}return b};KJUR.asn1.x509.AttributeTypeAndValue=function(b){KJUR.asn1.x509.AttributeTypeAndValue.superclass.constructor.call(this);var d=null;var c=null;var a="utf8";this.setByString=function(f){var e=f.match(/^([^=]+)=(.+)$/);if(e){this.setByAttrTypeAndValueStr(e[1],e[2])}else{throw"malformed attrTypeAndValueStr: "+f}};this.setByAttrTypeAndValueStr=function(g,f){this.typeObj=KJUR.asn1.x509.OID.atype2obj(g);var e=a;if(g=="C"){e="prn"}this.valueObj=this.getValueObj(e,f)};this.getValueObj=function(f,e){if(f=="utf8"){return new KJUR.asn1.DERUTF8String({str:e})}if(f=="prn"){return new KJUR.asn1.DERPrintableString({str:e})}if(f=="tel"){return new KJUR.asn1.DERTeletexString({str:e})}if(f=="ia5"){return new KJUR.asn1.DERIA5String({str:e})}throw"unsupported directory string type: type="+f+" value="+e};this.getEncodedHex=function(){var e=new KJUR.asn1.DERSequence({array:[this.typeObj,this.valueObj]});this.TLV=e.getEncodedHex();return this.TLV};if(typeof b!="undefined"){if(typeof b.str!="undefined"){this.setByString(b.str)}}};YAHOO.lang.extend(KJUR.asn1.x509.AttributeTypeAndValue,KJUR.asn1.ASN1Object);KJUR.asn1.x509.SubjectPublicKeyInfo=function(d){KJUR.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call(this);var b=null;var c=null;var a=null;this.setRSAKey=function(e){if(!RSAKey.prototype.isPrototypeOf(e)){throw"argument is not RSAKey instance"}this.rsaKey=e;var g=new KJUR.asn1.DERInteger({bigint:e.n});var f=new KJUR.asn1.DERInteger({"int":e.e});var i=new KJUR.asn1.DERSequence({array:[g,f]});var h=i.getEncodedHex();this.asn1AlgId=new KJUR.asn1.x509.AlgorithmIdentifier({name:"rsaEncryption"});this.asn1SubjPKey=new KJUR.asn1.DERBitString({hex:"00"+h})};this.setRSAPEM=function(g){if(g.match(/-----BEGIN PUBLIC KEY-----/)){var n=g;n=n.replace(/^-----[^-]+-----/,"");n=n.replace(/-----[^-]+-----\s*$/,"");var m=n.replace(/\s+/g,"");var f=CryptoJS.enc.Base64.parse(m);var i=CryptoJS.enc.Hex.stringify(f);var k=_rsapem_getHexValueArrayOfChildrenFromHex(i);var h=k[1];var l=h.substr(2);var e=_rsapem_getHexValueArrayOfChildrenFromHex(l);var j=new RSAKey();j.setPublic(e[0],e[1]);this.setRSAKey(j)}else{throw"key not supported"}};this.getASN1Object=function(){if(this.asn1AlgId==null||this.asn1SubjPKey==null){throw"algId and/or subjPubKey not set"}var e=new KJUR.asn1.DERSequence({array:[this.asn1AlgId,this.asn1SubjPKey]});return e};this.getEncodedHex=function(){var e=this.getASN1Object();this.hTLV=e.getEncodedHex();return this.hTLV};this._setRSAKey=function(e){var g=KJUR.asn1.ASN1Util.newObject({seq:[{"int":{bigint:e.n}},{"int":{"int":e.e}}]});var f=g.getEncodedHex();this.asn1AlgId=new KJUR.asn1.x509.AlgorithmIdentifier({name:"rsaEncryption"});this.asn1SubjPKey=new KJUR.asn1.DERBitString({hex:"00"+f})};this._setEC=function(e){var f=new KJUR.asn1.DERObjectIdentifier({name:e.curveName});this.asn1AlgId=new KJUR.asn1.x509.AlgorithmIdentifier({name:"ecPublicKey",asn1params:f});this.asn1SubjPKey=new KJUR.asn1.DERBitString({hex:"00"+e.pubKeyHex})};this._setDSA=function(e){var f=new KJUR.asn1.ASN1Util.newObject({seq:[{"int":{bigint:e.p}},{"int":{bigint:e.q}},{"int":{bigint:e.g}}]});this.asn1AlgId=new KJUR.asn1.x509.AlgorithmIdentifier({name:"dsa",asn1params:f});var g=new KJUR.asn1.DERInteger({bigint:e.y});this.asn1SubjPKey=new KJUR.asn1.DERBitString({hex:"00"+g.getEncodedHex()})};if(typeof d!="undefined"){if(typeof RSAKey!="undefined"&&d instanceof RSAKey){this._setRSAKey(d)}else{if(typeof KJUR.crypto.ECDSA!="undefined"&&d instanceof KJUR.crypto.ECDSA){this._setEC(d)}else{if(typeof KJUR.crypto.DSA!="undefined"&&d instanceof KJUR.crypto.DSA){this._setDSA(d)}else{if(typeof d.rsakey!="undefined"){this.setRSAKey(d.rsakey)}else{if(typeof d.rsapem!="undefined"){this.setRSAPEM(d.rsapem)}}}}}}};YAHOO.lang.extend(KJUR.asn1.x509.SubjectPublicKeyInfo,KJUR.asn1.ASN1Object);KJUR.asn1.x509.Time=function(c){KJUR.asn1.x509.Time.superclass.constructor.call(this);var b=null;var a=null;this.setTimeParams=function(d){this.timeParams=d};this.getEncodedHex=function(){var d=null;if(this.timeParams!=null){if(this.type=="utc"){d=new KJUR.asn1.DERUTCTime(this.timeParams)}else{d=new KJUR.asn1.DERGeneralizedTime(this.timeParams)}}else{if(this.type=="utc"){d=new KJUR.asn1.DERUTCTime()}else{d=new KJUR.asn1.DERGeneralizedTime()}}this.TLV=d.getEncodedHex();return this.TLV};this.type="utc";if(typeof c!="undefined"){if(typeof c.type!="undefined"){this.type=c.type}else{if(typeof c.str!="undefined"){if(c.str.match(/^[0-9]{12}Z$/)){this.type="utc"}if(c.str.match(/^[0-9]{14}Z$/)){this.type="gen"}}}this.timeParams=c}};YAHOO.lang.extend(KJUR.asn1.x509.Time,KJUR.asn1.ASN1Object);KJUR.asn1.x509.AlgorithmIdentifier=function(e){KJUR.asn1.x509.AlgorithmIdentifier.superclass.constructor.call(this);var a=null;var d=null;var b=null;var c=false;this.getEncodedHex=function(){if(this.nameAlg==null&&this.asn1Alg==null){throw"algorithm not specified"}if(this.nameAlg!=null&&this.asn1Alg==null){this.asn1Alg=KJUR.asn1.x509.OID.name2obj(this.nameAlg)}var f=[this.asn1Alg];if(!this.paramEmpty){f.push(this.asn1Params)}var g=new KJUR.asn1.DERSequence({array:f});this.hTLV=g.getEncodedHex();return this.hTLV};if(typeof e!="undefined"){if(typeof e.name!="undefined"){this.nameAlg=e.name}if(typeof e.asn1params!="undefined"){this.asn1Params=e.asn1params}if(typeof e.paramempty!="undefined"){this.paramEmpty=e.paramempty}}if(this.asn1Params==null){this.asn1Params=new KJUR.asn1.DERNull()}};YAHOO.lang.extend(KJUR.asn1.x509.AlgorithmIdentifier,KJUR.asn1.ASN1Object);KJUR.asn1.x509.GeneralName=function(d){KJUR.asn1.x509.GeneralName.superclass.constructor.call(this);var c=null;var b=null;var a={rfc822:"81",dns:"82",dn:"a4",uri:"86"};this.explicit=false;this.setByParam=function(k){var j=null;var g=null;if(typeof k=="undefined"){return}if(typeof k.rfc822!="undefined"){this.type="rfc822";g=new KJUR.asn1.DERIA5String({str:k[this.type]})}if(typeof k.dns!="undefined"){this.type="dns";g=new KJUR.asn1.DERIA5String({str:k[this.type]})}if(typeof k.uri!="undefined"){this.type="uri";g=new KJUR.asn1.DERIA5String({str:k[this.type]})}if(typeof k.certissuer!="undefined"){this.type="dn";this.explicit=true;var h=k.certissuer;var f=null;if(h.match(/^[0-9A-Fa-f]+$/)){f==h}if(h.indexOf("-----BEGIN ")!=-1){f=X509.pemToHex(h)}if(f==null){throw"certissuer param not cert"}var e=new X509();e.hex=f;var i=e.getIssuerHex();g=new KJUR.asn1.ASN1Object();g.hTLV=i}if(typeof k.certsubj!="undefined"){this.type="dn";this.explicit=true;var h=k.certsubj;var f=null;if(h.match(/^[0-9A-Fa-f]+$/)){f==h}if(h.indexOf("-----BEGIN ")!=-1){f=X509.pemToHex(h)}if(f==null){throw"certsubj param not cert"}var e=new X509();e.hex=f;var i=e.getSubjectHex();g=new KJUR.asn1.ASN1Object();g.hTLV=i}if(this.type==null){throw"unsupported type in params="+k}this.asn1Obj=new KJUR.asn1.DERTaggedObject({explicit:this.explicit,tag:a[this.type],obj:g})};this.getEncodedHex=function(){return this.asn1Obj.getEncodedHex()};if(typeof d!="undefined"){this.setByParam(d)}};YAHOO.lang.extend(KJUR.asn1.x509.GeneralName,KJUR.asn1.ASN1Object);KJUR.asn1.x509.GeneralNames=function(b){KJUR.asn1.x509.GeneralNames.superclass.constructor.call(this);var a=null;this.setByParamArray=function(e){for(var c=0;c0){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.Extension.appendByNameToArray=function(e,c,b){if(e.toLowerCase()=="basicconstraints"){var d=new KJUR.asn1.x509.BasicConstraints(c);b.push(d)}else{if(e.toLowerCase()=="keyusage"){var d=new KJUR.asn1.x509.KeyUsage(c);b.push(d)}else{if(e.toLowerCase()=="crldistributionpoints"){var d=new KJUR.asn1.x509.CRLDistributionPoints(c);b.push(d)}else{if(e.toLowerCase()=="extkeyusage"){var d=new KJUR.asn1.x509.ExtKeyUsage(c);b.push(d)}else{if(e.toLowerCase()=="authoritykeyidentifier"){var d=new KJUR.asn1.x509.AuthorityKeyIdentifier(c);b.push(d)}else{if(e.toLowerCase()=="authorityinfoaccess"){var d=new KJUR.asn1.x509.AuthorityInfoAccess(c);b.push(d)}else{if(e.toLowerCase()=="subjectaltname"){var d=new KJUR.asn1.x509.SubjectAltName(c);b.push(d)}else{if(e.toLowerCase()=="issueraltname"){var d=new KJUR.asn1.x509.IssuerAltName(c);b.push(d)}else{throw"unsupported extension name: "+e}}}}}}}}};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;f++){var h=c.shift();if(e===true){var d=b.pop();var j=(d+","+h).replace(/\\,/g,",");b.push(j);e=false}else{b.push(h)}if(h.substr(-1,1)==="\\"){e=true}}b=b.map(function(a){return a.replace("/","\\/")});b.reverse();return"/"+b.join("/")};KJUR.asn1.x509.RDN=function(a){KJUR.asn1.x509.RDN.superclass.constructor.call(this);this.asn1Array=new Array();this.addByString=function(b){this.asn1Array.push(new KJUR.asn1.x509.AttributeTypeAndValue({str:b}))};this.addByMultiValuedString=function(d){var b=KJUR.asn1.x509.RDN.parseString(d);for(var c=0;c0;g++){var k=j.shift();if(h===true){var f=c.pop();var d=(f+"+"+k).replace(/\\\+/g,"+");c.push(d);h=false}else{c.push(k)}if(k.substr(-1,1)==="\\"){h=true}}var l=false;var b=[];for(var g=0;c.length>0;g++){var k=c.shift();if(l===true){var e=b.pop();if(k.match(/"$/)){var d=(e+"+"+k).replace(/^([^=]+)="(.*)"$/,"$1=$2");b.push(d);l=false}else{b.push(e+"+"+k)}}else{b.push(k)}if(k.match(/^[^=]+="/)){l=true}}return b};KJUR.asn1.x509.AttributeTypeAndValue=function(b){KJUR.asn1.x509.AttributeTypeAndValue.superclass.constructor.call(this);var d=null;var c=null;var a="utf8";this.setByString=function(f){var e=f.match(/^([^=]+)=(.+)$/);if(e){this.setByAttrTypeAndValueStr(e[1],e[2])}else{throw"malformed attrTypeAndValueStr: "+f}};this.setByAttrTypeAndValueStr=function(g,f){this.typeObj=KJUR.asn1.x509.OID.atype2obj(g);var e=a;if(g=="C"){e="prn"}this.valueObj=this.getValueObj(e,f)};this.getValueObj=function(f,e){if(f=="utf8"){return new KJUR.asn1.DERUTF8String({str:e})}if(f=="prn"){return new KJUR.asn1.DERPrintableString({str:e})}if(f=="tel"){return new KJUR.asn1.DERTeletexString({str:e})}if(f=="ia5"){return new KJUR.asn1.DERIA5String({str:e})}throw"unsupported directory string type: type="+f+" value="+e};this.getEncodedHex=function(){var e=new KJUR.asn1.DERSequence({array:[this.typeObj,this.valueObj]});this.TLV=e.getEncodedHex();return this.TLV};if(typeof b!="undefined"){if(typeof b.str!="undefined"){this.setByString(b.str)}}};YAHOO.lang.extend(KJUR.asn1.x509.AttributeTypeAndValue,KJUR.asn1.ASN1Object);KJUR.asn1.x509.SubjectPublicKeyInfo=function(d){KJUR.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call(this);var b=null;var c=null;var a=null;this.setRSAKey=function(e){if(!RSAKey.prototype.isPrototypeOf(e)){throw"argument is not RSAKey instance"}this.rsaKey=e;var g=new KJUR.asn1.DERInteger({bigint:e.n});var f=new KJUR.asn1.DERInteger({"int":e.e});var i=new KJUR.asn1.DERSequence({array:[g,f]});var h=i.getEncodedHex();this.asn1AlgId=new KJUR.asn1.x509.AlgorithmIdentifier({name:"rsaEncryption"});this.asn1SubjPKey=new KJUR.asn1.DERBitString({hex:"00"+h})};this.setRSAPEM=function(g){if(g.match(/-----BEGIN PUBLIC KEY-----/)){var n=g;n=n.replace(/^-----[^-]+-----/,"");n=n.replace(/-----[^-]+-----\s*$/,"");var m=n.replace(/\s+/g,"");var f=CryptoJS.enc.Base64.parse(m);var i=CryptoJS.enc.Hex.stringify(f);var k=_rsapem_getHexValueArrayOfChildrenFromHex(i);var h=k[1];var l=h.substr(2);var e=_rsapem_getHexValueArrayOfChildrenFromHex(l);var j=new RSAKey();j.setPublic(e[0],e[1]);this.setRSAKey(j)}else{throw"key not supported"}};this.getASN1Object=function(){if(this.asn1AlgId==null||this.asn1SubjPKey==null){throw"algId and/or subjPubKey not set"}var e=new KJUR.asn1.DERSequence({array:[this.asn1AlgId,this.asn1SubjPKey]});return e};this.getEncodedHex=function(){var e=this.getASN1Object();this.hTLV=e.getEncodedHex();return this.hTLV};this._setRSAKey=function(e){var g=KJUR.asn1.ASN1Util.newObject({seq:[{"int":{bigint:e.n}},{"int":{"int":e.e}}]});var f=g.getEncodedHex();this.asn1AlgId=new KJUR.asn1.x509.AlgorithmIdentifier({name:"rsaEncryption"});this.asn1SubjPKey=new KJUR.asn1.DERBitString({hex:"00"+f})};this._setEC=function(e){var f=new KJUR.asn1.DERObjectIdentifier({name:e.curveName});this.asn1AlgId=new KJUR.asn1.x509.AlgorithmIdentifier({name:"ecPublicKey",asn1params:f});this.asn1SubjPKey=new KJUR.asn1.DERBitString({hex:"00"+e.pubKeyHex})};this._setDSA=function(e){var f=new KJUR.asn1.ASN1Util.newObject({seq:[{"int":{bigint:e.p}},{"int":{bigint:e.q}},{"int":{bigint:e.g}}]});this.asn1AlgId=new KJUR.asn1.x509.AlgorithmIdentifier({name:"dsa",asn1params:f});var g=new KJUR.asn1.DERInteger({bigint:e.y});this.asn1SubjPKey=new KJUR.asn1.DERBitString({hex:"00"+g.getEncodedHex()})};if(typeof d!="undefined"){if(typeof RSAKey!="undefined"&&d instanceof RSAKey){this._setRSAKey(d)}else{if(typeof KJUR.crypto.ECDSA!="undefined"&&d instanceof KJUR.crypto.ECDSA){this._setEC(d)}else{if(typeof KJUR.crypto.DSA!="undefined"&&d instanceof KJUR.crypto.DSA){this._setDSA(d)}else{if(typeof d.rsakey!="undefined"){this.setRSAKey(d.rsakey)}else{if(typeof d.rsapem!="undefined"){this.setRSAPEM(d.rsapem)}}}}}}};YAHOO.lang.extend(KJUR.asn1.x509.SubjectPublicKeyInfo,KJUR.asn1.ASN1Object);KJUR.asn1.x509.Time=function(c){KJUR.asn1.x509.Time.superclass.constructor.call(this);var b=null;var a=null;this.setTimeParams=function(d){this.timeParams=d};this.getEncodedHex=function(){var d=null;if(this.timeParams!=null){if(this.type=="utc"){d=new KJUR.asn1.DERUTCTime(this.timeParams)}else{d=new KJUR.asn1.DERGeneralizedTime(this.timeParams)}}else{if(this.type=="utc"){d=new KJUR.asn1.DERUTCTime()}else{d=new KJUR.asn1.DERGeneralizedTime()}}this.TLV=d.getEncodedHex();return this.TLV};this.type="utc";if(typeof c!="undefined"){if(typeof c.type!="undefined"){this.type=c.type}else{if(typeof c.str!="undefined"){if(c.str.match(/^[0-9]{12}Z$/)){this.type="utc"}if(c.str.match(/^[0-9]{14}Z$/)){this.type="gen"}}}this.timeParams=c}};YAHOO.lang.extend(KJUR.asn1.x509.Time,KJUR.asn1.ASN1Object);KJUR.asn1.x509.AlgorithmIdentifier=function(e){KJUR.asn1.x509.AlgorithmIdentifier.superclass.constructor.call(this);var a=null;var d=null;var b=null;var c=false;this.getEncodedHex=function(){if(this.nameAlg==null&&this.asn1Alg==null){throw"algorithm not specified"}if(this.nameAlg!=null&&this.asn1Alg==null){this.asn1Alg=KJUR.asn1.x509.OID.name2obj(this.nameAlg)}var f=[this.asn1Alg];if(!this.paramEmpty){f.push(this.asn1Params)}var g=new KJUR.asn1.DERSequence({array:f});this.hTLV=g.getEncodedHex();return this.hTLV};if(typeof e!="undefined"){if(typeof e.name!="undefined"){this.nameAlg=e.name}if(typeof e.asn1params!="undefined"){this.asn1Params=e.asn1params}if(typeof e.paramempty!="undefined"){this.paramEmpty=e.paramempty}}if(this.asn1Params==null){this.asn1Params=new KJUR.asn1.DERNull()}};YAHOO.lang.extend(KJUR.asn1.x509.AlgorithmIdentifier,KJUR.asn1.ASN1Object);KJUR.asn1.x509.GeneralName=function(d){KJUR.asn1.x509.GeneralName.superclass.constructor.call(this);var c=null;var b=null;var a={rfc822:"81",dns:"82",dn:"a4",uri:"86"};this.explicit=false;this.setByParam=function(k){var j=null;var g=null;if(k===undefined){return}if(k.rfc822!==undefined){this.type="rfc822";g=new KJUR.asn1.DERIA5String({str:k[this.type]})}if(k.dns!==undefined){this.type="dns";g=new KJUR.asn1.DERIA5String({str:k[this.type]})}if(k.uri!==undefined){this.type="uri";g=new KJUR.asn1.DERIA5String({str:k[this.type]})}if(k.dn!==undefined){this.type="dn";g=new KJUR.asn1.x509.X500Name({str:k.dn})}if(k.ldapdn!==undefined){this.type="dn";g=new KJUR.asn1.x509.X500Name({ldapstr:k.ldapdn})}if(k.certissuer!==undefined){this.type="dn";this.explicit=true;var h=k.certissuer;var f=null;if(h.match(/^[0-9A-Fa-f]+$/)){f==h}if(h.indexOf("-----BEGIN ")!=-1){f=X509.pemToHex(h)}if(f==null){throw"certissuer param not cert"}var e=new X509();e.hex=f;var i=e.getIssuerHex();g=new KJUR.asn1.ASN1Object();g.hTLV=i}if(k.certsubj!==undefined){this.type="dn";this.explicit=true;var h=k.certsubj;var f=null;if(h.match(/^[0-9A-Fa-f]+$/)){f==h}if(h.indexOf("-----BEGIN ")!=-1){f=X509.pemToHex(h)}if(f==null){throw"certsubj param not cert"}var e=new X509();e.hex=f;var i=e.getSubjectHex();g=new KJUR.asn1.ASN1Object();g.hTLV=i}if(this.type==null){throw"unsupported type in params="+k}this.asn1Obj=new KJUR.asn1.DERTaggedObject({explicit:this.explicit,tag:a[this.type],obj:g})};this.getEncodedHex=function(){return this.asn1Obj.getEncodedHex()};if(d!==undefined){this.setByParam(d)}};YAHOO.lang.extend(KJUR.asn1.x509.GeneralName,KJUR.asn1.ASN1Object);KJUR.asn1.x509.GeneralNames=function(b){KJUR.asn1.x509.GeneralNames.superclass.constructor.call(this);var a=null;this.setByParamArray=function(e){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;b0){var e=new KJUR.asn1.DERSequence({array:this.extensionsArray});var d=new KJUR.asn1.DERSet({array:[e]});var c=new KJUR.asn1.DERSequence({array:[new KJUR.asn1.DERObjectIdentifier({oid:"1.2.840.113549.1.9.14"}),d]});var b=new KJUR.asn1.DERTaggedObject({explicit:true,tag:"a0",obj:c});this.asn1Array.push(b)}else{var b=new KJUR.asn1.DERTaggedObject({explicit:false,tag:"a0",obj:new KJUR.asn1.DERNull()});this.asn1Array.push(b)}var f=new KJUR.asn1.DERSequence({array:this.asn1Array});this.hTLV=f.getEncodedHex();this.isModified=false;return this.hTLV};this._initialize()};YAHOO.lang.extend(KJUR.asn1.csr.CertificationRequestInfo,KJUR.asn1.ASN1Object);KJUR.asn1.csr.CSRUtil=new function(){};KJUR.asn1.csr.CSRUtil.newCSRPEM=function(g){var d=KJUR.asn1.csr;if(g.subject===undefined){throw"parameter subject undefined"}if(g.sbjpubkey===undefined){throw"parameter sbjpubkey undefined"}if(g.sigalg===undefined){throw"parameter sigalg undefined"}if(g.sbjprvkey===undefined){throw"parameter sbjpubkey undefined"}var b=new d.CertificationRequestInfo();b.setSubjectByParam(g.subject);b.setSubjectPublicKeyByGetKey(g.sbjpubkey);if(g.ext!==undefined&&g.ext.length!==undefined){for(var c=0;c0){var e=new KJUR.asn1.DERSequence({array:this.extensionsArray});var d=new KJUR.asn1.DERSet({array:[e]});var c=new KJUR.asn1.DERSequence({array:[new KJUR.asn1.DERObjectIdentifier({oid:"1.2.840.113549.1.9.14"}),d]});var b=new KJUR.asn1.DERTaggedObject({explicit:true,tag:"a0",obj:c});this.asn1Array.push(b)}else{var b=new KJUR.asn1.DERTaggedObject({explicit:false,tag:"a0",obj:new KJUR.asn1.DERNull()});this.asn1Array.push(b)}var f=new KJUR.asn1.DERSequence({array:this.asn1Array});this.hTLV=f.getEncodedHex();this.isModified=false;return this.hTLV};this._initialize()};YAHOO.lang.extend(KJUR.asn1.csr.CertificationRequestInfo,KJUR.asn1.ASN1Object);KJUR.asn1.csr.CSRUtil=new function(){};KJUR.asn1.csr.CSRUtil.newCSRPEM=function(g){var d=KJUR.asn1.csr;if(g.subject===undefined){throw"parameter subject undefined"}if(g.sbjpubkey===undefined){throw"parameter sbjpubkey undefined"}if(g.sigalg===undefined){throw"parameter sigalg undefined"}if(g.sbjprvkey===undefined){throw"parameter sbjpubkey undefined"}var b=new d.CertificationRequestInfo();b.setSubjectByParam(g.subject);b.setSubjectPublicKeyByGetKey(g.sbjpubkey);if(g.ext!==undefined&&g.ext.length!==undefined){for(var c=0;c0){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;f++){var h=c.shift();if(e===true){var d=b.pop();var j=(d+","+h).replace(/\\,/g,",");b.push(j);e=false}else{b.push(h)}if(h.substr(-1,1)==="\\"){e=true}}b=b.map(function(a){return a.replace("/","\\/")});b.reverse();return"/"+b.join("/")};KJUR.asn1.x509.RDN=function(a){KJUR.asn1.x509.RDN.superclass.constructor.call(this);this.asn1Array=new Array();this.addByString=function(b){this.asn1Array.push(new KJUR.asn1.x509.AttributeTypeAndValue({str:b}))};this.addByMultiValuedString=function(d){var b=KJUR.asn1.x509.RDN.parseString(d);for(var c=0;c0;g++){var k=j.shift();if(h===true){var f=c.pop();var d=(f+"+"+k).replace(/\\\+/g,"+");c.push(d);h=false}else{c.push(k)}if(k.substr(-1,1)==="\\"){h=true}}var l=false;var b=[];for(var g=0;c.length>0;g++){var k=c.shift();if(l===true){var e=b.pop();if(k.match(/"$/)){var d=(e+"+"+k).replace(/^([^=]+)="(.*)"$/,"$1=$2");b.push(d);l=false}else{b.push(e+"+"+k)}}else{b.push(k)}if(k.match(/^[^=]+="/)){l=true}}return b};KJUR.asn1.x509.AttributeTypeAndValue=function(b){KJUR.asn1.x509.AttributeTypeAndValue.superclass.constructor.call(this);var d=null;var c=null;var a="utf8";this.setByString=function(f){var e=f.match(/^([^=]+)=(.+)$/);if(e){this.setByAttrTypeAndValueStr(e[1],e[2])}else{throw"malformed attrTypeAndValueStr: "+f}};this.setByAttrTypeAndValueStr=function(g,f){this.typeObj=KJUR.asn1.x509.OID.atype2obj(g);var e=a;if(g=="C"){e="prn"}this.valueObj=this.getValueObj(e,f)};this.getValueObj=function(f,e){if(f=="utf8"){return new KJUR.asn1.DERUTF8String({str:e})}if(f=="prn"){return new KJUR.asn1.DERPrintableString({str:e})}if(f=="tel"){return new KJUR.asn1.DERTeletexString({str:e})}if(f=="ia5"){return new KJUR.asn1.DERIA5String({str:e})}throw"unsupported directory string type: type="+f+" value="+e};this.getEncodedHex=function(){var e=new KJUR.asn1.DERSequence({array:[this.typeObj,this.valueObj]});this.TLV=e.getEncodedHex();return this.TLV};if(typeof b!="undefined"){if(typeof b.str!="undefined"){this.setByString(b.str)}}};YAHOO.lang.extend(KJUR.asn1.x509.AttributeTypeAndValue,KJUR.asn1.ASN1Object);KJUR.asn1.x509.SubjectPublicKeyInfo=function(d){KJUR.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call(this);var b=null;var c=null;var a=null;this.setRSAKey=function(e){if(!RSAKey.prototype.isPrototypeOf(e)){throw"argument is not RSAKey instance"}this.rsaKey=e;var g=new KJUR.asn1.DERInteger({bigint:e.n});var f=new KJUR.asn1.DERInteger({"int":e.e});var i=new KJUR.asn1.DERSequence({array:[g,f]});var h=i.getEncodedHex();this.asn1AlgId=new KJUR.asn1.x509.AlgorithmIdentifier({name:"rsaEncryption"});this.asn1SubjPKey=new KJUR.asn1.DERBitString({hex:"00"+h})};this.setRSAPEM=function(g){if(g.match(/-----BEGIN PUBLIC KEY-----/)){var n=g;n=n.replace(/^-----[^-]+-----/,"");n=n.replace(/-----[^-]+-----\s*$/,"");var m=n.replace(/\s+/g,"");var f=CryptoJS.enc.Base64.parse(m);var i=CryptoJS.enc.Hex.stringify(f);var k=_rsapem_getHexValueArrayOfChildrenFromHex(i);var h=k[1];var l=h.substr(2);var e=_rsapem_getHexValueArrayOfChildrenFromHex(l);var j=new RSAKey();j.setPublic(e[0],e[1]);this.setRSAKey(j)}else{throw"key not supported"}};this.getASN1Object=function(){if(this.asn1AlgId==null||this.asn1SubjPKey==null){throw"algId and/or subjPubKey not set"}var e=new KJUR.asn1.DERSequence({array:[this.asn1AlgId,this.asn1SubjPKey]});return e};this.getEncodedHex=function(){var e=this.getASN1Object();this.hTLV=e.getEncodedHex();return this.hTLV};this._setRSAKey=function(e){var g=KJUR.asn1.ASN1Util.newObject({seq:[{"int":{bigint:e.n}},{"int":{"int":e.e}}]});var f=g.getEncodedHex();this.asn1AlgId=new KJUR.asn1.x509.AlgorithmIdentifier({name:"rsaEncryption"});this.asn1SubjPKey=new KJUR.asn1.DERBitString({hex:"00"+f})};this._setEC=function(e){var f=new KJUR.asn1.DERObjectIdentifier({name:e.curveName});this.asn1AlgId=new KJUR.asn1.x509.AlgorithmIdentifier({name:"ecPublicKey",asn1params:f});this.asn1SubjPKey=new KJUR.asn1.DERBitString({hex:"00"+e.pubKeyHex})};this._setDSA=function(e){var f=new KJUR.asn1.ASN1Util.newObject({seq:[{"int":{bigint:e.p}},{"int":{bigint:e.q}},{"int":{bigint:e.g}}]});this.asn1AlgId=new KJUR.asn1.x509.AlgorithmIdentifier({name:"dsa",asn1params:f});var g=new KJUR.asn1.DERInteger({bigint:e.y});this.asn1SubjPKey=new KJUR.asn1.DERBitString({hex:"00"+g.getEncodedHex()})};if(typeof d!="undefined"){if(typeof RSAKey!="undefined"&&d instanceof RSAKey){this._setRSAKey(d)}else{if(typeof KJUR.crypto.ECDSA!="undefined"&&d instanceof KJUR.crypto.ECDSA){this._setEC(d)}else{if(typeof KJUR.crypto.DSA!="undefined"&&d instanceof KJUR.crypto.DSA){this._setDSA(d)}else{if(typeof d.rsakey!="undefined"){this.setRSAKey(d.rsakey)}else{if(typeof d.rsapem!="undefined"){this.setRSAPEM(d.rsapem)}}}}}}};YAHOO.lang.extend(KJUR.asn1.x509.SubjectPublicKeyInfo,KJUR.asn1.ASN1Object);KJUR.asn1.x509.Time=function(c){KJUR.asn1.x509.Time.superclass.constructor.call(this);var b=null;var a=null;this.setTimeParams=function(d){this.timeParams=d};this.getEncodedHex=function(){var d=null;if(this.timeParams!=null){if(this.type=="utc"){d=new KJUR.asn1.DERUTCTime(this.timeParams)}else{d=new KJUR.asn1.DERGeneralizedTime(this.timeParams)}}else{if(this.type=="utc"){d=new KJUR.asn1.DERUTCTime()}else{d=new KJUR.asn1.DERGeneralizedTime()}}this.TLV=d.getEncodedHex();return this.TLV};this.type="utc";if(typeof c!="undefined"){if(typeof c.type!="undefined"){this.type=c.type}else{if(typeof c.str!="undefined"){if(c.str.match(/^[0-9]{12}Z$/)){this.type="utc"}if(c.str.match(/^[0-9]{14}Z$/)){this.type="gen"}}}this.timeParams=c}};YAHOO.lang.extend(KJUR.asn1.x509.Time,KJUR.asn1.ASN1Object);KJUR.asn1.x509.AlgorithmIdentifier=function(e){KJUR.asn1.x509.AlgorithmIdentifier.superclass.constructor.call(this);var a=null;var d=null;var b=null;var c=false;this.getEncodedHex=function(){if(this.nameAlg==null&&this.asn1Alg==null){throw"algorithm not specified"}if(this.nameAlg!=null&&this.asn1Alg==null){this.asn1Alg=KJUR.asn1.x509.OID.name2obj(this.nameAlg)}var f=[this.asn1Alg];if(!this.paramEmpty){f.push(this.asn1Params)}var g=new KJUR.asn1.DERSequence({array:f});this.hTLV=g.getEncodedHex();return this.hTLV};if(typeof e!="undefined"){if(typeof e.name!="undefined"){this.nameAlg=e.name}if(typeof e.asn1params!="undefined"){this.asn1Params=e.asn1params}if(typeof e.paramempty!="undefined"){this.paramEmpty=e.paramempty}}if(this.asn1Params==null){this.asn1Params=new KJUR.asn1.DERNull()}};YAHOO.lang.extend(KJUR.asn1.x509.AlgorithmIdentifier,KJUR.asn1.ASN1Object);KJUR.asn1.x509.GeneralName=function(d){KJUR.asn1.x509.GeneralName.superclass.constructor.call(this);var c=null;var b=null;var a={rfc822:"81",dns:"82",dn:"a4",uri:"86"};this.explicit=false;this.setByParam=function(k){var j=null;var g=null;if(typeof k=="undefined"){return}if(typeof k.rfc822!="undefined"){this.type="rfc822";g=new KJUR.asn1.DERIA5String({str:k[this.type]})}if(typeof k.dns!="undefined"){this.type="dns";g=new KJUR.asn1.DERIA5String({str:k[this.type]})}if(typeof k.uri!="undefined"){this.type="uri";g=new KJUR.asn1.DERIA5String({str:k[this.type]})}if(typeof k.certissuer!="undefined"){this.type="dn";this.explicit=true;var h=k.certissuer;var f=null;if(h.match(/^[0-9A-Fa-f]+$/)){f==h}if(h.indexOf("-----BEGIN ")!=-1){f=X509.pemToHex(h)}if(f==null){throw"certissuer param not cert"}var e=new X509();e.hex=f;var i=e.getIssuerHex();g=new KJUR.asn1.ASN1Object();g.hTLV=i}if(typeof k.certsubj!="undefined"){this.type="dn";this.explicit=true;var h=k.certsubj;var f=null;if(h.match(/^[0-9A-Fa-f]+$/)){f==h}if(h.indexOf("-----BEGIN ")!=-1){f=X509.pemToHex(h)}if(f==null){throw"certsubj param not cert"}var e=new X509();e.hex=f;var i=e.getSubjectHex();g=new KJUR.asn1.ASN1Object();g.hTLV=i}if(this.type==null){throw"unsupported type in params="+k}this.asn1Obj=new KJUR.asn1.DERTaggedObject({explicit:this.explicit,tag:a[this.type],obj:g})};this.getEncodedHex=function(){return this.asn1Obj.getEncodedHex()};if(typeof d!="undefined"){this.setByParam(d)}};YAHOO.lang.extend(KJUR.asn1.x509.GeneralName,KJUR.asn1.ASN1Object);KJUR.asn1.x509.GeneralNames=function(b){KJUR.asn1.x509.GeneralNames.superclass.constructor.call(this);var a=null;this.setByParamArray=function(e){for(var c=0;c0){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.Extension.appendByNameToArray=function(e,c,b){if(e.toLowerCase()=="basicconstraints"){var d=new KJUR.asn1.x509.BasicConstraints(c);b.push(d)}else{if(e.toLowerCase()=="keyusage"){var d=new KJUR.asn1.x509.KeyUsage(c);b.push(d)}else{if(e.toLowerCase()=="crldistributionpoints"){var d=new KJUR.asn1.x509.CRLDistributionPoints(c);b.push(d)}else{if(e.toLowerCase()=="extkeyusage"){var d=new KJUR.asn1.x509.ExtKeyUsage(c);b.push(d)}else{if(e.toLowerCase()=="authoritykeyidentifier"){var d=new KJUR.asn1.x509.AuthorityKeyIdentifier(c);b.push(d)}else{if(e.toLowerCase()=="authorityinfoaccess"){var d=new KJUR.asn1.x509.AuthorityInfoAccess(c);b.push(d)}else{if(e.toLowerCase()=="subjectaltname"){var d=new KJUR.asn1.x509.SubjectAltName(c);b.push(d)}else{if(e.toLowerCase()=="issueraltname"){var d=new KJUR.asn1.x509.IssuerAltName(c);b.push(d)}else{throw"unsupported extension name: "+e}}}}}}}}};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;f++){var h=c.shift();if(e===true){var d=b.pop();var j=(d+","+h).replace(/\\,/g,",");b.push(j);e=false}else{b.push(h)}if(h.substr(-1,1)==="\\"){e=true}}b=b.map(function(a){return a.replace("/","\\/")});b.reverse();return"/"+b.join("/")};KJUR.asn1.x509.RDN=function(a){KJUR.asn1.x509.RDN.superclass.constructor.call(this);this.asn1Array=new Array();this.addByString=function(b){this.asn1Array.push(new KJUR.asn1.x509.AttributeTypeAndValue({str:b}))};this.addByMultiValuedString=function(d){var b=KJUR.asn1.x509.RDN.parseString(d);for(var c=0;c0;g++){var k=j.shift();if(h===true){var f=c.pop();var d=(f+"+"+k).replace(/\\\+/g,"+");c.push(d);h=false}else{c.push(k)}if(k.substr(-1,1)==="\\"){h=true}}var l=false;var b=[];for(var g=0;c.length>0;g++){var k=c.shift();if(l===true){var e=b.pop();if(k.match(/"$/)){var d=(e+"+"+k).replace(/^([^=]+)="(.*)"$/,"$1=$2");b.push(d);l=false}else{b.push(e+"+"+k)}}else{b.push(k)}if(k.match(/^[^=]+="/)){l=true}}return b};KJUR.asn1.x509.AttributeTypeAndValue=function(b){KJUR.asn1.x509.AttributeTypeAndValue.superclass.constructor.call(this);var d=null;var c=null;var a="utf8";this.setByString=function(f){var e=f.match(/^([^=]+)=(.+)$/);if(e){this.setByAttrTypeAndValueStr(e[1],e[2])}else{throw"malformed attrTypeAndValueStr: "+f}};this.setByAttrTypeAndValueStr=function(g,f){this.typeObj=KJUR.asn1.x509.OID.atype2obj(g);var e=a;if(g=="C"){e="prn"}this.valueObj=this.getValueObj(e,f)};this.getValueObj=function(f,e){if(f=="utf8"){return new KJUR.asn1.DERUTF8String({str:e})}if(f=="prn"){return new KJUR.asn1.DERPrintableString({str:e})}if(f=="tel"){return new KJUR.asn1.DERTeletexString({str:e})}if(f=="ia5"){return new KJUR.asn1.DERIA5String({str:e})}throw"unsupported directory string type: type="+f+" value="+e};this.getEncodedHex=function(){var e=new KJUR.asn1.DERSequence({array:[this.typeObj,this.valueObj]});this.TLV=e.getEncodedHex();return this.TLV};if(typeof b!="undefined"){if(typeof b.str!="undefined"){this.setByString(b.str)}}};YAHOO.lang.extend(KJUR.asn1.x509.AttributeTypeAndValue,KJUR.asn1.ASN1Object);KJUR.asn1.x509.SubjectPublicKeyInfo=function(d){KJUR.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call(this);var b=null;var c=null;var a=null;this.setRSAKey=function(e){if(!RSAKey.prototype.isPrototypeOf(e)){throw"argument is not RSAKey instance"}this.rsaKey=e;var g=new KJUR.asn1.DERInteger({bigint:e.n});var f=new KJUR.asn1.DERInteger({"int":e.e});var i=new KJUR.asn1.DERSequence({array:[g,f]});var h=i.getEncodedHex();this.asn1AlgId=new KJUR.asn1.x509.AlgorithmIdentifier({name:"rsaEncryption"});this.asn1SubjPKey=new KJUR.asn1.DERBitString({hex:"00"+h})};this.setRSAPEM=function(g){if(g.match(/-----BEGIN PUBLIC KEY-----/)){var n=g;n=n.replace(/^-----[^-]+-----/,"");n=n.replace(/-----[^-]+-----\s*$/,"");var m=n.replace(/\s+/g,"");var f=CryptoJS.enc.Base64.parse(m);var i=CryptoJS.enc.Hex.stringify(f);var k=_rsapem_getHexValueArrayOfChildrenFromHex(i);var h=k[1];var l=h.substr(2);var e=_rsapem_getHexValueArrayOfChildrenFromHex(l);var j=new RSAKey();j.setPublic(e[0],e[1]);this.setRSAKey(j)}else{throw"key not supported"}};this.getASN1Object=function(){if(this.asn1AlgId==null||this.asn1SubjPKey==null){throw"algId and/or subjPubKey not set"}var e=new KJUR.asn1.DERSequence({array:[this.asn1AlgId,this.asn1SubjPKey]});return e};this.getEncodedHex=function(){var e=this.getASN1Object();this.hTLV=e.getEncodedHex();return this.hTLV};this._setRSAKey=function(e){var g=KJUR.asn1.ASN1Util.newObject({seq:[{"int":{bigint:e.n}},{"int":{"int":e.e}}]});var f=g.getEncodedHex();this.asn1AlgId=new KJUR.asn1.x509.AlgorithmIdentifier({name:"rsaEncryption"});this.asn1SubjPKey=new KJUR.asn1.DERBitString({hex:"00"+f})};this._setEC=function(e){var f=new KJUR.asn1.DERObjectIdentifier({name:e.curveName});this.asn1AlgId=new KJUR.asn1.x509.AlgorithmIdentifier({name:"ecPublicKey",asn1params:f});this.asn1SubjPKey=new KJUR.asn1.DERBitString({hex:"00"+e.pubKeyHex})};this._setDSA=function(e){var f=new KJUR.asn1.ASN1Util.newObject({seq:[{"int":{bigint:e.p}},{"int":{bigint:e.q}},{"int":{bigint:e.g}}]});this.asn1AlgId=new KJUR.asn1.x509.AlgorithmIdentifier({name:"dsa",asn1params:f});var g=new KJUR.asn1.DERInteger({bigint:e.y});this.asn1SubjPKey=new KJUR.asn1.DERBitString({hex:"00"+g.getEncodedHex()})};if(typeof d!="undefined"){if(typeof RSAKey!="undefined"&&d instanceof RSAKey){this._setRSAKey(d)}else{if(typeof KJUR.crypto.ECDSA!="undefined"&&d instanceof KJUR.crypto.ECDSA){this._setEC(d)}else{if(typeof KJUR.crypto.DSA!="undefined"&&d instanceof KJUR.crypto.DSA){this._setDSA(d)}else{if(typeof d.rsakey!="undefined"){this.setRSAKey(d.rsakey)}else{if(typeof d.rsapem!="undefined"){this.setRSAPEM(d.rsapem)}}}}}}};YAHOO.lang.extend(KJUR.asn1.x509.SubjectPublicKeyInfo,KJUR.asn1.ASN1Object);KJUR.asn1.x509.Time=function(c){KJUR.asn1.x509.Time.superclass.constructor.call(this);var b=null;var a=null;this.setTimeParams=function(d){this.timeParams=d};this.getEncodedHex=function(){var d=null;if(this.timeParams!=null){if(this.type=="utc"){d=new KJUR.asn1.DERUTCTime(this.timeParams)}else{d=new KJUR.asn1.DERGeneralizedTime(this.timeParams)}}else{if(this.type=="utc"){d=new KJUR.asn1.DERUTCTime()}else{d=new KJUR.asn1.DERGeneralizedTime()}}this.TLV=d.getEncodedHex();return this.TLV};this.type="utc";if(typeof c!="undefined"){if(typeof c.type!="undefined"){this.type=c.type}else{if(typeof c.str!="undefined"){if(c.str.match(/^[0-9]{12}Z$/)){this.type="utc"}if(c.str.match(/^[0-9]{14}Z$/)){this.type="gen"}}}this.timeParams=c}};YAHOO.lang.extend(KJUR.asn1.x509.Time,KJUR.asn1.ASN1Object);KJUR.asn1.x509.AlgorithmIdentifier=function(e){KJUR.asn1.x509.AlgorithmIdentifier.superclass.constructor.call(this);var a=null;var d=null;var b=null;var c=false;this.getEncodedHex=function(){if(this.nameAlg==null&&this.asn1Alg==null){throw"algorithm not specified"}if(this.nameAlg!=null&&this.asn1Alg==null){this.asn1Alg=KJUR.asn1.x509.OID.name2obj(this.nameAlg)}var f=[this.asn1Alg];if(!this.paramEmpty){f.push(this.asn1Params)}var g=new KJUR.asn1.DERSequence({array:f});this.hTLV=g.getEncodedHex();return this.hTLV};if(typeof e!="undefined"){if(typeof e.name!="undefined"){this.nameAlg=e.name}if(typeof e.asn1params!="undefined"){this.asn1Params=e.asn1params}if(typeof e.paramempty!="undefined"){this.paramEmpty=e.paramempty}}if(this.asn1Params==null){this.asn1Params=new KJUR.asn1.DERNull()}};YAHOO.lang.extend(KJUR.asn1.x509.AlgorithmIdentifier,KJUR.asn1.ASN1Object);KJUR.asn1.x509.GeneralName=function(d){KJUR.asn1.x509.GeneralName.superclass.constructor.call(this);var c=null;var b=null;var a={rfc822:"81",dns:"82",dn:"a4",uri:"86"};this.explicit=false;this.setByParam=function(k){var j=null;var g=null;if(k===undefined){return}if(k.rfc822!==undefined){this.type="rfc822";g=new KJUR.asn1.DERIA5String({str:k[this.type]})}if(k.dns!==undefined){this.type="dns";g=new KJUR.asn1.DERIA5String({str:k[this.type]})}if(k.uri!==undefined){this.type="uri";g=new KJUR.asn1.DERIA5String({str:k[this.type]})}if(k.dn!==undefined){this.type="dn";g=new KJUR.asn1.x509.X500Name({str:k.dn})}if(k.ldapdn!==undefined){this.type="dn";g=new KJUR.asn1.x509.X500Name({ldapstr:k.ldapdn})}if(k.certissuer!==undefined){this.type="dn";this.explicit=true;var h=k.certissuer;var f=null;if(h.match(/^[0-9A-Fa-f]+$/)){f==h}if(h.indexOf("-----BEGIN ")!=-1){f=X509.pemToHex(h)}if(f==null){throw"certissuer param not cert"}var e=new X509();e.hex=f;var i=e.getIssuerHex();g=new KJUR.asn1.ASN1Object();g.hTLV=i}if(k.certsubj!==undefined){this.type="dn";this.explicit=true;var h=k.certsubj;var f=null;if(h.match(/^[0-9A-Fa-f]+$/)){f==h}if(h.indexOf("-----BEGIN ")!=-1){f=X509.pemToHex(h)}if(f==null){throw"certsubj param not cert"}var e=new X509();e.hex=f;var i=e.getSubjectHex();g=new KJUR.asn1.ASN1Object();g.hTLV=i}if(this.type==null){throw"unsupported type in params="+k}this.asn1Obj=new KJUR.asn1.DERTaggedObject({explicit:this.explicit,tag:a[this.type],obj:g})};this.getEncodedHex=function(){return this.asn1Obj.getEncodedHex()};if(d!==undefined){this.setByParam(d)}};YAHOO.lang.extend(KJUR.asn1.x509.GeneralName,KJUR.asn1.ASN1Object);KJUR.asn1.x509.GeneralNames=function(b){KJUR.asn1.x509.GeneralNames.superclass.constructor.call(this);var a=null;this.setByParamArray=function(e){for(var c=0;c=(b*2))){break}if(d>=200){break}c.push(e);g=e;d++}return c};ASN1HEX.getNthChildIndex_AtObj=function(d,b,e){var c=ASN1HEX.getPosArrayOfChildren_AtObj(d,b);return c[e]};ASN1HEX.getDecendantIndexByNthList=function(e,d,c){if(c.length==0){return d}var f=c.shift();var b=ASN1HEX.getPosArrayOfChildren_AtObj(e,d);return ASN1HEX.getDecendantIndexByNthList(e,b[f],c)};ASN1HEX.getDecendantHexTLVByNthList=function(d,c,b){var a=ASN1HEX.getDecendantIndexByNthList(d,c,b);return ASN1HEX.getHexOfTLV_AtObj(d,a)};ASN1HEX.getDecendantHexVByNthList=function(d,c,b){var a=ASN1HEX.getDecendantIndexByNthList(d,c,b);return ASN1HEX.getHexOfV_AtObj(d,a)};ASN1HEX.getVbyList=function(d,c,b,e){var a=ASN1HEX.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 ASN1HEX.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};ASN1HEX.dump=function(e,c,k,g){var o=function(w,i){if(w.length<=i*2){return w}else{var v=w.substr(0,i)+"..(total "+w.length/2+"bytes).."+w.substr(w.length-i,i);return v}};if(c===undefined){c={ommit_long_octet:32}}if(k===undefined){k=0}if(g===undefined){g=""}var r=c.ommit_long_octet;if(e.substr(k,2)=="01"){var h=ASN1HEX.getHexOfV_AtObj(e,k);if(h=="00"){return g+"BOOLEAN FALSE\n"}else{return g+"BOOLEAN TRUE\n"}}if(e.substr(k,2)=="02"){var h=ASN1HEX.getHexOfV_AtObj(e,k);return g+"INTEGER "+o(h,r)+"\n"}if(e.substr(k,2)=="03"){var h=ASN1HEX.getHexOfV_AtObj(e,k);return g+"BITSTRING "+o(h,r)+"\n"}if(e.substr(k,2)=="04"){var h=ASN1HEX.getHexOfV_AtObj(e,k);if(ASN1HEX.isASN1HEX(h)){var j=g+"OCTETSTRING, encapsulates\n";j=j+ASN1HEX.dump(h,c,0,g+" ");return j}else{return g+"OCTETSTRING "+o(h,r)+"\n"}}if(e.substr(k,2)=="05"){return g+"NULL\n"}if(e.substr(k,2)=="06"){var l=ASN1HEX.getHexOfV_AtObj(e,k);var a=KJUR.asn1.ASN1Util.oidHexToInt(l);var n=KJUR.asn1.x509.OID.oid2name(a);var b=a.replace(/\./g," ");if(n!=""){return g+"ObjectIdentifier "+n+" ("+b+")\n"}else{return g+"ObjectIdentifier ("+b+")\n"}}if(e.substr(k,2)=="0c"){return g+"UTF8String '"+hextoutf8(ASN1HEX.getHexOfV_AtObj(e,k))+"'\n"}if(e.substr(k,2)=="13"){return g+"PrintableString '"+hextoutf8(ASN1HEX.getHexOfV_AtObj(e,k))+"'\n"}if(e.substr(k,2)=="14"){return g+"TeletexString '"+hextoutf8(ASN1HEX.getHexOfV_AtObj(e,k))+"'\n"}if(e.substr(k,2)=="16"){return g+"IA5String '"+hextoutf8(ASN1HEX.getHexOfV_AtObj(e,k))+"'\n"}if(e.substr(k,2)=="17"){return g+"UTCTime "+hextoutf8(ASN1HEX.getHexOfV_AtObj(e,k))+"\n"}if(e.substr(k,2)=="18"){return g+"GeneralizedTime "+hextoutf8(ASN1HEX.getHexOfV_AtObj(e,k))+"\n"}if(e.substr(k,2)=="30"){if(e.substr(k,4)=="3000"){return g+"SEQUENCE {}\n"}var j=g+"SEQUENCE\n";var d=ASN1HEX.getPosArrayOfChildren_AtObj(e,k);var f=c;if((d.length==2||d.length==3)&&e.substr(d[0],2)=="06"&&e.substr(d[d.length-1],2)=="04"){var t=ASN1HEX.getHexOfV_AtObj(e,d[0]);var a=KJUR.asn1.ASN1Util.oidHexToInt(t);var n=KJUR.asn1.x509.OID.oid2name(a);var p=JSON.parse(JSON.stringify(c));p.x509ExtName=n;f=p}for(var 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;f++){var h=c.shift();if(e===true){var d=b.pop();var j=(d+","+h).replace(/\\,/g,",");b.push(j);e=false}else{b.push(h)}if(h.substr(-1,1)==="\\"){e=true}}b=b.map(function(a){return a.replace("/","\\/")});b.reverse();return"/"+b.join("/")};KJUR.asn1.x509.RDN=function(a){KJUR.asn1.x509.RDN.superclass.constructor.call(this);this.asn1Array=new Array();this.addByString=function(b){this.asn1Array.push(new KJUR.asn1.x509.AttributeTypeAndValue({str:b}))};this.addByMultiValuedString=function(d){var b=KJUR.asn1.x509.RDN.parseString(d);for(var c=0;c0;g++){var k=j.shift();if(h===true){var f=c.pop();var d=(f+"+"+k).replace(/\\\+/g,"+");c.push(d);h=false}else{c.push(k)}if(k.substr(-1,1)==="\\"){h=true}}var l=false;var b=[];for(var g=0;c.length>0;g++){var k=c.shift();if(l===true){var e=b.pop();if(k.match(/"$/)){var d=(e+"+"+k).replace(/^([^=]+)="(.*)"$/,"$1=$2");b.push(d);l=false}else{b.push(e+"+"+k)}}else{b.push(k)}if(k.match(/^[^=]+="/)){l=true}}return b};KJUR.asn1.x509.AttributeTypeAndValue=function(b){KJUR.asn1.x509.AttributeTypeAndValue.superclass.constructor.call(this);var d=null;var c=null;var a="utf8";this.setByString=function(f){var e=f.match(/^([^=]+)=(.+)$/);if(e){this.setByAttrTypeAndValueStr(e[1],e[2])}else{throw"malformed attrTypeAndValueStr: "+f}};this.setByAttrTypeAndValueStr=function(g,f){this.typeObj=KJUR.asn1.x509.OID.atype2obj(g);var e=a;if(g=="C"){e="prn"}this.valueObj=this.getValueObj(e,f)};this.getValueObj=function(f,e){if(f=="utf8"){return new KJUR.asn1.DERUTF8String({str:e})}if(f=="prn"){return new KJUR.asn1.DERPrintableString({str:e})}if(f=="tel"){return new KJUR.asn1.DERTeletexString({str:e})}if(f=="ia5"){return new KJUR.asn1.DERIA5String({str:e})}throw"unsupported directory string type: type="+f+" value="+e};this.getEncodedHex=function(){var e=new KJUR.asn1.DERSequence({array:[this.typeObj,this.valueObj]});this.TLV=e.getEncodedHex();return this.TLV};if(typeof b!="undefined"){if(typeof b.str!="undefined"){this.setByString(b.str)}}};YAHOO.lang.extend(KJUR.asn1.x509.AttributeTypeAndValue,KJUR.asn1.ASN1Object);KJUR.asn1.x509.SubjectPublicKeyInfo=function(d){KJUR.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call(this);var b=null;var c=null;var a=null;this.setRSAKey=function(e){if(!RSAKey.prototype.isPrototypeOf(e)){throw"argument is not RSAKey instance"}this.rsaKey=e;var g=new KJUR.asn1.DERInteger({bigint:e.n});var f=new KJUR.asn1.DERInteger({"int":e.e});var i=new KJUR.asn1.DERSequence({array:[g,f]});var h=i.getEncodedHex();this.asn1AlgId=new KJUR.asn1.x509.AlgorithmIdentifier({name:"rsaEncryption"});this.asn1SubjPKey=new KJUR.asn1.DERBitString({hex:"00"+h})};this.setRSAPEM=function(g){if(g.match(/-----BEGIN PUBLIC KEY-----/)){var n=g;n=n.replace(/^-----[^-]+-----/,"");n=n.replace(/-----[^-]+-----\s*$/,"");var m=n.replace(/\s+/g,"");var f=CryptoJS.enc.Base64.parse(m);var i=CryptoJS.enc.Hex.stringify(f);var k=_rsapem_getHexValueArrayOfChildrenFromHex(i);var h=k[1];var l=h.substr(2);var e=_rsapem_getHexValueArrayOfChildrenFromHex(l);var j=new RSAKey();j.setPublic(e[0],e[1]);this.setRSAKey(j)}else{throw"key not supported"}};this.getASN1Object=function(){if(this.asn1AlgId==null||this.asn1SubjPKey==null){throw"algId and/or subjPubKey not set"}var e=new KJUR.asn1.DERSequence({array:[this.asn1AlgId,this.asn1SubjPKey]});return e};this.getEncodedHex=function(){var e=this.getASN1Object();this.hTLV=e.getEncodedHex();return this.hTLV};this._setRSAKey=function(e){var g=KJUR.asn1.ASN1Util.newObject({seq:[{"int":{bigint:e.n}},{"int":{"int":e.e}}]});var f=g.getEncodedHex();this.asn1AlgId=new KJUR.asn1.x509.AlgorithmIdentifier({name:"rsaEncryption"});this.asn1SubjPKey=new KJUR.asn1.DERBitString({hex:"00"+f})};this._setEC=function(e){var f=new KJUR.asn1.DERObjectIdentifier({name:e.curveName});this.asn1AlgId=new KJUR.asn1.x509.AlgorithmIdentifier({name:"ecPublicKey",asn1params:f});this.asn1SubjPKey=new KJUR.asn1.DERBitString({hex:"00"+e.pubKeyHex})};this._setDSA=function(e){var f=new KJUR.asn1.ASN1Util.newObject({seq:[{"int":{bigint:e.p}},{"int":{bigint:e.q}},{"int":{bigint:e.g}}]});this.asn1AlgId=new KJUR.asn1.x509.AlgorithmIdentifier({name:"dsa",asn1params:f});var g=new KJUR.asn1.DERInteger({bigint:e.y});this.asn1SubjPKey=new KJUR.asn1.DERBitString({hex:"00"+g.getEncodedHex()})};if(typeof d!="undefined"){if(typeof RSAKey!="undefined"&&d instanceof RSAKey){this._setRSAKey(d)}else{if(typeof KJUR.crypto.ECDSA!="undefined"&&d instanceof KJUR.crypto.ECDSA){this._setEC(d)}else{if(typeof KJUR.crypto.DSA!="undefined"&&d instanceof KJUR.crypto.DSA){this._setDSA(d)}else{if(typeof d.rsakey!="undefined"){this.setRSAKey(d.rsakey)}else{if(typeof d.rsapem!="undefined"){this.setRSAPEM(d.rsapem)}}}}}}};YAHOO.lang.extend(KJUR.asn1.x509.SubjectPublicKeyInfo,KJUR.asn1.ASN1Object);KJUR.asn1.x509.Time=function(c){KJUR.asn1.x509.Time.superclass.constructor.call(this);var b=null;var a=null;this.setTimeParams=function(d){this.timeParams=d};this.getEncodedHex=function(){var d=null;if(this.timeParams!=null){if(this.type=="utc"){d=new KJUR.asn1.DERUTCTime(this.timeParams)}else{d=new KJUR.asn1.DERGeneralizedTime(this.timeParams)}}else{if(this.type=="utc"){d=new KJUR.asn1.DERUTCTime()}else{d=new KJUR.asn1.DERGeneralizedTime()}}this.TLV=d.getEncodedHex();return this.TLV};this.type="utc";if(typeof c!="undefined"){if(typeof c.type!="undefined"){this.type=c.type}else{if(typeof c.str!="undefined"){if(c.str.match(/^[0-9]{12}Z$/)){this.type="utc"}if(c.str.match(/^[0-9]{14}Z$/)){this.type="gen"}}}this.timeParams=c}};YAHOO.lang.extend(KJUR.asn1.x509.Time,KJUR.asn1.ASN1Object);KJUR.asn1.x509.AlgorithmIdentifier=function(e){KJUR.asn1.x509.AlgorithmIdentifier.superclass.constructor.call(this);var a=null;var d=null;var b=null;var c=false;this.getEncodedHex=function(){if(this.nameAlg==null&&this.asn1Alg==null){throw"algorithm not specified"}if(this.nameAlg!=null&&this.asn1Alg==null){this.asn1Alg=KJUR.asn1.x509.OID.name2obj(this.nameAlg)}var f=[this.asn1Alg];if(!this.paramEmpty){f.push(this.asn1Params)}var g=new KJUR.asn1.DERSequence({array:f});this.hTLV=g.getEncodedHex();return this.hTLV};if(typeof e!="undefined"){if(typeof e.name!="undefined"){this.nameAlg=e.name}if(typeof e.asn1params!="undefined"){this.asn1Params=e.asn1params}if(typeof e.paramempty!="undefined"){this.paramEmpty=e.paramempty}}if(this.asn1Params==null){this.asn1Params=new KJUR.asn1.DERNull()}};YAHOO.lang.extend(KJUR.asn1.x509.AlgorithmIdentifier,KJUR.asn1.ASN1Object);KJUR.asn1.x509.GeneralName=function(d){KJUR.asn1.x509.GeneralName.superclass.constructor.call(this);var c=null;var b=null;var a={rfc822:"81",dns:"82",dn:"a4",uri:"86"};this.explicit=false;this.setByParam=function(k){var j=null;var g=null;if(typeof k=="undefined"){return}if(typeof k.rfc822!="undefined"){this.type="rfc822";g=new KJUR.asn1.DERIA5String({str:k[this.type]})}if(typeof k.dns!="undefined"){this.type="dns";g=new KJUR.asn1.DERIA5String({str:k[this.type]})}if(typeof k.uri!="undefined"){this.type="uri";g=new KJUR.asn1.DERIA5String({str:k[this.type]})}if(typeof k.certissuer!="undefined"){this.type="dn";this.explicit=true;var h=k.certissuer;var f=null;if(h.match(/^[0-9A-Fa-f]+$/)){f==h}if(h.indexOf("-----BEGIN ")!=-1){f=X509.pemToHex(h)}if(f==null){throw"certissuer param not cert"}var e=new X509();e.hex=f;var i=e.getIssuerHex();g=new KJUR.asn1.ASN1Object();g.hTLV=i}if(typeof k.certsubj!="undefined"){this.type="dn";this.explicit=true;var h=k.certsubj;var f=null;if(h.match(/^[0-9A-Fa-f]+$/)){f==h}if(h.indexOf("-----BEGIN ")!=-1){f=X509.pemToHex(h)}if(f==null){throw"certsubj param not cert"}var e=new X509();e.hex=f;var i=e.getSubjectHex();g=new KJUR.asn1.ASN1Object();g.hTLV=i}if(this.type==null){throw"unsupported type in params="+k}this.asn1Obj=new KJUR.asn1.DERTaggedObject({explicit:this.explicit,tag:a[this.type],obj:g})};this.getEncodedHex=function(){return this.asn1Obj.getEncodedHex()};if(typeof d!="undefined"){this.setByParam(d)}};YAHOO.lang.extend(KJUR.asn1.x509.GeneralName,KJUR.asn1.ASN1Object);KJUR.asn1.x509.GeneralNames=function(b){KJUR.asn1.x509.GeneralNames.superclass.constructor.call(this);var a=null;this.setByParamArray=function(e){for(var c=0;c0){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.Extension.appendByNameToArray=function(e,c,b){if(e.toLowerCase()=="basicconstraints"){var d=new KJUR.asn1.x509.BasicConstraints(c);b.push(d)}else{if(e.toLowerCase()=="keyusage"){var d=new KJUR.asn1.x509.KeyUsage(c);b.push(d)}else{if(e.toLowerCase()=="crldistributionpoints"){var d=new KJUR.asn1.x509.CRLDistributionPoints(c);b.push(d)}else{if(e.toLowerCase()=="extkeyusage"){var d=new KJUR.asn1.x509.ExtKeyUsage(c);b.push(d)}else{if(e.toLowerCase()=="authoritykeyidentifier"){var d=new KJUR.asn1.x509.AuthorityKeyIdentifier(c);b.push(d)}else{if(e.toLowerCase()=="authorityinfoaccess"){var d=new KJUR.asn1.x509.AuthorityInfoAccess(c);b.push(d)}else{if(e.toLowerCase()=="subjectaltname"){var d=new KJUR.asn1.x509.SubjectAltName(c);b.push(d)}else{if(e.toLowerCase()=="issueraltname"){var d=new KJUR.asn1.x509.IssuerAltName(c);b.push(d)}else{throw"unsupported extension name: "+e}}}}}}}}};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;f++){var h=c.shift();if(e===true){var d=b.pop();var j=(d+","+h).replace(/\\,/g,",");b.push(j);e=false}else{b.push(h)}if(h.substr(-1,1)==="\\"){e=true}}b=b.map(function(a){return a.replace("/","\\/")});b.reverse();return"/"+b.join("/")};KJUR.asn1.x509.RDN=function(a){KJUR.asn1.x509.RDN.superclass.constructor.call(this);this.asn1Array=new Array();this.addByString=function(b){this.asn1Array.push(new KJUR.asn1.x509.AttributeTypeAndValue({str:b}))};this.addByMultiValuedString=function(d){var b=KJUR.asn1.x509.RDN.parseString(d);for(var c=0;c0;g++){var k=j.shift();if(h===true){var f=c.pop();var d=(f+"+"+k).replace(/\\\+/g,"+");c.push(d);h=false}else{c.push(k)}if(k.substr(-1,1)==="\\"){h=true}}var l=false;var b=[];for(var g=0;c.length>0;g++){var k=c.shift();if(l===true){var e=b.pop();if(k.match(/"$/)){var d=(e+"+"+k).replace(/^([^=]+)="(.*)"$/,"$1=$2");b.push(d);l=false}else{b.push(e+"+"+k)}}else{b.push(k)}if(k.match(/^[^=]+="/)){l=true}}return b};KJUR.asn1.x509.AttributeTypeAndValue=function(b){KJUR.asn1.x509.AttributeTypeAndValue.superclass.constructor.call(this);var d=null;var c=null;var a="utf8";this.setByString=function(f){var e=f.match(/^([^=]+)=(.+)$/);if(e){this.setByAttrTypeAndValueStr(e[1],e[2])}else{throw"malformed attrTypeAndValueStr: "+f}};this.setByAttrTypeAndValueStr=function(g,f){this.typeObj=KJUR.asn1.x509.OID.atype2obj(g);var e=a;if(g=="C"){e="prn"}this.valueObj=this.getValueObj(e,f)};this.getValueObj=function(f,e){if(f=="utf8"){return new KJUR.asn1.DERUTF8String({str:e})}if(f=="prn"){return new KJUR.asn1.DERPrintableString({str:e})}if(f=="tel"){return new KJUR.asn1.DERTeletexString({str:e})}if(f=="ia5"){return new KJUR.asn1.DERIA5String({str:e})}throw"unsupported directory string type: type="+f+" value="+e};this.getEncodedHex=function(){var e=new KJUR.asn1.DERSequence({array:[this.typeObj,this.valueObj]});this.TLV=e.getEncodedHex();return this.TLV};if(typeof b!="undefined"){if(typeof b.str!="undefined"){this.setByString(b.str)}}};YAHOO.lang.extend(KJUR.asn1.x509.AttributeTypeAndValue,KJUR.asn1.ASN1Object);KJUR.asn1.x509.SubjectPublicKeyInfo=function(d){KJUR.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call(this);var b=null;var c=null;var a=null;this.setRSAKey=function(e){if(!RSAKey.prototype.isPrototypeOf(e)){throw"argument is not RSAKey instance"}this.rsaKey=e;var g=new KJUR.asn1.DERInteger({bigint:e.n});var f=new KJUR.asn1.DERInteger({"int":e.e});var i=new KJUR.asn1.DERSequence({array:[g,f]});var h=i.getEncodedHex();this.asn1AlgId=new KJUR.asn1.x509.AlgorithmIdentifier({name:"rsaEncryption"});this.asn1SubjPKey=new KJUR.asn1.DERBitString({hex:"00"+h})};this.setRSAPEM=function(g){if(g.match(/-----BEGIN PUBLIC KEY-----/)){var n=g;n=n.replace(/^-----[^-]+-----/,"");n=n.replace(/-----[^-]+-----\s*$/,"");var m=n.replace(/\s+/g,"");var f=CryptoJS.enc.Base64.parse(m);var i=CryptoJS.enc.Hex.stringify(f);var k=_rsapem_getHexValueArrayOfChildrenFromHex(i);var h=k[1];var l=h.substr(2);var e=_rsapem_getHexValueArrayOfChildrenFromHex(l);var j=new RSAKey();j.setPublic(e[0],e[1]);this.setRSAKey(j)}else{throw"key not supported"}};this.getASN1Object=function(){if(this.asn1AlgId==null||this.asn1SubjPKey==null){throw"algId and/or subjPubKey not set"}var e=new KJUR.asn1.DERSequence({array:[this.asn1AlgId,this.asn1SubjPKey]});return e};this.getEncodedHex=function(){var e=this.getASN1Object();this.hTLV=e.getEncodedHex();return this.hTLV};this._setRSAKey=function(e){var g=KJUR.asn1.ASN1Util.newObject({seq:[{"int":{bigint:e.n}},{"int":{"int":e.e}}]});var f=g.getEncodedHex();this.asn1AlgId=new KJUR.asn1.x509.AlgorithmIdentifier({name:"rsaEncryption"});this.asn1SubjPKey=new KJUR.asn1.DERBitString({hex:"00"+f})};this._setEC=function(e){var f=new KJUR.asn1.DERObjectIdentifier({name:e.curveName});this.asn1AlgId=new KJUR.asn1.x509.AlgorithmIdentifier({name:"ecPublicKey",asn1params:f});this.asn1SubjPKey=new KJUR.asn1.DERBitString({hex:"00"+e.pubKeyHex})};this._setDSA=function(e){var f=new KJUR.asn1.ASN1Util.newObject({seq:[{"int":{bigint:e.p}},{"int":{bigint:e.q}},{"int":{bigint:e.g}}]});this.asn1AlgId=new KJUR.asn1.x509.AlgorithmIdentifier({name:"dsa",asn1params:f});var g=new KJUR.asn1.DERInteger({bigint:e.y});this.asn1SubjPKey=new KJUR.asn1.DERBitString({hex:"00"+g.getEncodedHex()})};if(typeof d!="undefined"){if(typeof RSAKey!="undefined"&&d instanceof RSAKey){this._setRSAKey(d)}else{if(typeof KJUR.crypto.ECDSA!="undefined"&&d instanceof KJUR.crypto.ECDSA){this._setEC(d)}else{if(typeof KJUR.crypto.DSA!="undefined"&&d instanceof KJUR.crypto.DSA){this._setDSA(d)}else{if(typeof d.rsakey!="undefined"){this.setRSAKey(d.rsakey)}else{if(typeof d.rsapem!="undefined"){this.setRSAPEM(d.rsapem)}}}}}}};YAHOO.lang.extend(KJUR.asn1.x509.SubjectPublicKeyInfo,KJUR.asn1.ASN1Object);KJUR.asn1.x509.Time=function(c){KJUR.asn1.x509.Time.superclass.constructor.call(this);var b=null;var a=null;this.setTimeParams=function(d){this.timeParams=d};this.getEncodedHex=function(){var d=null;if(this.timeParams!=null){if(this.type=="utc"){d=new KJUR.asn1.DERUTCTime(this.timeParams)}else{d=new KJUR.asn1.DERGeneralizedTime(this.timeParams)}}else{if(this.type=="utc"){d=new KJUR.asn1.DERUTCTime()}else{d=new KJUR.asn1.DERGeneralizedTime()}}this.TLV=d.getEncodedHex();return this.TLV};this.type="utc";if(typeof c!="undefined"){if(typeof c.type!="undefined"){this.type=c.type}else{if(typeof c.str!="undefined"){if(c.str.match(/^[0-9]{12}Z$/)){this.type="utc"}if(c.str.match(/^[0-9]{14}Z$/)){this.type="gen"}}}this.timeParams=c}};YAHOO.lang.extend(KJUR.asn1.x509.Time,KJUR.asn1.ASN1Object);KJUR.asn1.x509.AlgorithmIdentifier=function(e){KJUR.asn1.x509.AlgorithmIdentifier.superclass.constructor.call(this);var a=null;var d=null;var b=null;var c=false;this.getEncodedHex=function(){if(this.nameAlg==null&&this.asn1Alg==null){throw"algorithm not specified"}if(this.nameAlg!=null&&this.asn1Alg==null){this.asn1Alg=KJUR.asn1.x509.OID.name2obj(this.nameAlg)}var f=[this.asn1Alg];if(!this.paramEmpty){f.push(this.asn1Params)}var g=new KJUR.asn1.DERSequence({array:f});this.hTLV=g.getEncodedHex();return this.hTLV};if(typeof e!="undefined"){if(typeof e.name!="undefined"){this.nameAlg=e.name}if(typeof e.asn1params!="undefined"){this.asn1Params=e.asn1params}if(typeof e.paramempty!="undefined"){this.paramEmpty=e.paramempty}}if(this.asn1Params==null){this.asn1Params=new KJUR.asn1.DERNull()}};YAHOO.lang.extend(KJUR.asn1.x509.AlgorithmIdentifier,KJUR.asn1.ASN1Object);KJUR.asn1.x509.GeneralName=function(d){KJUR.asn1.x509.GeneralName.superclass.constructor.call(this);var c=null;var b=null;var a={rfc822:"81",dns:"82",dn:"a4",uri:"86"};this.explicit=false;this.setByParam=function(k){var j=null;var g=null;if(k===undefined){return}if(k.rfc822!==undefined){this.type="rfc822";g=new KJUR.asn1.DERIA5String({str:k[this.type]})}if(k.dns!==undefined){this.type="dns";g=new KJUR.asn1.DERIA5String({str:k[this.type]})}if(k.uri!==undefined){this.type="uri";g=new KJUR.asn1.DERIA5String({str:k[this.type]})}if(k.dn!==undefined){this.type="dn";g=new KJUR.asn1.x509.X500Name({str:k.dn})}if(k.ldapdn!==undefined){this.type="dn";g=new KJUR.asn1.x509.X500Name({ldapstr:k.ldapdn})}if(k.certissuer!==undefined){this.type="dn";this.explicit=true;var h=k.certissuer;var f=null;if(h.match(/^[0-9A-Fa-f]+$/)){f==h}if(h.indexOf("-----BEGIN ")!=-1){f=X509.pemToHex(h)}if(f==null){throw"certissuer param not cert"}var e=new X509();e.hex=f;var i=e.getIssuerHex();g=new KJUR.asn1.ASN1Object();g.hTLV=i}if(k.certsubj!==undefined){this.type="dn";this.explicit=true;var h=k.certsubj;var f=null;if(h.match(/^[0-9A-Fa-f]+$/)){f==h}if(h.indexOf("-----BEGIN ")!=-1){f=X509.pemToHex(h)}if(f==null){throw"certsubj param not cert"}var e=new X509();e.hex=f;var i=e.getSubjectHex();g=new KJUR.asn1.ASN1Object();g.hTLV=i}if(this.type==null){throw"unsupported type in params="+k}this.asn1Obj=new KJUR.asn1.DERTaggedObject({explicit:this.explicit,tag:a[this.type],obj:g})};this.getEncodedHex=function(){return this.asn1Obj.getEncodedHex()};if(d!==undefined){this.setByParam(d)}};YAHOO.lang.extend(KJUR.asn1.x509.GeneralName,KJUR.asn1.ASN1Object);KJUR.asn1.x509.GeneralNames=function(b){KJUR.asn1.x509.GeneralNames.superclass.constructor.call(this);var a=null;this.setByParamArray=function(e){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;b0){var e=new KJUR.asn1.DERSequence({array:this.extensionsArray});var d=new KJUR.asn1.DERSet({array:[e]});var c=new KJUR.asn1.DERSequence({array:[new KJUR.asn1.DERObjectIdentifier({oid:"1.2.840.113549.1.9.14"}),d]});var b=new KJUR.asn1.DERTaggedObject({explicit:true,tag:"a0",obj:c});this.asn1Array.push(b)}else{var b=new KJUR.asn1.DERTaggedObject({explicit:false,tag:"a0",obj:new KJUR.asn1.DERNull()});this.asn1Array.push(b)}var f=new KJUR.asn1.DERSequence({array:this.asn1Array});this.hTLV=f.getEncodedHex();this.isModified=false;return this.hTLV};this._initialize()};YAHOO.lang.extend(KJUR.asn1.csr.CertificationRequestInfo,KJUR.asn1.ASN1Object);KJUR.asn1.csr.CSRUtil=new function(){};KJUR.asn1.csr.CSRUtil.newCSRPEM=function(g){var d=KJUR.asn1.csr;if(g.subject===undefined){throw"parameter subject undefined"}if(g.sbjpubkey===undefined){throw"parameter sbjpubkey undefined"}if(g.sigalg===undefined){throw"parameter sigalg undefined"}if(g.sbjprvkey===undefined){throw"parameter sbjpubkey undefined"}var b=new d.CertificationRequestInfo();b.setSubjectByParam(g.subject);b.setSubjectPublicKeyByGetKey(g.sbjpubkey);if(g.ext!==undefined&&g.ext.length!==undefined){for(var c=0;c
    test markup
    +TEST INDEX | +asn1x509 | +asn1csr | diff --git a/test/qunit-do-asn1x509-newcrt.html b/test/qunit-do-asn1x509-newcrt.html index 0803fd35..1b20376d 100755 --- a/test/qunit-do-asn1x509-newcrt.html +++ b/test/qunit-do-asn1x509-newcrt.html @@ -87,6 +87,19 @@ "558s\r\n" + "-----END CERTIFICATE-----\r\n"; +var z1CertIANSANPEM = "" + +"-----BEGIN CERTIFICATE-----\r\n" + +"MIIBqTCCAVOgAwIBAgIBBDANBgkqhkiG9w0BAQUFADAZMQswCQYDVQQGEwJVUzEK\r\n" + +"MAgGA1UECgwBYTAeFw0xMzA1MDQyMzU5NTlaFw0xNDA1MDQyMzU5NTlaMBkxCzAJ\r\n" + +"BgNVBAYTAlVTMQowCAYDVQQKDAFiMFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAOhm\r\n" + +"TdK0BSkSFWjzs5vJemLnujwJur3E8NzY35DreQubtkWitw4xEnR7TTxBtRQkiVEV\r\n" + +"/viPedQ+rlsaTjUY/VkCAwEAAaOBhTCBgjAPBgNVHRMBAf8EBTADAQH/MAsGA1Ud\r\n" + +"DwQEAwIGwDAlBgNVHR8EHjAcMBqgGKAWhhRodHRwOi8vYWFhLmNvbS9hLmNybDAT\r\n" + +"BgNVHSUEDDAKBggrBgEFBQcDAjASBgNVHRIECzAJggdhYWEuY29tMBIGA1UdEQQL\r\n" + +"MAmCB2FhYS5jb20wDQYJKoZIhvcNAQEFBQADQQDZydhz3UKmgIs4SKDKlInVOPKX\r\n" + +"njzwm83NGQZH/PRHA5esNtg284ekHIGFS6dg8ThtP1T3mon6VD78z8Z18eI0\r\n" + +"-----END CERTIFICATE-----\r\n"; + // _gitpg/jsrsasign/test/eckey/k1.* var k1PubP8PEM = "" + "-----BEGIN PUBLIC KEY-----\n" + @@ -195,6 +208,27 @@ equal(pem, z1CertPEM, "bbb"); }); +test("newCertPEM z1(RSA) {subject,issuer}AltName", function() { +var pem = KJUR.asn1.x509.X509Util.newCertPEM( + { serial: {int: 4}, + sigalg: {name: 'SHA1withRSA'}, + issuer: {str: '/C=US/O=a'}, + notbefore: {'str': '130504235959Z'}, + notafter: {'str': '140504235959Z'}, + subject: {str: '/C=US/O=b'}, + sbjpubkey: z1PubP8PEM, + ext: [ + {basicConstraints: {cA: true, critical: true}}, + {keyUsage: {bin: '11'}}, + {cRLDistributionPoints: {uri: 'http://aaa.com/a.crl'}}, + {extKeyUsage: {array: [{name: 'clientAuth'}]}}, + {issuerAltName: {array: [{dns: 'aaa.com'}]}}, + {subjectAltName: {array: [{dns: 'aaa.com'}]}}, + ], + cakey: [z1PrvP5EPEM, z1PrvP5EPass]}); +equal(pem, z1CertIANSANPEM, "z1CertIANSANPEM + san/ian"); +}); + test("newCertPEM k1(ECDSA secp256r1)", function() { var pem = KJUR.asn1.x509.X509Util.newCertPEM( { serial: {int: 4}, @@ -288,6 +322,11 @@
    test markup
    +TEST INDEX | +x509-hex2dn | +asn1x509 | +asn1x509-newcrt | +asn1x509-multirdn | diff --git a/test/qunit-do-asn1x509.html b/test/qunit-do-asn1x509.html index d563bef5..4babb8cd 100755 --- a/test/qunit-do-asn1x509.html +++ b/test/qunit-do-asn1x509.html @@ -219,7 +219,6 @@ }); test("GeneralName class test", function() { - expect(5); var o1 = new KJUR.asn1.x509.GeneralName({'rfc822':'u1@foo.com'}); equal(o1.getEncodedHex(), "810a753140666f6f2e636f6d", "constructor rfc822 u1@foo.com"); @@ -229,11 +228,17 @@ var o3 = new KJUR.asn1.x509.GeneralName({'uri':'http://aaa.com/'}); equal(o3.getEncodedHex(), "860f687474703a2f2f6161612e636f6d2f", "constructor uri http://aaa.com/"); - var o4= new KJUR.asn1.x509.GeneralName({certissuer: z4TSACERT}); + var o4 = new KJUR.asn1.x509.GeneralName({certissuer: z4TSACERT}); equal(o4.getEncodedHex(), "a41d301b310b3009060355040613025553310c300a060355040a0c03434131", "constructor certissuer cert1"); - var o5= new KJUR.asn1.x509.GeneralName({certsubj: z4TSACERT}); + var o5 = new KJUR.asn1.x509.GeneralName({certsubj: z4TSACERT}); equal(o5.getEncodedHex(), "a41e301c310b3009060355040613025553310d300b06035504030c0454534131", "constructor certsubj cert1"); + + var o6 = new KJUR.asn1.x509.GeneralName({dn: '/C=US/O=Test'}); + equal(o6.getEncodedHex(), "a41c310b3009060355040613025553310d300b060355040a0c0454657374", "dn /C=US/O=Test"); + + var o7 = new KJUR.asn1.x509.GeneralName({ldapdn: 'O=Test,C=US'}); + equal(o7.getEncodedHex(), "a41c310b3009060355040613025553310d300b060355040a0c0454657374", "ldapdn O=Test,C=US"); }); test("GeneralNames class test", function() { @@ -358,6 +363,24 @@ equal(o1.getEncodedHex(), "30100603551d230101ff04063004800289ab", "ext hex"); }); +test("SubjectAltName", function() { + var o1 = new KJUR.asn1.x509.SubjectAltName({ + critical: true, + array: [{uri: 'http://a.com'}, {uri: 'http://b.com'}] + }); + equal(o1.getExtnValueHex(), "301c860c687474703a2f2f612e636f6d860c687474703a2f2f622e636f6d", "URIs critical"); + equal(o1.getEncodedHex(), "30280603551d110101ff041e301c860c687474703a2f2f612e636f6d860c687474703a2f2f622e636f6d", "ext hex"); +}); + +test("IssuerAltName", function() { + var o1 = new KJUR.asn1.x509.IssuerAltName({ + critical: true, + array: [{uri: 'http://a.com'}, {uri: 'http://b.com'}] + }); + equal(o1.getExtnValueHex(), "301c860c687474703a2f2f612e636f6d860c687474703a2f2f622e636f6d", "URIs critical"); + equal(o1.getEncodedHex(), "30280603551d120101ff041e301c860c687474703a2f2f612e636f6d860c687474703a2f2f622e636f6d", "ext hex"); +}); + // ==== END OF X.509V3 EXTENSION TEST =================== test("CRL class test", function() { expect(1); @@ -431,6 +454,8 @@ TEST INDEX | x509-hex2dn | asn1x509 | +asn1x509-newcrt | asn1x509-multirdn | +asn1csr |