Jan Dittberner
9f0916b14a
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.
17 lines
359 B
Go
17 lines
359 B
Go
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
|
|
}
|