Add ascii armor support

This commit is contained in:
Jae Kwon
2016-03-13 14:00:27 -07:00
parent 181aa56c87
commit 185547efc1
4 changed files with 66 additions and 1 deletions

25
armor_test.go Normal file
View File

@ -0,0 +1,25 @@
package crypto
import (
"bytes"
"testing"
)
func TestSimpleArmor(t *testing.T) {
blockType := "MINT TEST"
data := []byte("somedata")
armorStr := EncodeArmor(blockType, nil, data)
t.Log("Got armor: ", armorStr)
// Decode armorStr and test for equivalence.
blockType2, _, data2, err := DecodeArmor(armorStr)
if err != nil {
t.Error(err)
}
if blockType != blockType2 {
t.Errorf("Expected block type %v but got %v", blockType, blockType2)
}
if !bytes.Equal(data, data2) {
t.Errorf("Expected data %X but got %X", data2, data)
}
}