decodePoint 函数输出中的 PublicKeySizeInvalid 错误
PublicKeySizeInvalid error in decodePoint function output
我正在 GHCI 中尝试这个功能,
import Data.ByteString.Char8
import Crypto.PubKey.ECIES
import Crypto.ECC
import Data.Proxy
curve = Proxy :: Proxy Curve_X448
str = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
seed = Data.ByteString.Char8.pack str
d = decodePoint curve seed
d
但是报错CryptoFailed CryptoError_PublicKeySizeInvalid
,str
的大小应该是多少?
对于X448曲线,顾名思义,密钥大小应该是448位,即56字节:
-- import ...
curve = Proxy :: Proxy Curve_X448
seed = Data.ByteString.Char8.replicate 56 'a'
d = decodePoint curve seed
d
打印出来:
CryptoPassed (PublicKey "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
我正在 GHCI 中尝试这个功能,
import Data.ByteString.Char8
import Crypto.PubKey.ECIES
import Crypto.ECC
import Data.Proxy
curve = Proxy :: Proxy Curve_X448
str = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
seed = Data.ByteString.Char8.pack str
d = decodePoint curve seed
d
但是报错CryptoFailed CryptoError_PublicKeySizeInvalid
,str
的大小应该是多少?
对于X448曲线,顾名思义,密钥大小应该是448位,即56字节:
-- import ...
curve = Proxy :: Proxy Curve_X448
seed = Data.ByteString.Char8.replicate 56 'a'
d = decodePoint curve seed
d
打印出来:
CryptoPassed (PublicKey "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")