Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crypto/x509: input not full blocks #11215

dvyukov opened this issue Jun 14, 2015 · 1 comment

crypto/x509: input not full blocks #11215

dvyukov opened this issue Jun 14, 2015 · 1 comment


Copy link

@dvyukov dvyukov commented Jun 14, 2015

The following program crashes with the panic:

package main

import (

func main() {
    data := []byte("3\xff\x81\x03\x01\x01\x0500000\x01\xff0\x00\x01\x03\x01\x04" +
        "0000\x01\f\x00\x01\aHeaders\x01\xff\x84\x00" +
        "\x01\x05Bytes\x01\n\x00\x00\x00!\xff\x83\x04\x01\x01\x110" +
        "0000000000000000\x01\xff0\x00" +
        "\x01\f\x01\f\x00\x00L\xff\x82\x01\x03000\x01\x02\t000" +
        "000000\v00000000000\bD" +
        "EK-Info\x18DES-CBC,0000" +
        "000000000000\x01\x010\x000000" +
    var b pem.Block
    err := gob.NewDecoder(bytes.NewReader(data)).Decode(&b)
    if err != nil {
    _, err = x509.DecryptPEMBlock(&b, []byte("pass"))
    if err != nil {
panic: crypto/cipher: input not full blocks

goroutine 1 [running]:
crypto/cipher.(*cbcDecrypter).CryptBlocks(0xc2080149b0, 0xc20800b180, 0x1, 0x1, 0xc20800b130, 0x1, 0x1)
    src/crypto/cipher/cbc.go:92 +0xa6
crypto/x509.DecryptPEMBlock(0xc208016c90, 0xc20800b140, 0x4, 0x8, 0x0, 0x0, 0x0, 0x0, 0x0)
    src/crypto/x509/pem_decrypt.go:149 +0x879
    pem.go:25 +0x47b

go version devel +6a34206 Sun Jun 14 17:55:53 2015 +0000 linux/amd64

@mikioh mikioh changed the title crypto:x509: input not full blocks crypto/x509: input not full blocks Jun 14, 2015
Copy link

@gopherbot gopherbot commented Jun 15, 2015

CL mentions this issue.

@ianlancetaylor ianlancetaylor added this to the Go1.5Maybe milestone Jun 15, 2015
@agl agl closed this in 4ec946c Jun 26, 2015
@mikioh mikioh modified the milestones: Go1.5, Go1.5Maybe Jun 27, 2015
@golang golang locked and limited conversation to collaborators Jun 27, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.