Jonathan Turner пре 9 година
родитељ
комит
f1a65e68b4

+ 15 - 16
config/krb5conf.go

@@ -6,14 +6,14 @@ import (
 	"errors"
 	"fmt"
 	"github.com/jcmturner/asn1"
+	"github.com/jcmturner/gokrb5/iana/etype"
+	"io"
 	"os"
 	"os/user"
 	"regexp"
 	"strconv"
 	"strings"
 	"time"
-	"github.com/jcmturner/gokrb5/types"
-	"io"
 )
 
 type Config struct {
@@ -29,7 +29,6 @@ const (
 	WEAK_ETYPE_LIST = "des-cbc-crc des-cbc-md4 des-cbc-md5 des-cbc-raw des3-cbc-raw des-hmac-sha1 arcfour-hmac-exp rc4-hmac-exp arcfour-hmac-md5-exp des"
 )
 
-
 func NewConfig() *Config {
 	d := make(DomainRealm)
 	return &Config{
@@ -50,11 +49,11 @@ type LibDefaults struct {
 	Default_realm              string
 	Default_tgs_enctypes       []string //default aes256-cts-hmac-sha1-96 aes128-cts-hmac-sha1-96 des3-cbc-sha1 arcfour-hmac-md5 camellia256-cts-cmac camellia128-cts-cmac des-cbc-crc des-cbc-md5 des-cbc-md4
 	Default_tkt_enctypes       []string //default aes256-cts-hmac-sha1-96 aes128-cts-hmac-sha1-96 des3-cbc-sha1 arcfour-hmac-md5 camellia256-cts-cmac camellia128-cts-cmac des-cbc-crc des-cbc-md5 des-cbc-md4
-	Default_tgs_enctype_ids       []int //default aes256-cts-hmac-sha1-96 aes128-cts-hmac-sha1-96 des3-cbc-sha1 arcfour-hmac-md5 camellia256-cts-cmac camellia128-cts-cmac des-cbc-crc des-cbc-md5 des-cbc-md4
-	Default_tkt_enctype_ids       []int //default aes256-cts-hmac-sha1-96 aes128-cts-hmac-sha1-96 des3-cbc-sha1 arcfour-hmac-md5 camellia256-cts-cmac camellia128-cts-cmac des-cbc-crc des-cbc-md5 des-cbc-md4
+	Default_tgs_enctype_ids    []int    //default aes256-cts-hmac-sha1-96 aes128-cts-hmac-sha1-96 des3-cbc-sha1 arcfour-hmac-md5 camellia256-cts-cmac camellia128-cts-cmac des-cbc-crc des-cbc-md5 des-cbc-md4
+	Default_tkt_enctype_ids    []int    //default aes256-cts-hmac-sha1-96 aes128-cts-hmac-sha1-96 des3-cbc-sha1 arcfour-hmac-md5 camellia256-cts-cmac camellia128-cts-cmac des-cbc-crc des-cbc-md5 des-cbc-md4
 	Dns_canonicalize_hostname  bool     //default true
 	Dns_lookup_kdc             bool     //default false
-	Dns_lookup_realm             bool
+	Dns_lookup_realm           bool
 	//extra_addresses []net.IPAddr //Not implementing yet
 	Forwardable              bool           //default false
 	Ignore_acceptor_hostname bool           //default false
@@ -63,8 +62,8 @@ type LibDefaults struct {
 	Kdc_default_options      asn1.BitString //default 0x00000010 (KDC_OPT_RENEWABLE_OK)
 	Kdc_timesync             int            //default 1
 	//kdc_req_checksum_type int //unlikely to implement as for very old KDCs
-	Noaddresses        bool //default true
-	Permitted_enctypes []string  //default aes256-cts-hmac-sha1-96 aes128-cts-hmac-sha1-96 des3-cbc-sha1 arcfour-hmac-md5 camellia256-cts-cmac camellia128-cts-cmac des-cbc-crc des-cbc-md5 des-cbc-md4
+	Noaddresses           bool     //default true
+	Permitted_enctypes    []string //default aes256-cts-hmac-sha1-96 aes128-cts-hmac-sha1-96 des3-cbc-sha1 arcfour-hmac-md5 camellia256-cts-cmac camellia128-cts-cmac des-cbc-crc des-cbc-md5 des-cbc-md4
 	Permitted_enctype_ids []int
 	//plugin_base_dir string //not supporting plugins
 	Preferred_preauth_types []int         //default “17, 16, 15, 14”, which forces libkrb5 to attempt to use PKINIT if it is supported
@@ -330,7 +329,7 @@ func (r *Realm) parseLines(name string, lines []string) error {
 	if len(r.Kpasswd_server) < 1 {
 		for _, a := range r.Admin_server {
 			s := strings.Split(a, ":")
-			r.Kpasswd_server = append(r.Kpasswd_server, s[0] + ":464")
+			r.Kpasswd_server = append(r.Kpasswd_server, s[0]+":464")
 		}
 	}
 	return nil
@@ -400,17 +399,17 @@ func Load(cfgPath string) (*Config, error) {
 	return NewConfigFromScanner(scanner)
 }
 
-func NewConfigFromString(s string) (*Config, error){
+func NewConfigFromString(s string) (*Config, error) {
 	reader := strings.NewReader(s)
 	return NewConfigFromReader(reader)
 }
 
-func NewConfigFromReader(r io.Reader) (*Config, error){
+func NewConfigFromReader(r io.Reader) (*Config, error) {
 	scanner := bufio.NewScanner(r)
 	return NewConfigFromScanner(scanner)
 }
 
-func NewConfigFromScanner(scanner *bufio.Scanner) (*Config, error){
+func NewConfigFromScanner(scanner *bufio.Scanner) (*Config, error) {
 	c := NewConfig()
 	sections := make(map[int]string)
 	var section_line_num []int
@@ -473,12 +472,12 @@ func NewConfigFromScanner(scanner *bufio.Scanner) (*Config, error){
 	return c, nil
 }
 
-func parseETypes(s []string, w bool) ([]int) {
+func parseETypes(s []string, w bool) []int {
 	var eti []int
 	for _, et := range s {
 		if !w {
 			var weak bool
-			for _, wet := range strings.Fields(WEAK_ETYPE_LIST){
+			for _, wet := range strings.Fields(WEAK_ETYPE_LIST) {
 				if et == wet {
 					weak = true
 					break
@@ -488,7 +487,7 @@ func parseETypes(s []string, w bool) ([]int) {
 				continue
 			}
 		}
-		i := types.KrbDictionary.ETypesByName[et]
+		i := etype.ETypesByName[et]
 		if i != 0 {
 			eti = append(eti, i)
 		}
@@ -556,4 +555,4 @@ func appendUntilFinal(s *[]string, value string, final *bool) {
 		value = value[:len(value)-1]
 	}
 	*s = append(*s, value)
-}
+}

+ 8 - 7
crypto/EncryptionEngine.go

@@ -7,6 +7,7 @@ import (
 	"encoding/hex"
 	"errors"
 	"fmt"
+	"github.com/jcmturner/gokrb5/iana/patype"
 	"github.com/jcmturner/gokrb5/keytab"
 	"github.com/jcmturner/gokrb5/types"
 	"hash"
@@ -160,16 +161,16 @@ func GetKeyFromPassword(passwd string, cn types.PrincipalName, realm string, ety
 	}
 	sk2p := etype.GetDefaultStringToKeyParams()
 	var salt string
-	var patype int
+	var paID int
 	for _, pa := range pas {
 		switch pa.PADataType {
-		case types.PA_PW_SALT:
-			if patype > pa.PADataType {
+		case patype.PA_PW_SALT:
+			if paID > pa.PADataType {
 				continue
 			}
 			salt = string(pa.PADataValue)
-		case types.PA_ETYPE_INFO:
-			if patype > pa.PADataType {
+		case patype.PA_ETYPE_INFO:
+			if paID > pa.PADataType {
 				continue
 			}
 			var et types.ETypeInfo
@@ -184,8 +185,8 @@ func GetKeyFromPassword(passwd string, cn types.PrincipalName, realm string, ety
 				}
 			}
 			salt = string(et[0].Salt)
-		case types.PA_ETYPE_INFO2:
-			if patype > pa.PADataType {
+		case patype.PA_ETYPE_INFO2:
+			if paID > pa.PADataType {
 				continue
 			}
 			var et2 types.ETypeInfo2

+ 8 - 0
iana/adtype/constants.go

@@ -0,0 +1,8 @@
+package adtype
+
+const (
+	AD_IF_RELEVANT       = 1
+	AD_KDCIssued         = 4
+	AD_AND_OR            = 5
+	AD_MANDATORY_FOR_KDC = 8
+)

+ 0 - 0
types/asnAppTag/constants.go → iana/asnAppTag/constants.go


+ 28 - 0
iana/chksumtype/constants.go

@@ -0,0 +1,28 @@
+package chksumtype
+
+const (
+	//RESERVED : 0
+	CRC32         = 1
+	RSA_MD4       = 2
+	RSA_MD4_DES   = 3
+	DES_MAC       = 4
+	DES_MAC_K     = 5
+	RSA_MD4_DES_K = 6
+	RSA_MD5       = 7
+	RSA_MD5_DES   = 8
+	RSA_MD5_DES3  = 9
+	SHA1_ID10     = 10
+	//UNASSIGNED : 11
+	HMAC_SHA1_DES3_KD      = 12
+	HMAC_SHA1_DES3         = 13
+	SHA1_ID14              = 14
+	HMAC_SHA1_96_AES128    = 15
+	HMAC_SHA1_96_AES256    = 16
+	CMAC_CAMELLIA128       = 17
+	CMAC_CAMELLIA256       = 18
+	HMAC_SHA256_128_AES128 = 19
+	HMAC_SHA384_192_AES256 = 20
+	//UNASSIGNED : 21-32770
+	//RESERVED : 32771
+	//UNASSIGNED : 32772-2147483647
+)

+ 5 - 0
iana/constants.go

@@ -0,0 +1,5 @@
+package iana
+
+const (
+	PVNO = 5
+)

+ 72 - 0
iana/errorcode/constants.go

@@ -0,0 +1,72 @@
+package errorcode
+
+const (
+	KDC_ERR_NONE                          = 0  //No error
+	KDC_ERR_NAME_EXP                      = 1  //Client's entry in database has expired
+	KDC_ERR_SERVICE_EXP                   = 2  //Server's entry in database has expired
+	KDC_ERR_BAD_PVNO                      = 3  //Requested protocol version number not supported
+	KDC_ERR_C_OLD_MAST_KVNO               = 4  //Client's key encrypted in old master key
+	KDC_ERR_S_OLD_MAST_KVNO               = 5  //Server's key encrypted in old master key
+	KDC_ERR_C_PRINCIPAL_UNKNOWN           = 6  //Client not found in Kerberos database
+	KDC_ERR_S_PRINCIPAL_UNKNOWN           = 7  //Server not found in Kerberos database
+	KDC_ERR_PRINCIPAL_NOT_UNIQUE          = 8  //Multiple principal entries in database
+	KDC_ERR_NULL_KEY                      = 9  //The client or server has a null key
+	KDC_ERR_CANNOT_POSTDATE               = 10 //Ticket not eligible for  postdating
+	KDC_ERR_NEVER_VALID                   = 11 //Requested starttime is later than end time
+	KDC_ERR_POLICY                        = 12 //KDC policy rejects request
+	KDC_ERR_BADOPTION                     = 13 //KDC cannot accommodate requested option
+	KDC_ERR_ETYPE_NOSUPP                  = 14 //KDC has no support for  encryption type
+	KDC_ERR_SUMTYPE_NOSUPP                = 15 //KDC has no support for  checksum type
+	KDC_ERR_PADATA_TYPE_NOSUPP            = 16 //KDC has no support for  padata type
+	KDC_ERR_TRTYPE_NOSUPP                 = 17 //KDC has no support for  transited type
+	KDC_ERR_CLIENT_REVOKED                = 18 //Clients credentials have been revoked
+	KDC_ERR_SERVICE_REVOKED               = 19 //Credentials for server have been revoked
+	KDC_ERR_TGT_REVOKED                   = 20 //TGT has been revoked
+	KDC_ERR_CLIENT_NOTYET                 = 21 //Client not yet valid; try again later
+	KDC_ERR_SERVICE_NOTYET                = 22 //Server not yet valid; try again later
+	KDC_ERR_KEY_EXPIRED                   = 23 //Password has expired; change password to reset
+	KDC_ERR_PREAUTH_FAILED                = 24 //Pre-authentication information was invalid
+	KDC_ERR_PREAUTH_REQUIRED              = 25 //Additional pre- authentication required
+	KDC_ERR_SERVER_NOMATCH                = 26 //Requested server and ticket don't match
+	KDC_ERR_MUST_USE_USER2USER            = 27 //Server principal valid for  user2user only
+	KDC_ERR_PATH_NOT_ACCEPTED             = 28 //KDC Policy rejects transited path
+	KDC_ERR_SVC_UNAVAILABLE               = 29 //A service is not available
+	KRB_AP_ERR_BAD_INTEGRITY              = 31 //Integrity check on decrypted field failed
+	KRB_AP_ERR_TKT_EXPIRED                = 32 //Ticket expired
+	KRB_AP_ERR_TKT_NYV                    = 33 //Ticket not yet valid
+	KRB_AP_ERR_REPEAT                     = 34 //Request is a replay
+	KRB_AP_ERR_NOT_US                     = 35 //The ticket isn't for us
+	KRB_AP_ERR_BADMATCH                   = 36 //Ticket and authenticator don't match
+	KRB_AP_ERR_SKEW                       = 37 //Clock skew too great
+	KRB_AP_ERR_BADADDR                    = 38 //Incorrect net address
+	KRB_AP_ERR_BADVERSION                 = 39 //Protocol version mismatch
+	KRB_AP_ERR_MSG_TYPE                   = 40 //Invalid msg type
+	KRB_AP_ERR_MODIFIED                   = 41 //Message stream modified
+	KRB_AP_ERR_BADORDER                   = 42 //Message out of order
+	KRB_AP_ERR_BADKEYVER                  = 44 //Specified version of key is not available
+	KRB_AP_ERR_NOKEY                      = 45 //Service key not available
+	KRB_AP_ERR_MUT_FAIL                   = 46 //Mutual authentication failed
+	KRB_AP_ERR_BADDIRECTION               = 47 //Incorrect message direction
+	KRB_AP_ERR_METHOD                     = 48 //Alternative authentication method required
+	KRB_AP_ERR_BADSEQ                     = 49 //Incorrect sequence number in message
+	KRB_AP_ERR_INAPP_CKSUM                = 50 //Inappropriate type of checksum in message
+	KRB_AP_PATH_NOT_ACCEPTED              = 51 //Policy rejects transited path
+	KRB_ERR_RESPONSE_TOO_BIG              = 52 //Response too big for UDP;  retry with TCP
+	KRB_ERR_GENERIC                       = 60 //Generic error (description in e-text)
+	KRB_ERR_FIELD_TOOLONG                 = 61 //Field is too long for this implementation
+	KDC_ERROR_CLIENT_NOT_TRUSTED          = 62 //Reserved for PKINIT
+	KDC_ERROR_KDC_NOT_TRUSTED             = 63 //Reserved for PKINIT
+	KDC_ERROR_INVALID_SIG                 = 64 //Reserved for PKINIT
+	KDC_ERR_KEY_TOO_WEAK                  = 65 //Reserved for PKINIT
+	KDC_ERR_CERTIFICATE_MISMATCH          = 66 //Reserved for PKINIT
+	KRB_AP_ERR_NO_TGT                     = 67 //No TGT available to validate USER-TO-USER
+	KDC_ERR_WRONG_REALM                   = 68 //Reserved for future use
+	KRB_AP_ERR_USER_TO_USER_REQUIRED      = 69 //Ticket must be for  USER-TO-USER
+	KDC_ERR_CANT_VERIFY_CERTIFICATE       = 70 //Reserved for PKINIT
+	KDC_ERR_INVALID_CERTIFICATE           = 71 //Reserved for PKINIT
+	KDC_ERR_REVOKED_CERTIFICATE           = 72 //Reserved for PKINIT
+	KDC_ERR_REVOCATION_STATUS_UNKNOWN     = 73 //Reserved for PKINIT
+	KDC_ERR_REVOCATION_STATUS_UNAVAILABLE = 74 //Reserved for PKINIT
+	KDC_ERR_CLIENT_NAME_MISMATCH          = 75 //Reserved for PKINIT
+	KDC_ERR_KDC_NAME_MISMATCH             = 76 //Reserved for PKINIT
+)

+ 74 - 0
iana/etype/constants.go

@@ -0,0 +1,74 @@
+package etype
+
+const (
+	//RESERVED : 0
+	DES_CBC_CRC                  = 1
+	DES_CBC_MD4                  = 2
+	DES_CBC_MD5                  = 3
+	DES_CBC_RAW                  = 4
+	DES3_CBC_MD5                 = 5
+	DES3_CBC_RAW                 = 6
+	DES3_CBC_SHA1                = 7
+	DES_HMAC_SHA1                = 8
+	DSAWITHSHA1_CMSOID           = 9
+	MD5WITHRSAENCRYPTION_CMSOID  = 10
+	SHA1WITHRSAENCRYPTION_CMSOID = 11
+	RC2CBC_ENVOID                = 12
+	RSAENCRYPTION_ENVOID         = 13
+	RSAES_OAEP_ENV_OID           = 14
+	DES_EDE3_CBC_ENV_OID         = 15
+	DES3_CBC_SHA1_KD             = 16
+	AES128_CTS_HMAC_SHA1_96      = 17
+	AES256_CTS_HMAC_SHA1_96      = 18
+	AES128_CTS_HMAC_SHA256_128   = 19
+	AES256_CTS_HMAC_SHA384_192   = 20
+	//UNASSIGNED : 21-22
+	RC4_HMAC             = 23
+	RC4_HMAC_EXP         = 24
+	CAMELLIA128_CTS_CMAC = 25
+	CAMELLIA256_CTS_CMAC = 26
+	//UNASSIGNED : 27-64
+	SUBKEY_KEYMATERIAL = 65
+	//UNASSIGNED : 66-2147483647
+)
+
+var ETypesByName = map[string]int{
+	"des-cbc-crc":                  DES_CBC_CRC,
+	"des-cbc-md4":                  DES_CBC_MD4,
+	"des-cbc-md5":                  DES_CBC_MD5,
+	"des-cbc-raw":                  DES_CBC_RAW,
+	"des3-cbc-md5":                 DES3_CBC_MD5,
+	"des3-cbc-raw":                 DES3_CBC_RAW,
+	"des3-cbc-sha1":                DES3_CBC_SHA1,
+	"des3-hmac-sha1":               DES3_CBC_SHA1,
+	"des3-cbc-sha1-kd":             DES3_CBC_SHA1,
+	"des-hmac-sha1":                DES_HMAC_SHA1,
+	"dsaWithSHA1-CmsOID":           DSAWITHSHA1_CMSOID,
+	"md5WithRSAEncryption-CmsOID":  MD5WITHRSAENCRYPTION_CMSOID,
+	"sha1WithRSAEncryption-CmsOID": SHA1WITHRSAENCRYPTION_CMSOID,
+	"rc2CBC-EnvOID":                RC2CBC_ENVOID,
+	"rsaEncryption-EnvOID":         RSAENCRYPTION_ENVOID,
+	"rsaES-OAEP-ENV-OID":           RSAES_OAEP_ENV_OID,
+	"des-ede3-cbc-Env-OID":         DES_EDE3_CBC_ENV_OID,
+	"aes128-cts-hmac-sha1-96":      AES128_CTS_HMAC_SHA1_96,
+	"aes128-cts":                   AES128_CTS_HMAC_SHA1_96,
+	"aes128-sha1":                  AES128_CTS_HMAC_SHA1_96,
+	"aes256-cts-hmac-sha1-96":      AES256_CTS_HMAC_SHA1_96,
+	"aes256-cts":                   AES128_CTS_HMAC_SHA1_96,
+	"aes256-sha1":                  AES128_CTS_HMAC_SHA1_96,
+	"aes128-cts-hmac-sha256-128":   AES128_CTS_HMAC_SHA256_128,
+	"aes128-sha2":                  AES128_CTS_HMAC_SHA256_128,
+	"aes256-cts-hmac-sha384-192":   AES256_CTS_HMAC_SHA384_192,
+	"aes256-sha2":                  AES256_CTS_HMAC_SHA384_192,
+	"arcfour-hmac":                 RC4_HMAC,
+	"rc4-hmac":                     RC4_HMAC,
+	"arcfour-hmac-md5":             RC4_HMAC,
+	"arcfour-hmac-exp":             RC4_HMAC_EXP,
+	"rc4-hmac-exp":                 RC4_HMAC_EXP,
+	"arcfour-hmac-md5-exp":         RC4_HMAC_EXP,
+	"camellia128-cts-cmac":         CAMELLIA128_CTS_CMAC,
+	"camellia128-cts":              CAMELLIA128_CTS_CMAC,
+	"camellia256-cts-cmac":         CAMELLIA256_CTS_CMAC,
+	"camellia256-cts":              CAMELLIA256_CTS_CMAC,
+	"subkey-keymaterial":           SUBKEY_KEYMATERIAL,
+}

+ 16 - 0
iana/msgtype/constants.go

@@ -0,0 +1,16 @@
+package msgtype
+
+const (
+	KRB_AS_REQ     = 10 //Request for initial authentication
+	KRB_AS_REP     = 11 //Response to KRB_AS_REQ request
+	KRB_TGS_REQ    = 12 //Request for authentication based on TGT
+	KRB_TGS_REP    = 13 //Response to KRB_TGS_REQ request
+	KRB_AP_REQ     = 14 //Application request to server
+	KRB_AP_REP     = 15 //Response to KRB_AP_REQ_MUTUAL
+	KRB_RESERVED16 = 16 //Reserved for user-to-user krb_tgt_request
+	KRB_RESERVED17 = 17 //Reserved for user-to-user krb_tgt_reply
+	KRB_SAFE       = 20 // Safe (checksummed) application message
+	KRB_PRIV       = 21 // Private (encrypted) application message
+	KRB_CRED       = 22 //Private (encrypted) message to forward credentials
+	KRB_ERROR      = 30 //Error response
+)

+ 13 - 0
iana/nametype/constants.go

@@ -0,0 +1,13 @@
+package nametype
+
+const (
+	KRB_NT_UNKNOWN        = 0  //Name type not known
+	KRB_NT_PRINCIPAL      = 1  //Just the name of the principal as in DCE,  or for users
+	KRB_NT_SRV_INST       = 2  //Service and other unique instance (krbtgt)
+	KRB_NT_SRV_HST        = 3  //Service with host name as instance (telnet, rcommands)
+	KRB_NT_SRV_XHST       = 4  //Service with host as remaining components
+	KRB_NT_UID            = 5  //Unique ID
+	KRB_NT_X500_PRINCIPAL = 6  //Encoded X.509 Distinguished name [RFC2253]
+	KRB_NT_SMTP_NAME      = 7  //Name in form of SMTP email name (e.g., user@example.com)
+	KRB_NT_ENTERPRISE     = 10 //Enterprise name; may be mapped to principal name
+)

+ 75 - 0
iana/patype/constants.go

@@ -0,0 +1,75 @@
+package patype
+
+const (
+	PA_TGS_REQ       = 1
+	PA_ENC_TIMESTAMP = 2
+	PA_PW_SALT       = 3
+	//RESERVED : 4
+	PA_ENC_UNIX_TIME       = 5
+	PA_SANDIA_SECUREID     = 6
+	PA_SESAME              = 7
+	PA_OSF_DCE             = 8
+	PA_CYBERSAFE_SECUREID  = 9
+	PA_AFS3_SALT           = 10
+	PA_ETYPE_INFO          = 11
+	PA_SAM_CHALLENGE       = 12
+	PA_SAM_RESPONSE        = 13
+	PA_PK_AS_REQ_OLD       = 14
+	PA_PK_AS_REP_OLD       = 15
+	PA_PK_AS_REQ           = 16
+	PA_PK_AS_REP           = 17
+	PA_PK_OCSP_RESPONSE    = 18
+	PA_ETYPE_INFO2         = 19
+	PA_USE_SPECIFIED_KVNO  = 20
+	PA_SVR_REFERRAL_INFO   = 20
+	PA_SAM_REDIRECT        = 21
+	PA_GET_FROM_TYPED_DATA = 22
+	TD_PADATA              = 22
+	PA_SAM_ETYPE_INFO      = 23
+	PA_ALT_PRINC           = 24
+	PA_SERVER_REFERRAL     = 25
+	//UNASSIGNED : 26-29
+	PA_SAM_CHALLENGE2 = 30
+	PA_SAM_RESPONSE2  = 31
+	//UNASSIGNED : 32-40
+	PA_EXTRA_TGT = 41
+	//UNASSIGNED : 42-100
+	TD_PKINIT_CMS_CERTIFICATES = 101
+	TD_KRB_PRINCIPAL           = 102
+	TD_KRB_REALM               = 103
+	TD_TRUSTED_CERTIFIERS      = 104
+	TD_CERTIFICATE_INDEX       = 105
+	TD_APP_DEFINED_ERROR       = 106
+	TD_REQ_NONCE               = 107
+	TD_REQ_SEQ                 = 108
+	TD_DH_PARAMETERS           = 109
+	//UNASSIGNED : 110
+	TD_CMS_DIGEST_ALGORITHMS  = 111
+	TD_CERT_DIGEST_ALGORITHMS = 112
+	//UNASSIGNED : 113-127
+	PA_PAC_REQUEST         = 128
+	PA_FOR_USER            = 129
+	PA_FOR_X509_USER       = 130
+	PA_FOR_CHECK_DUPS      = 131
+	PA_AS_CHECKSUM         = 132
+	PA_FX_COOKIE           = 133
+	PA_AUTHENTICATION_SET  = 134
+	PA_AUTH_SET_SELECTED   = 135
+	PA_FX_FAST             = 136
+	PA_FX_ERROR            = 137
+	PA_ENCRYPTED_CHALLENGE = 138
+	//UNASSIGNED : 139-140
+	PA_OTP_CHALLENGE  = 141
+	PA_OTP_REQUEST    = 142
+	PA_OTP_CONFIRM    = 143
+	PA_OTP_PIN_CHANGE = 144
+	PA_EPAK_AS_REQ    = 145
+	PA_EPAK_AS_REP    = 146
+	PA_PKINIT_KX      = 147
+	PA_PKU2U_NAME     = 148
+	PA_REQ_ENC_PA_REP = 149
+	PA_AS_FRESHNESS   = 150
+	//UNASSIGNED : 151-164
+	PA_SUPPORTED_ETYPES = 165
+	PA_EXTENDED_ERROR   = 166
+)

+ 3 - 2
messages/APRep.go

@@ -3,8 +3,9 @@ package messages
 import (
 	"fmt"
 	"github.com/jcmturner/asn1"
+	"github.com/jcmturner/gokrb5/iana/asnAppTag"
+	"github.com/jcmturner/gokrb5/iana/msgtype"
 	"github.com/jcmturner/gokrb5/types"
-	"github.com/jcmturner/gokrb5/types/asnAppTag"
 	"time"
 )
 
@@ -41,7 +42,7 @@ func (a *APRep) Unmarshal(b []byte) error {
 	if err != nil {
 		return err
 	}
-	expectedMsgType := types.KrbDictionary.MsgTypesByName["KRB_AP_REP"]
+	expectedMsgType := msgtype.KRB_AP_REP
 	if a.MsgType != expectedMsgType {
 		return fmt.Errorf("Message ID does not indicate a KRB_AP_REP. Expected: %v; Actual: %v", expectedMsgType, a.MsgType)
 	}

+ 4 - 5
messages/APRep_test.go

@@ -2,14 +2,13 @@ package messages
 
 import (
 	"encoding/hex"
-	"github.com/stretchr/testify/assert"
+	"github.com/jcmturner/gokrb5/iana/msgtype"
 	"github.com/jcmturner/gokrb5/testdata"
+	"github.com/stretchr/testify/assert"
 	"testing"
-	"github.com/jcmturner/gokrb5/types"
 	"time"
 )
 
-
 func TestUnmarshalAPRep(t *testing.T) {
 	var a APRep
 	v := "encode_krb5_ap_rep"
@@ -22,7 +21,7 @@ func TestUnmarshalAPRep(t *testing.T) {
 		t.Fatalf("Unmarshal error of %s: %v\n", v, err)
 	}
 	assert.Equal(t, testdata.TEST_KVNO, a.PVNO, "PVNO not as expected")
-	assert.Equal(t, types.KrbDictionary.MsgTypesByName["KRB_AP_REP"], a.MsgType, "MsgType is not as expected")
+	assert.Equal(t, msgtype.KRB_AP_REP, a.MsgType, "MsgType is not as expected")
 	assert.Equal(t, testdata.TEST_ETYPE, a.EncPart.EType, "Ticket encPart etype not as expected")
 	assert.Equal(t, testdata.TEST_KVNO, a.EncPart.KVNO, "Ticket encPart KVNO not as expected")
 	assert.Equal(t, []byte(testdata.TEST_CIPHERTEXT), a.EncPart.Cipher, "Ticket encPart cipher not as expected")
@@ -65,4 +64,4 @@ func TestUnmarshalEncAPRepPart_optionalsNULL(t *testing.T) {
 
 	assert.Equal(t, tt, a.CTime, "CTime not as expected")
 	assert.Equal(t, 123456, a.Cusec, "Client microseconds not as expected")
-}
+}

+ 3 - 2
messages/APReq.go

@@ -4,8 +4,9 @@ import (
 	"errors"
 	"fmt"
 	"github.com/jcmturner/asn1"
+	"github.com/jcmturner/gokrb5/iana/asnAppTag"
+	"github.com/jcmturner/gokrb5/iana/msgtype"
 	"github.com/jcmturner/gokrb5/types"
-	"github.com/jcmturner/gokrb5/types/asnAppTag"
 )
 
 /*AP-REQ          ::= [APPLICATION 14] SEQUENCE {
@@ -44,7 +45,7 @@ func (a *APReq) Unmarshal(b []byte) error {
 	if err != nil {
 		return err
 	}
-	if m.MsgType != types.KrbDictionary.MsgTypesByName["KRB_AP_REQ"] {
+	if m.MsgType != msgtype.KRB_AP_REQ {
 		return errors.New("Message ID does not indicate a KRB_AS_REP")
 	}
 	a.PVNO = m.PVNO

+ 3 - 4
messages/APReq_test.go

@@ -2,10 +2,10 @@ package messages
 
 import (
 	"encoding/hex"
-	"testing"
+	"github.com/jcmturner/gokrb5/iana/msgtype"
 	"github.com/jcmturner/gokrb5/testdata"
 	"github.com/stretchr/testify/assert"
-	"github.com/jcmturner/gokrb5/types"
+	"testing"
 )
 
 func TestUnmarshalAPReq(t *testing.T) {
@@ -20,7 +20,7 @@ func TestUnmarshalAPReq(t *testing.T) {
 		t.Fatalf("Unmarshal error of %s: %v\n", v, err)
 	}
 	assert.Equal(t, testdata.TEST_KVNO, a.PVNO, "PVNO not as expected")
-	assert.Equal(t, types.KrbDictionary.MsgTypesByName["KRB_AP_REQ"], a.MsgType, "MsgType is not as expected")
+	assert.Equal(t, msgtype.KRB_AP_REQ, a.MsgType, "MsgType is not as expected")
 	assert.Equal(t, "fedcba98", hex.EncodeToString(a.APOptions.Bytes), "AP Options not as expected")
 	assert.Equal(t, testdata.TEST_KVNO, a.Ticket.TktVNO, "Ticket VNO not as expected")
 	assert.Equal(t, testdata.TEST_REALM, a.Ticket.Realm, "Ticket realm not as expected")
@@ -31,4 +31,3 @@ func TestUnmarshalAPReq(t *testing.T) {
 	assert.Equal(t, testdata.TEST_KVNO, a.Ticket.EncPart.KVNO, "Ticket encPart KVNO not as expected")
 	assert.Equal(t, []byte(testdata.TEST_CIPHERTEXT), a.Ticket.EncPart.Cipher, "Ticket encPart cipher not as expected")
 }
-

+ 4 - 3
messages/KDCRep.go

@@ -8,9 +8,10 @@ import (
 	"fmt"
 	"github.com/jcmturner/asn1"
 	"github.com/jcmturner/gokrb5/crypto"
+	"github.com/jcmturner/gokrb5/iana/asnAppTag"
+	"github.com/jcmturner/gokrb5/iana/msgtype"
 	"github.com/jcmturner/gokrb5/keytab"
 	"github.com/jcmturner/gokrb5/types"
-	"github.com/jcmturner/gokrb5/types/asnAppTag"
 	"time"
 )
 
@@ -67,7 +68,7 @@ func (k *ASRep) Unmarshal(b []byte) error {
 	if err != nil {
 		return err
 	}
-	if m.MsgType != types.KrbDictionary.MsgTypesByName["KRB_AS_REP"] {
+	if m.MsgType != msgtype.KRB_AS_REP {
 		return errors.New("Message ID does not indicate a KRB_AS_REP")
 	}
 	//Process the raw ticket within
@@ -90,7 +91,7 @@ func (k *TGSRep) Unmarshal(b []byte) error {
 	if err != nil {
 		return err
 	}
-	if m.MsgType != types.KrbDictionary.MsgTypesByName["KRB_TGS_REP"] {
+	if m.MsgType != msgtype.KRB_TGS_REP {
 		return errors.New("Message ID does not indicate a KRB_TGS_REP")
 	}
 	//Process the raw ticket within

+ 11 - 10
messages/KDCRep_test.go

@@ -3,9 +3,10 @@ package messages
 import (
 	"encoding/hex"
 	"fmt"
+	"github.com/jcmturner/gokrb5/iana/etype"
+	"github.com/jcmturner/gokrb5/iana/msgtype"
 	"github.com/jcmturner/gokrb5/keytab"
 	"github.com/jcmturner/gokrb5/testdata"
-	"github.com/jcmturner/gokrb5/types"
 	"github.com/stretchr/testify/assert"
 	"testing"
 	"time"
@@ -16,7 +17,7 @@ const (
 	testuser1_etype18_ASREP  = "6b8202f3308202efa003020105a10302010ba22e302c302aa103020113a2230421301f301da003020112a1161b14544553542e474f4b524235746573747573657231a30d1b0b544553542e474f4b524235a4163014a003020101a10d300b1b09746573747573657231a582015a6182015630820152a003020105a10d1b0b544553542e474f4b524235a220301ea003020102a11730151b066b72627467741b0b544553542e474f4b524235a382011830820114a003020112a103020101a28201060482010237e486e32cd18ab1ac9f8d42e93f8babd7b3497084cc5599f18ec61961c6d5242d350354d99d67a7604c451116188d16cb719e84377212eac2743440e8c504ef69c755e489cc6b65f935dd032bfc076f9b2c56d816197845b8fe857d738bc59712787631a50e86833d1b0e4732c8712c856417a6a257758e7d01d3182adb3233f0dde65d228c240ed26aa1af69f8d765dc0bc69096fdb037a75af220fea176839528d44b70f7dabfaa2ea506de1296f847176a60c501fd8cef8e0a51399bb6d5f753962d96292e93ffe344c6630db912931d46d88c0279f00719e22d0efcfd4ee33a702d0b660c1f13970a9beec12c0c8af3dda68bd81ac1fe3f126d2a24ebb445c5a682012c30820128a003020112a282011f0482011bb149cc16018072c4c18788d95a33aba540e52c11b54a93e67e788d05de75d8f3d4aa1afafbbfa6fde3eb40e5aa1890644cea2607efd5213a3fd00345b02eeb9ae1b589f36c74c689cd4ec1239dfe61e42ba6afa33f6240e3cfab291e4abb465d273302dbf7dbd148a299a9369044dd03377c1687e7dd36aa66501284a4ca50c0a7b08f4f87aecfa23b0dd0b11490e3ad330906dab715de81fc52f120d09c39990b8b5330d4601cc396b2ed258834329c4cc02c563a12de3ef9bf11e946258bc2ab5257f4caa4d443a7daf0fc25f6f531c2fcba88af8ca55c85300997cd05abbea52811fe2d038ba8f62fc8e3bc71ce04362d356ea2e1df8ac55c784c53cfb07817d48e39fe99fc8788040d98209c79dcf044d97e80de9f47824646"
 	test_realm               = "TEST.GOKRB5"
 	test_user                = "testuser1"
-	test_user_password	= "passwordvalue"
+	test_user_password       = "passwordvalue"
 )
 
 func TestUnmarshalASRep(t *testing.T) {
@@ -31,7 +32,7 @@ func TestUnmarshalASRep(t *testing.T) {
 		t.Fatalf("Unmarshal error of %s: %v\n", v, err)
 	}
 	assert.Equal(t, testdata.TEST_KVNO, a.PVNO, "PVNO not as expected")
-	assert.Equal(t, types.KrbDictionary.MsgTypesByName["KRB_AS_REP"], a.MsgType, "MsgType not as expected")
+	assert.Equal(t, msgtype.KRB_AS_REP, a.MsgType, "MsgType not as expected")
 	assert.Equal(t, 2, len(a.PAData), "Number of PAData items in the sequence not as expected")
 	for i, pa := range a.PAData {
 		assert.Equal(t, testdata.TEST_PADATA_TYPE, pa.PADataType, fmt.Sprintf("PAData type for entry %d not as expected", i+1))
@@ -66,7 +67,7 @@ func TestUnmarshalASRep_optionalsNULL(t *testing.T) {
 		t.Fatalf("Unmarshal error of %s: %v\n", v, err)
 	}
 	assert.Equal(t, testdata.TEST_KVNO, a.PVNO, "PVNO not as expected")
-	assert.Equal(t, types.KrbDictionary.MsgTypesByName["KRB_AS_REP"], a.MsgType, "MsgType not as expected")
+	assert.Equal(t, msgtype.KRB_AS_REP, a.MsgType, "MsgType not as expected")
 	assert.Equal(t, 0, len(a.PAData), "Number of PAData items in the sequence not as expected")
 	assert.Equal(t, testdata.TEST_REALM, a.CRealm, "Client Realm not as expected")
 	assert.Equal(t, testdata.TEST_PRINCIPALNAME_NAMETYPE, a.CName.NameType, "CName NameType not as expected")
@@ -97,7 +98,7 @@ func TestUnmarshalTGSRep(t *testing.T) {
 		t.Fatalf("Unmarshal error of %s: %v\n", v, err)
 	}
 	assert.Equal(t, testdata.TEST_KVNO, a.PVNO, "PVNO not as expected")
-	assert.Equal(t, types.KrbDictionary.MsgTypesByName["KRB_TGS_REP"], a.MsgType, "MsgType not as expected")
+	assert.Equal(t, msgtype.KRB_TGS_REP, a.MsgType, "MsgType not as expected")
 	assert.Equal(t, 2, len(a.PAData), "Number of PAData items in the sequence not as expected")
 	for i, pa := range a.PAData {
 		assert.Equal(t, testdata.TEST_PADATA_TYPE, pa.PADataType, fmt.Sprintf("PAData type for entry %d not as expected", i+1))
@@ -132,7 +133,7 @@ func TestUnmarshalTGSRep_optionalsNULL(t *testing.T) {
 		t.Fatalf("Unmarshal error of %s: %v\n", v, err)
 	}
 	assert.Equal(t, testdata.TEST_KVNO, a.PVNO, "PVNO not as expected")
-	assert.Equal(t, types.KrbDictionary.MsgTypesByName["KRB_TGS_REP"], a.MsgType, "MsgType not as expected")
+	assert.Equal(t, msgtype.KRB_TGS_REP, a.MsgType, "MsgType not as expected")
 	assert.Equal(t, 0, len(a.PAData), "Number of PAData items in the sequence not as expected")
 	assert.Equal(t, testdata.TEST_REALM, a.CRealm, "Client Realm not as expected")
 	assert.Equal(t, testdata.TEST_PRINCIPALNAME_NAMETYPE, a.CName.NameType, "CName NameType not as expected")
@@ -237,9 +238,9 @@ func TestUnmarshalASRepDecodeAndDecrypt(t *testing.T) {
 	assert.Equal(t, 2, asRep.Ticket.SName.NameType, "Ticket service nametype not as expected")
 	assert.Equal(t, "krbtgt", asRep.Ticket.SName.NameString[0], "Ticket service name string not as expected")
 	assert.Equal(t, test_realm, asRep.Ticket.SName.NameString[1], "Ticket service name string not as expected")
-	assert.Equal(t, types.KrbDictionary.ETypesByName["aes256-cts-hmac-sha1-96"], asRep.Ticket.EncPart.EType, "Etype of ticket encrypted part not as expected")
+	assert.Equal(t, etype.ETypesByName["aes256-cts-hmac-sha1-96"], asRep.Ticket.EncPart.EType, "Etype of ticket encrypted part not as expected")
 	assert.Equal(t, 1, asRep.Ticket.EncPart.KVNO, "Ticket encrypted part KVNO not as expected")
-	assert.Equal(t, types.KrbDictionary.ETypesByName["aes256-cts-hmac-sha1-96"], asRep.EncPart.EType, "Etype of encrypted part not as expected")
+	assert.Equal(t, etype.ETypesByName["aes256-cts-hmac-sha1-96"], asRep.EncPart.EType, "Etype of encrypted part not as expected")
 	assert.Equal(t, 0, asRep.EncPart.KVNO, "Encrypted part KVNO not as expected")
 	//t.Log("Finished testing unecrypted parts of AS REP")
 	ktb, _ := hex.DecodeString(testuser1_etype18_keytab)
@@ -290,9 +291,9 @@ func TestUnmarshalASRepDecodeAndDecrypt_withPassword(t *testing.T) {
 	assert.Equal(t, 2, asRep.Ticket.SName.NameType, "Ticket service nametype not as expected")
 	assert.Equal(t, "krbtgt", asRep.Ticket.SName.NameString[0], "Ticket service name string not as expected")
 	assert.Equal(t, test_realm, asRep.Ticket.SName.NameString[1], "Ticket service name string not as expected")
-	assert.Equal(t, types.KrbDictionary.ETypesByName["aes256-cts-hmac-sha1-96"], asRep.Ticket.EncPart.EType, "Etype of ticket encrypted part not as expected")
+	assert.Equal(t, etype.AES256_CTS_HMAC_SHA1_96, asRep.Ticket.EncPart.EType, "Etype of ticket encrypted part not as expected")
 	assert.Equal(t, 1, asRep.Ticket.EncPart.KVNO, "Ticket encrypted part KVNO not as expected")
-	assert.Equal(t, types.KrbDictionary.ETypesByName["aes256-cts-hmac-sha1-96"], asRep.EncPart.EType, "Etype of encrypted part not as expected")
+	assert.Equal(t, etype.AES256_CTS_HMAC_SHA1_96, asRep.EncPart.EType, "Etype of encrypted part not as expected")
 	assert.Equal(t, 0, asRep.EncPart.KVNO, "Encrypted part KVNO not as expected")
 	err = asRep.DecryptEncPartWithPassword(test_user_password)
 	if err != nil {

+ 11 - 11
messages/KDCReq.go

@@ -7,11 +7,12 @@ import (
 	"fmt"
 	"github.com/jcmturner/asn1"
 	"github.com/jcmturner/gokrb5/asn1tools"
-	"github.com/jcmturner/gokrb5/types"
-	"github.com/jcmturner/gokrb5/types/asnAppTag"
-	"time"
 	"github.com/jcmturner/gokrb5/config"
+	"github.com/jcmturner/gokrb5/iana/asnAppTag"
+	"github.com/jcmturner/gokrb5/iana/msgtype"
+	"github.com/jcmturner/gokrb5/types"
 	"math/rand"
+	"time"
 )
 
 type marshalKDCReq struct {
@@ -74,19 +75,19 @@ func NewASReq(c *config.Config, username string) ASReq {
 	a := ASReq{
 		PVNO:    PVNO,
 		MsgType: KRB_AS_REQ,
-		PAData: pas,
+		PAData:  pas,
 		ReqBody: KDCReqBody{
 			KDCOptions: c.LibDefaults.Kdc_default_options,
-			Realm: c.LibDefaults.Default_realm,
+			Realm:      c.LibDefaults.Default_realm,
 			CName: types.PrincipalName{
-				NameType: types.KRB_NT_PRINCIPAL,
+				NameType:   types.KRB_NT_PRINCIPAL,
 				NameString: []string{username},
 			},
 			SName: types.PrincipalName{
-				NameType: types.KRB_NT_SRV_INST,
+				NameType:   types.KRB_NT_SRV_INST,
 				NameString: []string{"krbtgt", c.LibDefaults.Default_realm},
 			},
-			Till: t.Add(c.LibDefaults.Ticket_lifetime),
+			Till:  t.Add(c.LibDefaults.Ticket_lifetime),
 			Nonce: nonce,
 			EType: c.LibDefaults.Default_tkt_enctype_ids,
 		},
@@ -106,14 +107,13 @@ func NewASReq(c *config.Config, username string) ASReq {
 	return a
 }
 
-
 func (k *ASReq) Unmarshal(b []byte) error {
 	var m marshalKDCReq
 	_, err := asn1.UnmarshalWithParams(b, &m, fmt.Sprintf("application,explicit,tag:%v", asnAppTag.ASREQ))
 	if err != nil {
 		return fmt.Errorf("Error unmarshalling KDC_REQ: %v", err)
 	}
-	expectedMsgType := types.KrbDictionary.MsgTypesByName["KRB_AS_REQ"]
+	expectedMsgType := msgtype.KRB_AS_REQ
 	if m.MsgType != expectedMsgType {
 		return fmt.Errorf("Message ID does not indicate a KRB_AS_REQ. Expected: %v; Actual: %v", expectedMsgType, m.MsgType)
 	}
@@ -135,7 +135,7 @@ func (k *TGSReq) Unmarshal(b []byte) error {
 	if err != nil {
 		return fmt.Errorf("Error unmarshalling KDC_REQ: %v", err)
 	}
-	expectedMsgType := types.KrbDictionary.MsgTypesByName["KRB_TGS_REQ"]
+	expectedMsgType := msgtype.KRB_TGS_REQ
 	if m.MsgType != expectedMsgType {
 		return fmt.Errorf("Message ID does not indicate a KRB_TGS_REQ. Expected: %v; Actual: %v", expectedMsgType, m.MsgType)
 	}

+ 7 - 7
messages/KDCReq_test.go

@@ -4,8 +4,8 @@ import (
 	"encoding/hex"
 	"fmt"
 	"github.com/jcmturner/asn1"
+	"github.com/jcmturner/gokrb5/iana/msgtype"
 	"github.com/jcmturner/gokrb5/testdata"
-	"github.com/jcmturner/gokrb5/types"
 	"github.com/stretchr/testify/assert"
 	"testing"
 	"time"
@@ -135,7 +135,7 @@ func TestUnmarshalASReq(t *testing.T) {
 	tt, _ := time.Parse(testdata.TEST_TIME_FORMAT, testdata.TEST_TIME)
 
 	assert.Equal(t, testdata.TEST_KVNO, a.PVNO, "PVNO not as expected")
-	assert.Equal(t, types.KrbDictionary.MsgTypesByName["KRB_AS_REQ"], a.MsgType, "Message ID not as expected")
+	assert.Equal(t, msgtype.KRB_AS_REQ, a.MsgType, "Message ID not as expected")
 	assert.Equal(t, 2, len(a.PAData), "Number of PAData items in the sequence not as expected")
 	for i, pa := range a.PAData {
 		assert.Equal(t, testdata.TEST_PADATA_TYPE, pa.PADataType, fmt.Sprintf("PAData type for entry %d not as expected", i+1))
@@ -190,7 +190,7 @@ func TestUnmarshalASReq_optionalsNULLexceptsecond_ticket(t *testing.T) {
 	tt, _ := time.Parse(testdata.TEST_TIME_FORMAT, testdata.TEST_TIME)
 
 	assert.Equal(t, testdata.TEST_KVNO, a.PVNO, "PVNO not as expected")
-	assert.Equal(t, types.KrbDictionary.MsgTypesByName["KRB_AS_REQ"], a.MsgType, "Message ID not as expected")
+	assert.Equal(t, msgtype.KRB_AS_REQ, a.MsgType, "Message ID not as expected")
 	assert.Equal(t, 0, len(a.PAData), "Number of PAData items in the sequence not as expected")
 	assert.Equal(t, "fedcba98", hex.EncodeToString(a.ReqBody.KDCOptions.Bytes), "Request body flags not as expected")
 	assert.Equal(t, testdata.TEST_REALM, a.ReqBody.Realm, "Request body Realm not as expected")
@@ -227,7 +227,7 @@ func TestUnmarshalASReq_optionalsNULLexceptserver(t *testing.T) {
 	tt, _ := time.Parse(testdata.TEST_TIME_FORMAT, testdata.TEST_TIME)
 
 	assert.Equal(t, testdata.TEST_KVNO, a.PVNO, "PVNO not as expected")
-	assert.Equal(t, types.KrbDictionary.MsgTypesByName["KRB_AS_REQ"], a.MsgType, "Message ID not as expected")
+	assert.Equal(t, msgtype.KRB_AS_REQ, a.MsgType, "Message ID not as expected")
 	assert.Equal(t, 0, len(a.PAData), "Number of PAData items in the sequence not as expected")
 	assert.Equal(t, "fedcba90", hex.EncodeToString(a.ReqBody.KDCOptions.Bytes), "Request body flags not as expected")
 	assert.Equal(t, testdata.TEST_REALM, a.ReqBody.Realm, "Request body Realm not as expected")
@@ -257,7 +257,7 @@ func TestUnmarshalTGSReq(t *testing.T) {
 	tt, _ := time.Parse(testdata.TEST_TIME_FORMAT, testdata.TEST_TIME)
 
 	assert.Equal(t, testdata.TEST_KVNO, a.PVNO, "PVNO not as expected")
-	assert.Equal(t, types.KrbDictionary.MsgTypesByName["KRB_TGS_REQ"], a.MsgType, "Message ID not as expected")
+	assert.Equal(t, msgtype.KRB_TGS_REQ, a.MsgType, "Message ID not as expected")
 	assert.Equal(t, 2, len(a.PAData), "Number of PAData items in the sequence not as expected")
 	for i, pa := range a.PAData {
 		assert.Equal(t, testdata.TEST_PADATA_TYPE, pa.PADataType, fmt.Sprintf("PAData type for entry %d not as expected", i+1))
@@ -312,7 +312,7 @@ func TestUnmarshalTGSReq_optionalsNULLexceptsecond_ticket(t *testing.T) {
 	tt, _ := time.Parse(testdata.TEST_TIME_FORMAT, testdata.TEST_TIME)
 
 	assert.Equal(t, testdata.TEST_KVNO, a.PVNO, "PVNO not as expected")
-	assert.Equal(t, types.KrbDictionary.MsgTypesByName["KRB_TGS_REQ"], a.MsgType, "Message ID not as expected")
+	assert.Equal(t, msgtype.KRB_TGS_REQ, a.MsgType, "Message ID not as expected")
 	assert.Equal(t, 0, len(a.PAData), "Number of PAData items in the sequence not as expected")
 	assert.Equal(t, "fedcba98", hex.EncodeToString(a.ReqBody.KDCOptions.Bytes), "Request body flags not as expected")
 	assert.Equal(t, testdata.TEST_REALM, a.ReqBody.Realm, "Request body Realm not as expected")
@@ -349,7 +349,7 @@ func TestUnmarshalTGSReq_optionalsNULLexceptserver(t *testing.T) {
 	tt, _ := time.Parse(testdata.TEST_TIME_FORMAT, testdata.TEST_TIME)
 
 	assert.Equal(t, testdata.TEST_KVNO, a.PVNO, "PVNO not as expected")
-	assert.Equal(t, types.KrbDictionary.MsgTypesByName["KRB_TGS_REQ"], a.MsgType, "Message ID not as expected")
+	assert.Equal(t, msgtype.KRB_TGS_REQ, a.MsgType, "Message ID not as expected")
 	assert.Equal(t, 0, len(a.PAData), "Number of PAData items in the sequence not as expected")
 	assert.Equal(t, "fedcba90", hex.EncodeToString(a.ReqBody.KDCOptions.Bytes), "Request body flags not as expected")
 	assert.Equal(t, testdata.TEST_REALM, a.ReqBody.Realm, "Request body Realm not as expected")

+ 3 - 2
messages/KRBCred.go

@@ -4,8 +4,9 @@ import (
 	"fmt"
 	"github.com/jcmturner/asn1"
 	"github.com/jcmturner/gokrb5/crypto"
+	"github.com/jcmturner/gokrb5/iana/asnAppTag"
+	"github.com/jcmturner/gokrb5/iana/msgtype"
 	"github.com/jcmturner/gokrb5/types"
-	"github.com/jcmturner/gokrb5/types/asnAppTag"
 	"time"
 )
 
@@ -53,7 +54,7 @@ func (k *KRBCred) Unmarshal(b []byte) error {
 	if err != nil {
 		return fmt.Errorf("Error unmarshalling KDC_CRED: %v", err)
 	}
-	expectedMsgType := types.KrbDictionary.MsgTypesByName["KRB_CRED"]
+	expectedMsgType := msgtype.KRB_CRED
 	if m.MsgType != expectedMsgType {
 		return fmt.Errorf("Message ID does not indicate a KRB_CRED. Expected: %v; Actual: %v", expectedMsgType, m.MsgType)
 	}

+ 42 - 42
messages/KRBCred_test.go

@@ -3,8 +3,8 @@ package messages
 import (
 	"encoding/hex"
 	"fmt"
+	"github.com/jcmturner/gokrb5/iana/msgtype"
 	"github.com/jcmturner/gokrb5/testdata"
-	"github.com/jcmturner/gokrb5/types"
 	"github.com/stretchr/testify/assert"
 	"testing"
 	"time"
@@ -22,7 +22,7 @@ func TestUnmarshalKRBCred(t *testing.T) {
 		t.Fatalf("Unmarshal error of %s: %v\n", v, err)
 	}
 	assert.Equal(t, testdata.TEST_KVNO, a.PVNO, "PVNO not as expected")
-	assert.Equal(t, types.KrbDictionary.MsgTypesByName["KRB_CRED"], a.MsgType, "Message type not as expected")
+	assert.Equal(t, msgtype.KRB_CRED, a.MsgType, "Message type not as expected")
 	assert.Equal(t, 2, len(a.Tickets), "Number of tickets not as expected")
 	for i, tkt := range a.Tickets {
 		assert.Equal(t, testdata.TEST_KVNO, tkt.TktVNO, fmt.Sprintf("Ticket (%v) ticket-vno not as expected", i+1))
@@ -55,24 +55,24 @@ func TestUnmarshalEncCredPart(t *testing.T) {
 
 	assert.Equal(t, 2, len(a.TicketInfo), "Number of ticket info items not as expected")
 	for i, tkt := range a.TicketInfo {
-		assert.Equal(t, 1, tkt.Key.KeyType, fmt.Sprintf("Key type not as expected in ticket info item %d", i + 1))
-		assert.Equal(t, []byte("12345678"), tkt.Key.KeyValue, fmt.Sprintf("Key value not as expected in ticket info item %d", i + 1))
-		assert.Equal(t, testdata.TEST_REALM, tkt.PRealm, fmt.Sprintf("PRealm not as expected on ticket info item %d", i + 1))
-		assert.Equal(t, testdata.TEST_PRINCIPALNAME_NAMETYPE, tkt.PName.NameType, fmt.Sprintf("Ticket info (%v) PName NameType not as expected", i + 1))
-		assert.Equal(t, len(testdata.TEST_PRINCIPALNAME_NAMESTRING), len(tkt.PName.NameString), fmt.Sprintf("Ticket info (%v) PName does not have the expected number of NameStrings", i + 1))
-		assert.Equal(t, testdata.TEST_PRINCIPALNAME_NAMESTRING, tkt.PName.NameString, fmt.Sprintf("Ticket info (%v) PName name string entries not as expected", i + 1))
-		assert.Equal(t, "fedcba98", hex.EncodeToString(tkt.Flags.Bytes), fmt.Sprintf("Flags not as expected on ticket info %d", i + 1))
-		assert.Equal(t, tt, tkt.AuthTime, fmt.Sprintf("Auth time value not as expected for ticket info %d", i + 1))
-		assert.Equal(t, tt, tkt.StartTime, fmt.Sprintf("Start time value not as expected for ticket info %d", i + 1))
-		assert.Equal(t, tt, tkt.EndTime, fmt.Sprintf("End time value not as expected for ticket info %d", i + 1))
-		assert.Equal(t, tt, tkt.RenewTill, fmt.Sprintf("Renew Till time value not as expected for ticket info %d", i + 1))
-		assert.Equal(t, testdata.TEST_PRINCIPALNAME_NAMETYPE, tkt.SName.NameType, fmt.Sprintf("Ticket info (%v) PName NameType not as expected", i + 1))
-		assert.Equal(t, len(testdata.TEST_PRINCIPALNAME_NAMESTRING), len(tkt.SName.NameString), fmt.Sprintf("Ticket info (%v) PName does not have the expected number of NameStrings", i + 1))
-		assert.Equal(t, testdata.TEST_PRINCIPALNAME_NAMESTRING, tkt.SName.NameString, fmt.Sprintf("Ticket info (%v) PName name string entries not as expected", i + 1))
+		assert.Equal(t, 1, tkt.Key.KeyType, fmt.Sprintf("Key type not as expected in ticket info item %d", i+1))
+		assert.Equal(t, []byte("12345678"), tkt.Key.KeyValue, fmt.Sprintf("Key value not as expected in ticket info item %d", i+1))
+		assert.Equal(t, testdata.TEST_REALM, tkt.PRealm, fmt.Sprintf("PRealm not as expected on ticket info item %d", i+1))
+		assert.Equal(t, testdata.TEST_PRINCIPALNAME_NAMETYPE, tkt.PName.NameType, fmt.Sprintf("Ticket info (%v) PName NameType not as expected", i+1))
+		assert.Equal(t, len(testdata.TEST_PRINCIPALNAME_NAMESTRING), len(tkt.PName.NameString), fmt.Sprintf("Ticket info (%v) PName does not have the expected number of NameStrings", i+1))
+		assert.Equal(t, testdata.TEST_PRINCIPALNAME_NAMESTRING, tkt.PName.NameString, fmt.Sprintf("Ticket info (%v) PName name string entries not as expected", i+1))
+		assert.Equal(t, "fedcba98", hex.EncodeToString(tkt.Flags.Bytes), fmt.Sprintf("Flags not as expected on ticket info %d", i+1))
+		assert.Equal(t, tt, tkt.AuthTime, fmt.Sprintf("Auth time value not as expected for ticket info %d", i+1))
+		assert.Equal(t, tt, tkt.StartTime, fmt.Sprintf("Start time value not as expected for ticket info %d", i+1))
+		assert.Equal(t, tt, tkt.EndTime, fmt.Sprintf("End time value not as expected for ticket info %d", i+1))
+		assert.Equal(t, tt, tkt.RenewTill, fmt.Sprintf("Renew Till time value not as expected for ticket info %d", i+1))
+		assert.Equal(t, testdata.TEST_PRINCIPALNAME_NAMETYPE, tkt.SName.NameType, fmt.Sprintf("Ticket info (%v) PName NameType not as expected", i+1))
+		assert.Equal(t, len(testdata.TEST_PRINCIPALNAME_NAMESTRING), len(tkt.SName.NameString), fmt.Sprintf("Ticket info (%v) PName does not have the expected number of NameStrings", i+1))
+		assert.Equal(t, testdata.TEST_PRINCIPALNAME_NAMESTRING, tkt.SName.NameString, fmt.Sprintf("Ticket info (%v) PName name string entries not as expected", i+1))
 		assert.Equal(t, 2, len(tkt.CAddr), "Number of client addresses not as expected")
 		for j, addr := range tkt.CAddr {
-			assert.Equal(t, 2, addr.AddrType, fmt.Sprintf("Host address type not as expected for address item %d within ticket info %d", j + 1, i + 1))
-			assert.Equal(t, "12d00023", hex.EncodeToString(addr.Address), fmt.Sprintf("Host address not as expected for address item %d within ticket info %d", j + 1, i + 1))
+			assert.Equal(t, 2, addr.AddrType, fmt.Sprintf("Host address type not as expected for address item %d within ticket info %d", j+1, i+1))
+			assert.Equal(t, "12d00023", hex.EncodeToString(addr.Address), fmt.Sprintf("Host address not as expected for address item %d within ticket info %d", j+1, i+1))
 		}
 	}
 	assert.Equal(t, testdata.TEST_NONCE, a.Nouce, "Nouce not as expected")
@@ -100,29 +100,29 @@ func TestUnmarshalEncCredPart_optionalsNULL(t *testing.T) {
 
 	assert.Equal(t, 2, len(a.TicketInfo), "Number of ticket info items not as expected")
 	//1st Ticket
-	i:=0
-	assert.Equal(t, 1, a.TicketInfo[i].Key.KeyType, fmt.Sprintf("Key type not as expected in ticket info item %d", i + 1))
-	assert.Equal(t, []byte("12345678"), a.TicketInfo[i].Key.KeyValue, fmt.Sprintf("Key value not as expected in ticket info item %d", i + 1))
+	i := 0
+	assert.Equal(t, 1, a.TicketInfo[i].Key.KeyType, fmt.Sprintf("Key type not as expected in ticket info item %d", i+1))
+	assert.Equal(t, []byte("12345678"), a.TicketInfo[i].Key.KeyValue, fmt.Sprintf("Key value not as expected in ticket info item %d", i+1))
 
 	//2nd Ticket
-	i=1
-	assert.Equal(t, 1, a.TicketInfo[i].Key.KeyType, fmt.Sprintf("Key type not as expected in ticket info item %d", i + 1))
-		assert.Equal(t, []byte("12345678"), a.TicketInfo[i].Key.KeyValue, fmt.Sprintf("Key value not as expected in ticket info item %d", i + 1))
-		assert.Equal(t, testdata.TEST_REALM, a.TicketInfo[i].PRealm, fmt.Sprintf("PRealm not as expected on ticket info item %d", i + 1))
-		assert.Equal(t, testdata.TEST_PRINCIPALNAME_NAMETYPE, a.TicketInfo[i].PName.NameType, fmt.Sprintf("Ticket info (%v) PName NameType not as expected", i + 1))
-		assert.Equal(t, len(testdata.TEST_PRINCIPALNAME_NAMESTRING), len(a.TicketInfo[i].PName.NameString), fmt.Sprintf("Ticket info (%v) PName does not have the expected number of NameStrings", i + 1))
-		assert.Equal(t, testdata.TEST_PRINCIPALNAME_NAMESTRING, a.TicketInfo[i].PName.NameString, fmt.Sprintf("Ticket info (%v) PName name string entries not as expected", i + 1))
-		assert.Equal(t, "fedcba98", hex.EncodeToString(a.TicketInfo[i].Flags.Bytes), fmt.Sprintf("Flags not as expected on ticket info %d", i + 1))
-		assert.Equal(t, tt, a.TicketInfo[i].AuthTime, fmt.Sprintf("Auth time value not as expected for ticket info %d", i + 1))
-		assert.Equal(t, tt, a.TicketInfo[i].StartTime, fmt.Sprintf("Start time value not as expected for ticket info %d", i + 1))
-		assert.Equal(t, tt, a.TicketInfo[i].EndTime, fmt.Sprintf("End time value not as expected for ticket info %d", i + 1))
-		assert.Equal(t, tt, a.TicketInfo[i].RenewTill, fmt.Sprintf("Renew Till time value not as expected for ticket info %d", i + 1))
-		assert.Equal(t, testdata.TEST_PRINCIPALNAME_NAMETYPE, a.TicketInfo[i].SName.NameType, fmt.Sprintf("Ticket info (%v) PName NameType not as expected", i + 1))
-		assert.Equal(t, len(testdata.TEST_PRINCIPALNAME_NAMESTRING), len(a.TicketInfo[i].SName.NameString), fmt.Sprintf("Ticket info (%v) PName does not have the expected number of NameStrings", i + 1))
-		assert.Equal(t, testdata.TEST_PRINCIPALNAME_NAMESTRING, a.TicketInfo[i].SName.NameString, fmt.Sprintf("Ticket info (%v) PName name string entries not as expected", i + 1))
-		assert.Equal(t, 2, len(a.TicketInfo[i].CAddr), "Number of client addresses not as expected")
-		for j, addr := range a.TicketInfo[i].CAddr {
-			assert.Equal(t, 2, addr.AddrType, fmt.Sprintf("Host address type not as expected for address item %d within ticket info %d", j + 1, i + 1))
-			assert.Equal(t, "12d00023", hex.EncodeToString(addr.Address), fmt.Sprintf("Host address not as expected for address item %d within ticket info %d", j + 1, i + 1))
-		}
-}
+	i = 1
+	assert.Equal(t, 1, a.TicketInfo[i].Key.KeyType, fmt.Sprintf("Key type not as expected in ticket info item %d", i+1))
+	assert.Equal(t, []byte("12345678"), a.TicketInfo[i].Key.KeyValue, fmt.Sprintf("Key value not as expected in ticket info item %d", i+1))
+	assert.Equal(t, testdata.TEST_REALM, a.TicketInfo[i].PRealm, fmt.Sprintf("PRealm not as expected on ticket info item %d", i+1))
+	assert.Equal(t, testdata.TEST_PRINCIPALNAME_NAMETYPE, a.TicketInfo[i].PName.NameType, fmt.Sprintf("Ticket info (%v) PName NameType not as expected", i+1))
+	assert.Equal(t, len(testdata.TEST_PRINCIPALNAME_NAMESTRING), len(a.TicketInfo[i].PName.NameString), fmt.Sprintf("Ticket info (%v) PName does not have the expected number of NameStrings", i+1))
+	assert.Equal(t, testdata.TEST_PRINCIPALNAME_NAMESTRING, a.TicketInfo[i].PName.NameString, fmt.Sprintf("Ticket info (%v) PName name string entries not as expected", i+1))
+	assert.Equal(t, "fedcba98", hex.EncodeToString(a.TicketInfo[i].Flags.Bytes), fmt.Sprintf("Flags not as expected on ticket info %d", i+1))
+	assert.Equal(t, tt, a.TicketInfo[i].AuthTime, fmt.Sprintf("Auth time value not as expected for ticket info %d", i+1))
+	assert.Equal(t, tt, a.TicketInfo[i].StartTime, fmt.Sprintf("Start time value not as expected for ticket info %d", i+1))
+	assert.Equal(t, tt, a.TicketInfo[i].EndTime, fmt.Sprintf("End time value not as expected for ticket info %d", i+1))
+	assert.Equal(t, tt, a.TicketInfo[i].RenewTill, fmt.Sprintf("Renew Till time value not as expected for ticket info %d", i+1))
+	assert.Equal(t, testdata.TEST_PRINCIPALNAME_NAMETYPE, a.TicketInfo[i].SName.NameType, fmt.Sprintf("Ticket info (%v) PName NameType not as expected", i+1))
+	assert.Equal(t, len(testdata.TEST_PRINCIPALNAME_NAMESTRING), len(a.TicketInfo[i].SName.NameString), fmt.Sprintf("Ticket info (%v) PName does not have the expected number of NameStrings", i+1))
+	assert.Equal(t, testdata.TEST_PRINCIPALNAME_NAMESTRING, a.TicketInfo[i].SName.NameString, fmt.Sprintf("Ticket info (%v) PName name string entries not as expected", i+1))
+	assert.Equal(t, 2, len(a.TicketInfo[i].CAddr), "Number of client addresses not as expected")
+	for j, addr := range a.TicketInfo[i].CAddr {
+		assert.Equal(t, 2, addr.AddrType, fmt.Sprintf("Host address type not as expected for address item %d within ticket info %d", j+1, i+1))
+		assert.Equal(t, "12d00023", hex.EncodeToString(addr.Address), fmt.Sprintf("Host address not as expected for address item %d within ticket info %d", j+1, i+1))
+	}
+}

+ 3 - 2
messages/KRBError.go

@@ -3,8 +3,9 @@ package messages
 import (
 	"fmt"
 	"github.com/jcmturner/asn1"
+	"github.com/jcmturner/gokrb5/iana/asnAppTag"
+	"github.com/jcmturner/gokrb5/iana/msgtype"
 	"github.com/jcmturner/gokrb5/types"
-	"github.com/jcmturner/gokrb5/types/asnAppTag"
 	"time"
 )
 
@@ -29,7 +30,7 @@ func (k *KRBError) Unmarshal(b []byte) error {
 	if err != nil {
 		return err
 	}
-	expectedMsgType := types.KrbDictionary.MsgTypesByName["KRB_ERROR"]
+	expectedMsgType := msgtype.KRB_ERROR
 	if k.MsgType != expectedMsgType {
 		return fmt.Errorf("Message ID does not indicate a KRB_ERROR. Expected: %v; Actual: %v", expectedMsgType, k.MsgType)
 	}

+ 3 - 3
messages/KRBError_test.go

@@ -2,8 +2,8 @@ package messages
 
 import (
 	"encoding/hex"
+	"github.com/jcmturner/gokrb5/iana/msgtype"
 	"github.com/jcmturner/gokrb5/testdata"
-	"github.com/jcmturner/gokrb5/types"
 	"github.com/stretchr/testify/assert"
 	"testing"
 	"time"
@@ -24,7 +24,7 @@ func TestUnmarshalKRBError(t *testing.T) {
 	tt, _ := time.Parse(testdata.TEST_TIME_FORMAT, testdata.TEST_TIME)
 
 	assert.Equal(t, testdata.TEST_KVNO, a.PVNO, "PVNO is not as expected")
-	assert.Equal(t, types.KrbDictionary.MsgTypesByName["KRB_ERROR"], a.MsgType, "Message type is not as expected")
+	assert.Equal(t, msgtype.KRB_ERROR, a.MsgType, "Message type is not as expected")
 	assert.Equal(t, tt, a.CTime, "CTime not as expected")
 	assert.Equal(t, 123456, a.Cusec, "Client microseconds not as expected")
 	assert.Equal(t, tt, a.STime, "STime not as expected")
@@ -57,7 +57,7 @@ func TestUnmarshalKRBError_optionalsNULL(t *testing.T) {
 	tt, _ := time.Parse(testdata.TEST_TIME_FORMAT, testdata.TEST_TIME)
 
 	assert.Equal(t, testdata.TEST_KVNO, a.PVNO, "PVNO is not as expected")
-	assert.Equal(t, types.KrbDictionary.MsgTypesByName["KRB_ERROR"], a.MsgType, "Message type is not as expected")
+	assert.Equal(t, msgtype.KRB_ERROR, a.MsgType, "Message type is not as expected")
 	assert.Equal(t, 123456, a.Cusec, "Client microseconds not as expected")
 	assert.Equal(t, tt, a.STime, "STime not as expected")
 	assert.Equal(t, 123456, a.Susec, "Service microseconds not as expected")

+ 3 - 2
messages/KRBPriv.go

@@ -3,8 +3,9 @@ package messages
 import (
 	"fmt"
 	"github.com/jcmturner/asn1"
+	"github.com/jcmturner/gokrb5/iana/asnAppTag"
+	"github.com/jcmturner/gokrb5/iana/msgtype"
 	"github.com/jcmturner/gokrb5/types"
-	"github.com/jcmturner/gokrb5/types/asnAppTag"
 	"time"
 )
 
@@ -28,7 +29,7 @@ func (k *KRBPriv) Unmarshal(b []byte) error {
 	if err != nil {
 		return err
 	}
-	expectedMsgType := types.KrbDictionary.MsgTypesByName["KRB_PRIV"]
+	expectedMsgType := msgtype.KRB_PRIV
 	if k.MsgType != expectedMsgType {
 		return fmt.Errorf("Message ID does not indicate a KRB_PRIV. Expected: %v; Actual: %v", expectedMsgType, k.MsgType)
 	}

+ 2 - 2
messages/KRBPriv_test.go

@@ -2,8 +2,8 @@ package messages
 
 import (
 	"encoding/hex"
+	"github.com/jcmturner/gokrb5/iana/msgtype"
 	"github.com/jcmturner/gokrb5/testdata"
-	"github.com/jcmturner/gokrb5/types"
 	"github.com/stretchr/testify/assert"
 	"testing"
 	"time"
@@ -21,7 +21,7 @@ func TestUnmarshalKRBPriv(t *testing.T) {
 		t.Fatalf("Unmarshal error of %s: %v\n", v, err)
 	}
 	assert.Equal(t, testdata.TEST_KVNO, a.PVNO, "PVNO not as expected")
-	assert.Equal(t, types.KrbDictionary.MsgTypesByName["KRB_PRIV"], a.MsgType, "Message type not as expected")
+	assert.Equal(t, msgtype.KRB_PRIV, a.MsgType, "Message type not as expected")
 	assert.Equal(t, testdata.TEST_KVNO, a.EncPart.KVNO, "EncPart KVNO not as expected")
 	assert.Equal(t, testdata.TEST_ETYPE, a.EncPart.EType, "EncPart etype not as expected")
 	assert.Equal(t, []byte(testdata.TEST_CIPHERTEXT), a.EncPart.Cipher, "Cipher text of EncPart not as expected")

+ 3 - 2
messages/KRBSafe.go

@@ -3,8 +3,9 @@ package messages
 import (
 	"fmt"
 	"github.com/jcmturner/asn1"
+	"github.com/jcmturner/gokrb5/iana/asnAppTag"
+	"github.com/jcmturner/gokrb5/iana/msgtype"
 	"github.com/jcmturner/gokrb5/types"
-	"github.com/jcmturner/gokrb5/types/asnAppTag"
 	"time"
 )
 
@@ -47,7 +48,7 @@ func (s *KRBSafe) Unmarshal(b []byte) error {
 	if err != nil {
 		return err
 	}
-	expectedMsgType := types.KrbDictionary.MsgTypesByName["KRB_SAFE"]
+	expectedMsgType := msgtype.KRB_SAFE
 	if s.MsgType != expectedMsgType {
 		return fmt.Errorf("Message ID does not indicate a KRB_SAFE. Expected: %v; Actual: %v", expectedMsgType, s.MsgType)
 	}

+ 3 - 3
messages/KRBSafe_test.go

@@ -2,8 +2,8 @@ package messages
 
 import (
 	"encoding/hex"
+	"github.com/jcmturner/gokrb5/iana/msgtype"
 	"github.com/jcmturner/gokrb5/testdata"
-	"github.com/jcmturner/gokrb5/types"
 	"github.com/stretchr/testify/assert"
 	"testing"
 	"time"
@@ -24,7 +24,7 @@ func TestUnmarshalKRBSafe(t *testing.T) {
 	tt, _ := time.Parse(testdata.TEST_TIME_FORMAT, testdata.TEST_TIME)
 
 	assert.Equal(t, testdata.TEST_KVNO, a.PVNO, "PVNO not as expected")
-	assert.Equal(t, types.KrbDictionary.MsgTypesByName["KRB_SAFE"], a.MsgType, "MsgType is not as expected")
+	assert.Equal(t, msgtype.KRB_SAFE, a.MsgType, "MsgType is not as expected")
 	assert.Equal(t, []byte("krb5data"), a.SafeBody.UserData, "Safe body userdata not as expected")
 	assert.Equal(t, tt, a.SafeBody.Timestamp, "Safe body timestamp not as expected")
 	assert.Equal(t, 123456, a.SafeBody.Usec, "Safe body microseconds not as expected")
@@ -50,7 +50,7 @@ func TestUnmarshalKRBSafe_optionalsNULL(t *testing.T) {
 	}
 
 	assert.Equal(t, testdata.TEST_KVNO, a.PVNO, "PVNO not as expected")
-	assert.Equal(t, types.KrbDictionary.MsgTypesByName["KRB_SAFE"], a.MsgType, "MsgType is not as expected")
+	assert.Equal(t, msgtype.KRB_SAFE, a.MsgType, "MsgType is not as expected")
 	assert.Equal(t, []byte("krb5data"), a.SafeBody.UserData, "Safe body userdata not as expected")
 	assert.Equal(t, 2, a.SafeBody.SAddress.AddrType, "SAddress type not as expected")
 	assert.Equal(t, "12d00023", hex.EncodeToString(a.SafeBody.SAddress.Address), "SAddress not as expected")

+ 1 - 1
types/Authenticator.go

@@ -3,7 +3,7 @@ package types
 import (
 	"fmt"
 	"github.com/jcmturner/asn1"
-	"github.com/jcmturner/gokrb5/types/asnAppTag"
+	"github.com/jcmturner/gokrb5/iana/asnAppTag"
 	"time"
 )
 

+ 5 - 6
types/PAData.go

@@ -5,6 +5,7 @@ package types
 import (
 	"fmt"
 	"github.com/jcmturner/asn1"
+	"github.com/jcmturner/gokrb5/iana/patype"
 	"time"
 )
 
@@ -97,9 +98,8 @@ func (a *ETypeInfo2Entry) Unmarshal(b []byte) error {
 }
 
 func (pa *PAData) GetETypeInfo() (d ETypeInfo, err error) {
-	dt := KrbDictionary.PADataTypesByName["pa-etype-info"]
-	if pa.PADataType != dt {
-		err = fmt.Errorf("PAData does not contain PA EType Info data. TypeID Expected: %v; Actual: %v", dt, pa.PADataType)
+	if pa.PADataType != patype.PA_ETYPE_INFO {
+		err = fmt.Errorf("PAData does not contain PA EType Info data. TypeID Expected: %v; Actual: %v", patype.PA_ETYPE_INFO, pa.PADataType)
 		return
 	}
 	_, err = asn1.Unmarshal(pa.PADataValue, &d)
@@ -107,9 +107,8 @@ func (pa *PAData) GetETypeInfo() (d ETypeInfo, err error) {
 }
 
 func (pa *PAData) GetETypeInfo2() (d ETypeInfo2, err error) {
-	dt := KrbDictionary.PADataTypesByName["pa-etype-info2"]
-	if pa.PADataType != dt {
-		err = fmt.Errorf("PAData does not contain PA EType Info 2 data. TypeID Expected: %v; Actual: %v", dt, pa.PADataType)
+	if pa.PADataType != patype.PA_ETYPE_INFO2 {
+		err = fmt.Errorf("PAData does not contain PA EType Info 2 data. TypeID Expected: %v; Actual: %v", patype.PA_ETYPE_INFO2, pa.PADataType)
 		return
 	}
 	_, err = asn1.Unmarshal(pa.PADataValue, &d)

+ 1 - 1
types/Ticket.go

@@ -4,7 +4,7 @@ import (
 	"fmt"
 	"github.com/jcmturner/asn1"
 	"github.com/jcmturner/gokrb5/asn1tools"
-	"github.com/jcmturner/gokrb5/types/asnAppTag"
+	"github.com/jcmturner/gokrb5/iana/asnAppTag"
 	"time"
 )
 

+ 1 - 1
types/dictionary.go

@@ -1,6 +1,6 @@
 package types
 
-var KrbDictionary = struct {
+var KrbDictionary1 = struct {
 	MsgTypesByID      map[int]string
 	MsgTypesByName    map[string]int
 	NameTypesByID     map[int]string