utils

package
v0.0.0-...-0699224 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2022 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Overview

* * VISS-MANAGER: utils * * Copyright (C) 2022 NICS Lab, University of Malaga * Author: Jose Jesus Sanchez Gomez, sanchezg@lcc.uma.es * * This program and all files in the repository at https://github.com/josesnchz/viss-manager * are distributed following the terms of the LICENSE file in the repository. * *

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AESCTRDecoding

func AESCTRDecoding(key string, data string) (string, error)

AES-CTR decoding

func AESCTREncoding

func AESCTREncoding(key string, data string) (string, error)

AES-CTR encoding

func EcdsaGenP256

func EcdsaGenP256() *ecdsa.PrivateKey

Generates P256 EC Key

func EcdsaPemDecode

func EcdsaPemDecode(pemKey string) *ecdsa.PrivateKey

Gets ecdsa key in pem format and decodes it into ecdsa.privatekey

func EcdsaPemPrivEncode

func EcdsaPemPrivEncode(privKey *ecdsa.PrivateKey) string

Returns given ECDSA private key in PEM format

func EcdsaPemPubEncode

func EcdsaPemPubEncode(privKey *ecdsa.PrivateKey) string

Returns given ECDSA public key in PEM format

func EcdsaSign

func EcdsaSign(toSign string, privKey *ecdsa.PrivateKey) string

Returns base 64 RS256 signature of given string using the key

func JWKThumbprint

func JWKThumbprint(pubKey crypto.PublicKey) string

func JsonRecursiveMarshall

func JsonRecursiveMarshall(key string, value string, jplain *string)

Gets Json string (or nothing) and adds received key and value, if it doesnt receive a value or key, it does nothing

func Log

func Log(typ string, data string)

func Print

func Print(data string)

func PrintErr

func PrintErr(err interface{})

func RsaGen2048

func RsaGen2048() *rsa.PrivateKey

Generates 2048 RSA Key

func RsaPemDecode

func RsaPemDecode(pemKey string) *rsa.PrivateKey

Gets rsa key in pem format and decodes it into rsa.privatekey

func RsaPemPrivEncode

func RsaPemPrivEncode(privKey *rsa.PrivateKey) string

Returns given RSA private key in PEM format

func RsaPemPubEncode

func RsaPemPubEncode(privKey *rsa.PrivateKey) string

Returns given RSA public key in PEM format

func RsaSign

func RsaSign(toSign string, privKey *rsa.PrivateKey) string

Returns base 64 RS256 signature of given string using the key

Types

type JWK

type JWK struct {
	Type   string `json:"kty"`
	Use    string `json:"use,omitempty"`
	PubMod string `json:"n,omitempty"`   // RSA
	PubExp string `json:"e,omitempty"`   // RSA
	Curve  string `json:"crv,omitempty"` //ECDSA
	Xcoord string `json:"x,omitempty"`   //ECDSA
	Ycoord string `json:"y,omitempty"`   //ECDSA
}

func (*JWK) JWKGen

func (jwk *JWK) JWKGen(pubKey crypto.PublicKey)

Jump to

Keyboard shortcuts

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