Refactor code structure

Move X.509 and Openpgp operations into custom packages. Implement more
robust input reading. Do not convert []byte to string unnecessarily.

Finish implementation of X.509 CRL creation.
This commit is contained in:
Jan Dittberner 2021-01-05 19:59:43 +01:00
parent 2de9771472
commit 9f0916b14a
9 changed files with 715 additions and 493 deletions

17
signer/common/helpers.go Normal file
View file

@ -0,0 +1,17 @@
package common
import (
"fmt"
"math/big"
"strconv"
"strings"
)
func StringAsBigInt(data []byte) (*big.Int, error) {
dataString := strings.TrimSpace(string(data))
parseInt, err := strconv.ParseInt(dataString, 16, 64)
if err != nil {
return nil, fmt.Errorf("could not parse %s as big int: %v", dataString, err)
}
return big.NewInt(parseInt), nil
}