summaryrefslogtreecommitdiff
path: root/SWIG/_lib.i
diff options
context:
space:
mode:
authorHeikki Toivonen <heikki@heikkitoivonen.net>2006-12-06 05:30:34 +0000
committerHeikki Toivonen <heikki@heikkitoivonen.net>2006-12-06 05:30:34 +0000
commit88d440670dc9af2ff3067d4f6a8f52b68a953c47 (patch)
treea3fe0029d5c94ae7e4dfac6f2b15d02f826eea3c /SWIG/_lib.i
parent225f24da9cc7a54ca293d23006fd575a9151ec02 (diff)
downloadm2crypto-88d440670dc9af2ff3067d4f6a8f52b68a953c47.tar.gz
Bug 7036, added PKey.get_modulus, X509.get_fingerprint, X509_Name.as_der and
m2.bn_to_hex. Original patch by Thomas Uram. git-svn-id: http://svn.osafoundation.org/m2crypto/trunk@487 2715db39-9adf-0310-9c64-84f055769b4b
Diffstat (limited to 'SWIG/_lib.i')
-rw-r--r--SWIG/_lib.i18
1 files changed, 18 insertions, 0 deletions
diff --git a/SWIG/_lib.i b/SWIG/_lib.i
index 0d9e303..6d96c8d 100644
--- a/SWIG/_lib.i
+++ b/SWIG/_lib.i
@@ -302,6 +302,24 @@ BIGNUM *bin_to_bn(PyObject *value) {
return BN_bin2bn(vbuf, vlen, NULL);
}
+PyObject *bn_to_hex(BIGNUM *bn) {
+ char *hex;
+ PyObject *pyo;
+ int len;
+
+ hex = BN_bn2hex(bn);
+ if (!hex) {
+ PyErr_SetString(PyExc_RuntimeError,
+ ERR_error_string(ERR_get_error(), NULL));
+ OPENSSL_free(hex);
+ return NULL;
+ }
+ len = strlen(hex);
+ pyo=PyString_FromStringAndSize(hex, len);
+ OPENSSL_free(hex);
+ return pyo;
+}
+
BIGNUM *hex_to_bn(PyObject *value) {
const void *vbuf;
int vlen;