toPem method

String toPem()

Exports CSR to PEM format.

Implementation

String toPem() {
  final bio = _context.createBio();
  try {
    final result = _context.bindings.PEM_write_bio_X509_REQ(bio, handle);
    if (result != 1) throw OpenSslException('Failed to write CSR to PEM');
    return _context.bioToString(bio);
  } finally {
    _context.freeBio(bio);
  }
}