Git Product home page Git Product logo

sspi-rs's Introduction

sspi-rs

Build Status

sspi-rs is a Rust implementation of Security Support Provider Interface (SSPI). It ships with platform-independent implementations of Security Support Providers (SSP), and is able to utilize native Microsoft libraries when ran under Windows.

The purpose of sspi-rs is to clean the original interface from cluttering and provide users with Rust-friendly SSPs for execution under *nix or any other platform that is able to compile Rust.

Overview

The sspi-rs works in accordance with the MSDN documentation. At the moment, NT LAN Manager (NTLM) is implemented and available for platform independent execution. It is also possible to create your own SSPs by implementing the SspiImpl trait. More on that in the Documentation.

WinAPI

You can switch between the sspi module to use the platform independent implementations of the SSPs, and the sspi::winapi module to use the native Windows libraries when running under Windows.

Ease of use

Some SSPI functions tend to be cumbersome, that's why sspi-rs allows to use SSPI in a convenient way by utilizing builders. Examples are available in the examples, example section, and Documentation.

Usage

sspi-rs is included in the Cargo.toml like this:

[dependencies]
sspi = "0.1.0"

After that you can use the types that you need.

Documentation

Documentation will give you a comprehensive overlook of the crate. For the example of a simple use case, visit the examples folder.

Example

The usage of the SSPs is as simple as creating an instance of the security provider and calling its functions.

It is easy to switch between Windows and our SSP implementations. Here is an example of acquiring a credentials handle and a timestamp of their vaidity. The source of Ntlm is selected automatically depending on the platform:

#[cfg(windows)]
use sspi::{winapi::Ntlm, Sspi, CredentialUse};
#[cfg(unix)]
use sspi::{Ntlm, Sspi, CredentialUse};

fn main() {
    let mut ntlm = Ntlm::new();
        
    let (cred_handle, timestamp) = ntlm
        .acquire_credentials_handle()
        .with_credential_use(CredentialUse::Inbound)
        .execute()
        .unwrap();
}

Example of acquiring an SSP provided by Windows:

let mut negotiate = SecurityPackage::from_package_type(
    SecurityPackageType::Other(String::from("Negotiate"))
);

Projects that use sspi-rs

License

sspi-rs is licensed under MIT license.

sspi-rs's People

Contributors

vaffeine avatar awakecoding avatar rrradicaledward avatar fotosmile avatar cbenoit avatar failshell avatar sduquette-devolutions avatar acelletti avatar devolutionsbot avatar richlanc avatar pacmancoder avatar devolutionsinfra avatar

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.