给定它的价值,你如何得到一个常数的名字?
更具体地(并获得更可读的理解),我正在使用crypto / tls包.密码套件定义为常数:
const ( TLS_RSA_WITH_RC4_128_SHA uint16 = 0x0005 TLS_RSA_WITH_3DES_EDE_CBC_SHA uint16 = 0x000a TLS_RSA_WITH_AES_128_CBC_SHA uint16 = 0x002f TLS_RSA_WITH_AES_256_CBC_SHA uint16 = 0x0035 TLS_ECDHE_RSA_WITH_RC4_128_SHA uint16 = 0xc011 TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA uint16 = 0xc012 TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA uint16 = 0xc013 TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA uint16 = 0xc014 )
在与服务器成功握手后,我可以通过连接得到Ciphersuite:
c,_ := tls.Dial("tcp","somedomain.com:443",nil) // Suppose everything went right // This is the Ciphersuite for the conn: cipher := c.ConnectionState().Ciphersuite
这里的密码是一个uint16.有没有办法将其显示为字符串,例如TLS_RSA_WITH_3DES_EDE_CBC_SHA,如果这是同意的?