RSA_sign function

  1. @RecordUse.new()
  2. @Native<Int Function(Int, Pointer<Uint8>, Size, Pointer<Uint8>, Pointer<UnsignedInt>, Pointer<RSA>)>(ffi.Int, ffi.Pointer<ffi.Uint8>, ffi.Size, ffi.Pointer<ffi.Uint8>, ffi.Pointer<ffi.UnsignedInt>, ffi.Pointer<RSA>)>(symbol: 'bssl_dart_RSA_sign')
int RSA_sign(
  1. int hash_nid,
  2. Pointer<Uint8> digest,
  3. int digest_len,
  4. Pointer<Uint8> out,
  5. Pointer<UnsignedInt> out_len,
  6. Pointer<RSA> rsa,
)

RSA_sign signs |digest_len| bytes of digest from |digest| with |rsa| using RSASSA-PKCS1-v1_5. It writes, at most, |RSA_size(rsa)| bytes to |out|. On successful return, the actual number of bytes written is written to |*out_len|.

The |hash_nid| argument identifies the hash function used to calculate |digest| and is embedded in the resulting signature. For example, it might be |NID_sha256|.

It returns 1 on success and zero on error.

WARNING: |digest| must be the result of hashing the data to be signed with |hash_nid|. Passing unhashed inputs will not result in a secure signature scheme.

Implementation

@meta.RecordUse()
@ffi.Native<
  ffi.Int Function(
    ffi.Int,
    ffi.Pointer<ffi.Uint8>,
    ffi.Size,
    ffi.Pointer<ffi.Uint8>,
    ffi.Pointer<ffi.UnsignedInt>,
    ffi.Pointer<RSA>,
  )
>(symbol: 'bssl_dart_RSA_sign')
external int RSA_sign(
  int hash_nid,
  ffi.Pointer<ffi.Uint8> digest,
  int digest_len,
  ffi.Pointer<ffi.Uint8> out,
  ffi.Pointer<ffi.UnsignedInt> out_len,
  ffi.Pointer<RSA> rsa,
);