package pkcs11

  1. Overview
  2. Docs
Bindings to the PKCS#11 cryptographic API

Install

dune-project
 Dependency

Authors

Maintainers

Sources

pkcs11-0.9.0.tbz
sha256=0a1dc5fb54d3febbb0024b6fe9bb393f25e4ce6aadbc65fcc114345c5ca3982a
md5=c1a9bd7ed535e9fb31f2e6014567c9af

doc/src/pkcs11/p11_slot.ml.html

Source file p11_slot.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
type t =
  | Index of int
  | Id of int
  | Description of string
  | Label of string

let to_yojson = function
  | Index x -> `List [`String "index"; `Int x]
  | Id x -> `List [`String "id"; `Int x]
  | Description x -> `List [`String "description"; `String x]
  | Label x -> `List [`String "label"; `String x]

let of_yojson = function
  | `List [`String "index" ; `Int x] -> Ok (Index x)
  | `List [`String "id" ; `Int x] -> Ok (Id x)
  | `List [`String "description" ; `String x] -> Ok (Description x)
  | `List [`String "label" ; `String x] -> Ok (Label x)
  | _ -> Error "Slot.t"

let default = Index 0

let to_string = function
  | Index i -> "slot index", string_of_int i
  | Id i -> "slot ID", string_of_int i
  | Description s -> "slot description", s
  | Label s -> "token label", s