用于 Adobe® Flash® Platform 的 ActionScript® 3.0 参考
主页  |  隐藏包列表和类列表 |   |   |  新增内容  |  索引  |  附录  |  为什么显示为英语?
过滤条件: AIR 30.0 和更早版本, Flash Player 30.0 和更早版本, Flash Lite 4
Flex 4.6 和更早版本, Flash Pro CS6 和更早版本
隐藏过滤条件
flash.security 

XMLSignatureValidator  - AS3

x

顶级
adobe.utils
air.desktop
air.net
air.update
air.update.events
coldfusion.air
coldfusion.air.errors
coldfusion.air.events
coldfusion.service
coldfusion.service.events
coldfusion.service.mxml
com.adobe.acm.solutions.authoring.domain.extensions
com.adobe.acm.solutions.ccr.domain.extensions
com.adobe.consulting.pst.vo
com.adobe.dct.component
com.adobe.dct.component.datadictionary
com.adobe.dct.component.datadictionaryElement
com.adobe.dct.component.dataElementsPanel
com.adobe.dct.component.toolbars
com.adobe.dct.event
com.adobe.dct.exp
com.adobe.dct.model
com.adobe.dct.service
com.adobe.dct.service.provider
com.adobe.dct.transfer
com.adobe.dct.util
com.adobe.dct.view
com.adobe.ep.taskmanagement.domain
com.adobe.ep.taskmanagement.event
com.adobe.ep.taskmanagement.filter
com.adobe.ep.taskmanagement.services
com.adobe.ep.taskmanagement.util
com.adobe.ep.ux.attachmentlist.component
com.adobe.ep.ux.attachmentlist.domain
com.adobe.ep.ux.attachmentlist.domain.events
com.adobe.ep.ux.attachmentlist.domain.renderers
com.adobe.ep.ux.attachmentlist.skin
com.adobe.ep.ux.attachmentlist.skin.renderers
com.adobe.ep.ux.content.event
com.adobe.ep.ux.content.factory
com.adobe.ep.ux.content.handlers
com.adobe.ep.ux.content.managers
com.adobe.ep.ux.content.model.asset
com.adobe.ep.ux.content.model.preview
com.adobe.ep.ux.content.model.relation
com.adobe.ep.ux.content.model.search
com.adobe.ep.ux.content.model.toolbar
com.adobe.ep.ux.content.search
com.adobe.ep.ux.content.services
com.adobe.ep.ux.content.services.load
com.adobe.ep.ux.content.services.permissions
com.adobe.ep.ux.content.services.preview
com.adobe.ep.ux.content.services.providers
com.adobe.ep.ux.content.services.query
com.adobe.ep.ux.content.services.relationships
com.adobe.ep.ux.content.services.search.lccontent
com.adobe.ep.ux.content.services.version
com.adobe.ep.ux.content.view
com.adobe.ep.ux.content.view.components.activate
com.adobe.ep.ux.content.view.components.grid
com.adobe.ep.ux.content.view.components.grid.hover
com.adobe.ep.ux.content.view.components.grid.hover.component
com.adobe.ep.ux.content.view.components.grid.renderers
com.adobe.ep.ux.content.view.components.relationships
com.adobe.ep.ux.content.view.components.review
com.adobe.ep.ux.content.view.components.search.renderers
com.adobe.ep.ux.content.view.components.searchpod
com.adobe.ep.ux.content.view.components.toolbar
com.adobe.ep.ux.content.view.components.toolbar.controlRenderers
com.adobe.ep.ux.content.view.components.version
com.adobe.ep.ux.documentsubmit.component
com.adobe.ep.ux.documentsubmit.domain
com.adobe.ep.ux.documentsubmit.skin
com.adobe.ep.ux.taskaction.component
com.adobe.ep.ux.taskaction.domain
com.adobe.ep.ux.taskaction.domain.events
com.adobe.ep.ux.taskaction.skin
com.adobe.ep.ux.taskdetails.component
com.adobe.ep.ux.taskdetails.domain
com.adobe.ep.ux.taskdetails.skin
com.adobe.ep.ux.tasklist.component
com.adobe.ep.ux.tasklist.domain
com.adobe.ep.ux.tasklist.skin
com.adobe.ep.ux.webdocumentviewer.domain
com.adobe.exm.expression
com.adobe.exm.expression.error
com.adobe.exm.expression.event
com.adobe.exm.expression.impl
com.adobe.fiber.runtime.lib
com.adobe.fiber.services
com.adobe.fiber.services.wrapper
com.adobe.fiber.styles
com.adobe.fiber.util
com.adobe.fiber.valueobjects
com.adobe.gravity.binding
com.adobe.gravity.context
com.adobe.gravity.flex.bundleloader
com.adobe.gravity.flex.progress
com.adobe.gravity.flex.serviceloader
com.adobe.gravity.framework
com.adobe.gravity.init
com.adobe.gravity.service.bundleloader
com.adobe.gravity.service.logging
com.adobe.gravity.service.manifest
com.adobe.gravity.service.progress
com.adobe.gravity.tracker
com.adobe.gravity.ui
com.adobe.gravity.utility
com.adobe.gravity.utility.async
com.adobe.gravity.utility.error
com.adobe.gravity.utility.events
com.adobe.gravity.utility.factory
com.adobe.gravity.utility.flex.async
com.adobe.gravity.utility.logging
com.adobe.gravity.utility.message
com.adobe.gravity.utility.sequence
com.adobe.gravity.utility.url
com.adobe.guides.control
com.adobe.guides.domain
com.adobe.guides.i18n
com.adobe.guides.spark.components.skins
com.adobe.guides.spark.components.skins.mx
com.adobe.guides.spark.headers.components
com.adobe.guides.spark.headers.skins
com.adobe.guides.spark.layouts.components
com.adobe.guides.spark.layouts.skins
com.adobe.guides.spark.navigators.components
com.adobe.guides.spark.navigators.renderers
com.adobe.guides.spark.navigators.skins
com.adobe.guides.spark.util
com.adobe.guides.spark.wrappers.components
com.adobe.guides.spark.wrappers.skins
com.adobe.guides.submit
com.adobe.icc.dc.domain
com.adobe.icc.dc.domain.factory
com.adobe.icc.editors.events
com.adobe.icc.editors.handlers
com.adobe.icc.editors.managers
com.adobe.icc.editors.model
com.adobe.icc.editors.model.config
com.adobe.icc.editors.model.el
com.adobe.icc.editors.model.el.operands
com.adobe.icc.editors.model.el.operators
com.adobe.icc.enum
com.adobe.icc.external.dc
com.adobe.icc.obj
com.adobe.icc.services
com.adobe.icc.services.category
com.adobe.icc.services.config
com.adobe.icc.services.download
com.adobe.icc.services.export
com.adobe.icc.services.external
com.adobe.icc.services.formbridge
com.adobe.icc.services.fragmentlayout
com.adobe.icc.services.layout
com.adobe.icc.services.letter
com.adobe.icc.services.locator
com.adobe.icc.services.module
com.adobe.icc.services.render
com.adobe.icc.services.submit
com.adobe.icc.services.user
com.adobe.icc.token
com.adobe.icc.vo
com.adobe.icc.vo.render
com.adobe.icomm.assetplacement.controller
com.adobe.icomm.assetplacement.controller.utils
com.adobe.icomm.assetplacement.data
com.adobe.icomm.assetplacement.model
com.adobe.livecycle.assetmanager.client
com.adobe.livecycle.assetmanager.client.event
com.adobe.livecycle.assetmanager.client.handler
com.adobe.livecycle.assetmanager.client.managers
com.adobe.livecycle.assetmanager.client.model
com.adobe.livecycle.assetmanager.client.model.cms
com.adobe.livecycle.assetmanager.client.service
com.adobe.livecycle.assetmanager.client.service.search
com.adobe.livecycle.assetmanager.client.service.search.cms
com.adobe.livecycle.assetmanager.client.utils
com.adobe.livecycle.content
com.adobe.livecycle.rca.model
com.adobe.livecycle.rca.model.constant
com.adobe.livecycle.rca.model.document
com.adobe.livecycle.rca.model.participant
com.adobe.livecycle.rca.model.reminder
com.adobe.livecycle.rca.model.stage
com.adobe.livecycle.rca.service
com.adobe.livecycle.rca.service.core
com.adobe.livecycle.rca.service.core.delegate
com.adobe.livecycle.rca.service.process
com.adobe.livecycle.rca.service.process.delegate
com.adobe.livecycle.rca.token
com.adobe.livecycle.ria.security.api
com.adobe.livecycle.ria.security.service
com.adobe.mosaic.layouts
com.adobe.mosaic.layouts.dragAndDrop
com.adobe.mosaic.layouts.interfaces
com.adobe.mosaic.mxml
com.adobe.mosaic.om.constants
com.adobe.mosaic.om.events
com.adobe.mosaic.om.impl
com.adobe.mosaic.om.interfaces
com.adobe.mosaic.skinning
com.adobe.mosaic.sparklib.editors
com.adobe.mosaic.sparklib.optionMenu
com.adobe.mosaic.sparklib.scrollableMenu
com.adobe.mosaic.sparklib.scrollableMenu.skins
com.adobe.mosaic.sparklib.tabLayout
com.adobe.mosaic.sparklib.tabLayout.events
com.adobe.mosaic.sparklib.tabLayout.layouts
com.adobe.mosaic.sparklib.tabLayout.skins
com.adobe.mosaic.sparklib.text
com.adobe.mosaic.sparklib.util
com.adobe.solutions.acm.authoring.presentation
com.adobe.solutions.acm.authoring.presentation.actionbar
com.adobe.solutions.acm.authoring.presentation.common
com.adobe.solutions.acm.authoring.presentation.events
com.adobe.solutions.acm.authoring.presentation.fragment
com.adobe.solutions.acm.authoring.presentation.letter
com.adobe.solutions.acm.authoring.presentation.letter.data
com.adobe.solutions.acm.authoring.presentation.preview
com.adobe.solutions.acm.authoring.presentation.rte
com.adobe.solutions.acm.ccr.presentation
com.adobe.solutions.acm.ccr.presentation.contentcapture
com.adobe.solutions.acm.ccr.presentation.contentcapture.events
com.adobe.solutions.acm.ccr.presentation.contentcapture.preview
com.adobe.solutions.acm.ccr.presentation.datacapture
com.adobe.solutions.acm.ccr.presentation.datacapture.renderers
com.adobe.solutions.acm.ccr.presentation.pdf
com.adobe.solutions.exm
com.adobe.solutions.exm.authoring
com.adobe.solutions.exm.authoring.components.controls
com.adobe.solutions.exm.authoring.components.toolbars
com.adobe.solutions.exm.authoring.domain
com.adobe.solutions.exm.authoring.domain.expression
com.adobe.solutions.exm.authoring.domain.impl
com.adobe.solutions.exm.authoring.domain.method
com.adobe.solutions.exm.authoring.domain.variable
com.adobe.solutions.exm.authoring.enum
com.adobe.solutions.exm.authoring.events
com.adobe.solutions.exm.authoring.model
com.adobe.solutions.exm.authoring.renderer
com.adobe.solutions.exm.authoring.view
com.adobe.solutions.exm.expression
com.adobe.solutions.exm.impl
com.adobe.solutions.exm.impl.method
com.adobe.solutions.exm.method
com.adobe.solutions.exm.mock
com.adobe.solutions.exm.mock.method
com.adobe.solutions.exm.runtime
com.adobe.solutions.exm.runtime.impl
com.adobe.solutions.exm.variable
com.adobe.solutions.prm.constant
com.adobe.solutions.prm.domain
com.adobe.solutions.prm.domain.factory
com.adobe.solutions.prm.domain.impl
com.adobe.solutions.prm.domain.manager
com.adobe.solutions.prm.presentation.asset
com.adobe.solutions.prm.presentation.constant
com.adobe.solutions.prm.presentation.document
com.adobe.solutions.prm.presentation.event
com.adobe.solutions.prm.presentation.file
com.adobe.solutions.prm.presentation.project
com.adobe.solutions.prm.presentation.team
com.adobe.solutions.prm.presentation.util
com.adobe.solutions.prm.service
com.adobe.solutions.prm.services.impl
com.adobe.solutions.prm.vo
com.adobe.solutions.rca.constant
com.adobe.solutions.rca.domain
com.adobe.solutions.rca.domain.common
com.adobe.solutions.rca.domain.factory
com.adobe.solutions.rca.domain.impl
com.adobe.solutions.rca.domain.impl.manager
com.adobe.solutions.rca.domain.manager
com.adobe.solutions.rca.presentation
com.adobe.solutions.rca.presentation.comment
com.adobe.solutions.rca.presentation.constant
com.adobe.solutions.rca.presentation.event
com.adobe.solutions.rca.presentation.gantt
com.adobe.solutions.rca.presentation.gantt.ruler
com.adobe.solutions.rca.presentation.template
com.adobe.solutions.rca.presentation.template.audit
com.adobe.solutions.rca.presentation.template.definition
com.adobe.solutions.rca.presentation.template.documents
com.adobe.solutions.rca.presentation.template.stages
com.adobe.solutions.rca.presentation.util
com.adobe.solutions.rca.service
com.adobe.solutions.rca.services.impl
com.adobe.solutions.rca.vo
com.adobe.solutions.rca.vo.um
com.adobe.viewsource
fl.accessibility
fl.containers
fl.controls
fl.controls.dataGridClasses
fl.controls.listClasses
fl.controls.progressBarClasses
fl.core
fl.data
fl.display
fl.events
fl.ik
fl.lang
fl.livepreview
fl.managers
fl.motion
fl.motion.easing
fl.rsl
fl.text
fl.transitions
fl.transitions.easing
fl.video
flash.accessibility
flash.concurrent
flash.crypto
flash.data
flash.desktop
flash.display
flash.display3D
flash.display3D.textures
flash.errors
flash.events
flash.external
flash.filesystem
flash.filters
flash.geom
flash.globalization
flash.html
flash.media
flash.net
flash.net.dns
flash.net.drm
flash.notifications
flash.permissions
flash.printing
flash.profiler
flash.sampler
flash.security
flash.sensors
flash.system
flash.text
flash.text.engine
flash.text.ime
flash.ui
flash.utils
flash.xml
flashx.textLayout
flashx.textLayout.compose
flashx.textLayout.container
flashx.textLayout.conversion
flashx.textLayout.edit
flashx.textLayout.elements
flashx.textLayout.events
flashx.textLayout.factory
flashx.textLayout.formats
flashx.textLayout.operations
flashx.textLayout.utils
flashx.undo
ga.controls
ga.layouts
ga.model
ga.uiComponents
ga.util
ga.views
ga.wrappers
lc.foundation
lc.foundation.domain
lc.foundation.events
lc.foundation.ui
lc.foundation.util
lc.preloader
lc.procmgmt
lc.procmgmt.commands
lc.procmgmt.domain
lc.procmgmt.events
lc.procmgmt.formbridge
lc.procmgmt.impl
lc.procmgmt.ui.attachments
lc.procmgmt.ui.controls
lc.procmgmt.ui.controls.card
lc.procmgmt.ui.controls.renderer
lc.procmgmt.ui.help
lc.procmgmt.ui.layout
lc.procmgmt.ui.presentationmodel
lc.procmgmt.ui.process
lc.procmgmt.ui.search
lc.procmgmt.ui.startpoint
lc.procmgmt.ui.task
lc.procmgmt.ui.task.form
lc.procmgmt.ui.task.form.commands
lc.procmgmt.ui.tracking
mx.accessibility
mx.automation
mx.automation.air
mx.automation.delegates
mx.automation.delegates.advancedDataGrid
mx.automation.delegates.charts
mx.automation.delegates.containers
mx.automation.delegates.controls
mx.automation.delegates.controls.dataGridClasses
mx.automation.delegates.controls.fileSystemClasses
mx.automation.delegates.core
mx.automation.delegates.flashflexkit
mx.automation.events
mx.binding
mx.binding.utils
mx.charts
mx.charts.chartClasses
mx.charts.effects
mx.charts.effects.effectClasses
mx.charts.events
mx.charts.renderers
mx.charts.series
mx.charts.series.items
mx.charts.series.renderData
mx.charts.styles
mx.collections
mx.collections.errors
mx.containers
mx.containers.accordionClasses
mx.containers.dividedBoxClasses
mx.containers.errors
mx.containers.utilityClasses
mx.controls
mx.controls.advancedDataGridClasses
mx.controls.dataGridClasses
mx.controls.listClasses
mx.controls.menuClasses
mx.controls.olapDataGridClasses
mx.controls.scrollClasses
mx.controls.sliderClasses
mx.controls.textClasses
mx.controls.treeClasses
mx.controls.videoClasses
mx.core
mx.core.windowClasses
mx.data
mx.data.crypto
mx.data.errors
mx.data.events
mx.data.messages
mx.data.mxml
mx.data.offline.errors
mx.data.utils
mx.effects
mx.effects.easing
mx.effects.effectClasses
mx.events
mx.filters
mx.flash
mx.formatters
mx.geom
mx.graphics
mx.graphics.codec
mx.graphics.shaderClasses
mx.logging
mx.logging.errors
mx.logging.targets
mx.managers
mx.messaging
mx.messaging.channels
mx.messaging.config
mx.messaging.errors
mx.messaging.events
mx.messaging.management
mx.messaging.messages
mx.modules
mx.netmon
mx.olap
mx.olap.aggregators
mx.preloaders
mx.printing
mx.resources
mx.rpc
mx.rpc.events
mx.rpc.http
mx.rpc.http.mxml
mx.rpc.livecycle
mx.rpc.mxml
mx.rpc.remoting
mx.rpc.remoting.mxml
mx.rpc.soap
mx.rpc.soap.mxml
mx.rpc.wsdl
mx.rpc.xml
mx.skins
mx.skins.halo
mx.skins.spark
mx.skins.wireframe
mx.skins.wireframe.windowChrome
mx.states
mx.styles
mx.utils
mx.validators
org.osmf.containers
org.osmf.display
org.osmf.elements
org.osmf.events
org.osmf.layout
org.osmf.logging
org.osmf.media
org.osmf.metadata
org.osmf.net
org.osmf.net.dvr
org.osmf.net.httpstreaming
org.osmf.net.metrics
org.osmf.net.qos
org.osmf.net.rtmpstreaming
org.osmf.net.rules
org.osmf.traits
org.osmf.utils
spark.accessibility
spark.automation.delegates
spark.automation.delegates.components
spark.automation.delegates.components.gridClasses
spark.automation.delegates.components.mediaClasses
spark.automation.delegates.components.supportClasses
spark.automation.delegates.skins.spark
spark.automation.events
spark.collections
spark.components
spark.components.calendarClasses
spark.components.gridClasses
spark.components.mediaClasses
spark.components.supportClasses
spark.components.windowClasses
spark.core
spark.effects
spark.effects.animation
spark.effects.easing
spark.effects.interpolation
spark.effects.supportClasses
spark.events
spark.filters
spark.formatters
spark.formatters.supportClasses
spark.globalization
spark.globalization.supportClasses
spark.layouts
spark.layouts.supportClasses
spark.managers
spark.modules
spark.preloaders
spark.primitives
spark.primitives.supportClasses
spark.skins
spark.skins.mobile
spark.skins.mobile.supportClasses
spark.skins.spark
spark.skins.spark.mediaClasses.fullScreen
spark.skins.spark.mediaClasses.normal
spark.skins.spark.windowChrome
spark.skins.wireframe
spark.skins.wireframe.mediaClasses
spark.skins.wireframe.mediaClasses.fullScreen
spark.transitions
spark.utils
spark.validators
spark.validators.supportClasses
xd.core.axm.enterprise.view.components
xd.core.axm.enterprise.view.skins
xd.core.axm.view.components
xd.core.axm.view.components.support

语言元素

全局常量
全局函数
运算符
语句、关键字和指令
特殊类型

附录

新增内容
编译器错误
编译器警告
运行时错误
迁移到 ActionScript 3
支持的字符集
仅适用于 MXML 的标签
Motion XML 元素
Timed Text 标记
不推荐使用的元素的列表
AccessibilityImplementation 常量
如何使用 ActionScript 示例
法律声明
flash.security
public class XMLSignatureValidator
继承XMLSignatureValidator Inheritance EventDispatcher Inheritance Object

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

XMLSignatureValidator 类验证 XML 签名文件是否格式正确且未修改,以及它是否使用链接到受信任数字证书的密钥进行签名(可选)。

AIR 配置文件支持:所有桌面操作系统和 AIR for TV 设备均支持此功能,但移动设备不支持此功能。您可以使用 XMLSignatureValidator.isSupported 属性在运行时测试是否受支持。有关在多个配置文件之间支持 API 的详细信息,请参阅 AIR 配置文件支持

XMLSignatureValidator 针对 XML 签名语法和处理实现 W3C 建议的子集,XMLSignatureValidator 不应视为符合该建议的实现。该建议支持的子集包括:

  • 除 KeyInfo 元素外的所有核心签名语法。
  • KeyInfo 元素仅支持 X509Data 元素。
  • X509Data 元素仅支持 X509Certificate 元素。
  • SHA256 摘要方法算法。
  • PKCS1 签名算法。
  • “不带注释的规范化 XML”规范化方法和转换算法。
  • 采用其他签名语法的 Manifest 元素。

必须提供 IURIDereferencer 实现才能验证 XML 签名。此实现类负责解析签名文件的 SignedInfo 元素中指定的 URI 并返回实现 IDataInput 接口的对象(如 ByteArray)中引用的数据。

为了验证签名证书是否链接到受信任的证书,XML 签名必须以 X509Certificate 元素的形式包含构建链所需的证书,或者您必须使用 addCertificate() 方法提供构建该链所需的证书。

验证 XMLSignature:

  1. 创建 XMLSignatureValidator 类的实例。
  2. 将该实例的 uriDereferencer 属性设置为 IURIDereferencer 实现类的实例。
  3. 需要时,使用 addCertificate 方法提供 DER 编码的证书以便构建证书信任链。
  4. 调用 XMLSignatureValidator verify 方法,传入要验证的签名。
  5. XMLSignatureValidator 对象调度 complete 事件后,检查 validityStatus 属性。

关于签名状态:

XML 签名的有效性可以为 valid、invalid 或 unknown。整体状态取决于签名文件各个组件的验证状态:

  • digestStatus — 通过 SignedInfo 元素计算的加密签名的有效性。可以是 validinvalidunknown
  • identityStatus — 签名证书的有效性。如果证书已到期、已吊销或已更改,则该状态为 invalid。如果无法将证书链接到受信任的根证书,则该状态为 unknown。如果摘要无效,则不检查证书。如果不检查证书,状态将报告为 unknown
  • referencesStatus — 签名文件的 SignedInfo 元素中引用定址的数据的有效性。可以是 validinvalidunknown。如果摘要或证书无效,则不检查引用。还可以根据 referencesValidationSetting 属性的设置跳过引用检查。如果不检查证书,状态将报告为 unknown

validityStatus 属性报告的签名有效性可以为:

  • valid — 如果 referencesStatusdigestStatusidentityStatus 全部为 valid
  • invalid — 如果其中任一状态为 invalid
  • unknown — 如果 referencesStatusdigestStatusidentityStatusunknown

规范化限制:

AIR 中的 XML 引擎对 XML 文档进行规范化时,并不总是能生成预期的 XML 字符串。因此,建议避免在已包封或已分离的签名文档中放置元素间空白,且不要重新定义签名文档内的命名空间。在这两种情况下,AIR 都可能无法重新创建具有相同字符序列的文档,进而导致验证失败。

查看示例

了解详细信息

相关 API 元素



公共属性
 属性由以下参数定义
 Inheritedconstructor : Object
对类对象或给定对象实例的构造函数的引用。
Object
      digestStatus : String
[只读] 通过签名 SignedInfo 元素计算的加密签名的有效性状态。
XMLSignatureValidator
      identityStatus : String
[只读] 签名证书的有效性状态。
XMLSignatureValidator
      isSupported : Boolean
[静态] [只读] 如果当前平台支持 XMLSignatureValidator 类,则 isSupported 属性设置为 true,否则,设置为 false。
XMLSignatureValidator
      referencesStatus : String
[只读] 签名 SignedInfo 元素中引用数据的有效性状态。
XMLSignatureValidator
      referencesValidationSetting : String
指定在什么条件下检查引用。
XMLSignatureValidator
      revocationCheckSetting : String
指定如何检查证书吊销。
XMLSignatureValidator
      signerCN : String
[只读] 签名证书的“公共名称”字段。
XMLSignatureValidator
      signerDN : String
[只读] 签名证书的“识别名称”字段。
XMLSignatureValidator
      signerExtendedKeyUsages : Array
[只读] 包含签名证书中列出的扩展密钥用法 OID 的数组。
XMLSignatureValidator
      signerTrustSettings : Array
[只读] 包含签名证书的信任设置的数组。
XMLSignatureValidator
      uriDereferencer : IURIDereferencer
IURIDereferencer 实现。
XMLSignatureValidator
      useSystemTrustStore : Boolean
指定使用系统信任存储中的证书来构建链。
XMLSignatureValidator
      validityStatus : String
[只读] 经过验证的 XML 签名的有效性状态。
XMLSignatureValidator
公共方法
 方法由以下参数定义
  
创建 XMLSignatureValidator 对象。
XMLSignatureValidator
  
    addCertificate(cert:ByteArray, trusted:Boolean):*
添加 x509 证书以构建链。
XMLSignatureValidator
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
使用 EventDispatcher 对象注册事件侦听器对象,以使侦听器能够接收事件通知。
EventDispatcher
 Inherited
将事件调度到事件流中。
EventDispatcher
 Inherited
检查 EventDispatcher 对象是否为特定事件类型注册了任何侦听器。
EventDispatcher
 Inherited
表示对象是否已经定义了指定的属性。
Object
 Inherited
表示 Object 类的实例是否在指定为参数的对象的原型链中。
Object
 Inherited
表示指定的属性是否存在、是否可枚举。
Object
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
从 EventDispatcher 对象中删除侦听器。
EventDispatcher
 Inherited
设置循环操作动态属性的可用性。
Object
 Inherited
返回此对象的字符串表示形式,其格式设置遵守区域设置特定的约定。
Object
 Inherited
返回指定对象的字符串表示形式。
Object
 Inherited
返回指定对象的原始值。
Object
  
    verify(signature:XML):void
验证指定的签名。
XMLSignatureValidator
 Inherited
检查是否用此 EventDispatcher 对象或其任何祖代为指定事件类型注册了事件侦听器。
EventDispatcher
事件
 事件 摘要 由以下参数定义
 Inherited[广播事件] Flash Player 或 AIR 应用程序获得操作系统焦点并变为活动状态时将调度此事件。EventDispatcher
  
    complete
在完成验证时调度。XMLSignatureValidator
 Inherited[广播事件] Flash Player 或 AIR 应用程序失去操作系统焦点并变为非活动状态时将调度此事件。EventDispatcher
  
    error
由于错误而无法完成验证时调度。XMLSignatureValidator
属性详细信息
    

digestStatus

属性
digestStatus:String  [只读]

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

通过签名 SignedInfo 元素计算的加密签名的有效性状态。

状态为:

  • valid - 如果签名加密有效。
  • invalid - 如果在签名后更改了摘要。
  • unknown — 如果尚未调用 verify() 方法。

注意:如果 digestStatus 无效,则不检查 identityStatusreferencesStatus,并会将其报告为 unknown



实现
    public function get digestStatus():String

引发
IllegalOperationError — 如果在正在验证签名时访问。
    

identityStatus

属性 
identityStatus:String  [只读]

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

签名证书的有效性状态。

该状态可以是:

  • valid - 证书尚未过期,吊销检查未失败且链接到受信任的根证书。
  • unknown — 证书尚未过期,吊销检查没有失败,但没有链接到受信任的根证书。尚未验证状态时也会报告 unknown,不管是因为尚未调用 verify() 方法还是因为 SignedInfo 元素 (digestStatus) 的加密签名无效。
  • invalid — 证书已过期或吊销检查失败。

无论证书是否被视为有效,使用 addCertificate() 方法添加的证书以及 revocationCheckSettinguseSystemTrustStore 属性的设置都可以进行更改。

注意:如果 identityStatus 无效,则不检查 referencesStatus,并会将其报告为 unknown。此外,当 identityStatus 为 unknown 时,不检查引用,除非 referencesValidationSettingvalidOrUnknownIdentity



实现
    public function get identityStatus():String

引发
IllegalOperationError — 如果在正在验证签名时访问。

相关 API 元素


示例  ( 如何使用本示例 )
下例得到对签名证书进行验证后的结果(已验证签名之后):
 import flash.security.XMLSignatureValidator;
 
 
 var verifier:XMLSignatureValidator = new XMLSignatureValidator();
 //validate a signature...
  
 var identityResult:String = verifier.identityStatus;
    

isSupported

属性 
isSupported:Boolean  [只读]

语言版本: ActionScript 3.0
运行时版本: AIR 2

如果当前平台支持 XMLSignatureValidator 类,则 isSupported 属性设置为 true,否则,设置为 false



实现
    public static function get isSupported():Boolean
    

referencesStatus

属性 
referencesStatus:String  [只读]

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

签名 SignedInfo 元素中引用数据的有效性状态。

该状态可以是:

  • valid - 如果所有引用都有效。
  • invalid - 如果任何引用无效。
  • unknown - 如果未验证。在以下环境中引用可以保持未验证状态:
    • 尚未调用 verify() 方法
    • SignedInfo 元素的加密签名 (digestStatus) 无效。
    • 签名证书 (identityStatus) 无效
    • referencesValidationSettingvalidIdentity(默认设置),且签名证书的 identityStatus 未知。
    • referencesValidationSettingnever

重要说明:不验证外部资源,除非在签名文档内的 SignedInfo 元素中直接引用这些外部资源。不验证辅助引用所指的外部资源。例如,如果 XML 签名签署了一个 manifest 元素,则仅验证 manifest 元素自身的完整性。不检查 manifest 中列出的文件。



实现
    public function get referencesStatus():String

引发
IllegalOperationError — 如果在正在验证签名时访问。

相关 API 元素


示例  ( 如何使用本示例 )
下例得到对签名中的引用进行验证后的结果(已验证签名之后):
 import flash.security.XMLSignatureValidator;
 
 var verifier:XMLSignatureValidator = new XMLSignatureValidator();
 //validate a signature...
  
 var dataResult:String = verifier.referencesStatus;
    

referencesValidationSetting

属性 
referencesValidationSetting:String

语言版本: ActionScript 3.0
运行时版本: AIR 1.5

指定在什么条件下检查引用。

使用 ReferencesValidationSetting 类中定义的常量来设置此属性。这些设置包括:

  • ReferencesValidationSetting.VALID_IDENTITY - 仅在签名证书有效且与受信任的根有联系时检查引用。这是默认设置。
  • ReferencesValidationSetting.VALID_OR_UNKNOWN_IDENTITY - 如果签名证书有效,即使与受信任的根无联系,也会检查引用。
  • ReferencesValidationSetting.NEVER — 从不检查引用。

对于以商业证书签署的签名,或当您以 addCertificate() 方法提供自己的证书作为受信任的锚记时,将使用默认设置 validIdentity。在已签名文档无论如何都会被拒绝时,此设置避免了检查引用有效性的开销。

对于以自签名证书签署的签名,将使用 validOrUnknownIdentity 设置。此设置使您可以验证已签名的数据未被更改,但无法确定签名者的身份。

此类验证对您的应用程序并不重要时,使用 never 设置可避免验证引用的开销。



实现
    public function get referencesValidationSetting():String
    public function set referencesValidationSetting(value:String):void

引发
IllegalOperationError — 如果在正在验证签名时设置。
 
ArgumentError — 如果 setting 参数包含 ReferencesValidationSetting 类中未定义的值。

相关 API 元素


示例  ( 如何使用本示例 )
下例将 XMLSignatureValidator 对象设置为仅在签名证书与信任锚记有联系时检查引用:
 import flash.security.ReferencesValidationSetting;
 
 var verifier:XMLSignatureValidator = new XMLSignatureValidator(); 
 verifier.referencesValidationSetting = ReferencesValidationSetting.VALID_OR_UNKNOWN_IDENTITY;
    

revocationCheckSetting

属性 
revocationCheckSetting:String

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

指定如何检查证书吊销。

使用 RevocationSettings 类中定义的常量来设置此属性。这些设置包括:

  • RevocationCheckSettings.NEVER - 不检查证书吊销。
  • RevocationCheckSettings.BEST_EFFORT - 如果吊销信息可用且可以获取吊销状态,则检查证书吊销。如果无法明确确定吊销状态,则不拒绝该证书。
  • RevocationCheckSettings.REQUIRED_IF_AVAILABLE - 如果证书包括吊销信息,则必须明确确定吊销状态以验证该证书。
  • RevocationCheckSettings.ALWAYS_REQUIRED - 始终检查证书吊销。拒绝没有吊销信息的证书。



实现
    public function get revocationCheckSetting():String
    public function set revocationCheckSetting(value:String):void

引发
IllegalOperationError — 如果在正在验证签名时设置。

相关 API 元素

    

signerCN

属性 
signerCN:String  [只读]

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

签名证书的“公共名称”字段。



实现
    public function get signerCN():String

示例  ( 如何使用本示例 )
下例读取签名证书的公用名称(已验证签名之后):
 
 var verifier:XMLSignatureValidator = new XMLSignatureValidator();
 //validate a signature...
  
 var commonName:String = verifier.signerCN;
    

signerDN

属性 
signerDN:String  [只读]

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

签名证书的“识别名称”字段。



实现
    public function get signerDN():String

示例  ( 如何使用本示例 )
下例读取签名证书的判别名(已验证签名之后):
 
 var verifier:XMLSignatureValidator = new XMLSignatureValidator();
 //validate a signature...
  
 var distinguishedName:String = verifier.signerDN;
    

signerExtendedKeyUsages

属性 
signerExtendedKeyUsages:Array  [只读]

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

包含签名证书中列出的扩展密钥用法 OID 的数组。

每种扩展密钥用法均以数字 OID 形式进行报告。



实现
    public function get signerExtendedKeyUsages():Array

引发
IllegalOperationError — 如果在正在验证签名时访问。

示例  ( 如何使用本示例 )
下例读取签名证书的扩展密钥 OID(已验证签名之后):
 import flash.security.XMLSignatureValidator;
 
 var verifier:XMLSignatureValidator = new XMLSignatureValidator();
 //validate a signature...
  
 var extendedKeyOIDs:Array = verifier.signerExtendedKeyUsages;
    

signerTrustSettings

属性 
signerTrustSettings:Array  [只读]

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

包含签名证书的信任设置的数组。

信任设置是从系统和证书中嵌入的密钥用法 OID 中派生的。用作表示已识别的信任设置的字符串的常量在 SignerTrustSettings 类中定义。

unknowninvalid 证书的 signerTrustSettings 数组为空数组。

修改该数组不会更改证书信任设置。



实现
    public function get signerTrustSettings():Array

引发
IllegalOperationError — 如果在正在验证签名时访问。

相关 API 元素


示例  ( 如何使用本示例 )
下例读取签名证书的信任设置(已验证签名之后):
 import flash.security.XMLSignatureValidator;
 
 var verifier:XMLSignatureValidator = new XMLSignatureValidator();
 //validate a signature...
  
 var certificateTrustedFor:Array = verifier.signerTrustSettings;
    

uriDereferencer

属性 
uriDereferencer:IURIDereferencer

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

IURIDereferencer 实现。

尝试验证签名之前必须提供 IURIDereferencer 实现。



实现
    public function get uriDereferencer():IURIDereferencer
    public function set uriDereferencer(value:IURIDereferencer):void

引发
IllegalOperationError — 如果在正在验证签名时设置。

相关 API 元素


示例  ( 如何使用本示例 )
下例创建 SignedMessageDereferencer 的一个实例(它实现了 IURIDereferencer 接口),并将其设置为用于签名验证的去引用器:
 import com.example.SignedMessageDereferencer; //A custom class implementing IURIDereferencer
 
 var verifier:XMLSignatureValidator = new XMLSignatureValidator(); 
 verifier.uriDereferencer = new SignedMessageDereferencer();
    

useSystemTrustStore

属性 
useSystemTrustStore:Boolean

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

指定使用系统信任存储中的证书来构建链。

如果为 true,则使用系统信任存储中的信任锚记作为受信任的根。默认情况下不使用系统信任存储。



实现
    public function get useSystemTrustStore():Boolean
    public function set useSystemTrustStore(value:Boolean):void

引发
IllegalOperationError — 如果在正在验证签名时设置。

示例  ( 如何使用本示例 )
下例创建一个 XMLSignatureValidator 实例,并将其设置为在验证 XML 签名时使用受信任证书的系统存储库:
 var verifier:XMLSignatureValidator = new XMLSignatureValidator(); 
 verifier.useSystemTrustStore = true;
    

validityStatus

属性 
validityStatus:String  [只读]

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

经过验证的 XML 签名的有效性状态。

验证 XML 签名的途径是验证 SignedInfo 元素的加密签名、签名证书以及 SignedInfo 元素中引用所指的数据。这些元素中每个元素的有效性分别由 digestStatusidentityStatus()referencesStatus 属性进行报告。

XML 签名的有效性可以为 valid、invalid 或 unknown。整体状态取决于签名文件各个组件的验证状态:

  • digestStatus - 通过 SignedInfo 元素计算的加密签名的有效性。
  • identityStatus - 签名证书的有效性。
  • referencesStatus - 签名 SignedInfo 元素中引用摘要的有效性。

validityStatus 属性报告的签名有效性可以为:

  • valid — 如果 referencesStatusdigestStatusidentityStatus 全部为 valid
  • invalid — 如果其中任一状态为 invalid
  • unknown - 如果其中任何一个状态为 unknown



实现
    public function get validityStatus():String

引发
IllegalOperationError — 如果在正在验证签名时访问。

相关 API 元素


示例  ( 如何使用本示例 )
下例得到验证 XML 签名的结果
 import flash.security.XMLSignatureValidator;
 
 var verifier:XMLSignatureValidator = new XMLSignatureValidator();
 //validate the signature...
  
 var validationResult:String = verifier.validityStatus;
构造函数详细信息
    

XMLSignatureValidator

()构造函数
public function XMLSignatureValidator()

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

创建 XMLSignatureValidator 对象。

在调用新对象的 verify() 方法之前必须设置 uriDereferencer 属性。

相关 API 元素


示例  ( 如何使用本示例 )

下例创建并设置一个新的 XMLSignatureValidator 对象:
 
import com.example.EnvelopedDereferencer; //Your custom IURIDereferencer implementation

//Create the object
var verifier:XMLSignatureValidator = new XMLSignatureValidator();

//Provide the IURIDerferencer
verifier.uriDereferencer = new EnvelopedDereferencer(xmlDoc);

//Set validation options
verifier.referencesValidationSetting = ReferencesValidationSetting.VALID_OR_UNKNOWN_IDENTITY;
verifier.revocationCheckSetting = RevocationCheckSettings.NEVER;
verifier.useSystemTrustStore = true;

//Add listeners to handle results
verifier.addEventListener(Event.COMPLETE, verificationComplete);
verifier.addEventListener(ErrorEvent.ERROR, verificationError);
方法详细信息

    addCertificate

()方法
public function addCertificate(cert:ByteArray, trusted:Boolean):*

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

添加 x509 证书以构建链。

添加的证书必须是 DER 编码的 x509 证书。

如果 trusted 参数为 true,则将证书视为信任锚记。

注意:XML 签名可能包括用于构建签名者的证书链的证书。XMLSignatureValidator 类使用这些证书构建链,但不作为受信任的根(默认情况下)。

参数

cert:ByteArray — 包含 DER 编码的 x509 数字证书的 ByteArray 对象。
 
trusted:Boolean — 设置为 true 可将此证书指定为信任锚记。

返回
*

引发
IllegalOperationError — 如果在正在验证签名时调用。

示例  ( 如何使用本示例 )

下例从文件系统加载一个证书,并将其添加为受信任的锚记。
 import flash.utils.ByteArray;
 
 var verifier:XMLSignatureValidator = new XMLSignatureValidator();
 var certificate:ByteArray = new ByteArray();
 
 var certFile:File = new File("certificate.cer");
 var certFileStream:FileStream = new FileStream();
 certFileStream.open(certFile, FileMode.READ);
 certFileStream.readBytes(certificate, 0, certFileStream.bytesAvailable);

 verifier.addCertificate(certificate, true);

    verify

()方法 
public function verify(signature:XML):void

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

验证指定的签名。

验证是异步进行的。验证成功完成时,XMLSignatureValidator 对象将调度 complete 事件,或者由于错误无法完成验证时将调用 error 事件。

无法取消验证过程。当验证过程正在进行时,对 verify() 方法的后续调用将失败。在当前验证检查完成后,可以再次调用 verify() 方法。

注意:由于 XMLSignatureValidator 只能实现“W3C Recommendation for XML Signature Syntax and Processing”(W3C 推荐的 XML 签名语法和处理标准)的一个子集,因此无法验证所有有效的 XML 签名。

参数

signature:XML — 要验证的 XML 签名。


事件
complete:Event — 在成功完成验证时调度。
 
error:ErrorEvent — 验证引用遇到错误时调度。

引发
IllegalOperationError — 如果在正在验证签名时调用。
 
Error — 遇到其他错误时,如格式不正确的 XML 或签名文件中不支持的元素。

示例  ( 如何使用本示例 )

下例读取一个包含 XML 签名的文件,并通过调用 verify() 方法验证该签名。(此示例假定该 IURIDereferencer 实现适合于该签名。)
import flash.filesystem.File;
import flash.filesystem.FileStream;
import com.example.SignedMessageDereferencer; //Your IURIDereferencer implementation
 
const xmlSignatureNS:Namespace = new Namespace( "http://www.w3.org/2000/09/xmldsig#" );

var verifier:XMLSignatureValidator = new XMLSignatureValidator();
verifier.uriDereferencer = new SignedMessageDereferencer();

var signatureFile:File = new File( "path/to/XMLSignatureDocument.xml" );
var sigFileStream:FileStream = new FileStream();
sigFileStream.open( signatureFile, FileMode.READ );

var xmlDoc:XML = XML( sigFileStream.readUTFBytes(sigFileStream.bytesAvailable) );
var xmlSig:XML = XML( xmlDoc..xmlSignatureNS::Signature );

verifier.verify( xmlSig );
事件详细信息
    

complete

事件
事件对象类型: flash.events.Event
属性 Event.type = flash.events.Event.COMPLETE

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

在完成验证时调度。

complete 事件并不意味着签名有效。检查 XMLSignatureValidator 对象的 validityStatus 属性来确定签名验证的结果。

Event.COMPLETE 常量定义 complete 事件对象的 type 属性值。

此事件具有以下属性:

属性
bubblesfalse
cancelablefalse;没有要取消的默认行为。
currentTarget当前正在使用某个事件侦听器处理 Event 对象的对象。
target已完成加载的网络对象。

示例  ( 如何使用本示例 )

下例侦听由 XMLSignatureValidator 对象调度的 complete 事件,并跟踪验证结果:
private function verificationComplete(event:Event):void{
    var validator:XMLSignatureValidator = event.target as XMLSignatureValidator;
    trace("Digest status: " + validator.digestStatus);
    trace("Identity status: " + validator.identityStatus);
    trace("Reference status: " + validator.referencesStatus);
    trace("Signature status: " + validator.validityStatus);    
}

相关 API 元素

    

error

事件  
事件对象类型: flash.events.ErrorEvent
属性 ErrorEvent.type = flash.events.ErrorEvent.ERROR

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

由于错误而无法完成验证时调度。

定义 error 事件对象的 type 属性值。

此事件具有以下属性:

属性
bubblesfalse
cancelablefalse;没有要取消的默认行为。
currentTarget当前正在使用某个事件侦听器处理 Event 对象的对象。
target发生网络操作失败的对象。
text要显示为错误消息的文本。

示例  ( 如何使用本示例 )

下例侦听由 XMLSignatureValidator 对象调度的 error 事件,并跟踪错误消息:
private function verificationError(event:ErrorEvent):void{
    trace("Verification error: " + event.text);                
}
XMLSignatureValidatorExample.as

下例加载并验证一个包含 XML 签名的文件。要使用此示例,必须实现一个适合于要验证的签名的 IURIDereferencer(替代示例中所使用的 SignedMessageDereferencer 类)。通过调用 SignatureValidatorExample.validateSignature( signatureFile ) 来运行示例,同时传入引用要验证的 XML 签名文档的文件。
import flash.events.Event;
import flash.filesystem.File;
import flash.filesystem.FileStream;
import flash.security.ReferencesValidationSetting;
import flash.security.XMLSignatureValidator; 

import com.example.SignedMessageDereferencer; //A custom class implementing IURIDereferencer

public class SignatureValidatorExample{ 
    private var xmlSig:XML;
    private const signatureNS:Namespace = new Namespace( "http://www.w3.org/2000/09/xmldsig#" );
    
    public static function validateSignature( signatureFile:File ):void{
        try{
            //Set up the XMLSignatureValidator
            var verifier:XMLSignatureValidator = new XMLSignatureValidator();
            verifier.addEventListener( Event.COMPLETE, verificationComplete );
            verifier.uriDereferencer = new SignedMessageDereferencer();
            verifier.referencesValidationSetting = ReferencesValidationSetting.VALID_OR_UNKNOWN_IDENTITY;
    
            //Load the signed document
            var sigFileStream:FileStream = new FileStream();
            sigFileStream.open( signatureFile, FileMode.READ );
            var xmlDoc:XML = XML( sigFileStream.readUTFBytes(sigFileStream.bytesAvailable) );
            
            //Get the last Signature element in the document
            if( xmlDoc.name().localName != "Signature" ){
                var signatureList:XMLList = xmlDoc..signatureNS::Signature;
                xmlSig = XML( signatureList[ signatureList.length()-1 ] );
            } else{
                xmlSig = xmlDoc;
            }
    
            //Validate the signature
            verifier.verify( xmlSig );
            
        }catch (e:Error){
            statusDisplay.text = "Verification error.\n" + e;
        }
    }
    
    private static function verificationComplete(event:Event):void{
        trace( "Signature Validity: " + verifier.validityStatus );
        trace( "Digest validity: " + verifier.digestStatus );
        trace( "Certificate validity: " + verifier.identityStatus );
        trace( "Data validity: " + verifier.referencesStatus );
    }
}




[ X ]为什么显示为英语?
《ActionScript 3.0 参考》中的内容以英语显示

《ActionScript 3.0 参考》中的部分内容未翻译成所有语言。当某个语言元素未翻译时,将显示为英语。例如,ga.controls.HelpBox 类未翻译成任何语言。因此在简体中文版的参考中,ga.controls.HelpBox 类显示为英语。