Documentation ¶
Overview ¶
Package secure encrypting/decrypting the message body.
Copyright 2018 HenryLee. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Package secure is a generated protocol buffer package. It is generated from these files: secure.proto It has these top-level messages: Encrypt
Index ¶
- Constants
- Variables
- func EnforceSecure(output tp.Message)
- func NewPlugin(rerrCode int32, cipherkey string) tp.Plugin
- func WithAcceptSecureMeta(accept bool) tp.MessageSetting
- func WithSecureMeta() tp.MessageSetting
- type Encrypt
- func (*Encrypt) Descriptor() ([]byte, []int)
- func (m *Encrypt) GetCiphertext() string
- func (m *Encrypt) GetCipherversion() string
- func (m *Encrypt) Marshal() (dAtA []byte, err error)
- func (m *Encrypt) MarshalTo(dAtA []byte) (int, error)
- func (*Encrypt) ProtoMessage()
- func (m *Encrypt) Reset()
- func (m *Encrypt) Size() (n int)
- func (m *Encrypt) String() string
- func (m *Encrypt) Unmarshal(dAtA []byte) error
Constants ¶
const ( // SECURE_META_KEY if the metadata is true, perform encryption operation to the body. SECURE_META_KEY = "X-Secure" // value: true/false // ACCEPT_SECURE_META_KEY if the metadata is true, perform encryption operation to the body. ACCEPT_SECURE_META_KEY = "X-Accept-Secure" // value: true/false )
const ( // CIPHERVERSION_KEY cipherkey version CIPHERVERSION_KEY = "cipherversion" // CIPHERTEXT_KEY ciphertext content CIPHERTEXT_KEY = "ciphertext" )
Variables ¶
var ( ErrInvalidLengthSecure = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowSecure = fmt.Errorf("proto: integer overflow") )
Functions ¶
func EnforceSecure ¶
EnforceSecure enforces the body of the encrypted reply message. Note: requires that the secure plugin has been registered!
func NewPlugin ¶
NewPlugin creates a AES encryption/decryption plugin. The cipherkey argument should be the AES key, either 16, 24, or 32 bytes to select AES-128, AES-192, or AES-256.
func WithAcceptSecureMeta ¶
func WithAcceptSecureMeta(accept bool) tp.MessageSetting
WithAcceptSecureMeta requires the peer to encrypt the replying body. Note: requires that the secure plugin has been registered!
func WithSecureMeta ¶
func WithSecureMeta() tp.MessageSetting
WithSecureMeta encrypts the body of the current message. Note: requires that the secure plugin has been registered!
Types ¶
type Encrypt ¶
type Encrypt struct { Cipherversion string `protobuf:"bytes,1,opt,name=cipherversion,proto3" json:"cipherversion,omitempty"` Ciphertext string `protobuf:"bytes,2,opt,name=ciphertext,proto3" json:"ciphertext,omitempty"` }
func (*Encrypt) Descriptor ¶
func (*Encrypt) GetCiphertext ¶
func (*Encrypt) GetCipherversion ¶
func (*Encrypt) ProtoMessage ¶
func (*Encrypt) ProtoMessage()