1、五、政府憑證管理中心相關規範 (一)技術標準 政府憑證管理中心(Government Certificate Authority, GCA)有關電子憑證之命名、加密演算、數位簽章演算、憑證格式、憑證編碼、私密金鑰加密格式等所採用之標準與格式如下: 1、命名(Naming):採X.509命名方式。其他標準包括電子郵件E-mail(RFC 822)、網域名稱服務Domain Name Service Name(RFC 1035)、Originator/Recipient Address O/R Address(X.400, 1988)、 目錄名稱Directory Name(X.501,19
2、93)、電子文件交換EDI part Name、 全球資訊網網址Uniform Resource Locator URL(RFC 1630)、網際網路位址IP address(RFC 791)及註冊識別碼Registered ID(X.660)等。 2、加密演算法 :採Triple DES CBC 112 bits演算法。 3、憑證的數位簽章演算法:採RSA演算法,其金鑰長度為1024 bits,並配合雜湊函數SHA-1作訊息摘要,補白(padding)方法採SET規範。 4、憑證公佈(Certificate Distribution):採用HTTP協定。 5、憑證格式(Certifi
3、cate Format):採用X.509(V3,1993)標準。 6、廢止清冊(CRL):採用X.509(V2,1993)標準。 7、憑證編碼方式。 (1)Abstract Syntax Notation One( ASN.1):描述資料欄位的形態與數值(定義在 CCITTT X.208, 1988) (2)Basic Encoding Rule(BER):描述資料標碼規則(定義在 CCITT X.209, 1988) (3)Distinguish Encoding Rule(DER):對 ASN.1提供唯一編碼方式,DER是 BER的 Subset(定義在 ITU-T X.690,
4、 1994) 8、個人密鑰: 採用 PKCS#5 (PKCS: Public Key Cryptographic Standard)公開金鑰密碼標準格式加密格式。 9、通信協定: (1)TCP/IP (2)HTTP (二)政府機關憑證格式 有關GCA的憑證格式及其ASN.1的格式如下說明 1、GCA 憑證格式(X.509 v3) 擴充欄位 憑證格式版本 憑證序號 簽章演算法 簽發者名稱 憑證有效期限 持有者識別名稱(Subject Name) 持有者公鑰 簽發者唯一識別碼 持有者唯一識別碼(Subject Unique ID) 金鑰用途 憑證政策
5、持有者別名 基本限制 CA 簽章 憑證管理中心所使用之公開金鑰憑證內容敘述如下: (1)版本:該憑證製作所依據的X.509版序(V3) (2)序號:由憑證管理中心所給定的唯一憑證序號 (3)數位簽章演算法:憑證管理中心簽署該憑證所用的演算法 (4)簽發單位名稱:簽署該憑證之憑證管理中心名稱 (5)憑證有效期限:該憑證生效日期與截止日期 (6)用戶名稱:依據X.500命名方式所命名的用戶名稱 (7)公開金鑰資料:公開金鑰的值與演算法名稱 (8)簽發者識別號:簽署該憑證之憑證管理中心獨有的識別號碼 (9)用戶識別號:用戶獨有唯一識別碼 (10)X.
6、509 擴充欄位(V3):憑證管理中心的政策與金鑰名稱補充 (11)數位簽章演算法:憑證管理中心簽章所用的演算法 (12)數位簽章:憑證管理中心對以上資料作數位簽章 公鑰憑證擴充欄位(Certificate Extensions) 敘述如下: (1)金鑰的用途(Key Usage) (2)憑證簽發原則與政策(Certificate Policies) (3)替代名稱(Alternative Name) (4)基本限制(Basic Constraints) 2、憑證的ASN.1格式說明 憑證的ASN.1格式詳細如下所列: Certificate ::= SEQ
7、UENCE { tbsCertificate TBSCertificate, signatureAlgorithm AlgorithmIdentifier, signature BIT STRING } TBSCertificate ::= SEQUENCE { version [0] EXPLICIT Version, serialNumber CertificateSerialNumber, signature AlgorithmIdentifier, issuer Name, validity
8、Validity, subject Name, subjectPublicKeyInfo SubjectPublicKeyInfo, issuerUniqueID [1] IMPLICIT UniqueIdentifier OPTIONAL, SubjectUniqueID [2] IMPLICIT UniqueIdentifier OPTIONAL, extensions [3] EXPLICIT Extensions OPTI
9、ONAL } Version ::= INTEGER { v3(2) } CertificateSerialNumber ::= INTEGER Validity ::= SEQUENCE { notBefore Time, notAfter Time } Time ::= CHOICE { utcTime UTCTime, generalTime GerneralizedTime } UniqueIdentifier ::= BIT STRING SubjectPublicKeyInfo ::= SEQUENCE { a
10、lgorithm AlgorithmIdentifier, subjectPublicKey BIT STRING } Extensions ::= SEQUENCE SIZE (1..MAX) OF EXTENSION Extension ::= SEQUENCE { exnID OBJECT IDENTIFIER, critical BOOLEAN DEFAULT FALSE, extnValue OCTET STRING } AlgorithmIdentifier ::= SEQUENCE { algorithm OBJECT IDENTIF
11、IER, parameters ANY DEFINED BY algorithm OPTIONAL } Name ::= CHOICE { RDNSequence } RDNSequence ::=SEQUENCE OF RelativeDistinguishedName RelativeDistinguishedName ::= SET OF AttributeTypeAndValue AttributeTypeAndValue ::= SEQUENCE { type AttributeType, value AttributeValue }
12、 AttributeType OBJECT IDENTIFIER ::= { joint-iso-ccitt (2) ds(5) attributeType (4) } AttributeValue ::= ANY DEFINED BY AttribeType -- country type countryName ATTRIBUTE WITH ATTRIBUTE-SYNTAX PrintableString (SIZE(2) )-- IS 3166 codes only MATCHES FOR EQUALITY SINGLE VALUE
13、 ::= { attributeType 6 } -- organization type organizationName ATTRIBUTE WITH ATTRIBUTE-SYNTAX caseIgnoreStringSyntax (SIZE(1..ub-organization-Name) ) ::= { attributeType 10 } -- organization unit type organizationUnitName ATTRIBUTE WITH ATTRIBUTE-SYNTAX caseIgnoreStringSyntax
14、 (SIZE(1..ub-organizational-unit-Name) ) ::= { attributeType 11 } -- common name type commonName ATTRIBUTE WITH ATTRIBUTE-SYNTAX caseIgnoreStringSyntax (SIZE(1..ub-common-Name) ) ::= { attributeType 3 } -- extensions -- key usage extension id-ce-keyUsage OBJECT IDENTIFIER ::= { id
15、ce 15 } KeyUsage ::= BIT STRING{ DigitalSignature (0) NonRepudiation (1) keyEncipherment (2) dataEncryption (3) keyAgreement (4) keyCertSign (5) cRLSign (6) encipherOnly (7) decipherOnly (8) } -- policy extension id-ce-certificatePolicies OBJECT IDENTIFIER ::=
16、 { id-ce 32 } certificatePolicies ::= SEQUENCE SIZE (1..MAX) OF PolicyInformation PolicyInformation ::= SEQUENCE { policyIdentifier CertPolicyId, policyQualifiers SEQUENCE SIZE (1..MAX) OF PolicyQualifierInfo OPTIONAL } CertPolicyId OBJECT IDENTIFIER id-cht-cp-1 OBJECT IDENTIFIER
17、 ::= {1 2 tw(886) cht(1) cp(2) policy-1(1) } PolicyQualifierInfo ::= SEQUENCE { policyQualifierId PolicyQualifierId, qualifier ANY DEFUNED BY policyQualifierId } -- subject alternative name extension id-ce-subjectAltName OBJECT IDENTIFIER ::= {id-ce 17 } SubjectAltName ::= GeneralNam
18、es GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GernalName GernalName ::= CHOICE { otherName [0] OtherName, rfc822Name [1] IA5String, dNSName [2] IA5String, x400Name [3] ORAddress, directoryName [4] Name, ediPartyName [5]
19、EDIPartyName, uniformResourceIdentifier [6] IA5String, iPAddress [7] OCTET STRING, reqisterdID [8] OBJECT IDENTIFIER } OtherName ::= SEQUENCE { type-id OBJECT IDENTIFIER, value [0] EXPLICIT ANY DEFIED BY type-id } id-taiwanPersonalID OBJECT IDENTIFIER ::= { 1 2
20、 tw(886) cht(1) id(1) } TaiwanPersonID IA5String -- basic constraints entensions id-ce-basicConstraints OBJECT IDENTIFIER ::= { id-ce 19 } BasicConstraints ::= SEQUENCE { cA BOOLEAN DEFAULT FALSE, pathConstraint INTEGER (..MAX) OPTIONAL } (三)政府機關憑證內容及查詢說明 GCA所核發政府機構憑證有兩項資料內容說明
21、 1、持有者識別名稱 (Subject Name) c=tw,o=行政院,ou=主管機關註冊窗口,cn=單位全名 2、持有者唯一識別碼 (Subject Unique ID) 依據“全國公務人員人事資訊統一代碼管理要點“規定 3、憑證查詢時輸入 全國公務人員人事資訊統一代碼 單位全名 註: country(c), organization(o), organization unit(ou), common name(cn) (四)GCA本身憑證以及簽章格式 本簽章的內容分成A,B兩部分﹐其依循的標準為X.509v3﹐ PKCS#1 v1.5﹐參照的實
22、際憑證為VeriSign(1998)和SET(1998)的憑證中的簽章格式。 Part A, Algorithm ID of RSAwithSHA_1 含DER的Tag及Length(各為一位元組)﹐和OID:sha-1WithRSAEncryption的資料則總長度為11位元組。即: 30 09 ---- signature algorithm OID 06 05 ---- OBJECT IDENTIFIER sha- 1WithRSAEncryption (1 3 14 3 2 29)
23、 2b 0e 03 02 1d ---- NULL 05 00 Part B, Signature of data of signed by RSA private key 因key length為128位元組﹐再加上Bit string ”00”的一個位元組, 所以總長度為129位元組。 名稱 Appending Algorithm ID Hash value 內容說明 PKCS#1 format SHA_1 Hash of X.509v3 to be signed data 以RSA public key解
24、密後得原來實際的資料內容 00:01:ff:ff:…..ff:00: 30:21 30:09 06:05 2b:0e:03:02:1a 05:00 04:14 SHA_1 output 資料長度(位元組) 93 15 20 03 81 81 ---- signature tag and length ---- signature(BIT STRING) 00 42 2e 40 ef 3c b8 cb a4 2b c8 b4 60 4c 7e 0c d5 57 f3 8
25、d 74 09 2b 說明: bit string data必須補成8的倍數, 所以會多加一個byte來記錄所補充的位元數, 而本列中為128bytes的資料, 所以所補的長度為0 GCA 憑證 DER code範例 以下描述某一份GCA憑證的DER編碼: 30 82 02 93 ---- certificate tag and length 30 82 02 00 ---- tag and length of to-be-signed part a0 03 ---- tag and length of certificate
26、 version 02 01 ---- integer with 1-byte length for version 3 02 ---- version 3 02 04 ---- integer with 4-byte length for serial number 0f 7f 49 02 ---- serial number 30 09 ----
27、signature algorithm OID 06 05 ( 1 3 14 3 2 29 ) 2b 0e 03 02 1d 05 00 30 57 ---- (issuer) tag and length of Name 31 0b 30 09 06 03 ---- (issuer) countryName OID ( 2 5 4 6 )
28、 55 04 06 13 02 'TW' 54 57 31 0f 30 0d 06 03 ---- (issuer) localityName OID ( 2 5 4 8 ) 55 04 08 14 06 '臺灣省'
29、 bb 4f c6 57 ac d9 31 0f 30 0d 06 03 ---- (issuer) organizationName OID ( 2 5 4 10 ) 55 04 0a 14 06 '行政院' a6 e6 ac 46 b0 7c 31 0f
30、 30 0d 06 03 ---- (issuer) organizationUnitName OID ( 2 5 4 11 ) 55 04 0b 14 06 '研考會' ac e3 a6 d2 b7 7c 31 15 30 13
31、 06 03 ---- (issuer) commonName OID ( 2 5 4 3 ) 55 04 03 14 0c '憑證管理中心' be cc c3 d2 ba de b2 7a a4 a4 a4 df 30 1e ---- Validity tag and length 17 0d
32、'980219091852Z' 39 38 30 32 31 39 30 39 31 38 35 32 5a ---- NotBefore 17 0d '000219091852Z' 30 30 30 32 31 39 30 39 31 38 35 32 5a---- NotAfter 30 5d ---- (Subject) tag and length 31 0b 30 09 06
33、03 ---- (Subject) countryName OID ( 2 5 4 6 ) 55 04 06 13 02 'TW' 54 57 31 0f 30 0d 06 03 ---- (Subject) localityName OID ( 2 5 4 8 )
34、 55 04 08 14 06 '臺灣省' bb 4f c6 57 ac d9 31 17 30 15 06 03 ---- (Subject) organizationName OID ( 2 5 4 10 ) 55 04 0a 14 0e
35、 '中華電信研究所' a4 a4 b5 d8 b9 71 ab 48 ac e3 a8 73 a9 d2 31 13 30 11 06 03 ---- (Subject) OrganizationUnitName OID ( 2 5 4 11 ) 55 04 0b 14 0a '應用科技室'
36、 c0 b3 a5 ce ac ec a7 de ab c7 31 0f 30 0d 06 03 ---- (Subject) commonName OID ( 2 5 4 3 ) 55 04 03 14 06 '王上安' a7 f5 ab d8 bd f7 30 81 9e
37、 Subject PubliceKeyInfo tag and length 30 0d ---- Algorithm OID 06 09 ( 1 2 840 113549 1 1 1 ) 2a 86 48 86 f7 0d 01 01 01 05 00 03 81 8c ---- Public Key:參照X.509規範存入 128byte的n以及3 byt
38、e的e 00 30 81 88 02 81 80 16 91 e0 a7 b6 52 f5 d0 5f b4 c2 00 bd bd 18 b7 8c e7 67 a0 65 d2 4e 42 1c c2 66 c2 1e cb e6 20 70 93 00 ab c8 14 f0 6d fc 17 40 6e 90 ba 51 37 d3 2f 7a 07 98 87 79 89 90 98 99 d4 42 6a ef 07 d2 9a 08 11 82 ae 56 a5 16 f4 d5 14 1b a4 60 7e
39、 e3 81 f1 70 2c bd de c1 9d 4b 4b 24 0d db 50 3a c8 ea e8 c6 8a d0 86 cf 74 b6 ea 6d 3c e7 9a 60 fb eb a5 17 a3 09 b2 04 ad bf ea c9 a2 bd 09 6d 02 03 01 00 01 82 1a ---- UniqueIdentifier tag and length 03 18 00 30 15 06 05 ---- id-t
40、aiwanPersonalID OID 2a 86 76 01 01 a0 0c 16 0a 55 31 32 30 30 39 37 36 37 38 ---- ID Number a3 53 30 51 30 0b 06 03 ---- keyUsage OID ( 2 5 29 15
41、 ) 55 1d 0f 04 04 ---- KeyUsage(BIT STRING) 03 02 07 80 30 09 06 03 ---- basicConstraints OID ( 2 5 29 19 ) 55 1d 13 04 02 30 00
42、 30 22 06 03 ---- subjectAltName OID ( 2 5 29 17 ) 55 1d 11 04 1b 30 19 a0 17 30 15 06 05 2a 86 76 01 01 a0 0c 16 0a 55 31 32 30 30 39 37 36 37 38 30 13
43、 06 03 ---- certificatePolicy OID ( 2 5 29 32 ) 55 1d 20 04 0c ---- id-cht-cp-1 tag and length 30 0a 30 08 06 06 2a 86 76 01 02 01 ---- id-cht-cp-1 30 09 06 05 ---- signature Alg
44、orithm OID ( 1 3 14 3 2 29 ) 2b 0e 03 02 1d 05 00 03 81 81 ---- signature tag and length ---- signature(BIT STRING) 00 42 2e 40 ef 3c b8 cb a4 2b c8 b4 60 4c 7e 0c d5 57 f3 8d 74 09 2b 4a 73 02 cf dd 06 0a da 85 90 ec 78 6a 6f 06 c5 70 1
45、d 1c b3 6f bd d8 34 11 49 e6 40 9d dc 35 e7 18 5b 43 7d 98 93 0a e5 fc e2 66 5e 48 22 16 8a 99 a3 25 bd 76 da c8 f9 e2 92 15 1e 5b ad 42 4e f7 77 d3 ed 1b 21 ee c8 fb ee 9d d6 4c 38 1b 6b a2 b9 33 36 09 85 93 fb ca de 4b 37 8e 6b 6f e7 d2 99 18 1c 70 3b 71 b8 84 37
46、簽章中取hash的範圍及內容 以下描述憑證中簽章的資料範圍: 由 30 82 02 00 ---- tag and length of to-be-signed part 到 30 0a 30 08 06 06 2a 86 76 01 02 01 ---- id-cht-cp-1 之DER code (五)憑證廢止清冊 憑證廢止清冊(Certificate Revocation List, CRL)係在某些金鑰已經有安全顧慮時,用來通知各相關單位,以避免使用該有疑慮的金鑰。本憑證管理中心之目錄伺服器會依作業準則,傳播憑證廢止清冊,以便降低有安全顧慮的金鑰遭冒用的機會
47、 1、本憑證管理中心所使用之憑證廢止清冊內容大致如下: (1) 版序 (2) 簽章演算法 (3) 憑證管理中心名稱 (4) 本次發佈時間 (5) 下次發佈時間 (6) 廢止憑證串列: 憑證序號、廢止時間、廢止憑證串列項目之擴充資料(廢止原因) (7) 廢止憑證清冊擴充資料 (8) 簽章方法 (9) 數位簽章:憑證管理中心對以上資料,使用其私密金鑰做數位簽章運算所得的數位簽章 (a) Version: Indicator of Version 1 or 2 format. (b) Signature: Indicator of the algorithm used
48、in signing this CRL. (c) Issuer: Name of the authority that issued this CRL and whose signature on this CRL. (d) This Update: Date and time of issue of this CRL. (e) Next Update: Date and time of issue of next CRL (f) User Certificate: Certificate serial number of a revoked or susp
49、ended certificate. (g) Revocation Date: Effective date of revocation or suspension of a particular certificate. (h) CRL Entry Extensions: Additional fields,the types of which must be registered,and that may be attached to each revocation entry. (I) CRL Extensions: Additional fields,the types of w
50、hich must be registered,and that may be attached to the full CRL. 註: l CRL:Certificate Revocation List l 過期的憑證其序號是不刊在CRL中的 圖一、CRL格式 2、憑證廢止清冊的ASN.1說明 憑證廢止清冊的ASN.1格式,詳如下所列: CertificateRevokationList ::= SIGNED{ SEQUENCE { version Version OPTIONAL-- if present, must be v2 signature






