https://github.com/meshplus/flato-msp-cert
https://github.com/meshplus/flato-msp-cert
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/meshplus/flato-msp-cert
- Owner: meshplus
- License: apache-2.0
- Created: 2021-01-06T04:54:00.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-12-02T06:20:43.000Z (over 4 years ago)
- Last Synced: 2025-08-01T04:30:01.299Z (11 months ago)
- Language: Go
- Size: 466 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
flato-msp-cert
=========
> Implementation of certificate operations.
## Table of Contents
- [Usage](#usage)
- [API](#api)
- [Mockgen](#mockgen)
- [GitCZ](#gitcz)
- [Contribute](#contribute)
- [License](#license)
## Mockgen
Install **mockgen** : `go get github.com/golang/mock/mockgen`
How to use?
- source: Specify interface file
- destination: Generated file name
- package:The package name of the generated file
- imports: Dependent package that requires import
- aux_files: Attach a file when there is more than one file in the interface file
- build_flags: Parameters passed to the build tool
Eg.`mockgen -destination mock/mock_crypto.go -package crypto -source crypto.go`
## GitCZ
**Note**: Please use command `npm install` if you are the first time to use `git cz` in this repo.
## api
### parse key
```
//ParseSMPrivateKey Parse guomi private key, support gmssl private key and cfca private key
// return the gmx509.PrivateKey type.
// first try to resolve to the private key of type gmssl.
// if it fails, try to resolve to the private key of cfca.
func ParseSMPrivateKey(der []byte) (interface{}, error)
```
### generate cert
```
//GenCert generate ecert
func GenCert(ca *gmx509.Certificate, privatekey interface{}, publicKey interface{},
o, cn, gn string, isCA bool) ([]byte, error)
```
### generate root cert
```
//NewSelfSignedCert generate self-signature certificate
func NewSelfSignedCert(o, cn, gn string, useGuomi bool) (
[]byte, interface{}, error)
```
## Contribute
PRs are welcome!
Small note: If editing the Readme, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification.
## License
This project is currently under Apache 2.0 license. See the LICENSE file for details.