use dictionary to compress certificates

This commit is contained in:
Lucas Clemente
2016-04-15 20:39:48 +02:00
parent a6549d0cc7
commit 7acb3365d5
3 changed files with 136 additions and 2 deletions

View File

@@ -2,6 +2,7 @@ package crypto
import (
"bytes"
"compress/flate"
"compress/zlib"
"crypto"
"crypto/rsa"
@@ -16,7 +17,8 @@ var _ = Describe("ProofRsa", func() {
It("gives correct cert", func() {
cert := []byte{0xde, 0xca, 0xfb, 0xad}
certZlib := &bytes.Buffer{}
z := zlib.NewWriter(certZlib)
z, err := zlib.NewWriterLevelDict(certZlib, flate.BestCompression, certDictZlib)
Expect(err).ToNot(HaveOccurred())
z.Write([]byte{0x04, 0x00, 0x00, 0x00})
z.Write(cert)
z.Close()