Next: , Previous: , Up: SXEmacs OpenSSL API   [Contents][Index]


62.2.1 General information

In this section we deal with informative functions which kind of reflect the underlying library capabilities. It is very hard to say which of the capabilities are guaranteed to exist since it is possible to strip certain cryptographic stuff from the OpenSSL installation, for instance due to license, patent, or legal issues.

Function: ossl-version

Return a descriptive version number of the OpenSSL in use.

The version string should be identical to the output of openssl version in a shell.

(ossl-version)
  ⇒ "OpenSSL 0.9.9-dev XX xxx XXXX"
Function: ossl-available-digests

Return a list of digest algorithms in the underlying crypto library. This yields a plain list of symbols.

Function: ossl-available-ciphers

Return a list of cipher algorithms in the underlying crypto library. This yields a list of symbols.

(ossl-available-digests)
  ⇒ '(UNDEF MD2 MD5 RSA-MD2 RSA-MD5 SHA RSA-SHA SHA1 RSA-SHA1 DSA-SHA
       DSA-SHA1-old MDC2 RSA-MDC2 DSA-SHA1 RSA-SHA1-2 DSA RIPEMD160
       RSA-RIPEMD160 MD4 RSA-MD4 ecdsa-with-SHA1 RSA-SHA256 RSA-SHA384
       RSA-SHA512 RSA-SHA224 SHA256 SHA384 SHA512 SHA224 whirlpool)
(ossl-available-ciphers)
  ⇒ '(RC4 DES-ECB DES-CFB DES-CBC DES-EDE DES-EDE3 IDEA-CBC IDEA-CFB
       IDEA-ECB RC2-CBC RC2-ECB RC2-CFB RC2-OFB DES-EDE-CBC
       DES-EDE3-CBC DES-OFB IDEA-OFB DES-EDE-CFB DES-EDE3-CFB
       DES-EDE-OFB DES-EDE3-OFB DESX-CBC BF-CBC BF-ECB BF-CFB BF-OFB
       RC4-40 RC2-40-CBC CAST5-CBC CAST5-ECB CAST5-CFB CAST5-OFB
       RC5-CBC RC5-ECB RC5-CFB RC5-OFB RC2-64-CBC AES-128-ECB
       AES-128-CBC AES-128-OFB AES-128-CFB AES-192-ECB AES-192-CBC
       AES-192-OFB AES-192-CFB AES-256-ECB AES-256-CBC AES-256-OFB
       AES-256-CFB AES-128-CFB1 AES-192-CFB1 AES-256-CFB1 AES-128-CFB8
       AES-192-CFB8 AES-256-CFB8 DES-CFB1 DES-CFB8 CAMELLIA-128-CBC
       CAMELLIA-192-CBC CAMELLIA-256-CBC CAMELLIA-128-ECB
       CAMELLIA-192-ECB CAMELLIA-256-ECB CAMELLIA-128-CFB
       CAMELLIA-192-CFB CAMELLIA-256-CFB CAMELLIA-128-CFB1
       CAMELLIA-192-CFB1 CAMELLIA-256-CFB1 CAMELLIA-128-CFB8
       CAMELLIA-192-CFB8 CAMELLIA-256-CFB8 CAMELLIA-128-OFB
       CAMELLIA-192-OFB CAMELLIA-256-OFB)

These two functions are most useful to conditionalise like

(when (member 'MD4 (ossl-available-digests))
  …)

The aforementioned functions work at run-time (not compile time) so it is possible when building a dynamically linked SXEmacs to update OpenSSL on the fly. A very rough estimate is to assume to have support for the MD5 and SHA1 message digests, and the BF-* symmetric cipher systems, any installation of OpenSSL without those is purely ridiculous although not impossible.

Furthermore we provide convenience functions which, given a digest or cipher algorithm symbol, allow to obtain information about the hash result size of a digest, and the key size of a cipher, respectively.

Function: ossl-digest-size digest

Return the hash length of digest in bytes.

(ossl-digest-size 'MD5)
  ⇒ 16
(ossl-digest-size 'SHA512)
  ⇒ 64
Function: ossl-digest-block-size digest

Return the block size of digest in bytes.

(ossl-digest-block-size 'MD5)
  ⇒ 64
(ossl-digest-block-size 'SHA512)
  ⇒ 128
Function: ossl-cipher-key-length cipher

Return the effective key size of cipher in bytes.

(ossl-cipher-key-length 'RC4)
  ⇒ 16
(ossl-cipher-key-length 'CAMELLIA-256-CBC)
  ⇒ 32
Function: ossl-cipher-iv-length cipher

Return the initialisation vector length of cipher in bytes.

(ossl-cipher-iv-length 'idea-cbc)
  ⇒ 8
(ossl-cipher-iv-length 'aes-256-cbc)
  ⇒ 16
Function: ossl-cipher-block-size cipher

Return the block size of cipher in bytes.

(ossl-cipher-block-size 'aes-256-cbc)
  ⇒ 16
(ossl-cipher-block-size 'rc4)
  ⇒ 1
Function: ossl-cipher-mode cipher

Return the operation mode of cipher.

(ossl-cipher-mode 'rc4)
  ⇒ stream
(ossl-cipher-mode 'aes-192-ofb)
  ⇒ ofb

The openssl API provides following features:


Next: , Previous: , Up: SXEmacs OpenSSL API   [Contents][Index]