Giter Site home page Giter Site logo

nimssl's Introduction

Nimssl is a Nim wrapper for the OpenSSL library.

Nimssl is distributed as a Nimble package and depends on Nimterop to generate the wrappers. The OpenSSL source code is downloaded using Git so having git in the path is required.

Installation

Nimssl can be installed via Nimble:

> nimble install nimssl

This will download, wrap and install nimssl in the standard Nimble package location, typically ~/.nimble. Once installed, its libraries can be imported into any Nim program.

Usage

To get started, here is an example:

import nimssl/crypto

var test = "Hello, world!"
var hash = SHA256(addr test[0], cast[uint](test.len()), nil)

echo hash.toArray(32).toHex()

When compiling with nimssl/crypto, include the -d:cryptoStd command line flag, and -d:sslStd when compiling with nimssl/ssl. The first compile will be slow, but those after should be much faster. If you are experiencing consistently slow compile times, try including the -f:off flag.

Nimssl currently wraps almost everything from OpenSSL's libcrypto and libssl, but few things are tested (refer to tests). Contributions to the tests pool are appreciated!

Credits

Nimssl wraps the OpenSSL source code and all licensing terms of OpenSSL apply to the usage of this package.

Feedback

Nimssl is a work in progress and any feedback or suggestions are welcome. It is hosted on GitHub with an MIT license so issues, forks and PRs are most appreciated.

nimssl's People

Contributors

genotrance avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

nimssl's Issues

Name monopoly

I have built a Nim wrapper for OpenSSL's RSA library and a couple of others. I would submit a pull request to add it to nimssl, but it uses the new nimterop library rather than nimgen. I suspect it would be very easy to wrap the rest of libcrypto with nimterop, but it feels pointless considering that this project already has the package name of nimssl on nimble. Would the maintainer (@genotrance) be interested in moving nimssl to nimterop (and the continuing to actively maintain it) or allowing me to re-assign the nimble listing to my own, more complete nimssl?

Error install

nimble v0.11.0
Nim Compiler Version 1.0.6
FreeBSD 11.3-RELEASE-p6
OpenSSL 1.0.2s

% nimble install nimssl
Downloading https://github.com/genotrance/nimssl using git
Setting up Git repo: https://github.com/openssl/openssl.git
Pulling repository
Creating nimssl/include/openssl/opensslconf.h
Processing nimssl/include/openssl/sha.h
Processing nimssl/include/openssl/macros.h
File doesn't exist: openssl/opensslv.h
stack trace: (most recent call last)
/tmp/nimblecache/nimscriptapi.nim(177, 29)
/tmp/nimble_44882/githubcom_genotrancenimssl/nimssl_44882.nims(32, 12) installBefore
/tmp/nimble_44882/githubcom_genotrancenimssl/nimssl_44882.nims(29, 8) setupTask
/usr/local/lib/system/nimscript.nim(252, 7) exec
/usr/local/lib/system/nimscript.nim(252, 7) Error: unhandled exception: FAILED: nimgen nimssl.cfg [OSError]

NimSSL won't install on Linux

$ nimble install nimssl
Downloading https://github.com/genotrance/nimssl using git
Setting up Git repo: https://github.com/openssl/openssl.git
Pulling repository
Creating nimssl/include/openssl/opensslconf.h
Processing nimssl/include/openssl/sha.h
Processing nimssl/include/openssl/macros.h
File doesn't exist: openssl/opensslv.h
stack trace: (most recent call last)
/tmp/nimblecache-2278977883/nimscriptapi_596699823.nim(199, 29)
/tmp/nimble_48649/githubcom_genotrancenimssl/nimssl.nimble(27, 12) installBefore
/tmp/nimble_48649/githubcom_genotrancenimssl/nimssl.nimble(24, 8) setupTask
/home/mihara/.choosenim/toolchains/nim-1.6.14/lib/system/nimscript.nim(273, 7) exec
/home/mihara/.choosenim/toolchains/nim-1.6.14/lib/system/nimscript.nim(273, 7) Error: unhandled exception: FAILED: nimgen nimssl.cfg [OSError]
       Tip: 4 messages have been suppressed, use --verbose to show them.
     Error: Exception raised during nimble script execution

I can't seem to figure out why it isn't pulling anything.

Guess this project is now entirely defunct...

nimssl won't install on Mac OSX v11.3

nimble install nimssl
Downloading https://github.com/genotrance/nimssl using git
Setting up Git repo: https://github.com/openssl/openssl.git
Pulling repository
Creating nimssl/include/openssl/opensslconf.h
Processing nimssl/include/openssl/sha.h
Processing nimssl/include/openssl/macros.h
File doesn't exist: openssl/opensslv.h
stack trace: (most recent call last)
/private/var/folders/81/zn5n71012mb48jwlptm46_m80000gq/T/nimblecache-1664209541/nimscriptapi_2030147282.nim(199, 29)
/private/var/folders/81/zn5n71012mb48jwlptm46_m80000gq/T/nimble_53510/githubcom_genotrancenimssl/nimssl.nimble(27, 12) installBefore
/private/var/folders/81/zn5n71012mb48jwlptm46_m80000gq/T/nimble_53510/githubcom_genotrancenimssl/nimssl.nimble(24, 8) setupTask
/Users/.choosenim/toolchains/nim-1.4.6/lib/system/nimscript.nim(260, 7) exec
/Users/.choosenim/toolchains/nim-1.4.6/lib/system/nimscript.nim(260, 7) Error: unhandled exception: FAILED: nimgen nimssl.cfg [OSError]
Tip: 5 messages have been suppressed, use --verbose to show them.
Error: Exception raised during nimble script execution`

nim --version
Nim Compiler Version 1.4.6 [MacOSX: amd64]
Compiled at 2021-05-06
Copyright (c) 2006-2020 by Andreas Rumpf

git hash: b50e8303f935edff595df1626eff59d6e02c537b
active boot switches: -d:release

openssl
OpenSSL> version
OpenSSL 1.1.1k 25 Mar 2021

locate opensslv.h
/usr/local/Cellar/[email protected]/1.1.1k/include/openssl/opensslv.h

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.