const sha1
XuAPI
pub const sha1 = 3用途
公开常量 `sha1`。 值为 `3`
参数
无
API
#crypto/rsaPKCS#1 v1.5 加密与签名。无 OAEP/PSS。
const sha1pub const sha1 = 3公开常量 `sha1`。 值为 `3`
无
const sha256pub const sha256 = 5公开常量 `sha256`。 值为 `5`
无
const sha384pub const sha384 = 6公开常量 `sha384`。 值为 `6`
无
const sha512pub const sha512 = 7公开常量 `sha512`。 值为 `7`
无
struct PublicKeypub struct PublicKey {
pub n big.Int
pub e int
}公开结构体 `PublicKey`。
n big.Inte intstruct PrivateKeypub struct PrivateKey {
pub public PublicKey
pub d big.Int
pub p big.Int
pub q big.Int
}公开结构体 `PrivateKey`。
public PublicKeyd big.Intp big.Intq big.Int(&PublicKey) sizepub fn (pk &PublicKey) size() int`&PublicKey` 上的方法:返回尺寸。
pk &PublicKeyint — 该类型的值
encrypt_pkcs1v15pub fn encrypt_pkcs1v15(pk &PublicKey, msg &string) string加密pkcs1v15。失败时 throw。
pk &PublicKeymsg &stringstring — 结果字符串
decrypt_pkcs1v15pub fn decrypt_pkcs1v15(priv &PrivateKey, ciphertext &string) string解密pkcs1v15。失败时 throw。
priv &PrivateKeyciphertext &stringstring — 结果字符串
sign_pkcs1v15pub fn sign_pkcs1v15(priv &PrivateKey, hash int, hashed &string) string符号pkcs1v15。失败时 throw。
priv &PrivateKeyhash inthashed &stringstring — 结果字符串
verify_pkcs1v15pub fn verify_pkcs1v15(pk &PublicKey, hash int, hashed &string, sig &string) int验签pkcs1v15。失败时 throw。
pk &PublicKeyhash inthashed &stringsig &stringint — 该类型的值
generate_keypub fn generate_key(bits int) PrivateKey生成键。失败时 throw。
bits intPrivateKey — 该类型的值