Jonathan Turner 9 年之前
父節點
當前提交
c15ec87005
共有 2 個文件被更改,包括 8 次插入8 次删除
  1. 2 2
      crypto/aes-cts-hmac-sha1-96_test.go
  2. 6 6
      messages/KDCRep_test.go

+ 2 - 2
crypto/aes-cts-hmac-sha1-96_test.go

@@ -32,7 +32,7 @@ func TestAesCtsHmacSha196_Encrypt_Decrypt(t *testing.T) {
 		assert.Equal(t, test.cipher, hex.EncodeToString(c), "Encrypted result not as expected")
 		assert.Equal(t, test.cipher, hex.EncodeToString(c), "Encrypted result not as expected")
 		assert.Equal(t, test.nextIV, hex.EncodeToString(niv), "Next state IV not as expected")
 		assert.Equal(t, test.nextIV, hex.EncodeToString(niv), "Next state IV not as expected")
 	}
 	}
-	t.Log("AES CTS Encryption tests finished")
+	//t.Log("AES CTS Encryption tests finished")
 	for i, test := range tests {
 	for i, test := range tests {
 		b, _ := hex.DecodeString(test.cipher)
 		b, _ := hex.DecodeString(test.cipher)
 		p, err := AESCTSDecrypt(key, b, e)
 		p, err := AESCTSDecrypt(key, b, e)
@@ -41,7 +41,7 @@ func TestAesCtsHmacSha196_Encrypt_Decrypt(t *testing.T) {
 		}
 		}
 		assert.Equal(t, test.plain, hex.EncodeToString(p), "Decrypted result not as expected")
 		assert.Equal(t, test.plain, hex.EncodeToString(p), "Decrypted result not as expected")
 	}
 	}
-	t.Log("AES CTS Decryption tests finished")
+	//t.Log("AES CTS Decryption tests finished")
 }
 }
 
 
 func TestAes256CtsHmacSha196_StringToKey(t *testing.T) {
 func TestAes256CtsHmacSha196_StringToKey(t *testing.T) {

+ 6 - 6
messages/KDCRep_test.go

@@ -29,8 +29,8 @@ func TestUnmarshalASRep(t *testing.T) {
 	assert.Equal(t, types.KrbDictionary.MsgTypesByName["KRB_AS_REP"], a.MsgType, "MsgType not as expected")
 	assert.Equal(t, types.KrbDictionary.MsgTypesByName["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")
 	assert.Equal(t, 2, len(a.PAData), "Number of PAData items in the sequence not as expected")
 	for i, pa := range a.PAData {
 	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))
-		assert.Equal(t, []byte(testdata.TEST_PADATA_VALUE), pa.PADataValue, fmt.Sprintf("PAData valye for entry %d not as expected", i + 1))
+		assert.Equal(t, testdata.TEST_PADATA_TYPE, pa.PADataType, fmt.Sprintf("PAData type for entry %d not as expected", i+1))
+		assert.Equal(t, []byte(testdata.TEST_PADATA_VALUE), pa.PADataValue, fmt.Sprintf("PAData valye for entry %d not as expected", i+1))
 	}
 	}
 	assert.Equal(t, testdata.TEST_REALM, a.CRealm, "Client Realm 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")
 	assert.Equal(t, testdata.TEST_PRINCIPALNAME_NAMETYPE, a.CName.NameType, "CName NameType not as expected")
@@ -95,8 +95,8 @@ func TestUnmarshalTGSRep(t *testing.T) {
 	assert.Equal(t, types.KrbDictionary.MsgTypesByName["KRB_TGS_REP"], a.MsgType, "MsgType not as expected")
 	assert.Equal(t, types.KrbDictionary.MsgTypesByName["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")
 	assert.Equal(t, 2, len(a.PAData), "Number of PAData items in the sequence not as expected")
 	for i, pa := range a.PAData {
 	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))
-		assert.Equal(t, []byte(testdata.TEST_PADATA_VALUE), pa.PADataValue, fmt.Sprintf("PAData valye for entry %d not as expected", i + 1))
+		assert.Equal(t, testdata.TEST_PADATA_TYPE, pa.PADataType, fmt.Sprintf("PAData type for entry %d not as expected", i+1))
+		assert.Equal(t, []byte(testdata.TEST_PADATA_VALUE), pa.PADataValue, fmt.Sprintf("PAData valye for entry %d not as expected", i+1))
 	}
 	}
 	assert.Equal(t, testdata.TEST_REALM, a.CRealm, "Client Realm 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")
 	assert.Equal(t, testdata.TEST_PRINCIPALNAME_NAMETYPE, a.CName.NameType, "CName NameType not as expected")
@@ -242,7 +242,7 @@ func TestUnmarshalASRepDecodeAndDecrypt(t *testing.T) {
 	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, types.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")
 	kt, err := keytab.Load(dir + "/tmp.keytab")
 	kt, err := keytab.Load(dir + "/tmp.keytab")
 	if err != nil {
 	if err != nil {
 		fmt.Printf("keytab parse error: %v\n", err)
 		fmt.Printf("keytab parse error: %v\n", err)
@@ -262,7 +262,7 @@ func TestUnmarshalASRepDecodeAndDecrypt(t *testing.T) {
 	assert.Equal(t, "JTLAN.CO.UK", asRep.DecryptedEncPart.SRealm, "Service realm not as expected")
 	assert.Equal(t, "JTLAN.CO.UK", asRep.DecryptedEncPart.SRealm, "Service realm not as expected")
 	assert.Equal(t, 2, asRep.DecryptedEncPart.SName.NameType, "Name type for AS_REP not as expected")
 	assert.Equal(t, 2, asRep.DecryptedEncPart.SName.NameType, "Name type for AS_REP not as expected")
 	assert.Equal(t, []string{"krbtgt", "JTLAN.CO.UK"}, asRep.DecryptedEncPart.SName.NameString, "Service name string not as expected")
 	assert.Equal(t, []string{"krbtgt", "JTLAN.CO.UK"}, asRep.DecryptedEncPart.SName.NameString, "Service name string not as expected")
-	t.Log("Finished testing ecrypted parts of AS REP")
+	//t.Log("Finished testing ecrypted parts of AS REP")
 
 
 	//TODO should we be able to decrypt this part with the client key?
 	//TODO should we be able to decrypt this part with the client key?
 	/*s, err = etype.Decrypt(key, asRep.Ticket.EncPart.Cipher)
 	/*s, err = etype.Decrypt(key, asRep.Ticket.EncPart.Cipher)