github.com/egonelbre/exp@v0.0.0-20240430123955-ed1d3aa93911/smime/visualize.go (about)

     1  // +build ignore
     2  
     3  package main
     4  
     5  import (
     6  	"encoding/base64"
     7  	"log"
     8  
     9  	"github.com/gobs/pretty"
    10  	"raintree/smime"
    11  )
    12  
    13  func indefiniteToDefinite(data []byte) []byte {
    14  
    15  }
    16  
    17  func main() {
    18  	data, err := base64.StdEncoding.DecodeString(envelopedData)
    19  	if err != nil {
    20  		log.Fatal(err)
    21  	}
    22  
    23  	val, err := smime.Parse(data)
    24  	if err != nil {
    25  		log.Fatal(err)
    26  	}
    27  
    28  	pretty.PrettyPrint(val)
    29  }
    30  
    31  const envelopedData = `
    32  MIIBHgYJKoZIhvcNAQcDoIIBDzCCAQsCAQAxgcAwgb0CAQAwJjASMRAwDgYDVQQDEwdDYXJ
    33  sUlNBAhBGNGvHgABWvBHTbi7NXXHQMA0GCSqGSIb3DQEBAQUABIGAC3EN5nGIiJi2lsGPcP
    34  2iJ97a4e8kbKQz36zg6Z2i0yx6zYC4mZ7mX7FBs3IWg+f6KgCLx3M1eCbWx8+MDFbbpXadC
    35  DgO8/nUkUNYeNxJtuzubGgzoyEd8Ch4H/dd9gdzTd+taTEgS0ipdSJuNnkVY4/M652jKKHR
    36  LFf02hosdR8wQwYJKoZIhvcNAQcBMBQGCCqGSIb3DQMHBAgtaMXpRwZRNYAgDsiSf8Z9P43
    37  LrY4OxUk660cu1lXeCSFOSOpOJ7FuVyU=`