OXIESEC PANEL
- Current Dir:
/
/
opt
/
golang
/
1.22.0
/
src
/
crypto
Server IP: 191.96.63.230
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
02/02/2024 06:09:55 PM
rwxr-xr-x
📁
aes
-
02/02/2024 06:09:55 PM
rwxr-xr-x
📁
boring
-
02/02/2024 06:09:55 PM
rwxr-xr-x
📁
cipher
-
02/02/2024 06:09:55 PM
rwxr-xr-x
📄
crypto.go
6.76 KB
02/02/2024 06:09:55 PM
rw-r--r--
📁
des
-
02/02/2024 06:09:55 PM
rwxr-xr-x
📁
dsa
-
02/02/2024 06:09:55 PM
rwxr-xr-x
📁
ecdh
-
02/02/2024 06:09:55 PM
rwxr-xr-x
📁
ecdsa
-
02/02/2024 06:09:55 PM
rwxr-xr-x
📁
ed25519
-
02/02/2024 06:09:55 PM
rwxr-xr-x
📁
elliptic
-
02/02/2024 06:09:55 PM
rwxr-xr-x
📁
hmac
-
02/02/2024 06:09:55 PM
rwxr-xr-x
📁
internal
-
02/02/2024 06:09:55 PM
rwxr-xr-x
📄
issue21104_test.go
1.81 KB
02/02/2024 06:09:55 PM
rw-r--r--
📁
md5
-
02/02/2024 06:09:55 PM
rwxr-xr-x
📁
rand
-
02/02/2024 06:09:55 PM
rwxr-xr-x
📁
rc4
-
02/02/2024 06:09:55 PM
rwxr-xr-x
📁
rsa
-
02/02/2024 06:09:55 PM
rwxr-xr-x
📁
sha1
-
02/02/2024 06:09:55 PM
rwxr-xr-x
📁
sha256
-
02/02/2024 06:09:55 PM
rwxr-xr-x
📁
sha512
-
02/02/2024 06:09:55 PM
rwxr-xr-x
📁
subtle
-
02/02/2024 06:09:55 PM
rwxr-xr-x
📁
tls
-
02/02/2024 06:09:55 PM
rwxr-xr-x
📁
x509
-
02/02/2024 06:09:55 PM
rwxr-xr-x
Editing: issue21104_test.go
Close
// Copyright 2017 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package crypto_test import ( "crypto/aes" "crypto/cipher" "crypto/rc4" "testing" ) func TestRC4OutOfBoundsWrite(t *testing.T) { // This cipherText is encrypted "0123456789" cipherText := []byte{238, 41, 187, 114, 151, 2, 107, 13, 178, 63} cipher, err := rc4.NewCipher([]byte{0}) if err != nil { panic(err) } test(t, "RC4", cipherText, cipher.XORKeyStream) } func TestCTROutOfBoundsWrite(t *testing.T) { testBlock(t, "CTR", cipher.NewCTR) } func TestOFBOutOfBoundsWrite(t *testing.T) { testBlock(t, "OFB", cipher.NewOFB) } func TestCFBEncryptOutOfBoundsWrite(t *testing.T) { testBlock(t, "CFB Encrypt", cipher.NewCFBEncrypter) } func TestCFBDecryptOutOfBoundsWrite(t *testing.T) { testBlock(t, "CFB Decrypt", cipher.NewCFBDecrypter) } func testBlock(t *testing.T, name string, newCipher func(cipher.Block, []byte) cipher.Stream) { // This cipherText is encrypted "0123456789" cipherText := []byte{86, 216, 121, 231, 219, 191, 26, 12, 176, 117} var iv, key [16]byte block, err := aes.NewCipher(key[:]) if err != nil { panic(err) } stream := newCipher(block, iv[:]) test(t, name, cipherText, stream.XORKeyStream) } func test(t *testing.T, name string, cipherText []byte, xor func([]byte, []byte)) { want := "abcdefghij" plainText := []byte(want) shorterLen := len(cipherText) / 2 defer func() { err := recover() if err == nil { t.Errorf("%v XORKeyStream expected to panic on len(dst) < len(src), but didn't", name) } const plain = "0123456789" if plainText[shorterLen] == plain[shorterLen] { t.Errorf("%v XORKeyStream did out of bounds write, want %v, got %v", name, want, string(plainText)) } }() xor(plainText[:shorterLen], cipherText) }