Version 1.0 alpha

This commit is contained in:
V2Ray committed 2015-09-12 20:36:21 +02:00
1 parent f3a12e9f57
commit cc3fdb6ef4
21 files changed
+279 -103

No files matched your search

+2 -2
View File
@@ -29,8 +29,8 @@ func NewDecryptionReader(reader io.Reader, key []byte, iv []byte) (*DecryptionRe
if err != nil {
return nil, err
}
aesBlockMode := cipher.NewCBCDecrypter(aesCipher, iv)
decryptionReader.reader = v2io.NewCryptionReader(aesBlockMode, reader)
aesStream := cipher.NewCFBDecrypter(aesCipher, iv)
decryptionReader.reader = v2io.NewCryptionReader(aesStream, reader)
decryptionReader.buffer = bytes.NewBuffer(make([]byte, 0, 2*blockSize))
return decryptionReader, nil
}
+2 -2
View File
@@ -35,10 +35,10 @@ func TestNormalReading(t *testing.T) {
aesBlock, err := aes.NewCipher(key)
assert.Error(err).IsNil()
aesMode := cipher.NewCBCEncrypter(aesBlock, iv)
aesStream := cipher.NewCFBEncrypter(aesBlock, iv)
ciphertext := make([]byte, testSize)
aesMode.CryptBlocks(ciphertext, plaintext)
aesStream.XORKeyStream(ciphertext, plaintext)
ciphertextcopy := make([]byte, testSize)
copy(ciphertextcopy, ciphertext)
+2 -2
View File
@@ -224,8 +224,8 @@ func (w *VMessRequestWriter) Write(writer io.Writer, request *VMessRequest) erro
if err != nil {
return err
}
aesMode := cipher.NewCBCEncrypter(aesCipher, make([]byte, blockSize))
cWriter := v2io.NewCryptionWriter(aesMode, writer)
aesStream := cipher.NewCFBEncrypter(aesCipher, make([]byte, blockSize))
cWriter := v2io.NewCryptionWriter(aesStream, writer)
_, err = writer.Write(buffer[0:encryptionBegin])
if err != nil {