func (b *BasicMessage) Sign(provider SignatureProvider) (*BasicSignedMessage, error) {
	if b.HBCIMessage == nil {
		panic(fmt.Errorf("HBCIMessage must be set"))
	}
	// TODO: fix only PinTan segments!!!
	b.SignatureBegin = b.hbciVersion.SignatureHeader()
	provider.WriteSignatureHeader(b.SignatureBegin)
	b.SignatureEnd = b.hbciVersion.SignatureEnd()
	b.SetNumbers()
	var buffer bytes.Buffer
	buffer.WriteString(b.SignatureBegin.String())
	for _, segment := range b.HBCIMessage.HBCISegments() {
		if !reflect.ValueOf(segment).IsNil() {
			buffer.WriteString(segment.String())
		}
	}
	sig, err := provider.Sign(buffer.Bytes())
	if err != nil {
		return nil, err
	}
	provider.WriteSignature(b.SignatureEnd, sig)
	signedMessage := NewBasicSignedMessage(b)
	return signedMessage, nil
}
// Sign signs b using the SignatureProvider
Sign signs b using the SignatureProvider
// Sign signs b using the SignatureProvider
func (b *BasicMessage) Sign(provider SignatureProvider) (*BasicSignedMessage, error) {
	if b.HBCIMessage == nil {
		panic(fmt.Errorf("HBCIMessage must be set"))
	}
	b.SignatureBegin = b.hbciVersion.SignatureHeader()
	provider.WriteSignatureHeader(b.SignatureBegin)
	b.SignatureEnd = b.hbciVersion.SignatureEnd()
	b.SetNumbers()
	var buffer bytes.Buffer
	buffer.WriteString(b.SignatureBegin.String())
	for _, segment := range b.HBCIMessage.HBCISegments() {
		if !reflect.ValueOf(segment).IsNil() {
			buffer.WriteString(segment.String())
		}
	}
	sig, err := provider.Sign(buffer.Bytes())
	if err != nil {
		return nil, err
	}
	provider.WriteSignature(b.SignatureEnd, sig)
	signedMessage := NewBasicSignedMessage(b)
	return signedMessage, nil
}
func ( b * BasicMessage ) Sign ( provider SignatureProvider ) ( * BasicSignedMessage , error ) { if b . HBCIMessage == nil { panic ( fmt . Errorf ( " " ) ) } b . SignatureBegin = b . hbciVersion . SignatureHeader ( ) provider . WriteSignatureHeader ( b . SignatureBegin ) b . SignatureEnd = b . hbciVersion . SignatureEnd ( ) b . SetNumbers ( ) var buffer bytes . Buffer buffer . WriteString ( b . SignatureBegin . String ( ) ) for _ , segment := range b . HBCIMessage . HBCISegments ( ) { if ! reflect . ValueOf ( segment ) . IsNil ( ) { buffer . WriteString ( segment . String ( ) ) } } sig , err := provider . Sign ( buffer . Bytes ( ) ) if err != nil { return nil , err } provider . WriteSignature ( b . SignatureEnd , sig ) signedMessage := NewBasicSignedMessage ( b ) return signedMessage , nil }
Sign signs b using the SignatureProvider
Sign signs b using the SignatureProvider
// TODO: fix only PinTan segments!!!