manpagez: man pages & more
info gnutls
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

11.2.3 Representation of Binary Data

Many procedures operate on binary data. For instance, pkcs3-import-dh-parameters expects binary data as input and, similarly, procedures like pkcs1-export-rsa-parameters return binary data.

Binary data is represented on the Scheme side using SRFI-4 homogeneous vectors (see (guile)SRFI-4 section `SRFI-4' in The GNU Guile Reference Manual). Although any type of homogeneous vector may be used, u8vectors (i.e., vectors of bytes) are highly recommended.

As an example, generating and then exporting RSA parameters in the PEM format can be done as follows:

 
(let* ((rsa-params (make-rsa-parameters 1024))
       (raw-data
        (pkcs1-export-rsa-parameters rsa-params
                                     x509-certificate-format/pem)))
  (uniform-vector-write raw-data (open-output-file "some-file.pem")))

For an example of OpenPGP key import from a file, see Importing OpenPGP Keys Guile Example.


© manpagez.com 2000-2024
Individual documents may contain additional copyright information.