Documentation ¶
Overview ¶
Package ocra implements a full OATH OCRA algorithm as defined in RFC6287 (https://tools.ietf.org/html/rfc6287). OCRA is an algorithm for challenge-response authentication developed by the Initiative for Open Authentication (OATH).
Index ¶
- type OCRA
- func (o *OCRA) OTP(key []byte, counter, timeStamp uint64, question, password []byte, ...) (*OTP, error)
- func (o *OCRA) PasswordEncoding(password []byte) ([]byte, error)
- func (o *OCRA) QuestionEncoding(value interface{}, otherPartyGenerated interface{}) ([]byte, error)
- func (o *OCRA) TimeStampEncoding(ts *time.Time) (uint64, error)
- type OTP
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OCRA ¶
type OCRA struct {
// contains filtered or unexported fields
}
OCRA represent the basic tructure used to execute challenge and response ops.
func NewOCRA ¶
NewOCRA generate an OCRA struct from the available options that can be descrived in a RFC6287 standard OCRASuite. An OCRASuite value is a text string that captures one mode of operation for OCRA, completely specifying the various options for that computation. An OCRASuite value is represented as follows: <Algorithm>:<CryptoFunction>:<DataInput>
func (*OCRA) OTP ¶
func (o *OCRA) OTP( key []byte, counter, timeStamp uint64, question, password []byte, session string, ) (*OTP, error)
OTP implements RFC6287 to produce an OTP starting from a challenge shared with the server. All passed arguments will be validated considering the evaluated OCRA suite.
func (*OCRA) PasswordEncoding ¶
PasswordEncoding encode a binary password using the suite defined hashing algorithm.
func (*OCRA) QuestionEncoding ¶
func (o *OCRA) QuestionEncoding( value interface{}, otherPartyGenerated interface{}, ) ([]byte, error)
QuestionEncoding generate correctly encoded binary questions starting from OCRA suite and passed arguments. The function consider the use case of mutual authentication by accepting a otherPartyGenerated question that will be concatenated (if any) with the self targeted question.