Documentation
¶
Index ¶
- Constants
- func EncodePEM(key []byte, representation Representation) []byte
- func LoadRSAPrivateKey(keyData []byte, representation Representation) (*rsa.PrivateKey, error)
- func LoadRSAPublicKey(keyData []byte, representation Representation) (*rsa.PublicKey, error)
- func SignPSS(message []byte, key *rsa.PrivateKey, csprng io.Reader) ([]byte, error)
- func VerifyPSS(message []byte, signature []byte, key *rsa.PublicKey) bool
- type Representation
Constants ¶
View Source
const ( BLOCK_TYPE_INVALID = "INVALID" BLOCK_TYPE_PRIVATE_KEY_PKCS1 = "RSA PRIVATE KEY" BLOCK_TYPE_PRIVATE_KEY_PKCS8 = "PRIVATE KEY" BLOCK_TYPE_PUBLIC_KEY_PKCS1 = "RSA PUBLIC KEY" BLOCK_TYPE_PUBLIC_KEY_PKIX = "PUBLIC KEY" )
View Source
const ( REPRESENTATION_INVALID = Representation(iota - 1) REPRESENTATION_RSA_PRIVATE_KEY_PKCS1 REPRESENTATION_RSA_PRIVATE_KEY_PKCS8 REPRESENTATION_RSA_PUBLIC_KEY_PKCS1 REPRESENTATION_RSA_PUBLIC_KEY_PKIX )
Variables ¶
This section is empty.
Functions ¶
func EncodePEM ¶
func EncodePEM(key []byte, representation Representation) []byte
* Encode an RSA key in a certain representation as PEM.
func LoadRSAPrivateKey ¶
func LoadRSAPrivateKey(keyData []byte, representation Representation) (*rsa.PrivateKey, error)
* Loads an RSA private key in ASN.1 encoding and either PKCS1 or PKCS8 * representation.
func LoadRSAPublicKey ¶
func LoadRSAPublicKey(keyData []byte, representation Representation) (*rsa.PublicKey, error)
* Loads an RSA public key in ASN.1 encoding and either PKCS1 or PKIX * representation.
Types ¶
type Representation ¶
type Representation int8
func CreateRepresentation ¶
func CreateRepresentation(blockType string) Representation
* Determines the representation of an RSA key from the PEM block type.
func DecodePEM ¶
func DecodePEM(pemData []byte) ([]byte, Representation, error)
* Decode a PEM-encoded RSA key and return the decoded key material, the * representation and, potentially, an error.
func (*Representation) String ¶
func (this *Representation) String() string
* Returns the PEM block type corresponding to this representation.
Click to show internal directories.
Click to hide internal directories.