diff --git a/proto/pki/tx.proto b/proto/pki/tx.proto index c5aee66bf..3d6a9fff3 100644 --- a/proto/pki/tx.proto +++ b/proto/pki/tx.proto @@ -21,6 +21,7 @@ service Msg { rpc UpdatePkiRevocationDistributionPoint(MsgUpdatePkiRevocationDistributionPoint) returns (MsgUpdatePkiRevocationDistributionPointResponse); rpc DeletePkiRevocationDistributionPoint(MsgDeletePkiRevocationDistributionPoint) returns (MsgDeletePkiRevocationDistributionPointResponse); rpc AssignVid(MsgAssignVid) returns (MsgAssignVidResponse); + rpc RemoveX509Cert(MsgRemoveX509Cert) returns (MsgRemoveX509CertResponse); // this line is used by starport scaffolding # proto/tx/rpc } @@ -156,4 +157,14 @@ message MsgAssignVid { message MsgAssignVidResponse { } +message MsgRemoveX509Cert { + string signer = 1 [(cosmos_proto.scalar) = "cosmos.AddressString", (gogoproto.moretags) = "validate:\"required\""]; + string subject = 2 [(gogoproto.moretags) = "validate:\"required,max=1024\""]; + string subjectKeyId = 3 [(gogoproto.moretags) = "validate:\"required,max=256\""]; + string serialNumber = 4; +} + +message MsgRemoveX509CertResponse { +} + // this line is used by starport scaffolding # proto/tx/message \ No newline at end of file diff --git a/scripts/starport/upgrade-0.44/07.pki_types.sh b/scripts/starport/upgrade-0.44/07.pki_types.sh index ec35186e7..5ffa69f30 100755 --- a/scripts/starport/upgrade-0.44/07.pki_types.sh +++ b/scripts/starport/upgrade-0.44/07.pki_types.sh @@ -12,6 +12,7 @@ starport scaffold --module pki message AddX509Cert cert --signer signer starport scaffold --module pki message ProposeRevokeX509RootCert subject subjectKeyId --signer signer starport scaffold --module pki message ApproveRevokeX509RootCert subject subjectKeyId --signer signer starport scaffold --module pki message RevokeX509Cert subject subjectKeyId --signer signer +starport scaffold --module pki message RemoveX509Cert subject subjectKeyId serialNumber --signer signer starport scaffold --module pki message RejectAddX509RootCert cert --signer signer starport scaffold --module pki message add-pki-revocation-distribution-point vid:uint pid:uint isPAA:bool label crlSignerCertificate issuerSubjectKeyID dataURL dataFileSize:uint dataDigest dataDigestType:uint revocationType:uint --signer signer starport scaffold --module pki message update-pki-revocation-distribution-point vid:uint label crlSignerCertificate issuerSubjectKeyID dataURL dataFileSize:uint dataDigest dataDigestType:uint --signer signer diff --git a/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/index.ts b/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/index.ts index e5867ac96..f95d14131 100755 --- a/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/index.ts +++ b/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/index.ts @@ -15,6 +15,7 @@ import { MsgAddPkiRevocationDistributionPoint } from "./types/pki/tx"; import { MsgAddX509Cert } from "./types/pki/tx"; import { MsgApproveRevokeX509RootCert } from "./types/pki/tx"; import { MsgProposeRevokeX509RootCert } from "./types/pki/tx"; +import { MsgRemoveX509Cert } from "./types/pki/tx"; const types = [ @@ -29,7 +30,7 @@ const types = [ ["/zigbeealliance.distributedcomplianceledger.pki.MsgAddX509Cert", MsgAddX509Cert], ["/zigbeealliance.distributedcomplianceledger.pki.MsgApproveRevokeX509RootCert", MsgApproveRevokeX509RootCert], ["/zigbeealliance.distributedcomplianceledger.pki.MsgProposeRevokeX509RootCert", MsgProposeRevokeX509RootCert], - + ["/zigbeealliance.distributedcomplianceledger.pki.MsgRemoveX509Cert", MsgRemoveX509Cert], ]; export const MissingWalletError = new Error("wallet is required"); @@ -72,7 +73,7 @@ const txClient = async (wallet: OfflineSigner, { addr: addr }: TxClientOptions = msgAddX509Cert: (data: MsgAddX509Cert): EncodeObject => ({ typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgAddX509Cert", value: MsgAddX509Cert.fromPartial( data ) }), msgApproveRevokeX509RootCert: (data: MsgApproveRevokeX509RootCert): EncodeObject => ({ typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgApproveRevokeX509RootCert", value: MsgApproveRevokeX509RootCert.fromPartial( data ) }), msgProposeRevokeX509RootCert: (data: MsgProposeRevokeX509RootCert): EncodeObject => ({ typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgProposeRevokeX509RootCert", value: MsgProposeRevokeX509RootCert.fromPartial( data ) }), - + msgRemoveX509Cert: (data: MsgRemoveX509Cert): EncodeObject => ({ typeUrl: "/zigbeealliance.distributedcomplianceledger.pki.MsgRemoveX509Cert", value: MsgRemoveX509Cert.fromPartial( data ) }), }; }; diff --git a/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/rest.ts b/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/rest.ts index 25ce651e6..d83700f44 100644 --- a/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/rest.ts +++ b/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/rest.ts @@ -94,6 +94,8 @@ export type PkiMsgProposeRevokeX509RootCertResponse = object; export type PkiMsgRejectAddX509RootCertResponse = object; +export type PkiMsgRemoveX509CertResponse = object; + export type PkiMsgRevokeX509CertResponse = object; export type PkiMsgUpdatePkiRevocationDistributionPointResponse = object; diff --git a/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/types/pki/tx.ts b/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/types/pki/tx.ts index b0834fbbb..297bf780a 100644 --- a/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/types/pki/tx.ts +++ b/vue/src/store/generated/zigbee-alliance/distributed-compliance-ledger/zigbeealliance.distributedcomplianceledger.pki/module/types/pki/tx.ts @@ -125,6 +125,15 @@ export interface MsgAssignVid { export interface MsgAssignVidResponse {} +export interface MsgRemoveX509Cert { + signer: string + subject: string + subjectKeyId: string + serialNumber: string +} + +export interface MsgRemoveX509CertResponse {} + const baseMsgProposeAddX509RootCert: object = { signer: '', cert: '', info: '', time: 0, vid: 0 } export const MsgProposeAddX509RootCert = { @@ -2106,6 +2115,150 @@ export const MsgAssignVidResponse = { } } +const baseMsgRemoveX509Cert: object = { signer: '', subject: '', subjectKeyId: '', serialNumber: '' } + +export const MsgRemoveX509Cert = { + encode(message: MsgRemoveX509Cert, writer: Writer = Writer.create()): Writer { + if (message.signer !== '') { + writer.uint32(10).string(message.signer) + } + if (message.subject !== '') { + writer.uint32(18).string(message.subject) + } + if (message.subjectKeyId !== '') { + writer.uint32(26).string(message.subjectKeyId) + } + if (message.serialNumber !== '') { + writer.uint32(34).string(message.serialNumber) + } + return writer + }, + + decode(input: Reader | Uint8Array, length?: number): MsgRemoveX509Cert { + const reader = input instanceof Uint8Array ? new Reader(input) : input + let end = length === undefined ? reader.len : reader.pos + length + const message = { ...baseMsgRemoveX509Cert } as MsgRemoveX509Cert + while (reader.pos < end) { + const tag = reader.uint32() + switch (tag >>> 3) { + case 1: + message.signer = reader.string() + break + case 2: + message.subject = reader.string() + break + case 3: + message.subjectKeyId = reader.string() + break + case 4: + message.serialNumber = reader.string() + break + default: + reader.skipType(tag & 7) + break + } + } + return message + }, + + fromJSON(object: any): MsgRemoveX509Cert { + const message = { ...baseMsgRemoveX509Cert } as MsgRemoveX509Cert + if (object.signer !== undefined && object.signer !== null) { + message.signer = String(object.signer) + } else { + message.signer = '' + } + if (object.subject !== undefined && object.subject !== null) { + message.subject = String(object.subject) + } else { + message.subject = '' + } + if (object.subjectKeyId !== undefined && object.subjectKeyId !== null) { + message.subjectKeyId = String(object.subjectKeyId) + } else { + message.subjectKeyId = '' + } + if (object.serialNumber !== undefined && object.serialNumber !== null) { + message.serialNumber = String(object.serialNumber) + } else { + message.serialNumber = '' + } + return message + }, + + toJSON(message: MsgRemoveX509Cert): unknown { + const obj: any = {} + message.signer !== undefined && (obj.signer = message.signer) + message.subject !== undefined && (obj.subject = message.subject) + message.subjectKeyId !== undefined && (obj.subjectKeyId = message.subjectKeyId) + message.serialNumber !== undefined && (obj.serialNumber = message.serialNumber) + return obj + }, + + fromPartial(object: DeepPartial): MsgRemoveX509Cert { + const message = { ...baseMsgRemoveX509Cert } as MsgRemoveX509Cert + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer + } else { + message.signer = '' + } + if (object.subject !== undefined && object.subject !== null) { + message.subject = object.subject + } else { + message.subject = '' + } + if (object.subjectKeyId !== undefined && object.subjectKeyId !== null) { + message.subjectKeyId = object.subjectKeyId + } else { + message.subjectKeyId = '' + } + if (object.serialNumber !== undefined && object.serialNumber !== null) { + message.serialNumber = object.serialNumber + } else { + message.serialNumber = '' + } + return message + } +} + +const baseMsgRemoveX509CertResponse: object = {} + +export const MsgRemoveX509CertResponse = { + encode(_: MsgRemoveX509CertResponse, writer: Writer = Writer.create()): Writer { + return writer + }, + + decode(input: Reader | Uint8Array, length?: number): MsgRemoveX509CertResponse { + const reader = input instanceof Uint8Array ? new Reader(input) : input + let end = length === undefined ? reader.len : reader.pos + length + const message = { ...baseMsgRemoveX509CertResponse } as MsgRemoveX509CertResponse + while (reader.pos < end) { + const tag = reader.uint32() + switch (tag >>> 3) { + default: + reader.skipType(tag & 7) + break + } + } + return message + }, + + fromJSON(_: any): MsgRemoveX509CertResponse { + const message = { ...baseMsgRemoveX509CertResponse } as MsgRemoveX509CertResponse + return message + }, + + toJSON(_: MsgRemoveX509CertResponse): unknown { + const obj: any = {} + return obj + }, + + fromPartial(_: DeepPartial): MsgRemoveX509CertResponse { + const message = { ...baseMsgRemoveX509CertResponse } as MsgRemoveX509CertResponse + return message + } +} + /** Msg defines the Msg service. */ export interface Msg { ProposeAddX509RootCert(request: MsgProposeAddX509RootCert): Promise @@ -2118,8 +2271,8 @@ export interface Msg { AddPkiRevocationDistributionPoint(request: MsgAddPkiRevocationDistributionPoint): Promise UpdatePkiRevocationDistributionPoint(request: MsgUpdatePkiRevocationDistributionPoint): Promise DeletePkiRevocationDistributionPoint(request: MsgDeletePkiRevocationDistributionPoint): Promise - /** this line is used by starport scaffolding # proto/tx/rpc */ AssignVid(request: MsgAssignVid): Promise + RemoveX509Cert(request: MsgRemoveX509Cert): Promise } export class MsgClientImpl implements Msg { @@ -2192,6 +2345,12 @@ export class MsgClientImpl implements Msg { const promise = this.rpc.request('zigbeealliance.distributedcomplianceledger.pki.Msg', 'AssignVid', data) return promise.then((data) => MsgAssignVidResponse.decode(new Reader(data))) } + + RemoveX509Cert(request: MsgRemoveX509Cert): Promise { + const data = MsgRemoveX509Cert.encode(request).finish() + const promise = this.rpc.request('zigbeealliance.distributedcomplianceledger.pki.Msg', 'RemoveX509Cert', data) + return promise.then((data) => MsgRemoveX509CertResponse.decode(new Reader(data))) + } } interface Rpc { diff --git a/x/pki/client/cli/tx.go b/x/pki/client/cli/tx.go index 56803106e..63ef89023 100644 --- a/x/pki/client/cli/tx.go +++ b/x/pki/client/cli/tx.go @@ -33,6 +33,7 @@ func GetTxCmd() *cobra.Command { cmd.AddCommand(CmdUpdatePkiRevocationDistributionPoint()) cmd.AddCommand(CmdDeletePkiRevocationDistributionPoint()) cmd.AddCommand(CmdAssignVid()) + cmd.AddCommand(CmdRemoveX509Cert()) // this line is used by starport scaffolding # 1 return cmd diff --git a/x/pki/client/cli/tx_remove_x_509_cert.go b/x/pki/client/cli/tx_remove_x_509_cert.go new file mode 100644 index 000000000..3759424f9 --- /dev/null +++ b/x/pki/client/cli/tx_remove_x_509_cert.go @@ -0,0 +1,46 @@ +package cli + +import ( + "strconv" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/spf13/cobra" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" +) + +var _ = strconv.Itoa(0) + +func CmdRemoveX509Cert() *cobra.Command { + cmd := &cobra.Command{ + Use: "remove-x-509-cert [subject] [subject-key-id] [serial-number]", + Short: "Broadcast message RemoveX509Cert", + Args: cobra.ExactArgs(3), + RunE: func(cmd *cobra.Command, args []string) (err error) { + argSubject := args[0] + argSubjectKeyId := args[1] + argSerialNumber := args[2] + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + msg := types.NewMsgRemoveX509Cert( + clientCtx.GetFromAddress().String(), + argSubject, + argSubjectKeyId, + argSerialNumber, + ) + if err := msg.ValidateBasic(); err != nil { + return err + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/pki/handler.go b/x/pki/handler.go index 7ef7098b5..68db083bc 100644 --- a/x/pki/handler.go +++ b/x/pki/handler.go @@ -63,6 +63,9 @@ func NewHandler(k keeper.Keeper) sdk.Handler { res, err := msgServer.AssignVid(sdk.WrapSDKContext(ctx), msg) return sdk.WrapServiceResult(ctx, res, err) + case *types.MsgRemoveX509Cert: + res, err := msgServer.RemoveX509Cert(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) // this line is used by starport scaffolding # 1 default: errMsg := fmt.Sprintf("unrecognized %s message type: %T", pkitypes.ModuleName, msg) diff --git a/x/pki/keeper/msg_server_remove_x_509_cert.go b/x/pki/keeper/msg_server_remove_x_509_cert.go new file mode 100644 index 000000000..4afa3342a --- /dev/null +++ b/x/pki/keeper/msg_server_remove_x_509_cert.go @@ -0,0 +1,37 @@ +package keeper + +import ( + "context" + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + pkitypes "github.com/zigbee-alliance/distributed-compliance-ledger/types/pki" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" +) + +func (k msgServer) RemoveX509Cert(goCtx context.Context, msg *types.MsgRemoveX509Cert) (*types.MsgRemoveX509CertResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + certificates, found := k.GetApprovedCertificates(ctx, msg.Subject, msg.SubjectKeyId) + if !found { + return nil, pkitypes.NewErrCertificateDoesNotExist(msg.Subject, msg.SubjectKeyId) + } + + if certificates.Certs[0].IsRoot { + return nil, pkitypes.NewErrInappropriateCertificateType( + fmt.Sprintf("Inappropriate Certificate Type: Certificate with subject=%v and subjectKeyID=%v "+ + "is a root certificate. To propose revocation of a root certificate please use "+ + "`PROPOSE_REVOKE_X509_ROOT_CERT` transaction.", msg.Subject, msg.SubjectKeyId), + ) + } + + if msg.Signer != certificates.Certs[0].Owner { + return nil, sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, + "Only owner can revoke certificate using `REVOKE_X509_CERT`", + ) + } + + return &types.MsgRemoveX509CertResponse{}, nil +} diff --git a/x/pki/module_simulation.go b/x/pki/module_simulation.go index 3576b6232..7b1ec67a0 100644 --- a/x/pki/module_simulation.go +++ b/x/pki/module_simulation.go @@ -69,6 +69,10 @@ const ( // TODO: Determine the simulation weight value. defaultWeightMsgAssignVid int = 100 + opWeightMsgRemoveX509Cert = "op_weight_msg_create_chain" + // TODO: Determine the simulation weight value + defaultWeightMsgRemoveX509Cert int = 100 + // this line is used by starport scaffolding # simapp/module/const. ) @@ -223,6 +227,17 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp pkisimulation.SimulateMsgAssignVid(am.keeper), )) + var weightMsgRemoveX509Cert int + simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgRemoveX509Cert, &weightMsgRemoveX509Cert, nil, + func(_ *rand.Rand) { + weightMsgRemoveX509Cert = defaultWeightMsgRemoveX509Cert + }, + ) + operations = append(operations, simulation.NewWeightedOperation( + weightMsgRemoveX509Cert, + pkisimulation.SimulateMsgRemoveX509Cert(am.keeper), + )) + // this line is used by starport scaffolding # simapp/module/operation return operations diff --git a/x/pki/simulation/remove_x_509_cert.go b/x/pki/simulation/remove_x_509_cert.go new file mode 100644 index 000000000..c55f70c2c --- /dev/null +++ b/x/pki/simulation/remove_x_509_cert.go @@ -0,0 +1,29 @@ +package simulation + +import ( + "math/rand" + + "github.com/cosmos/cosmos-sdk/baseapp" + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + + pkitypes "github.com/zigbee-alliance/distributed-compliance-ledger/types/pki" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/keeper" + "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types" +) + +func SimulateMsgRemoveX509Cert( + k keeper.Keeper, +) simtypes.Operation { + return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, + ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { + simAccount, _ := simtypes.RandomAcc(r, accs) + msg := &types.MsgRemoveX509Cert{ + Signer: simAccount.Address.String(), + } + + // TODO: Handling the RemoveX509Cert simulation + + return simtypes.NoOpMsg(pkitypes.ModuleName, msg.Type(), "RemoveX509Cert simulation not implemented"), nil, nil + } +} diff --git a/x/pki/types/codec.go b/x/pki/types/codec.go index a91b5d20e..8c1e23a66 100644 --- a/x/pki/types/codec.go +++ b/x/pki/types/codec.go @@ -19,6 +19,7 @@ func RegisterCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgUpdatePkiRevocationDistributionPoint{}, "pki/UpdatePkiRevocationDistributionPoint", nil) cdc.RegisterConcrete(&MsgDeletePkiRevocationDistributionPoint{}, "pki/DeletePkiRevocationDistributionPoint", nil) cdc.RegisterConcrete(&MsgAssignVid{}, "pki/AssignVid", nil) + cdc.RegisterConcrete(&MsgRemoveX509Cert{}, "pki/RemoveX509Cert", nil) // this line is used by starport scaffolding # 2 } @@ -56,6 +57,9 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), &MsgAssignVid{}, ) + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgRemoveX509Cert{}, + ) // this line is used by starport scaffolding # 3 msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) diff --git a/x/pki/types/message_remove_x_509_cert.go b/x/pki/types/message_remove_x_509_cert.go new file mode 100644 index 000000000..878b2937f --- /dev/null +++ b/x/pki/types/message_remove_x_509_cert.go @@ -0,0 +1,57 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + pkitypes "github.com/zigbee-alliance/distributed-compliance-ledger/types/pki" + "github.com/zigbee-alliance/distributed-compliance-ledger/utils/validator" +) + +const TypeMsgRemoveX509Cert = "remove_x_509_cert" + +var _ sdk.Msg = &MsgRemoveX509Cert{} + +func NewMsgRemoveX509Cert(signer string, subject string, subjectKeyId string, serialNumber string) *MsgRemoveX509Cert { + return &MsgRemoveX509Cert{ + Signer: signer, + Subject: subject, + SubjectKeyId: subjectKeyId, + SerialNumber: serialNumber, + } +} + +func (msg *MsgRemoveX509Cert) Route() string { + return pkitypes.RouterKey +} + +func (msg *MsgRemoveX509Cert) Type() string { + return TypeMsgRemoveX509Cert +} + +func (msg *MsgRemoveX509Cert) GetSigners() []sdk.AccAddress { + signer, err := sdk.AccAddressFromBech32(msg.Signer) + if err != nil { + panic(err) + } + return []sdk.AccAddress{signer} +} + +func (msg *MsgRemoveX509Cert) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + + return sdk.MustSortJSON(bz) +} + +func (msg *MsgRemoveX509Cert) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.Signer) + if err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid signer address (%s)", err) + } + + err = validator.Validate(msg) + if err != nil { + return err + } + + return nil +} diff --git a/x/pki/types/message_remove_x_509_cert_test.go b/x/pki/types/message_remove_x_509_cert_test.go new file mode 100644 index 000000000..8b3fc65fd --- /dev/null +++ b/x/pki/types/message_remove_x_509_cert_test.go @@ -0,0 +1,105 @@ +package types + +import ( + "testing" + + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/stretchr/testify/require" + tmrand "github.com/tendermint/tendermint/libs/rand" + + testconstants "github.com/zigbee-alliance/distributed-compliance-ledger/integration_tests/constants" + "github.com/zigbee-alliance/distributed-compliance-ledger/testutil/sample" + "github.com/zigbee-alliance/distributed-compliance-ledger/utils/validator" +) + +func TestMsgRemoveX509Cert_ValidateBasic(t *testing.T) { + negativeTests := []struct { + name string + msg MsgRemoveX509Cert + err error + }{ + { + name: "invalid address", + msg: MsgRemoveX509Cert{ + Signer: "invalid_address", + Subject: testconstants.RootSubject, + SubjectKeyId: testconstants.RootSubjectKeyID, + }, + err: sdkerrors.ErrInvalidAddress, + }, + { + name: "empty subject", + msg: MsgRemoveX509Cert{ + Signer: sample.AccAddress(), + Subject: "", + SubjectKeyId: testconstants.RootSubjectKeyID, + }, + err: validator.ErrRequiredFieldMissing, + }, + { + name: "empty SubjectKeyId", + msg: MsgRemoveX509Cert{ + Signer: sample.AccAddress(), + Subject: testconstants.RootSubject, + SubjectKeyId: "", + }, + err: validator.ErrRequiredFieldMissing, + }, + { + name: "subject len > 1024 (1 KB)", + msg: MsgRemoveX509Cert{ + Signer: sample.AccAddress(), + Subject: testconstants.RootSubject + tmrand.Str(1025-len(testconstants.RootSubject)), + SubjectKeyId: testconstants.RootSubjectKeyID, + }, + err: validator.ErrFieldMaxLengthExceeded, + }, + { + name: "subject key id len > 256", + msg: MsgRemoveX509Cert{ + Signer: sample.AccAddress(), + Subject: testconstants.RootSubject, + SubjectKeyId: testconstants.RootSubjectKeyID + tmrand.Str(257-len(testconstants.RootSubjectKeyID)), + }, + err: validator.ErrFieldMaxLengthExceeded, + }, + } + + positiveTests := []struct { + name string + msg MsgRemoveX509Cert + }{ + { + name: "valid remove x509cert msg", + msg: MsgRemoveX509Cert{ + Signer: sample.AccAddress(), + Subject: testconstants.RootSubject, + SubjectKeyId: testconstants.RootSubjectKeyID, + }, + }, + { + name: "valid remove x509cert msg with serial number", + msg: MsgRemoveX509Cert{ + Signer: sample.AccAddress(), + Subject: testconstants.RootSubject, + SubjectKeyId: testconstants.RootSubjectKeyID, + SerialNumber: testconstants.RootSerialNumber, + }, + }, + } + + for _, tt := range negativeTests { + t.Run(tt.name, func(t *testing.T) { + err := tt.msg.ValidateBasic() + require.Error(t, err) + require.ErrorIs(t, err, tt.err) + }) + } + + for _, tt := range positiveTests { + t.Run(tt.name, func(t *testing.T) { + err := tt.msg.ValidateBasic() + require.NoError(t, err) + }) + } +} diff --git a/x/pki/types/tx.pb.go b/x/pki/types/tx.pb.go index 4812fdb4a..50f5af7d9 100644 --- a/x/pki/types/tx.pb.go +++ b/x/pki/types/tx.pb.go @@ -1365,6 +1365,110 @@ func (m *MsgAssignVidResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgAssignVidResponse proto.InternalMessageInfo +type MsgRemoveX509Cert struct { + Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty" validate:"required"` + Subject string `protobuf:"bytes,2,opt,name=subject,proto3" json:"subject,omitempty" validate:"required,max=1024"` + SubjectKeyId string `protobuf:"bytes,3,opt,name=subjectKeyId,proto3" json:"subjectKeyId,omitempty" validate:"required,max=256"` + SerialNumber string `protobuf:"bytes,4,opt,name=serialNumber,proto3" json:"serialNumber,omitempty"` +} + +func (m *MsgRemoveX509Cert) Reset() { *m = MsgRemoveX509Cert{} } +func (m *MsgRemoveX509Cert) String() string { return proto.CompactTextString(m) } +func (*MsgRemoveX509Cert) ProtoMessage() {} +func (*MsgRemoveX509Cert) Descriptor() ([]byte, []int) { + return fileDescriptor_badfdb2b39855d16, []int{22} +} +func (m *MsgRemoveX509Cert) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRemoveX509Cert) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRemoveX509Cert.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgRemoveX509Cert) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRemoveX509Cert.Merge(m, src) +} +func (m *MsgRemoveX509Cert) XXX_Size() int { + return m.Size() +} +func (m *MsgRemoveX509Cert) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRemoveX509Cert.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRemoveX509Cert proto.InternalMessageInfo + +func (m *MsgRemoveX509Cert) GetSigner() string { + if m != nil { + return m.Signer + } + return "" +} + +func (m *MsgRemoveX509Cert) GetSubject() string { + if m != nil { + return m.Subject + } + return "" +} + +func (m *MsgRemoveX509Cert) GetSubjectKeyId() string { + if m != nil { + return m.SubjectKeyId + } + return "" +} + +func (m *MsgRemoveX509Cert) GetSerialNumber() string { + if m != nil { + return m.SerialNumber + } + return "" +} + +type MsgRemoveX509CertResponse struct { +} + +func (m *MsgRemoveX509CertResponse) Reset() { *m = MsgRemoveX509CertResponse{} } +func (m *MsgRemoveX509CertResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRemoveX509CertResponse) ProtoMessage() {} +func (*MsgRemoveX509CertResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_badfdb2b39855d16, []int{23} +} +func (m *MsgRemoveX509CertResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRemoveX509CertResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRemoveX509CertResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgRemoveX509CertResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRemoveX509CertResponse.Merge(m, src) +} +func (m *MsgRemoveX509CertResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRemoveX509CertResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRemoveX509CertResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRemoveX509CertResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgProposeAddX509RootCert)(nil), "zigbeealliance.distributedcomplianceledger.pki.MsgProposeAddX509RootCert") proto.RegisterType((*MsgProposeAddX509RootCertResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.MsgProposeAddX509RootCertResponse") @@ -1388,86 +1492,90 @@ func init() { proto.RegisterType((*MsgDeletePkiRevocationDistributionPointResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.MsgDeletePkiRevocationDistributionPointResponse") proto.RegisterType((*MsgAssignVid)(nil), "zigbeealliance.distributedcomplianceledger.pki.MsgAssignVid") proto.RegisterType((*MsgAssignVidResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.MsgAssignVidResponse") + proto.RegisterType((*MsgRemoveX509Cert)(nil), "zigbeealliance.distributedcomplianceledger.pki.MsgRemoveX509Cert") + proto.RegisterType((*MsgRemoveX509CertResponse)(nil), "zigbeealliance.distributedcomplianceledger.pki.MsgRemoveX509CertResponse") } func init() { proto.RegisterFile("pki/tx.proto", fileDescriptor_badfdb2b39855d16) } var fileDescriptor_badfdb2b39855d16 = []byte{ - // 1176 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x59, 0xdf, 0x6f, 0xdb, 0x54, - 0x14, 0xae, 0xf3, 0xa3, 0x3f, 0xce, 0x4a, 0x05, 0x97, 0xd2, 0xb9, 0x6e, 0x95, 0x64, 0x5e, 0xb5, - 0x55, 0xa2, 0x4d, 0xd2, 0xae, 0x29, 0xeb, 0x44, 0x41, 0xe9, 0xa2, 0x8d, 0x6a, 0x2d, 0x2a, 0x6e, - 0x07, 0x08, 0x21, 0x26, 0x27, 0xbe, 0x33, 0x97, 0x3a, 0xb9, 0xc6, 0xd7, 0xa9, 0xda,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 0xe5, 0x41, 0xfb, 0xef, 0x92, 0x5b, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, - 0xda, 0x6b, 0x4c, 0x0a, 0x9f, 0x19, 0x00, 0x00, + // 1214 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x59, 0xdf, 0x6f, 0xdb, 0x44, + 0x1c, 0x9f, 0xf3, 0xa3, 0x5d, 0xbf, 0x2b, 0x95, 0x76, 0x94, 0xce, 0x75, 0xab, 0x24, 0xf3, 0xaa, + 0xad, 0x12, 0x6d, 0x92, 0x76, 0x4d, 0x59, 0x27, 0x0a, 0x4a, 0x17, 0x6d, 0x54, 0x6b, 0x51, 0x71, + 0x3b, 0x40, 0x08, 0x31, 0x39, 0xf1, 0xcd, 0x1c, 0x75, 0x72, 0xc6, 0xe7, 0x54, 0xed, 0xde, 0xf8, + 0x0b, 0x40, 0x42, 0xbc, 0x80, 0xc4, 0x1b, 0xfc, 0x03, 0x20, 0xde, 0x10, 0x12, 0x4f, 0xbc, 0x20, + 0x4d, 0x08, 0x09, 0x9e, 0xa2, 0xa9, 0xfd, 0x0f, 0xf2, 0x8e, 0x84, 0x6c, 0x27, 0x76, 0x9c, 0xd9, + 0x69, 0xe2, 0xb6, 0x0f, 0x94, 0xbe, 0xd9, 0x97, 0xfb, 0x7c, 0xee, 0xbe, 0x9f, 0xef, 0xc7, 0x77, + 0xdf, 0xbb, 0xc0, 0xa8, 0xbe, 0x4b, 0x72, 0xe6, 0x7e, 0x56, 0x37, 0xa8, 0x49, 0x51, 0xf6, 0x29, + 0x51, 0xcb, 0x18, 0xcb, 0x9a, 0x46, 0xe4, 0x5a, 0x05, 0x67, 0x15, 0xc2, 0x4c, 0x83, 0x94, 0xeb, + 0x26, 0x56, 0x2a, 0xb4, 0xaa, 0x3b, 0xad, 0x1a, 0x56, 0x54, 0x6c, 0x64, 0xf5, 0x5d, 0x22, 0x4c,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x44, 0x38, 0x73, 0x4f, 0xc0, 0x78, 0xa7, + 0x28, 0xae, 0x5a, 0x9f, 0xb5, 0xeb, 0xc6, 0x2a, 0xdd, 0x3b, 0x8f, 0x75, 0x63, 0x77, 0xd9, 0x97, + 0xe8, 0x51, 0xf6, 0x75, 0x4a, 0xd0, 0x16, 0x68, 0xf1, 0xe7, 0xab, 0x10, 0xdf, 0x64, 0x2a, 0xfa, + 0x89, 0x83, 0x89, 0x90, 0xeb, 0x9c, 0xf5, 0x01, 0xaf, 0x93, 0xb2, 0xa1, 0xb7, 0x1f, 0xc2, 0x3b, + 0xa7, 0x46, 0xd5, 0x0e, 0xc0, 0x9e, 0x78, 0xc8, 0x2d, 0x4a, 0x94, 0x89, 0x07, 0x53, 0x45, 0x9a, + 0x78, 0xef, 0x3b, 0x0b, 0xf4, 0x15, 0x07, 0x57, 0x3a, 0x2f, 0x2c, 0xde, 0x88, 0x32, 0x84, 0x87, + 0x17, 0xee, 0x9f, 0x0c, 0xef, 0xce, 0xeb, 0x17, 0x0e, 0x26, 0xc3, 0xef, 0x15, 0x36, 0xa2, 0x67, + 0xf0, 0x45, 0x36, 0x61, 0xe7, 0x34, 0xd9, 0x7c, 0x11, 0x84, 0x9f, 0xd0, 0x37, 0xa2, 0xa7, 0xf2, + 0x94, 0x22, 0x38, 0xf6, 0xb8, 0x8b, 0xbe, 0xe5, 0x60, 0xac, 0xeb, 0xac, 0x5b, 0x8c, 0x30, 0x90, + 0x9f, 0x42, 0x58, 0x3f, 0x31, 0x85, 0x3b, 0xc1, 0x1f, 0x38, 0x78, 0x25, 0xf8, 0xa8, 0xf8, 0x56, + 0xa4, 0x41, 0x02, 0x98, 0x84, 0xad, 0xd3, 0x62, 0x72, 0x67, 0xfd, 0x17, 0x07, 0xd7, 0x8f, 0x3f, + 0x94, 0xed, 0x44, 0xfb, 0x90, 0x7a, 0xb3, 0x0a, 0x1f, 0x9e, 0x05, 0xab, 0x1b, 0xd9, 0x73, 0x0e, + 0x66, 0xfa, 0x2a, 0xd0, 0xdf, 0x8b, 0x30, 0x8d, 0x7e, 0x88, 0x85, 0xc7, 0x67, 0x44, 0xec, 0x0b, + 0xb1, 0xaf, 0x82, 0x32, 0x4a, 0x88, 0xfd, 0x10, 0x47, 0x0a, 0x71, 0x90, 0xda, 0x0e, 0x7d, 0xce, + 0xc1, 0x88, 0x57, 0xd8, 0xbd, 0x1e, 0xc5, 0x31, 0x6d, 0xb4, 0x50, 0x3a, 0x09, 0xba, 0x6b, 0x21, + 0xf2, 0x15, 0x4f, 0xd1, 0x16, 0xa2, 0x4e, 0x8a, 0x88, 0x0b, 0x51, 0x50, 0xfd, 0xb2, 0xf6, 0xd1, + 0x6f, 0x87, 0x29, 0xee, 0xd9, 0x61, 0x8a, 0x7b, 0x7e, 0x98, 0xe2, 0xbe, 0x38, 0x4a, 0x5d, 0x7a, + 0x76, 0x94, 0xba, 0xf4, 0xf7, 0x51, 0xea, 0xd2, 0x07, 0x25, 0x95, 0x98, 0x1f, 0xd7, 0xcb, 0xd9, + 0x0a, 0xad, 0xe6, 0x9c, 0xe1, 0xe6, 0xdb, 0xe3, 0xe5, 0x3a, 0xc6, 0x9b, 0xf7, 0x06, 0x9c, 0x77, + 0x46, 0xcc, 0xed, 0xe7, 0xec, 0x7f, 0xd3, 0x0e, 0x74, 0xcc, 0xca, 0x43, 0xf6, 0x1f, 0x5e, 0xb7, + 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x8b, 0x0b, 0x81, 0x59, 0x61, 0x1b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1493,6 +1601,7 @@ type MsgClient interface { UpdatePkiRevocationDistributionPoint(ctx context.Context, in *MsgUpdatePkiRevocationDistributionPoint, opts ...grpc.CallOption) (*MsgUpdatePkiRevocationDistributionPointResponse, error) DeletePkiRevocationDistributionPoint(ctx context.Context, in *MsgDeletePkiRevocationDistributionPoint, opts ...grpc.CallOption) (*MsgDeletePkiRevocationDistributionPointResponse, error) AssignVid(ctx context.Context, in *MsgAssignVid, opts ...grpc.CallOption) (*MsgAssignVidResponse, error) + RemoveX509Cert(ctx context.Context, in *MsgRemoveX509Cert, opts ...grpc.CallOption) (*MsgRemoveX509CertResponse, error) } type msgClient struct { @@ -1602,6 +1711,15 @@ func (c *msgClient) AssignVid(ctx context.Context, in *MsgAssignVid, opts ...grp return out, nil } +func (c *msgClient) RemoveX509Cert(ctx context.Context, in *MsgRemoveX509Cert, opts ...grpc.CallOption) (*MsgRemoveX509CertResponse, error) { + out := new(MsgRemoveX509CertResponse) + err := c.cc.Invoke(ctx, "/zigbeealliance.distributedcomplianceledger.pki.Msg/RemoveX509Cert", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { ProposeAddX509RootCert(context.Context, *MsgProposeAddX509RootCert) (*MsgProposeAddX509RootCertResponse, error) @@ -1615,6 +1733,7 @@ type MsgServer interface { UpdatePkiRevocationDistributionPoint(context.Context, *MsgUpdatePkiRevocationDistributionPoint) (*MsgUpdatePkiRevocationDistributionPointResponse, error) DeletePkiRevocationDistributionPoint(context.Context, *MsgDeletePkiRevocationDistributionPoint) (*MsgDeletePkiRevocationDistributionPointResponse, error) AssignVid(context.Context, *MsgAssignVid) (*MsgAssignVidResponse, error) + RemoveX509Cert(context.Context, *MsgRemoveX509Cert) (*MsgRemoveX509CertResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -1654,6 +1773,9 @@ func (*UnimplementedMsgServer) DeletePkiRevocationDistributionPoint(ctx context. func (*UnimplementedMsgServer) AssignVid(ctx context.Context, req *MsgAssignVid) (*MsgAssignVidResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method AssignVid not implemented") } +func (*UnimplementedMsgServer) RemoveX509Cert(ctx context.Context, req *MsgRemoveX509Cert) (*MsgRemoveX509CertResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RemoveX509Cert not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -1857,6 +1979,24 @@ func _Msg_AssignVid_Handler(srv interface{}, ctx context.Context, dec func(inter return interceptor(ctx, in, info, handler) } +func _Msg_RemoveX509Cert_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRemoveX509Cert) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).RemoveX509Cert(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zigbeealliance.distributedcomplianceledger.pki.Msg/RemoveX509Cert", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).RemoveX509Cert(ctx, req.(*MsgRemoveX509Cert)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "zigbeealliance.distributedcomplianceledger.pki.Msg", HandlerType: (*MsgServer)(nil), @@ -1905,6 +2045,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "AssignVid", Handler: _Msg_AssignVid_Handler, }, + { + MethodName: "RemoveX509Cert", + Handler: _Msg_RemoveX509Cert_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "pki/tx.proto", @@ -2845,6 +2989,80 @@ func (m *MsgAssignVidResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *MsgRemoveX509Cert) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgRemoveX509Cert) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRemoveX509Cert) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.SerialNumber) > 0 { + i -= len(m.SerialNumber) + copy(dAtA[i:], m.SerialNumber) + i = encodeVarintTx(dAtA, i, uint64(len(m.SerialNumber))) + i-- + dAtA[i] = 0x22 + } + if len(m.SubjectKeyId) > 0 { + i -= len(m.SubjectKeyId) + copy(dAtA[i:], m.SubjectKeyId) + i = encodeVarintTx(dAtA, i, uint64(len(m.SubjectKeyId))) + i-- + dAtA[i] = 0x1a + } + if len(m.Subject) > 0 { + i -= len(m.Subject) + copy(dAtA[i:], m.Subject) + i = encodeVarintTx(dAtA, i, uint64(len(m.Subject))) + i-- + dAtA[i] = 0x12 + } + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRemoveX509CertResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgRemoveX509CertResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRemoveX509CertResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -3299,6 +3517,40 @@ func (m *MsgAssignVidResponse) Size() (n int) { return n } +func (m *MsgRemoveX509Cert) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Subject) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.SubjectKeyId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.SerialNumber) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgRemoveX509CertResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -6271,6 +6523,234 @@ func (m *MsgAssignVidResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgRemoveX509Cert) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgRemoveX509Cert: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRemoveX509Cert: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Subject", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Subject = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SubjectKeyId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SubjectKeyId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SerialNumber", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SerialNumber = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgRemoveX509CertResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgRemoveX509CertResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRemoveX509CertResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0