Documentation ¶
Index ¶
- func GenerateMessageKey() ([]byte, error)
- func HashSum(message string) []byte
- func SignMessageHash(messageHash []byte, key *rsa.PrivateKey) ([]byte, error)
- type AnonymousDialogMessage
- type BankMessage
- type BasicMessage
- func (b *BasicMessage) Encrypt(provider CryptoProvider) (*EncryptedMessage, error)
- func (b *BasicMessage) FindMarshaledSegment(segmentID string) []byte
- func (b *BasicMessage) FindMarshaledSegments(segmentID string) [][]byte
- func (b *BasicMessage) FindSegment(segmentID string) segment.Segment
- func (b *BasicMessage) FindSegments(segmentID string) []segment.Segment
- func (b *BasicMessage) MarshalHBCI() ([]byte, error)
- func (b *BasicMessage) MessageEnd() *segment.MessageEndSegment
- func (b *BasicMessage) MessageHeader() *segment.MessageHeaderSegment
- func (b *BasicMessage) SegmentNumber(segmentID string) int
- func (b *BasicMessage) SetMessageNumber(messageNumber int)
- func (b *BasicMessage) SetNumbers()
- func (b *BasicMessage) SetSize() error
- func (b *BasicMessage) Sign(provider SignatureProvider) (*BasicSignedMessage, error)
- type BasicSignedMessage
- func (b *BasicSignedMessage) Encrypt(provider CryptoProvider) (*EncryptedMessage, error)
- func (b *BasicSignedMessage) HBCISegments() []segment.ClientSegment
- func (b *BasicSignedMessage) HBCIVersion() segment.HBCIVersion
- func (b *BasicSignedMessage) MarshalHBCI() ([]byte, error)
- func (b *BasicSignedMessage) SetNumbers()
- func (b *BasicSignedMessage) SetSignatureEnd(sigEnd *segment.SignatureEndSegment)
- func (b *BasicSignedMessage) SetSignatureHeader(sigBegin *segment.SignatureHeaderSegment)
- type ClientMessage
- type CryptoProvider
- type DialogCancellationMessage
- type DialogFinishingMessage
- type DialogInitializationClientMessage
- type EncryptedMessage
- type HBCIMessage
- type Message
- type SignatureProvider
- type SignedHBCIMessage
- type SynchronisationMessage
- type Unmarshaler
- func (u *Unmarshaler) CanUnmarshal(segmentID string, version int) bool
- func (u *Unmarshaler) MarshaledSegmentByID(segmentID string) []byte
- func (u *Unmarshaler) MarshaledSegments() [][]byte
- func (u *Unmarshaler) MarshaledSegmentsByID(segmentID string) [][]byte
- func (u *Unmarshaler) SegmentByID(segmentID string) segment.Segment
- func (u *Unmarshaler) SegmentsByID(segmentID string) []segment.Segment
- func (u *Unmarshaler) Unmarshal() error
- func (u *Unmarshaler) UnmarshalSegment(segmentID string, version int) (segment.Segment, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateMessageKey ¶
GenerateMessageKey generates a random key with 16 bytes
func SignMessageHash ¶
func SignMessageHash(messageHash []byte, key *rsa.PrivateKey) ([]byte, error)
SignMessageHash signs the messageHash with key
Types ¶
type AnonymousDialogMessage ¶
type AnonymousDialogMessage struct { *BasicMessage Identification *segment.IdentificationSegment ProcessingPreparation *segment.ProcessingPreparationSegment }
AnonymousDialogMessage represents a message used by anonymous dialogs
type BankMessage ¶
type BankMessage interface { Message Acknowledgements() []domain.Acknowledgement }
BankMessage represents a message composed by the bank
func NewDecryptedMessage ¶
func NewDecryptedMessage(header *segment.MessageHeaderSegment, end *segment.MessageEndSegment, rawMessage []byte) (BankMessage, error)
NewDecryptedMessage creates a new decrypted message from rawMessage
type BasicMessage ¶
type BasicMessage struct { Header *segment.MessageHeaderSegment End *segment.MessageEndSegment SignatureBegin *segment.SignatureHeaderSegment SignatureEnd *segment.SignatureEndSegment HBCIMessage // contains filtered or unexported fields }
BasicMessage represents a basic HBCI message with all necessary components such as MessageHeader, MessageEnd, Signature and message body
func NewBasicMessage ¶
func NewBasicMessage(message HBCIMessage) *BasicMessage
NewBasicMessage creates a new BasicMessage from the HBCIMessage
func NewBasicMessageWithHeaderAndEnd ¶
func NewBasicMessageWithHeaderAndEnd(header *segment.MessageHeaderSegment, end *segment.MessageEndSegment, message HBCIMessage) *BasicMessage
NewBasicMessageWithHeaderAndEnd creates a new BasicMessage with the provided header and end and embodies message
func (*BasicMessage) Encrypt ¶
func (b *BasicMessage) Encrypt(provider CryptoProvider) (*EncryptedMessage, error)
Encrypt encrypts the message using the CryptoProvider
func (*BasicMessage) FindMarshaledSegment ¶
func (b *BasicMessage) FindMarshaledSegment(segmentID string) []byte
FindMarshaledSegment returns the first segment found for segmentID as []byte, or nil if nothing found
func (*BasicMessage) FindMarshaledSegments ¶
func (b *BasicMessage) FindMarshaledSegments(segmentID string) [][]byte
FindMarshaledSegments returns all segments found for segmentID as []byte, or nil if nothing found
func (*BasicMessage) FindSegment ¶
func (b *BasicMessage) FindSegment(segmentID string) segment.Segment
FindSegment returns the segment found for the segmentID, or nil if not found. The first matching segment will be returned.
func (*BasicMessage) FindSegments ¶
func (b *BasicMessage) FindSegments(segmentID string) []segment.Segment
FindSegments returns all segments found for the segmentID, or nil if nothing found
func (*BasicMessage) MarshalHBCI ¶
func (b *BasicMessage) MarshalHBCI() ([]byte, error)
MarshalHBCI marshals b into HBCI wire format
func (*BasicMessage) MessageEnd ¶
func (b *BasicMessage) MessageEnd() *segment.MessageEndSegment
MessageEnd returns the MessageEnd
func (*BasicMessage) MessageHeader ¶
func (b *BasicMessage) MessageHeader() *segment.MessageHeaderSegment
MessageHeader returns the MessageHeader
func (*BasicMessage) SegmentNumber ¶
func (b *BasicMessage) SegmentNumber(segmentID string) int
SegmentNumber returns the segment number for the given segmentID
func (*BasicMessage) SetMessageNumber ¶
func (b *BasicMessage) SetMessageNumber(messageNumber int)
SetMessageNumber sets the message number in the MessageHeader
func (*BasicMessage) SetNumbers ¶
func (b *BasicMessage) SetNumbers()
SetNumbers sets the message number on every segment within the message
func (*BasicMessage) SetSize ¶
func (b *BasicMessage) SetSize() error
SetSize writes the size of the marshaled message into the message header
func (*BasicMessage) Sign ¶
func (b *BasicMessage) Sign(provider SignatureProvider) (*BasicSignedMessage, error)
Sign signs b using the SignatureProvider
type BasicSignedMessage ¶
type BasicSignedMessage struct {
// contains filtered or unexported fields
}
BasicSignedMessage represents a basic message which can be signed
func NewBasicSignedMessage ¶
func NewBasicSignedMessage(message *BasicMessage) *BasicSignedMessage
NewBasicSignedMessage creates a new signed message from message
func (*BasicSignedMessage) Encrypt ¶
func (b *BasicSignedMessage) Encrypt(provider CryptoProvider) (*EncryptedMessage, error)
Encrypt encrypts the message using the CryptoProvider
func (*BasicSignedMessage) HBCISegments ¶
func (b *BasicSignedMessage) HBCISegments() []segment.ClientSegment
HBCISegments returns all segments of the message
func (*BasicSignedMessage) HBCIVersion ¶
func (b *BasicSignedMessage) HBCIVersion() segment.HBCIVersion
HBCIVersion returns the HBCI version of the message
func (*BasicSignedMessage) MarshalHBCI ¶
func (b *BasicSignedMessage) MarshalHBCI() ([]byte, error)
MarshalHBCI marshals the message into HBCI wire format
func (*BasicSignedMessage) SetNumbers ¶
func (b *BasicSignedMessage) SetNumbers()
SetNumbers sets the message numbers in all segments
func (*BasicSignedMessage) SetSignatureEnd ¶
func (b *BasicSignedMessage) SetSignatureEnd(sigEnd *segment.SignatureEndSegment)
SetSignatureEnd sets the SignatureEnd
func (*BasicSignedMessage) SetSignatureHeader ¶
func (b *BasicSignedMessage) SetSignatureHeader(sigBegin *segment.SignatureHeaderSegment)
SetSignatureHeader sets the SignatureHeader
type ClientMessage ¶
type ClientMessage interface { Message MarshalHBCI() ([]byte, error) Encrypt(provider CryptoProvider) (*EncryptedMessage, error) SetMessageNumber(messageNumber int) }
ClientMessage represents a message composed by the client
type CryptoProvider ¶
type CryptoProvider interface { SetClientSystemID(clientSystemID string) SetSecurityFunction(securityFn string) Encrypt(message []byte) ([]byte, error) Decrypt(encryptedMessage []byte) ([]byte, error) WriteEncryptionHeader(header segment.EncryptionHeader) }
CryptoProvider represents a provider to encrypt and decrypt messages
func NewPinTanCryptoProvider ¶
func NewPinTanCryptoProvider(key *domain.PinKey, clientSystemID string) CryptoProvider
NewPinTanCryptoProvider creates a new CryptoProvider for the pin key
type DialogCancellationMessage ¶
type DialogCancellationMessage struct { *BasicMessage MessageAcknowledgements *segment.MessageAcknowledgement }
DialogCancellationMessage represents a message used to cancel a dialog
func NewDialogCancellationMessage ¶
func NewDialogCancellationMessage(messageAcknowledgement *segment.MessageAcknowledgement) *DialogCancellationMessage
NewDialogCancellationMessage creates a message to cancel a dialog
type DialogFinishingMessage ¶
type DialogFinishingMessage struct { *BasicMessage DialogEnd *segment.DialogEndSegment // contains filtered or unexported fields }
DialogFinishingMessage represents a message used to finish a dialog
func NewDialogFinishingMessage ¶
func NewDialogFinishingMessage(hbciVersion segment.HBCIVersion, dialogID string) *DialogFinishingMessage
NewDialogFinishingMessage creates a message used to finish a dialog
func (*DialogFinishingMessage) HBCISegments ¶
func (d *DialogFinishingMessage) HBCISegments() []segment.ClientSegment
HBCISegments returns all segment from this message
func (*DialogFinishingMessage) HBCIVersion ¶
func (d *DialogFinishingMessage) HBCIVersion() segment.HBCIVersion
HBCIVersion returns the version used for this message
type DialogInitializationClientMessage ¶
type DialogInitializationClientMessage struct { *BasicMessage Identification *segment.IdentificationSegment ProcessingPreparation *segment.ProcessingPreparationSegment PublicSigningKeyRequest *segment.PublicKeyRequestSegment PublicEncryptionKeyRequest *segment.PublicKeyRequestSegment PublicKeyRequest *segment.PublicKeyRequestSegment // contains filtered or unexported fields }
DialogInitializationClientMessage represents a client message used to initialize a dialog
func NewDialogInitializationClientMessage ¶
func NewDialogInitializationClientMessage(hbciVersion segment.HBCIVersion) *DialogInitializationClientMessage
NewDialogInitializationClientMessage creates a basic client message used for DialogInitialization
func (*DialogInitializationClientMessage) HBCISegments ¶
func (d *DialogInitializationClientMessage) HBCISegments() []segment.ClientSegment
HBCISegments returns all segment from this message
func (*DialogInitializationClientMessage) HBCIVersion ¶
func (d *DialogInitializationClientMessage) HBCIVersion() segment.HBCIVersion
HBCIVersion returns the version used for this message
type EncryptedMessage ¶
type EncryptedMessage struct { ClientMessage EncryptionHeader segment.EncryptionHeader EncryptedData *segment.EncryptedDataSegment // contains filtered or unexported fields }
EncryptedMessage represents an encrypted message
func NewEncryptedMessage ¶
func NewEncryptedMessage(header *segment.MessageHeaderSegment, end *segment.MessageEndSegment, hbciVersion segment.HBCIVersion) *EncryptedMessage
NewEncryptedMessage creates a new encrypted message
func (*EncryptedMessage) Decrypt ¶
func (e *EncryptedMessage) Decrypt(provider CryptoProvider) (BankMessage, error)
Decrypt decrypts the message using the CryptoProvider
func (*EncryptedMessage) HBCISegments ¶
func (e *EncryptedMessage) HBCISegments() []segment.ClientSegment
HBCISegments returns all segments within the message
func (*EncryptedMessage) HBCIVersion ¶
func (e *EncryptedMessage) HBCIVersion() segment.HBCIVersion
HBCIVersion returns the HBCIVersion of this message
type HBCIMessage ¶
type HBCIMessage interface { HBCIVersion() segment.HBCIVersion HBCISegments() []segment.ClientSegment }
HBCIMessage represents a basic set of message for introspecting HBCI messages
func NewHBCIMessage ¶
func NewHBCIMessage(hbciVersion segment.HBCIVersion, segments ...segment.ClientSegment) HBCIMessage
NewHBCIMessage creates a new hbci message for the given version and adds the segments as message body
type Message ¶
type Message interface { MessageHeader() *segment.MessageHeaderSegment MessageEnd() *segment.MessageEndSegment FindMarshaledSegment(segmentID string) []byte FindMarshaledSegments(segmentID string) [][]byte FindSegment(segmentID string) segment.Segment FindSegments(segmentID string) []segment.Segment SegmentNumber(segmentID string) int }
Message represents a basic message
type SignatureProvider ¶
type SignatureProvider interface { SetSecurityFunction(securityFn string) SetClientSystemID(clientSystemID string) Sign(message []byte) ([]byte, error) WriteSignatureHeader(segment.SignatureHeader) WriteSignature(end segment.SignatureEnd, signature []byte) }
A SignatureProvider represents a provider to sign a message
func NewPinTanSignatureProvider ¶
func NewPinTanSignatureProvider(key *domain.PinKey, clientSystemID string) SignatureProvider
NewPinTanSignatureProvider creates a SignatureProvider for the pin key
func NewRDHSignatureProvider ¶
func NewRDHSignatureProvider(signingKey *domain.RSAKey, signatureID int) SignatureProvider
NewRDHSignatureProvider creates a new SignatureProvider for the given signingKey
type SignedHBCIMessage ¶
type SignedHBCIMessage interface { HBCIMessage SetNumbers() SetSignatureHeader(*segment.SignatureHeaderSegment) SetSignatureEnd(*segment.SignatureEndSegment) }
A SignedHBCIMessage represents a HBCI message that can be signed
type SynchronisationMessage ¶
type SynchronisationMessage struct { *BasicMessage Identification *segment.IdentificationSegment ProcessingPreparation *segment.ProcessingPreparationSegment PublicSigningKeyRequest *segment.PublicKeyRequestSegment PublicEncryptionKeyRequest *segment.PublicKeyRequestSegment PublicKeyRequest *segment.PublicKeyRequestSegment Sync *segment.SynchronisationRequestSegment // contains filtered or unexported fields }
SynchronisationMessage serves the purpose of syncing the client and the server
func NewSynchronisationMessage ¶
func NewSynchronisationMessage(hbciVersion segment.HBCIVersion) *SynchronisationMessage
NewSynchronisationMessage creates a new Message for Synchronizing client and server
func (*SynchronisationMessage) HBCISegments ¶
func (s *SynchronisationMessage) HBCISegments() []segment.ClientSegment
HBCISegments returns all segments of the message
func (*SynchronisationMessage) HBCIVersion ¶
func (s *SynchronisationMessage) HBCIVersion() segment.HBCIVersion
HBCIVersion returns the HBCI version of the message
type Unmarshaler ¶
type Unmarshaler struct {
// contains filtered or unexported fields
}
Unmarshaler unmarshals a complete message
func NewUnmarshaler ¶
func NewUnmarshaler(message []byte) *Unmarshaler
NewUnmarshaler returns a new Unmarshaler for the message
func (*Unmarshaler) CanUnmarshal ¶
func (u *Unmarshaler) CanUnmarshal(segmentID string, version int) bool
CanUnmarshal returns true if the segment with the ID and version can be unmarshaled, false otherwise
func (*Unmarshaler) MarshaledSegmentByID ¶
func (u *Unmarshaler) MarshaledSegmentByID(segmentID string) []byte
MarshaledSegmentByID returns the first segment for the given ID as array of bytes
func (*Unmarshaler) MarshaledSegments ¶
func (u *Unmarshaler) MarshaledSegments() [][]byte
MarshaledSegments return all marshaled segments as array of bytes
func (*Unmarshaler) MarshaledSegmentsByID ¶
func (u *Unmarshaler) MarshaledSegmentsByID(segmentID string) [][]byte
MarshaledSegmentsByID returns all segments for a given ID as array of bytes
func (*Unmarshaler) SegmentByID ¶
func (u *Unmarshaler) SegmentByID(segmentID string) segment.Segment
SegmentByID returns the first segment found for ID
func (*Unmarshaler) SegmentsByID ¶
func (u *Unmarshaler) SegmentsByID(segmentID string) []segment.Segment
SegmentsByID returns all already unmarshaled segments for the given ID
func (*Unmarshaler) Unmarshal ¶
func (u *Unmarshaler) Unmarshal() error
Unmarshal unmarshals the raw message
func (*Unmarshaler) UnmarshalSegment ¶
UnmarshalSegment unmarshals the segment with the given ID and version