Documentation ¶
Overview ¶
Package rsakys is an abstraction layer for the crypto/rsa and connected packages.
The purpose is to avoid a lot of boilerplate code and error checks when creating, writing, reading, or transforming RSA based keys.
Index ¶
- func GeneratePKCS1Keypair(path, keyname string, bitSize int) (*rsa.PrivateKey, error)
- func GeneratePKCS1PrivateKey(path string, bitSize int) (*rsa.PrivateKey, error)
- func GeneratePKCS8Keypair(path, keyname string, bitSize int) (*rsa.PrivateKey, error)
- func GeneratePKCS8PrivateKey(path string, bitSize int) (*rsa.PrivateKey, error)
- func GetPKCS1PrivateKey(bitSize int) ([]byte, error)
- func GetPKCS1PrivateKeyString(privateKey *rsa.PrivateKey) ([]byte, error)
- func GetPKCS1PublicKeyString(publicKey *rsa.PublicKey) ([]byte, error)
- func GetPKCS8PrivateKey(bitSize int) ([]byte, error)
- func GetPKCS8PrivateKeyString(privateKey *rsa.PrivateKey) ([]byte, error)
- func GetPKIXPublicKeyString(publicKey *rsa.PublicKey) ([]byte, error)
- func GetPrivateKey(bitSize int) (*rsa.PrivateKey, error)
- func ReadPrivate(path string) (*rsa.PrivateKey, error)
- func ReadPrivatePKCS1(path string) ([]byte, error)
- func ReadPrivatePKCS8(path string) ([]byte, error)
- func ReadPublic(path string) (*rsa.PublicKey, error)
- func ReadPublicPKCS1(path string) ([]byte, error)
- func ReadPublicPKIX(path string) ([]byte, error)
- func WritePKCS1PrivateKey(privateKey *rsa.PrivateKey, path string) error
- func WritePKCS1PublicKey(publicKey *rsa.PublicKey, path string) error
- func WritePKCS8PrivateKey(privateKey *rsa.PrivateKey, path string) error
- func WritePKIXPublicKey(publicKey *rsa.PublicKey, path string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GeneratePKCS1Keypair ¶
func GeneratePKCS1Keypair(path, keyname string, bitSize int) (*rsa.PrivateKey, error)
GeneratePKCS1Keypair generates a new private key of the given bit size, writes its private key part with '.pem' suffix as PKCS1 PEM file to disc, writes its public key part with '.pub' suffix as PKIX PEM file to disc, and returns the RSA private key struct
func GeneratePKCS1PrivateKey ¶
func GeneratePKCS1PrivateKey(path string, bitSize int) (*rsa.PrivateKey, error)
GeneratePKCS1PrivateKey generates a new private key of the given bit size, writes it as PKCS1 PEM file to disc, and returns the RSA private key struct
func GeneratePKCS8Keypair ¶
func GeneratePKCS8Keypair(path, keyname string, bitSize int) (*rsa.PrivateKey, error)
GeneratePKCS8Keypair generates a new private key of the given bit size, writes its private key part with '.pem' suffix as PKCS8 PEM file to disc, writes its public key part with '.pub' suffix as PKIX PEM file to disc, and returns the RSA private key struct
func GeneratePKCS8PrivateKey ¶
func GeneratePKCS8PrivateKey(path string, bitSize int) (*rsa.PrivateKey, error)
GeneratePKCS8PrivateKey generates a new private key of the given bit size, writes it as PKCS8 PEM file to disc, and returns the RSA private key struct
func GetPKCS1PrivateKey ¶
GetPKCS1PrivateKey generates an RSA private key and returns the PKCS1 byterepresentation of the PEM block
func GetPKCS1PrivateKeyString ¶
func GetPKCS1PrivateKeyString(privateKey *rsa.PrivateKey) ([]byte, error)
GetPKCS1PrivateKeyString returns the PKCS1 byterepresentation of a given RSA private key struct
func GetPKCS1PublicKeyString ¶
GetPKCS1PublicKeyString returns the PKCS1 byterepresentation of a given RSA public key struct
func GetPKCS8PrivateKey ¶
GetPKCS8PrivateKey generates an RSA private key and returns the PKCS8 byterepresentation of the PEM block
func GetPKCS8PrivateKeyString ¶
func GetPKCS8PrivateKeyString(privateKey *rsa.PrivateKey) ([]byte, error)
GetPKCS8PrivateKeyString returns the PKCS8 byterepresentation of a given RSA private key struct
func GetPKIXPublicKeyString ¶
GetPKIXPublicKeyString returns the PKIX byterepresentation of a given RSA public key struct
func GetPrivateKey ¶
func GetPrivateKey(bitSize int) (*rsa.PrivateKey, error)
GetPrivateKey generates an RSA private key struct of the given bit size
func ReadPrivate ¶
func ReadPrivate(path string) (*rsa.PrivateKey, error)
ReadPrivate reads a private key PEM file and returns the private key struct
func ReadPrivatePKCS1 ¶
ReadPrivatePKCS1 reads a private key PEM file and returns a PKCS1 encoded private key byte slice
func ReadPrivatePKCS8 ¶
ReadPrivatePKCS8 reads a private key PEM file and returns a PKCS8 encoded private key byte slice
func ReadPublic ¶
ReadPublic reads a public key PEM file and returns the public key struct
func ReadPublicPKCS1 ¶
ReadPublicPKCS1 reads a public key PEM file and returns a PKCS1 encoded public key byte slice
func ReadPublicPKIX ¶
ReadPublicPKIX reads a public key PEM file and returns a PKIX encoded public key byte slice
func WritePKCS1PrivateKey ¶
func WritePKCS1PrivateKey(privateKey *rsa.PrivateKey, path string) error
WritePKCS1PrivateKey writes a given RSA private key as PKCS1 PEM block to disc
func WritePKCS1PublicKey ¶
WritePKCS1PublicKey writes the public key part of a given RSA private key as PKCS1 PEM block to disc
func WritePKCS8PrivateKey ¶
func WritePKCS8PrivateKey(privateKey *rsa.PrivateKey, path string) error
WritePKCS8PrivateKey writes a given RSA private key as PKCS8 PEM block to disc
Types ¶
This section is empty.