csp

package
v0.0.0-...-7608d4d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Copyright IBM Corp. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GeneratePrivateKey

func GeneratePrivateKey(keystorePath string) (*sm2.PrivateKey, error)

GeneratePrivateKey creates an SM2 private key using SM2P256V1 curve and stores it in keystorePath.

func LoadPrivateKey

func LoadPrivateKey(keystorePath string) (*sm2.PrivateKey, error)

LoadPrivateKey loads a private key from a file in keystorePath. It looks for a file ending in "_sk" and expects a PEM-encoded PKCS8 EC private key.

Types

type SM2Signature

type SM2Signature struct {
	R, S *big.Int
}

type SM2Signer

type SM2Signer struct {
	PrivateKey *sm2.PrivateKey
}

SM2Signer 实现 crypto.Signer 接口

func (*SM2Signer) Public

func (s *SM2Signer) Public() crypto.PublicKey

Public returns the *sm2.PublicKey associated with PrivateKey.

func (e *ECDSASigner) Public() crypto.PublicKey {
	return &e.PrivateKey.PublicKey
}

func (*SM2Signer) Sign

func (s *SM2Signer) Sign(rand io.Reader, msg []byte, opts crypto.SignerOpts) ([]byte, error)

Sign returns SM2 signature in form of DER marshalized via ASN1

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL