diff --git a/rsa.go b/rsa.go index a027ced..36e719a 100644 --- a/rsa.go +++ b/rsa.go @@ -50,9 +50,12 @@ func SupportsSignatureRSAPKCS1v15(ch crypto.Hash) (supported bool) { } defer C.go_openssl_EVP_PKEY_CTX_free(ctx) + msg := make([]byte, 1) + var outLen C.size_t return C.go_openssl_EVP_PKEY_sign_init(ctx) == 1 && C.go_openssl_EVP_PKEY_CTX_ctrl(ctx, -1, -1, C.GO_EVP_PKEY_CTRL_MD, 0, unsafe.Pointer(md)) == 1 && - setRSAPAdding(ctx, C.GO_RSA_PKCS1_PADDING) == nil + setRSAPAdding(ctx, C.GO_RSA_PKCS1_PADDING) == nil && + C.go_openssl_EVP_PKEY_sign(ctx, nil, &outLen, base(msg), C.size_t(len(msg))) == 1 } func GenerateKeyRSA(bits int) (N, E, D, P, Q, Dp, Dq, Qinv BigInt, err error) {