Finished Crypto

This commit is contained in:
Willie Koomson
2018-03-07 21:03:46 -05:00
parent 4f9daea6f6
commit 8b93448bcd
2 changed files with 155 additions and 4 deletions

View File

@ -174,7 +174,7 @@ func (c *Crypto) SignatureKeyPairFromStream(stream *Stream) (sgk SignatureKeyPai
}
// Generate a signature keypair
func (c *Crypto) SignatureKeygen(algorithmTyp uint8) (sgk SignatureKeyPair, err error) {
func (c *Crypto) SignatureKeygen(algorithmTyp uint32) (sgk SignatureKeyPair, err error) {
var pkey dsa.PrivateKey
pkey.G = c.params.G
pkey.Q = c.params.Q
@ -206,12 +206,12 @@ func (c *Crypto) EncodeStream(algorithmTyp uint8, src *Stream) (dst Stream) {
}
return
}
func (c *Crypto) DecodeStream(algorithmTyp uint8, src *Stream) (dst Stream) {
func (c *Crypto) DecodeStream(algorithmTyp uint8, src *Stream) (dst Stream, err error) {
switch algorithmTyp {
case CODEC_BASE32:
c.b32.Decode(dst.Bytes(), src.Bytes())
_, err = c.b32.Decode(dst.Bytes(), src.Bytes())
case CODEC_BASE64:
c.b64.Decode(dst.Bytes(), src.Bytes())
_, err = c.b64.Decode(dst.Bytes(), src.Bytes())
}
return
}