• Onvif鉴权实现方式


    Onvif鉴权实现方式

    Digest = B64ENCODE( SHA1( B64DECODE( Nonce ) + Date + Password ) )

    gsoap中digest生成代码:

    int
    soap_wsse_add_UsernameTokenDigest(struct soap *soap, const char *id, const char *username, const char *password)
    { _wsse__Security *security = soap_wsse_add_Security(soap);
      time_t now = time(NULL);
      const char *created = soap_dateTime2s(soap, now);
      char HA[SOAP_SMD_SHA1_SIZE], HABase64[29];
      char nonce[SOAP_WSSE_NONCELEN], *nonceBase64;
      DBGFUN2("soap_wsse_add_UsernameTokenDigest", "id=%s", id?id:"", "username=%s", username?username:"");
      /* generate a nonce */
      calc_nonce(soap, nonce);
      nonceBase64 = soap_s2base64(soap, (unsigned char*)nonce, NULL, SOAP_WSSE_NONCELEN);
      /* The specs are not clear: compute digest over binary nonce or base64 nonce? */
      /* compute SHA1(created, nonce, password) */
      calc_digest(soap, created, nonce, SOAP_WSSE_NONCELEN, password, HA);
      /* Hm...?
      calc_digest(soap, created, nonceBase64, strlen(nonceBase64), password, HA);
      */
      soap_s2base64(soap, (unsigned char*)HA, HABase64, SOAP_SMD_SHA1_SIZE);
      /* populate the UsernameToken with digest */
      soap_wsse_add_UsernameTokenText(soap, id, username, HABase64);
      /* populate the remainder of the password, nonce, and created */
      security->UsernameToken->Password->Type = (char*)wsse_PasswordDigestURI;
      security->UsernameToken->Nonce = nonceBase64;
      security->UsernameToken->wsu__Created = soap_strdup(soap, created);
      return SOAP_OK;
    }
  • 相关阅读:
    tomcat配置通过域名直接访问项目首页步骤
    kafka配置参数
    nginx平滑升级
    redsi一主两从三哨兵
    kill
    lelnet爱一直在
    在linux中查看进程占用的端口号
    监控redis
    老猿学5G随笔:RAN、RAT以及anchor移动性锚点的概念
    老猿学5G随笔:5G网元功能体NF以及NF之间的两种接口--服务化接口和参考点
  • 原文地址:https://www.cnblogs.com/jingzhishen/p/5614448.html
Copyright © 2020-2023  润新知