Next: Input and Output, Previous: Procedure Names, Up: Guile API Conventions [Contents][Index]
Many procedures operate on binary data. For instance,
pkcs3-import-dh-parameters
expects binary data as input.
Binary data is represented on the Scheme side using bytevectors
(see Bytevectors in The GNU Guile Reference Manual).
Homogeneous vectors such as SRFI-4 u8vector
s can also be
used1.
As an example, generating and then exporting Diffie-Hellman parameters in the PEM format can be done as follows:
(let* ((dh (make-dh-parameters 1024)) (pem (pkcs3-export-dh-parameters dh x509-certificate-format/pem))) (call-with-output-file "some-file.pem" (lambda (port) (uniform-vector-write pem port))))
Historically, SRFI-4 u8vector
s are the closest
thing to bytevectors that Guile 1.8 and earlier supported.