package pkcs11

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

Install

dune-project
 Dependency

Authors

Maintainers

Sources

pkcs11-0.17.0.tbz
sha256=175a7706dcfb9355664e99284681ff04fbb1da7ccebe6276bcd1067c189f51f8
md5=21b68f5531337247f832b25d769e5dde

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
27
type t =
  | Index of int
  | Id of int
  | Description of string
  | Label of string
[@@deriving eq,ord,show]

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