duanqizao6492 2018-11-29 18:38
浏览 462

如何从Pem文件中获取subject_hash(md5)

I have a pem file that I am trying to get the subject_has for in Go.

In command line:

wmachs-iphone:platform-tools user$ openssl x509 -noout -subject_hash_old -in ../charles-ssl-proxying-certificate.pem
e64b345

I've tried using https://golang.org/pkg/crypto/md5/ (no luck, md5 value is different) and https://godoc.org/github.com/spacemonkeygo/openssl==> slight learning curve that I need help on. I tried loading the Pem file but not sure how to get the MD5 portion:

pemfile,_ := openssl.LoadCertificateFromPEM(buf.Bytes())

Any ideas?

  • 写回答

1条回答 默认 最新

  • dongmu1390 2018-11-30 05:22
    关注
    package main
    
    import (
        "fmt"
        "io/ioutil"
        "regexp"
    )
    
    func main() {
        regex := regexp.MustCompile("(
    )?-----(.)*-----
    ")
        data, _ := ioutil.ReadFile("file.pem")
        parts := regex.ReplaceAllString(string(data), "")
        fmt.Println(parts)
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器