Browse Source

package rename

Jonathan Turner 9 years ago
parent
commit
a0db32dbd5

+ 1 - 2
krb5crypto/EncryptionEngine.go → crypto/EncryptionEngine.go

@@ -1,4 +1,4 @@
-package krb5crypto
+package crypto
 
 
 import (
 import (
 	"bytes"
 	"bytes"
@@ -157,4 +157,3 @@ var KeyUsageNumbers map[int]string = map[int]string{
 	19:   "AD-KDC-ISSUED checksum",
 	19:   "AD-KDC-ISSUED checksum",
 	1024: "Encryption for application use in protocols that do not specify key usage values",
 	1024: "Encryption for application use in protocols that do not specify key usage values",
 }
 }
-

+ 1 - 1
krb5crypto/aes-cts-hmac-sha1-96.go → crypto/aes-cts-hmac-sha1-96.go

@@ -1,4 +1,4 @@
-package krb5crypto
+package crypto
 
 
 import (
 import (
 	"bytes"
 	"bytes"

+ 1 - 1
krb5crypto/aes-cts-hmac-sha1-96_test.go → crypto/aes-cts-hmac-sha1-96_test.go

@@ -1,4 +1,4 @@
-package krb5crypto
+package crypto
 
 
 import (
 import (
 	"encoding/hex"
 	"encoding/hex"

+ 1 - 1
krb5crypto/aes128-cts-hmac-sha1-96.go → crypto/aes128-cts-hmac-sha1-96.go

@@ -1,4 +1,4 @@
-package krb5crypto
+package crypto
 
 
 import (
 import (
 	"crypto/aes"
 	"crypto/aes"

+ 1 - 1
krb5crypto/aes256-cts-hmac-sha1-96.go → crypto/aes256-cts-hmac-sha1-96.go

@@ -1,4 +1,4 @@
-package krb5crypto
+package crypto
 
 
 import (
 import (
 	"crypto/aes"
 	"crypto/aes"

+ 1 - 1
krb5crypto/des3-cbc-sha1-kd.go → crypto/des3-cbc-sha1-kd.go

@@ -1,4 +1,4 @@
-package krb5crypto
+package crypto
 
 
 import (
 import (
 	"crypto/cipher"
 	"crypto/cipher"

+ 7 - 7
krb5crypto/des3-cbc-sha1-kd_test.go → crypto/des3-cbc-sha1-kd_test.go

@@ -1,19 +1,19 @@
-package krb5crypto
+package crypto
 
 
 import (
 import (
-	"testing"
-	"github.com/stretchr/testify/assert"
 	"encoding/hex"
 	"encoding/hex"
 	"fmt"
 	"fmt"
+	"github.com/stretchr/testify/assert"
+	"testing"
 )
 )
 
 
-func TestDes3CbcSha1Kd_DR_DK(t *testing.T){
+func TestDes3CbcSha1Kd_DR_DK(t *testing.T) {
 	// Test vectors from RFC 3961 Appendix A3
 	// Test vectors from RFC 3961 Appendix A3
 	var tests = []struct {
 	var tests = []struct {
-		key string
+		key   string
 		usage string
 		usage string
-		dr string
-		dk string
+		dr    string
+		dk    string
 	}{
 	}{
 		{"dce06b1f64c857a11c3db57c51899b2cc1791008ce973b92", "0000000155", "935079d14490a75c3093c4a6e8c3b049c71e6ee705", "925179d04591a79b5d3192c4a7e9c289b049c71f6ee604cd"},
 		{"dce06b1f64c857a11c3db57c51899b2cc1791008ce973b92", "0000000155", "935079d14490a75c3093c4a6e8c3b049c71e6ee705", "925179d04591a79b5d3192c4a7e9c289b049c71f6ee604cd"},
 		{"5e13d31c70ef765746578531cb51c15bf11ca82c97cee9f2", "00000001aa", "9f58e5a047d894101c469845d67ae3c5249ed812f2", "9e58e5a146d9942a101c469845d67a20e3c4259ed913f207"},
 		{"5e13d31c70ef765746578531cb51c15bf11ca82c97cee9f2", "00000001aa", "9f58e5a047d894101c469845d67ae3c5249ed812f2", "9e58e5a146d9942a101c469845d67a20e3c4259ed913f207"},

+ 3 - 3
krb5crypto/nfold.go → crypto/nfold.go

@@ -1,4 +1,4 @@
-package krb5crypto
+package crypto
 
 
 /*
 /*
 Implementation of the n-fold algorithm as defined in RFC 3961.
 Implementation of the n-fold algorithm as defined in RFC 3961.
@@ -61,7 +61,7 @@ func Nfold(in []byte, n int) []byte {
 
 
 func onesComplementAddition(n1, n2 []byte) []byte {
 func onesComplementAddition(n1, n2 []byte) []byte {
 	numBits := len(n1) * 8
 	numBits := len(n1) * 8
-	out := make([]byte, numBits / 8)
+	out := make([]byte, numBits/8)
 	carry := 0
 	carry := 0
 	for i := numBits - 1; i > -1; i-- {
 	for i := numBits - 1; i > -1; i-- {
 		n1b := getBit(&n1, i)
 		n1b := getBit(&n1, i)
@@ -91,7 +91,7 @@ func rotateRight(b []byte, step int) []byte {
 	bitLen := len(b) * 8
 	bitLen := len(b) * 8
 	for i := 0; i < bitLen; i++ {
 	for i := 0; i < bitLen; i++ {
 		v := getBit(&b, i)
 		v := getBit(&b, i)
-		setBit(&out, (i + step) % bitLen, v)
+		setBit(&out, (i+step)%bitLen, v)
 	}
 	}
 	return out
 	return out
 }
 }

+ 6 - 6
krb5crypto/nfold_test.go → crypto/nfold_test.go

@@ -1,15 +1,15 @@
-package krb5crypto
+package crypto
 
 
 import (
 import (
-	"testing"
-	"github.com/stretchr/testify/assert"
 	"encoding/hex"
 	"encoding/hex"
+	"github.com/stretchr/testify/assert"
+	"testing"
 )
 )
 
 
 func Test_nfold(t *testing.T) {
 func Test_nfold(t *testing.T) {
 	var tests = []struct {
 	var tests = []struct {
-		n int
-		b []byte
+		n      int
+		b      []byte
 		folded string
 		folded string
 	}{
 	}{
 		{64, []byte("012345"), "be072631276b1955"},
 		{64, []byte("012345"), "be072631276b1955"},
@@ -21,6 +21,6 @@ func Test_nfold(t *testing.T) {
 		{168, []byte("ba"), "fb25d531ae8974499f52fd92ea9857c4ba24cf297e"},
 		{168, []byte("ba"), "fb25d531ae8974499f52fd92ea9857c4ba24cf297e"},
 	}
 	}
 	for _, test := range tests {
 	for _, test := range tests {
-		assert.Equal(t, test.folded, hex.EncodeToString(Nfold(test.b,test.n)), "Folded not as expected")
+		assert.Equal(t, test.folded, hex.EncodeToString(Nfold(test.b, test.n)), "Folded not as expected")
 	}
 	}
 }
 }

+ 0 - 24
krb5types/asnAppTag/constants.go

@@ -1,24 +0,0 @@
-package asnAppTag
-
-const (
-	Ticket = 1
-	Authenticator = 2
-	EncTicketPart = 3
-	ASREQ = 10
-	TGSREQ = 12
-	ASREP = 11
-	TGSREP = 13
-	APREQ = 14
-	APREP = 15
-	KRBSafe = 20
-	KRBPriv = 21
-	KRBCred = 22
-	EncASRepPart = 25
-	EncTGSRepPart = 26
-	EncAPRepPart = 27
-	EncKrbPrivPart  = 28
-	EncKrbCredPart = 29
-	KRBError = 30
-)
-
-//TODO review if we want to consolidate with the MsgTypes in the dictionary

+ 31 - 31
messages/KDCRep.go

@@ -7,38 +7,38 @@ import (
 	"encoding/asn1"
 	"encoding/asn1"
 	"errors"
 	"errors"
 	"fmt"
 	"fmt"
+	"github.com/jcmturner/gokrb5/crypto"
 	"github.com/jcmturner/gokrb5/keytab"
 	"github.com/jcmturner/gokrb5/keytab"
-	"github.com/jcmturner/gokrb5/krb5crypto"
-	"github.com/jcmturner/gokrb5/krb5types"
-	"github.com/jcmturner/gokrb5/krb5types/asnAppTag"
+	"github.com/jcmturner/gokrb5/types"
+	"github.com/jcmturner/gokrb5/types/asnAppTag"
 	"os"
 	"os"
 	"time"
 	"time"
 )
 )
 
 
 type marshalKDCRep struct {
 type marshalKDCRep struct {
-	PVNO    int                     `asn1:"explicit,tag:0"`
-	MsgType int                     `asn1:"explicit,tag:1"`
-	PAData  []krb5types.PAData      `asn1:"explicit,optional,tag:2"`
-	CRealm  string                  `asn1:"explicit,tag:3"`
-	CName   krb5types.PrincipalName `asn1:"explicit,tag:4"`
+	PVNO    int                 `asn1:"explicit,tag:0"`
+	MsgType int                 `asn1:"explicit,tag:1"`
+	PAData  []types.PAData      `asn1:"explicit,optional,tag:2"`
+	CRealm  string              `asn1:"explicit,tag:3"`
+	CName   types.PrincipalName `asn1:"explicit,tag:4"`
 	// Ticket needs to be a raw value as it is wrapped in an APPLICATION tag
 	// Ticket needs to be a raw value as it is wrapped in an APPLICATION tag
-	Ticket  asn1.RawValue           `asn1:"explicit,tag:5"`
-	EncPart krb5types.EncryptedData `asn1:"explicit,tag:6"`
+	Ticket  asn1.RawValue       `asn1:"explicit,tag:5"`
+	EncPart types.EncryptedData `asn1:"explicit,tag:6"`
 }
 }
 
 
 type marshalEncKDCRepPart struct {
 type marshalEncKDCRepPart struct {
-	Key           krb5types.EncryptionKey `asn1:"explicit,tag:0"`
-	LastReqs      []marshalLastReq        `asn1:"explicit,tag:1"`
-	Nonce         int                  `asn1:"explicit,tag:2"`
-	KeyExpiration time.Time               `asn1:"explicit,optional,tag:3"`
-	Flags         asn1.BitString   `asn1:"explicit,tag:4"`
-	AuthTime      time.Time               `asn1:"explicit,tag:5"`
-	StartTime     time.Time               `asn1:"explicit,optional,tag:6"`
-	EndTime       time.Time               `asn1:"explicit,tag:7"`
-	RenewTill     time.Time               `asn1:"explicit,optional,tag:8"`
-	SRealm        string                  `asn1:"explicit,tag:9"`
-	SName         krb5types.PrincipalName `asn1:"explicit,tag:10"`
-	CAddr         []krb5types.HostAddress `asn1:"explicit,optional,tag:11"`
+	Key           types.EncryptionKey `asn1:"explicit,tag:0"`
+	LastReqs      []marshalLastReq    `asn1:"explicit,tag:1"`
+	Nonce         int                 `asn1:"explicit,tag:2"`
+	KeyExpiration time.Time           `asn1:"explicit,optional,tag:3"`
+	Flags         asn1.BitString      `asn1:"explicit,tag:4"`
+	AuthTime      time.Time           `asn1:"explicit,tag:5"`
+	StartTime     time.Time           `asn1:"explicit,optional,tag:6"`
+	EndTime       time.Time           `asn1:"explicit,tag:7"`
+	RenewTill     time.Time           `asn1:"explicit,optional,tag:8"`
+	SRealm        string              `asn1:"explicit,tag:9"`
+	SName         types.PrincipalName `asn1:"explicit,tag:10"`
+	CAddr         []types.HostAddress `asn1:"explicit,optional,tag:11"`
 }
 }
 
 
 type marshalLastReq struct {
 type marshalLastReq struct {
@@ -49,22 +49,22 @@ type marshalLastReq struct {
 type KDCRep struct {
 type KDCRep struct {
 	PVNO    int
 	PVNO    int
 	MsgType int
 	MsgType int
-	PAData  []krb5types.PAData
+	PAData  []types.PAData
 	CRealm  string
 	CRealm  string
-	CName   krb5types.PrincipalName
+	CName   types.PrincipalName
 	// Ticket needs to be a raw value as it is wrapped in an APPLICATION tag
 	// Ticket needs to be a raw value as it is wrapped in an APPLICATION tag
-	Ticket        krb5types.Ticket
-	EncPart       krb5types.EncryptedData
+	Ticket        types.Ticket
+	EncPart       types.EncryptedData
 	DecryptedPart marshalEncKDCRepPart
 	DecryptedPart marshalEncKDCRepPart
 }
 }
 
 
 func (k *KDCRep) DecryptEncPart(kt keytab.Keytab) error {
 func (k *KDCRep) DecryptEncPart(kt keytab.Keytab) error {
 	//TODO create the etype based on the EType value in the EncPart and find the corresponding entry in the keytab
 	//TODO create the etype based on the EType value in the EncPart and find the corresponding entry in the keytab
 	//k.EncPart.EType
 	//k.EncPart.EType
-	var etype krb5crypto.Aes256CtsHmacSha96
+	var etype crypto.Aes256CtsHmacSha96
 	//Derive the key
 	//Derive the key
 	//Key Usage Number: 3 - "AS-REP encrypted part (includes TGS session key or application session key), encrypted with the client key"
 	//Key Usage Number: 3 - "AS-REP encrypted part (includes TGS session key or application session key), encrypted with the client key"
-	key, err := etype.DeriveKey(kt.Entries[0].Key.KeyMaterial, krb5crypto.GetUsageKe(3))
+	key, err := etype.DeriveKey(kt.Entries[0].Key.KeyMaterial, crypto.GetUsageKe(3))
 	b, err := etype.Decrypt(key, k.EncPart.Cipher)
 	b, err := etype.Decrypt(key, k.EncPart.Cipher)
 	//TODO why is this 19???
 	//TODO why is this 19???
 	b = b[19:]
 	b = b[19:]
@@ -85,7 +85,7 @@ func UnmarshalASRep(b []byte) (k KDCRep, err error) {
 	if err != nil {
 	if err != nil {
 		return k, err
 		return k, err
 	}
 	}
-	if k.MsgType != krb5types.KrbDictionary.MsgTypesByName["KRB_AS_REP"] {
+	if k.MsgType != types.KrbDictionary.MsgTypesByName["KRB_AS_REP"] {
 		return k, errors.New("Message ID does not indicate a KRB_TGS_REP")
 		return k, errors.New("Message ID does not indicate a KRB_TGS_REP")
 	}
 	}
 	return k, nil
 	return k, nil
@@ -96,7 +96,7 @@ func UnmarshalTGSRep(b []byte) (k KDCRep, err error) {
 	if err != nil {
 	if err != nil {
 		return k, err
 		return k, err
 	}
 	}
-	if k.MsgType != krb5types.KrbDictionary.MsgTypesByName["KRB_TGS_REP"] {
+	if k.MsgType != types.KrbDictionary.MsgTypesByName["KRB_TGS_REP"] {
 		return k, errors.New("Message ID does not indicate a KRB_TGS_REP")
 		return k, errors.New("Message ID does not indicate a KRB_TGS_REP")
 	}
 	}
 	return k, nil
 	return k, nil
@@ -109,7 +109,7 @@ func unmarshalKDCRep(b []byte, asnAppTag int) (k KDCRep, err error) {
 		return
 		return
 	}
 	}
 	//Process the raw ticket within
 	//Process the raw ticket within
-	k.Ticket, err = krb5types.UnmarshalTicket(asRep.Ticket.Bytes)
+	k.Ticket, err = types.UnmarshalTicket(asRep.Ticket.Bytes)
 	if err != nil {
 	if err != nil {
 		return
 		return
 	}
 	}

+ 6 - 8
messages/KDCRep_test.go

@@ -1,15 +1,14 @@
 package messages
 package messages
 
 
 import (
 import (
-"github.com/stretchr/testify/assert"
-"testing"
-	"io/ioutil"
 	"fmt"
 	"fmt"
-	"github.com/jcmturner/gokrb5/krb5types"
 	"github.com/jcmturner/gokrb5/keytab"
 	"github.com/jcmturner/gokrb5/keytab"
+	"github.com/jcmturner/gokrb5/types"
+	"github.com/stretchr/testify/assert"
+	"io/ioutil"
+	"testing"
 )
 )
 
 
-
 func TestUnmarshalASRep(t *testing.T) {
 func TestUnmarshalASRep(t *testing.T) {
 	asrepData, _ := ioutil.ReadFile("/home/turnerj/IdeaProjects/golang/src/github.com/jcmturner/gokrb5/AS-REP.raw")
 	asrepData, _ := ioutil.ReadFile("/home/turnerj/IdeaProjects/golang/src/github.com/jcmturner/gokrb5/AS-REP.raw")
 	asRep, err := UnmarshalASRep(asrepData)
 	asRep, err := UnmarshalASRep(asrepData)
@@ -28,9 +27,9 @@ func TestUnmarshalASRep(t *testing.T) {
 	assert.Equal(t, 2, asRep.Ticket.SName.NameType, "Ticket service nametype not as expected")
 	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, "krbtgt", asRep.Ticket.SName.NameString[0], "Ticket service name string not as expected")
 	assert.Equal(t, "JTLAN.CO.UK", asRep.Ticket.SName.NameString[1], "Ticket service name string not as expected")
 	assert.Equal(t, "JTLAN.CO.UK", asRep.Ticket.SName.NameString[1], "Ticket service name string not as expected")
-	assert.Equal(t, krb5types.KrbDictionary.ETypesByName["aes256-cts-hmac-sha1-96"], asRep.Ticket.EncPart.EType, "Etype of ticket encrypted part 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, 1, asRep.Ticket.EncPart.KVNO, "Ticket encrypted part KVNO not as expected")
 	assert.Equal(t, 1, asRep.Ticket.EncPart.KVNO, "Ticket encrypted part KVNO not as expected")
-	assert.Equal(t, krb5types.KrbDictionary.ETypesByName["aes256-cts-hmac-sha1-96"], asRep.EncPart.EType, "Etype of encrypted part 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, 0, asRep.EncPart.KVNO, "Encrypted part KVNO 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")
 	t.Log("Finished testing unecrypted parts of AS REP")
 
 
@@ -52,4 +51,3 @@ func TestUnmarshalASRep(t *testing.T) {
 	}
 	}
 	t.Logf("Decypted Ticket EncPart %+v", s)*/
 	t.Logf("Decypted Ticket EncPart %+v", s)*/
 }
 }
-

+ 20 - 20
messages/KDCReq.go

@@ -5,35 +5,35 @@ package messages
 
 
 import (
 import (
 	"encoding/asn1"
 	"encoding/asn1"
-	"github.com/jcmturner/gokrb5/krb5types"
-	"time"
 	"fmt"
 	"fmt"
-	"github.com/jcmturner/gokrb5/krb5types/asnAppTag"
+	"github.com/jcmturner/gokrb5/types"
+	"github.com/jcmturner/gokrb5/types/asnAppTag"
+	"time"
 )
 )
 
 
 type KDCReq struct {
 type KDCReq struct {
-	PVNO    int                `asn1:"explicit,tag:1"`
-	MsgType int                `asn1:"explicit,tag:2"`
-	PAData  []krb5types.PAData `asn1:"explicit,general,tag:3"`
-	ReqBody KDCReqBody         `asn1:"explicit,tag:4"`
+	PVNO    int            `asn1:"explicit,tag:1"`
+	MsgType int            `asn1:"explicit,tag:2"`
+	PAData  []types.PAData `asn1:"explicit,general,tag:3"`
+	ReqBody KDCReqBody     `asn1:"explicit,tag:4"`
 }
 }
 
 
 type KDCReqBody struct {
 type KDCReqBody struct {
-	KDCOptions        asn1.BitString          `asn1:"explicit,tag:0"`
-	CName             krb5types.PrincipalName `asn1:"explicit,optional,tag:1"`
-	Realm             string         `asn1:"explicit,tag:2"`
-	SName             krb5types.PrincipalName `asn1:"explicit,optional,tag:3"`
-	From              time.Time               `asn1:"explicit,optional,tag:4"`
-	Till              time.Time               `asn1:"explicit,tag:5"`
-	RTime             time.Time               `asn1:"explicit,optional,tag:6"`
-	Nonce             int                     `asn1:"explicit,tag:7"`
-	EType             []int                   `asn1:"explicit,tag:8"`
-	Address           []krb5types.HostAddress `asn1:"explicit,optional,tag:9"`
-	EncAuthData       krb5types.EncryptedData `asn1:"explicit,optional,tag:10"`
-	AdditionalTickets []krb5types.Ticket      `asn1:"explicit,optional,tag:11"`
+	KDCOptions        asn1.BitString      `asn1:"explicit,tag:0"`
+	CName             types.PrincipalName `asn1:"explicit,optional,tag:1"`
+	Realm             string              `asn1:"explicit,tag:2"`
+	SName             types.PrincipalName `asn1:"explicit,optional,tag:3"`
+	From              time.Time           `asn1:"explicit,optional,tag:4"`
+	Till              time.Time           `asn1:"explicit,tag:5"`
+	RTime             time.Time           `asn1:"explicit,optional,tag:6"`
+	Nonce             int                 `asn1:"explicit,tag:7"`
+	EType             []int               `asn1:"explicit,tag:8"`
+	Address           []types.HostAddress `asn1:"explicit,optional,tag:9"`
+	EncAuthData       types.EncryptedData `asn1:"explicit,optional,tag:10"`
+	AdditionalTickets []types.Ticket      `asn1:"explicit,optional,tag:11"`
 }
 }
 
 
 func UnmarshalASReq(b []byte) (k KDCReq, err error) {
 func UnmarshalASReq(b []byte) (k KDCReq, err error) {
 	_, err = asn1.UnmarshalWithParams(b, &k, fmt.Sprintf("application,explicit,tag:%v", asnAppTag.ASREQ))
 	_, err = asn1.UnmarshalWithParams(b, &k, fmt.Sprintf("application,explicit,tag:%v", asnAppTag.ASREQ))
 	return
 	return
-}
+}

+ 5 - 7
krb5types/AuthorizationData.go → types/AuthorizationData.go

@@ -1,4 +1,4 @@
-package krb5types
+package types
 
 
 // Reference: https://www.ietf.org/rfc/rfc4120.txt
 // Reference: https://www.ietf.org/rfc/rfc4120.txt
 // Section: 5.2.6
 // Section: 5.2.6
@@ -85,24 +85,22 @@ type ADIfRelevant struct {
 
 
 type ADAndOr struct {
 type ADAndOr struct {
 	ConditionCount int
 	ConditionCount int
-	Elements AuthorizationData
+	Elements       AuthorizationData
 }
 }
 
 
 type ADKDCIssued struct {
 type ADKDCIssued struct {
 	ADChecksum string
 	ADChecksum string
-	IRealm string
-	Isname PrincipalName
-	Elements AuthorizationData
+	IRealm     string
+	Isname     PrincipalName
+	Elements   AuthorizationData
 }
 }
 
 
 type ADMandatoryForKDC struct {
 type ADMandatoryForKDC struct {
 	AuthorizationData
 	AuthorizationData
 }
 }
 
 
-
 func (a *AuthorizationData) GetData() (string, error) {
 func (a *AuthorizationData) GetData() (string, error) {
 	var b []byte
 	var b []byte
 	_, err := asn1.Unmarshal(a.ADData, &b)
 	_, err := asn1.Unmarshal(a.ADData, &b)
 	return string(b), err
 	return string(b), err
 }
 }
-

+ 2 - 2
krb5types/Cryptosystem.go → types/Cryptosystem.go

@@ -1,4 +1,4 @@
-package krb5types
+package types
 
 
 // Reference: https://www.ietf.org/rfc/rfc4120.txt
 // Reference: https://www.ietf.org/rfc/rfc4120.txt
 // Section: 5.2.9
 // Section: 5.2.9
@@ -7,7 +7,7 @@ package krb5types
 
 
 type EncryptedData struct {
 type EncryptedData struct {
 	EType  int    `asn1:"explicit,tag:0"`
 	EType  int    `asn1:"explicit,tag:0"`
-	KVNO   int `asn1:"explicit,optional,tag:1"`
+	KVNO   int    `asn1:"explicit,optional,tag:1"`
 	Cipher []byte `asn1:"explicit,tag:2"`
 	Cipher []byte `asn1:"explicit,tag:2"`
 }
 }
 
 

+ 1 - 1
krb5types/HostAddress.go → types/HostAddress.go

@@ -1,4 +1,4 @@
-package krb5types
+package types
 
 
 // Reference: https://www.ietf.org/rfc/rfc4120.txt
 // Reference: https://www.ietf.org/rfc/rfc4120.txt
 // Section: 5.2.5
 // Section: 5.2.5

+ 2 - 2
krb5types/KerberosFlags.go → types/KerberosFlags.go

@@ -1,4 +1,4 @@
-package krb5types
+package types
 
 
 // Reference: https://www.ietf.org/rfc/rfc4120.txt
 // Reference: https://www.ietf.org/rfc/rfc4120.txt
 // Section: 5.2.8
 // Section: 5.2.8
@@ -94,4 +94,4 @@ const (
 	Validate              KerberosFlag = 31
 	Validate              KerberosFlag = 31
 )*/
 )*/
 
 
-type KDCOptions asn1.BitString
+type KDCOptions asn1.BitString

+ 1 - 1
krb5types/KerberosString.go → types/KerberosString.go

@@ -1,4 +1,4 @@
-package krb5types
+package types
 
 
 // Reference: https://www.ietf.org/rfc/rfc4120.txt
 // Reference: https://www.ietf.org/rfc/rfc4120.txt
 // Section: 5.2.1
 // Section: 5.2.1

+ 6 - 6
krb5types/PAData.go → types/PAData.go

@@ -1,11 +1,11 @@
-package krb5types
+package types
 
 
 // Reference: https://www.ietf.org/rfc/rfc4120.txt
 // Reference: https://www.ietf.org/rfc/rfc4120.txt
 // Section: 5.2.7
 // Section: 5.2.7
 import (
 import (
-	"time"
-	"fmt"
 	"encoding/asn1"
 	"encoding/asn1"
+	"fmt"
+	"time"
 )
 )
 
 
 type PAData struct {
 type PAData struct {
@@ -20,18 +20,18 @@ type PAEncTimestamp struct {
 
 
 type PAEncTSEnc struct {
 type PAEncTSEnc struct {
 	PATimestamp time.Time `asn1:"explicit,tag:0"`
 	PATimestamp time.Time `asn1:"explicit,tag:0"`
-	PAUSec      int `asn1:"explicit,optional,tag:1"`
+	PAUSec      int       `asn1:"explicit,optional,tag:1"`
 }
 }
 
 
 type ETypeInfoEntry struct {
 type ETypeInfoEntry struct {
-	EType int `asn1:"explicit,tag:0"`
+	EType int    `asn1:"explicit,tag:0"`
 	Salt  []byte `asn1:"explicit,optional,tag:1"`
 	Salt  []byte `asn1:"explicit,optional,tag:1"`
 }
 }
 
 
 type ETypeInfo []ETypeInfoEntry
 type ETypeInfo []ETypeInfoEntry
 
 
 type ETypeInfo2Entry struct {
 type ETypeInfo2Entry struct {
-	EType     int `asn1:"explicit,tag:0"`
+	EType     int    `asn1:"explicit,tag:0"`
 	Salt      string `asn1:"explicit,optional,tag:1,ia5"`
 	Salt      string `asn1:"explicit,optional,tag:1,ia5"`
 	S2KParams []byte `asn1:"explicit,optional,tag:2"`
 	S2KParams []byte `asn1:"explicit,optional,tag:2"`
 }
 }

+ 2 - 2
krb5types/PrincipalName.go → types/PrincipalName.go

@@ -1,9 +1,9 @@
-package krb5types
+package types
 
 
 // Reference: https://www.ietf.org/rfc/rfc4120.txt
 // Reference: https://www.ietf.org/rfc/rfc4120.txt
 // Section: 5.2.2
 // Section: 5.2.2
 
 
 type PrincipalName struct {
 type PrincipalName struct {
-	NameType int `asn1:"explicit,tag:0"`
+	NameType   int      `asn1:"explicit,tag:0"`
 	NameString []string `asn1:"explicit,tag:1,ia5"`
 	NameString []string `asn1:"explicit,tag:1,ia5"`
 }
 }

+ 7 - 7
krb5types/Ticket.go → types/Ticket.go

@@ -1,10 +1,10 @@
-package krb5types
+package types
 
 
 import (
 import (
-	"time"
 	"encoding/asn1"
 	"encoding/asn1"
 	"fmt"
 	"fmt"
-	"github.com/jcmturner/gokrb5/krb5types/asnAppTag"
+	"github.com/jcmturner/gokrb5/types/asnAppTag"
+	"time"
 )
 )
 
 
 // Reference: https://www.ietf.org/rfc/rfc4120.txt
 // Reference: https://www.ietf.org/rfc/rfc4120.txt
@@ -12,15 +12,15 @@ import (
 
 
 type Ticket struct {
 type Ticket struct {
 	TktVNO  int           `asn1:"explicit,tag:0"`
 	TktVNO  int           `asn1:"explicit,tag:0"`
-	Realm   string         `asn1:"explicit,tag:1"`
+	Realm   string        `asn1:"explicit,tag:1"`
 	SName   PrincipalName `asn1:"explicit,tag:2"`
 	SName   PrincipalName `asn1:"explicit,tag:2"`
 	EncPart EncryptedData `asn1:"explicit,tag:3"`
 	EncPart EncryptedData `asn1:"explicit,tag:3"`
 }
 }
 
 
 type EncTicketPart struct {
 type EncTicketPart struct {
-	Flags             asn1.BitString       `asn1:"explicit,tag:0"`
+	Flags             asn1.BitString    `asn1:"explicit,tag:0"`
 	Key               EncryptionKey     `asn1:"explicit,tag:1"`
 	Key               EncryptionKey     `asn1:"explicit,tag:1"`
-	CRealm            string             `asn1:"explicit,tag:2"`
+	CRealm            string            `asn1:"explicit,tag:2"`
 	CName             PrincipalName     `asn1:"explicit,tag:3"`
 	CName             PrincipalName     `asn1:"explicit,tag:3"`
 	Transited         TransitedEncoding `asn1:"explicit,tag:4"`
 	Transited         TransitedEncoding `asn1:"explicit,tag:4"`
 	AuthTime          time.Time         `asn1:"explicit,tag:5"`
 	AuthTime          time.Time         `asn1:"explicit,tag:5"`
@@ -39,4 +39,4 @@ type TransitedEncoding struct {
 func UnmarshalTicket(b []byte) (t Ticket, err error) {
 func UnmarshalTicket(b []byte) (t Ticket, err error) {
 	_, err = asn1.UnmarshalWithParams(b, &t, fmt.Sprintf("application,explicit,tag:%v", asnAppTag.Ticket))
 	_, err = asn1.UnmarshalWithParams(b, &t, fmt.Sprintf("application,explicit,tag:%v", asnAppTag.Ticket))
 	return
 	return
-}
+}

+ 24 - 0
types/asnAppTag/constants.go

@@ -0,0 +1,24 @@
+package asnAppTag
+
+const (
+	Ticket         = 1
+	Authenticator  = 2
+	EncTicketPart  = 3
+	ASREQ          = 10
+	TGSREQ         = 12
+	ASREP          = 11
+	TGSREP         = 13
+	APREQ          = 14
+	APREP          = 15
+	KRBSafe        = 20
+	KRBPriv        = 21
+	KRBCred        = 22
+	EncASRepPart   = 25
+	EncTGSRepPart  = 26
+	EncAPRepPart   = 27
+	EncKrbPrivPart = 28
+	EncKrbCredPart = 29
+	KRBError       = 30
+)
+
+//TODO review if we want to consolidate with the MsgTypes in the dictionary

+ 1 - 1
krb5types/dictionary.go → types/dictionary.go

@@ -1,4 +1,4 @@
-package krb5types
+package types
 
 
 var KrbDictionary = struct {
 var KrbDictionary = struct {
 	MsgTypesByID      map[int]string
 	MsgTypesByID      map[int]string