package pkcs11uri
import "github.com/stefanberger/go-pkcs11uri"
Index ¶
- type Pkcs11URI
- func New() *Pkcs11URI
- func (uri *Pkcs11URI) AddEnv(name, value string)
- func (uri *Pkcs11URI) AddPathAttribute(name, value string) error
- func (uri *Pkcs11URI) AddPathAttributeUnencoded(name string, value []byte) error
- func (uri *Pkcs11URI) AddQueryAttribute(name, value string) error
- func (uri *Pkcs11URI) AddQueryAttributeUnencoded(name string, value []byte) error
- func (uri *Pkcs11URI) Format() (string, error)
- func (uri *Pkcs11URI) GetEnvMap() map[string]string
- func (uri *Pkcs11URI) GetModule() (string, error)
- func (uri *Pkcs11URI) GetModuleDirectories() []string
- func (uri *Pkcs11URI) GetPIN() (string, error)
- func (uri *Pkcs11URI) GetPathAttribute(name string, pctencode bool) (string, bool)
- func (uri *Pkcs11URI) GetQueryAttribute(name string, pctencode bool) (string, bool)
- func (uri *Pkcs11URI) HasPIN() bool
- func (uri *Pkcs11URI) Parse(uristring string) error
- func (uri *Pkcs11URI) RemovePathAttribute(name string)
- func (uri *Pkcs11URI) RemoveQueryAttribute(name string)
- func (uri *Pkcs11URI) SetAllowAnyModule(allowAnyModule bool)
- func (uri *Pkcs11URI) SetAllowedModulePaths(allowedModulePaths []string)
- func (uri *Pkcs11URI) SetEnvMap(env map[string]string)
- func (uri *Pkcs11URI) SetModuleDirectories(moduleDirectories []string)
- func (uri *Pkcs11URI) SetPathAttribute(name, value string) error
- func (uri *Pkcs11URI) SetPathAttributeUnencoded(name string, value []byte)
- func (uri *Pkcs11URI) SetQueryAttribute(name, value string) error
- func (uri *Pkcs11URI) SetQueryAttributeUnencoded(name string, value []byte)
- func (uri *Pkcs11URI) Validate() error
Types ¶
type Pkcs11URI ¶
type Pkcs11URI struct {
// contains filtered or unexported fields
}
Pkcs11URI holds a pkcs11 URI object
func New ¶
func New() *Pkcs11URI
New creates a new Pkcs11URI object
func (*Pkcs11URI) AddEnv ¶
AddEnv adds an environment variable for the pkcs11 module
func (*Pkcs11URI) AddPathAttribute ¶
AddPathAttribute adds a path attribute; it returns an error if an attribute with the same name already existed or if the given value cannot be pct-unescaped
func (*Pkcs11URI) AddPathAttributeUnencoded ¶
AddPathAttributeUnencoded adds a path attribute given as byte[] which must not already be pct-encoded; it returns an error if an attribute with the same name already existed
func (*Pkcs11URI) AddQueryAttribute ¶
AddQueryAttribute adds a query attribute; it returns an error if an attribute with the same name already existed or if the given value cannot be pct-unescaped
func (*Pkcs11URI) AddQueryAttributeUnencoded ¶
AddQueryAttributeUnencoded adds a query attribute given as byte[] which must not already be pct-encoded; it returns an error if an attribute with the same name already existed
func (*Pkcs11URI) Format ¶
Format formats a Pkcs11URI to it string representaion
func (*Pkcs11URI) GetEnvMap ¶
GetEnvMap returns the map of environment variables
func (*Pkcs11URI) GetModule ¶
GetModule returns the module to use or an error in case no module could be found. First the module-path is checked for whether it holds an absolute that can be read by the current user. If this is the case the module is returned. Otherwise either the module-path is used or the user-provided module path is used to match a module containing what is set in the attribute module-name.
func (*Pkcs11URI) GetModuleDirectories ¶
GetModuleDirectories gets the search directories for pkcs11 modules
func (*Pkcs11URI) GetPIN ¶
GetPIN gets the PIN from either the pin-value or pin-source attribute; a user may want to call HasPIN() before calling this function to determine whether a PIN has been provided at all so that an error code returned by this function indicates that the PIN value could not be retrieved.
func (*Pkcs11URI) GetPathAttribute ¶
GetPathAttribute returns the value of a path attribute in unescaped form or pct-encoded form
func (*Pkcs11URI) GetQueryAttribute ¶
GetQueryAttribute returns the value of a query attribute in unescaped or pct-encoded form
func (*Pkcs11URI) HasPIN ¶
HasPIN allows the user to check whether a PIN has been provided either by the pin-value or the pin-source attributes. It should be called before GetPIN(), which may still fail getting the PIN from a file for example.
func (*Pkcs11URI) Parse ¶
Parse parses a pkcs11: URI string
func (*Pkcs11URI) RemovePathAttribute ¶
RemovePathAttribute removes a path attribute
func (*Pkcs11URI) RemoveQueryAttribute ¶
RemoveQueryAttribute removes a path attribute
func (*Pkcs11URI) SetAllowAnyModule ¶
SetAllowAnyModule allows any module to be loaded; by default this is not allowed
func (*Pkcs11URI) SetAllowedModulePaths ¶
SetAllowedModulePaths sets allowed module paths to restrict access to modules. Directory entries must end with a '/', all other ones are assumed to be file entries. Allowed modules are filtered by string matching.
func (*Pkcs11URI) SetEnvMap ¶
SetEnvMap sets the environment variables for the pkcs11 module
func (*Pkcs11URI) SetModuleDirectories ¶
SetModuleDirectories sets the search directories for pkcs11 modules
func (*Pkcs11URI) SetPathAttribute ¶
SetPathAttribute sets the value for a path attribute; this function may return an error if the given value cannot be pct-unescaped
func (*Pkcs11URI) SetPathAttributeUnencoded ¶
SetPathAttributeUnencoded sets the value for a path attribute given as byte[]. The value must not have been pct-encoded already.
func (*Pkcs11URI) SetQueryAttribute ¶
SetQueryAttribute sets the value for a query attribute; this function may return an error if the given value cannot pct-unescaped
func (*Pkcs11URI) SetQueryAttributeUnencoded ¶
SetQueryAttributeUnencoded sets the value for a quiery attribute given as byte[]. The value must not have been pct-encoded already.
func (*Pkcs11URI) Validate ¶
Validate validates a Pkcs11URI object's attributes following RFC 7512 rules and proper formatting of their values
Source Files ¶
- Version
- v0.0.0-20230803200340-78284954bff6 (latest)
- Published
- Aug 3, 2023
- Platform
- js/wasm
- Imports
- 8 packages
- Last checked
- 4 days ago –
Tools for package owners.