Skip to content

安装用户证书

方法名

installCertificateWithType

用法

  • 用法如下:
    js
    module.installCertificateWithType({
      params: {
        type: 0,
        certBuffer:[],
        name:"",
        password:"",
        flag:1,
        requestAccess:true
      },
      complete: (res) => {
        console.log(res)
      }
    })
    js
    module.installCertificateWithType({
      params: {
        type: 0,
        certBuffer:[],
        name:"",
        password:"",
        flag:1,
        requestAccess:true
      },
      complete: (res : LevenResult) => {
        console.log(res)
      }
    } as LevenOptions)
  • 参数说明
    参数名参数类型是否必填默认值参数描述
    paramsObject接口请求参数
    params.typeInteger安装证书类型,支持 PKCS12 ,PEM_BASE64
    0:CERTIFICATE_PKCS12
    1:CERTIFICATE_PEM_BASE64
    params.certBufferbyte[]将证书流文件读入到 byte 数据,读取 pkcs12 文件一般涉及密码
    params.nameInteger指定安装证书名字
    params.passwordInteger证书的密码,提起证书流时的密码,一般 pkcs12 证书涉及
    params.flagInteger证书安装用途
    1: WLAN 用途
    0: vpn 和应用,安装证书前必须设置锁屏密码
    params.requestAccessBoolean是否自动授权应用可访问证书
    true:自动授权
    false:不自动授权
    successFunction执行成功的函数
    failFunction执行失败的函数
    completeFunction执行完成的函数,不管成功还是失败都会执行

回调

  • 示例
    json
    {
        "data": {
          "result":true
        },
        "message": "",
        "code": 0
    }
  • 回调说明:
    参数名参数类型参数描述
    messageString消息提示
    dataObject数据对象
    data.resultBooleantrue:安装成功(若指定 requestAccess 为 true,则证书安装并授权 mdm 都成功才返回 true)
    false:安装失败
    codeInteger返回类型,0.成功,其他:失败