Documentation ¶
Index ¶
- Constants
- Variables
- func GetExtensionListFromSignatureScheme(sigScheme mint.SignatureScheme) mint.ExtensionList
- func GetExtensionListFromSignatureSchemes(sigSchemes []mint.SignatureScheme) mint.ExtensionList
- func GetRandomBytes(n int) []byte
- func MarshalErrorAsJSON(target error) ([]byte, error)
- func MarshalList(toMarshal []Marshaler) ([]byte, error)
- func SelfSignedCert(domain string, roots *x509.CertPool, scheme mint.SignatureScheme) (*mint.Certificate, error)
- func SelfSignedCerts(domain string, roots *x509.CertPool) ([]*mint.Certificate, error)
- func UnmarshalList(toUnmarshal []Unmarshaler, data []byte) (int, error)
- func XORBytes(a, b []byte) ([]byte, error)
- type Causer
- type Error
- type MarshalUnmarshaler
- type Marshaler
- type Unmarshaler
Constants ¶
const (
ErrMarshalUnmarshalFailed = "marshal unmarshal %v failed: \nexpected %#v,\ngot %#v"
)
Test strings
Variables ¶
var HashMap = map[mint.SignatureScheme]crypto.Hash{ mint.RSA_PKCS1_SHA1: crypto.SHA1, mint.RSA_PKCS1_SHA256: crypto.SHA256, mint.RSA_PKCS1_SHA384: crypto.SHA384, mint.RSA_PKCS1_SHA512: crypto.SHA512, mint.ECDSA_P256_SHA256: crypto.SHA256, mint.ECDSA_P384_SHA384: crypto.SHA384, mint.ECDSA_P521_SHA512: crypto.SHA512, mint.RSA_PSS_SHA256: crypto.SHA256, mint.RSA_PSS_SHA384: crypto.SHA384, mint.RSA_PSS_SHA512: crypto.SHA512, }
HashMap is a map from signature schemes to the hash that they use.
var MintSupportedSignatureSchemes = []mint.SignatureScheme{ mint.ECDSA_P256_SHA256, mint.ECDSA_P384_SHA384, mint.ECDSA_P521_SHA512, mint.RSA_PKCS1_SHA256, mint.RSA_PKCS1_SHA384, mint.RSA_PKCS1_SHA512, }
MintSupportedSignatureSchemes is a list of all signature schemes supported by the mint package.
Functions ¶
func GetExtensionListFromSignatureScheme ¶
func GetExtensionListFromSignatureScheme(sigScheme mint.SignatureScheme) mint.ExtensionList
GetExtensionListFromSignatureScheme returns an ExtensionList containing the given signature scheme.
func GetExtensionListFromSignatureSchemes ¶
func GetExtensionListFromSignatureSchemes(sigSchemes []mint.SignatureScheme) mint.ExtensionList
GetExtensionListFromSignatureSchemes returns an ExtensionList containing the given signature schemes.
func MarshalErrorAsJSON ¶
MarshalErrorAsJSON marshals an error as json.
func MarshalList ¶
MarshalList marshals a list of values that are marshal-able.
func SelfSignedCert ¶
func SelfSignedCert(domain string, roots *x509.CertPool, scheme mint.SignatureScheme) (*mint.Certificate, error)
SelfSignedCert creates a new self-signed cert for the given domain and adds it to the roots pool (if provided).
func SelfSignedCerts ¶
SelfSignedCerts returns a list of self-signed certificates, each signed with a different signature scheme supported by mint.
func UnmarshalList ¶
func UnmarshalList(toUnmarshal []Unmarshaler, data []byte) (int, error)
UnmarshalList unmarshals a list of values that are unmarshal-able.
Types ¶
type Causer ¶
type Causer interface {
Cause() error
}
Causer is an interface for the cause of an error.
type Error ¶
type Error uint8
Error represents an error for the library.
const ( // ErrorNoError represents an empty error. ErrorNoError Error = 0 + iota // ErrorSpontaneousAuthForbidden represents error when an spontaneous session is forbidden. ErrorSpontaneousAuthForbidden // ErrorSessionNotFound represents error when the session is not found. ErrorSessionNotFound // ErrorIncorrectState represents error it reaches an incorrect state. ErrorIncorrectState // ErrorIncorrectRole represents error when it reaches an incorrect role. ErrorIncorrectRole // ErrorUnrecognizedMessage represents error when the message is not recognized. ErrorUnrecognizedMessage // ErrorNoCertificates represents error when there are no certificates. ErrorNoCertificates // ErrorInconsistentContext represents error when the context is inconsistent. ErrorInconsistentContext // ErrorReusedContext represents error when context is reused. ErrorReusedContext // ErrorInvalidContext represents error when the context is invalid. ErrorInvalidContext // ErrorUnrecognizedLabel represents error when the label is not recognized. ErrorUnrecognizedLabel // ErrorNoPasswordTable represents error when there is no password table. ErrorNoPasswordTable // ErrorUserNotRegistered represents error when the user is not yet registered. ErrorUserNotRegistered // ErrorUserAlreadyRegistered represents error when the user is already registered. ErrorUserAlreadyRegistered // ErrorUnexpectedMessage represents error when an unexpected message arrives. ErrorUnexpectedMessage // ErrorHmacTagInvalid represents error when HMAC tag is invalid. ErrorHmacTagInvalid // ErrorForbiddenPolicy represents error when there is a forbidden credential encoding policy. ErrorForbiddenPolicy // ErrorUnexpectedData represents error when unexpected data arrived. ErrorUnexpectedData // ErrorInvalidFinishedMac represents error when the finished MAC is invalid. ErrorInvalidFinishedMac // ErrorBadEnvelope represents error when decription of the envelope fails. ErrorBadEnvelope // ErrorInvalidAuthenticator represents error when the authenticator is invalid. ErrorInvalidAuthenticator // ErrorUnsupportedCiphersuite represents error when the ciphersuite is not supported. ErrorUnsupportedCiphersuite // ErrorNotFound represents error when a field is not found. ErrorNotFound // ErrorOtherError represents other kinds of errors not previously covered. ErrorOtherError )
type MarshalUnmarshaler ¶
type MarshalUnmarshaler interface { Marshaler Unmarshaler }
MarshalUnmarshaler is a type that can marshal and unmarshal itself.
type Marshaler ¶
Marshaler is the interface implemented by types that can be marshaled (converted to raw bytes).
type Unmarshaler ¶
Unmarshaler is the interface implemented by types that can be unmarshaled (converted from raw bytes to a struct).