ssh-pkcs11-uri.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Copyright (c) 2017 Red Hat
  3. *
  4. * Authors: Jakub Jelen <jjelen@redhat.com>
  5. *
  6. * Permission to use, copy, modify, and distribute this software for any
  7. * purpose with or without fee is hereby granted, provided that the above
  8. * copyright notice and this permission notice appear in all copies.
  9. *
  10. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  11. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  12. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  13. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  14. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  15. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  16. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  17. */
  18. #define PKCS11_URI_SCHEME "pkcs11:"
  19. #define PKCS11_URI_WHITELIST "abcdefghijklmnopqrstuvwxyz" \
  20. "ABCDEFGHIJKLMNOPQRSTUVWXYZ" \
  21. "0123456789_-.()"
  22. struct pkcs11_uri {
  23. /* path */
  24. char *id;
  25. size_t id_len;
  26. char *token;
  27. char *object;
  28. char *lib_manuf;
  29. char *manuf;
  30. /* query */
  31. char *module_path;
  32. char *pin; /* Only parsed, but not printed */
  33. };
  34. struct pkcs11_uri *pkcs11_uri_init();
  35. void pkcs11_uri_cleanup(struct pkcs11_uri *);
  36. int pkcs11_uri_parse(const char *, struct pkcs11_uri *);
  37. struct pkcs11_uri *pkcs11_uri_init();
  38. char *pkcs11_uri_get(struct pkcs11_uri *uri);