Documentation
¶
Index ¶
- Variables
- func CertificateToPem(CertBytes *[]byte) *[]byte
- func DecryptWithPrivateKey(ciphertext []byte, priv *rsa.PrivateKey) []byte
- func EncryptWithPublicKey(msg []byte, pub *rsa.PublicKey) []byte
- func GenerateRsaCertificate(Key *rsa.PrivateKey, CertTemplate *x509.Certificate) (Certificate *[]byte)
- func GenerateRsaKey(bitSize RsaBitSize) *rsa.PrivateKey
- func GenerateSignature(privateKey *rsa.PrivateKey, hashed []byte, alg DSA) ([]byte, error)
- func JsonToHash(stableJson []byte, alg DSA) ([]byte, error)
- func NewX509CertificateTemplate(Organization, CommonName string, Duration time.Duration) *x509.Certificate
- func RsaKeyToPem(Key *rsa.PrivateKey) (PublicKey, PrivateKey *[]byte)
- func SetupAlgFlags() map[DSA]*bool
- func VerifySignature(publicKey *rsa.PublicKey, hashed, signature []byte, alg DSA) error
- func WithPrivateKey(privateKey *rsa.PrivateKey) func(*JsonSign)
- func WithPrivateKeyFilePath(privateKeyFilePath string) func(*JsonSign)
- func WithPublicKey(publicKey *rsa.PublicKey) func(*JsonSign)
- func WithPublicKeyFilePath(publicKeyFilePath string) func(*JsonSign)
- type DSA
- type JsonSign
- type RsaBitSize
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func CertificateToPem ¶
func DecryptWithPrivateKey ¶
func DecryptWithPrivateKey( ciphertext []byte, priv *rsa.PrivateKey, ) []byte
DecryptWithPrivateKey decrypts data with private key
func EncryptWithPublicKey ¶
https://gist.github.com/miguelmota/3ea9286bd1d3c2a985b67cac4ba2130a EncryptWithPublicKey encrypts data with public key
func GenerateRsaCertificate ¶
func GenerateRsaCertificate( Key *rsa.PrivateKey, CertTemplate *x509.Certificate, ) ( Certificate *[]byte, )
func GenerateRsaKey ¶
func GenerateRsaKey(bitSize RsaBitSize) *rsa.PrivateKey
func GenerateSignature ¶
func NewX509CertificateTemplate ¶
func NewX509CertificateTemplate( Organization, CommonName string, Duration time.Duration, ) *x509.Certificate
func RsaKeyToPem ¶
func RsaKeyToPem(Key *rsa.PrivateKey) ( PublicKey, PrivateKey *[]byte, )
func SetupAlgFlags ¶
func VerifySignature ¶
func WithPrivateKey ¶
func WithPrivateKey(privateKey *rsa.PrivateKey) func(*JsonSign)
func WithPrivateKeyFilePath ¶
WithPrivateKeyFilePath give the private key file path
func WithPublicKey ¶
func WithPublicKeyFilePath ¶
WithPublicKeyFilePath give the public key file path
Types ¶
type JsonSign ¶
type JsonSign struct {
PrivateKey *rsa.PrivateKey
PublicKey *rsa.PublicKey
Algorithm DSA
}
JsonSign containt keys path
func (*JsonSign) ValidateBytes ¶ added in v0.1.3
Validate the JSON file signature
type RsaBitSize ¶
type RsaBitSize int
const ( Rsa1024 RsaBitSize = 1024 Rsa2048 RsaBitSize = 2048 Rsa4096 RsaBitSize = 4096 )
Click to show internal directories.
Click to hide internal directories.