Documentation ¶
Overview ¶
Package secure encrypting/decrypting the message body.
Copyright 2018-2023 HenryLee. All Rights Reserved. Copyright 2024 sqos. 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.
Index ¶
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 File_secure_proto protoreflect.FileDescriptor
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) yrpc.MessageSetting
WithAcceptSecureMeta requires the peer to encrypt the replying body. Note: requires that the secure plugin has been registered!
func WithSecureMeta ¶
func WithSecureMeta() yrpc.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"` // contains filtered or unexported fields }
func (*Encrypt) Descriptor
deprecated
func (*Encrypt) GetCiphertext ¶
func (*Encrypt) GetCipherversion ¶
func (*Encrypt) ProtoMessage ¶
func (*Encrypt) ProtoMessage()
func (*Encrypt) ProtoReflect ¶
func (x *Encrypt) ProtoReflect() protoreflect.Message