Documentation
¶
Overview ¶
Package rsa implements RSA encryption, decryption, signing, and verification with streaming support. It provides RSA operations using the standard RSA algorithm with support for different key sizes and various padding schemes.
Index ¶
- func NewStreamDecrypter(r io.Reader, kp *keypair.RsaKeyPair) io.Reader
- func NewStreamEncrypter(w io.Writer, kp *keypair.RsaKeyPair) io.WriteCloser
- func NewStreamSigner(w io.Writer, kp *keypair.RsaKeyPair) io.WriteCloser
- func NewStreamVerifier(r io.Reader, kp *keypair.RsaKeyPair) io.WriteCloser
- type BufferError
- type DataTooLargeError
- type DecryptError
- type EncryptError
- type KeyPairError
- type NilKeyPairError
- type NoSignatureError
- type PrivateKeyUnsetError
- type PublicKeyUnsetError
- type ReadError
- type SignError
- type StdDecrypter
- type StdEncrypter
- type StdSigner
- type StdVerifier
- type StreamDecrypter
- type StreamEncrypter
- type StreamSigner
- type StreamVerifier
- type VerifyError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewStreamEncrypter ¶
func NewStreamEncrypter(w io.Writer, kp *keypair.RsaKeyPair) io.WriteCloser
func NewStreamSigner ¶
func NewStreamSigner(w io.Writer, kp *keypair.RsaKeyPair) io.WriteCloser
func NewStreamVerifier ¶
func NewStreamVerifier(r io.Reader, kp *keypair.RsaKeyPair) io.WriteCloser
Types ¶
type BufferError ¶
type BufferError struct {
// contains filtered or unexported fields
}
func (BufferError) Error ¶
func (e BufferError) Error() string
type DataTooLargeError ¶
type DataTooLargeError struct {
}
func (DataTooLargeError) Error ¶
func (e DataTooLargeError) Error() string
type DecryptError ¶
type DecryptError struct {
Err error
}
func (DecryptError) Error ¶
func (e DecryptError) Error() string
type EncryptError ¶
type EncryptError struct {
Err error
}
func (EncryptError) Error ¶
func (e EncryptError) Error() string
type KeyPairError ¶
type KeyPairError struct {
Err error
}
func (KeyPairError) Error ¶
func (e KeyPairError) Error() string
type NilKeyPairError ¶
type NilKeyPairError struct {
}
func (NilKeyPairError) Error ¶
func (e NilKeyPairError) Error() string
type NoSignatureError ¶
type NoSignatureError struct {
}
func (NoSignatureError) Error ¶
func (e NoSignatureError) Error() string
type PrivateKeyUnsetError ¶
type PrivateKeyUnsetError struct {
}
func (PrivateKeyUnsetError) Error ¶
func (k PrivateKeyUnsetError) Error() string
type PublicKeyUnsetError ¶
type PublicKeyUnsetError struct {
}
func (PublicKeyUnsetError) Error ¶
func (k PublicKeyUnsetError) Error() string
Error returns a formatted error message indicating that the key is not set. The message provides guidance to use the SetKey() method to resolve the issue.
type StdDecrypter ¶
type StdDecrypter struct {
Error error // Error field for storing decryption errors
// contains filtered or unexported fields
}
func NewStdDecrypter ¶
func NewStdDecrypter(kp *keypair.RsaKeyPair) *StdDecrypter
func (*StdDecrypter) Decrypt ¶
func (d *StdDecrypter) Decrypt(src []byte) (dst []byte, err error)
type StdEncrypter ¶
type StdEncrypter struct {
Error error
// contains filtered or unexported fields
}
func NewStdEncrypter ¶
func NewStdEncrypter(kp *keypair.RsaKeyPair) *StdEncrypter
func (*StdEncrypter) Encrypt ¶
func (e *StdEncrypter) Encrypt(src []byte) (dst []byte, err error)
type StdSigner ¶
type StdSigner struct {
Error error // Error field for storing signature errors
// contains filtered or unexported fields
}
func NewStdSigner ¶
func NewStdSigner(kp *keypair.RsaKeyPair) *StdSigner
type StdVerifier ¶
type StdVerifier struct {
Error error // Error field for storing verification errors
// contains filtered or unexported fields
}
func NewStdVerifier ¶
func NewStdVerifier(kp *keypair.RsaKeyPair) *StdVerifier
func (*StdVerifier) Verify ¶
func (v *StdVerifier) Verify(src, sign []byte) (valid bool, err error)
type StreamDecrypter ¶
type StreamDecrypter struct {
Error error // Error field for storing decryption errors
// contains filtered or unexported fields
}
func (*StreamDecrypter) Read ¶
func (d *StreamDecrypter) Read(p []byte) (n int, err error)
type StreamEncrypter ¶
type StreamEncrypter struct {
Error error // Error field for storing encryption errors
// contains filtered or unexported fields
}
func (*StreamEncrypter) Close ¶
func (e *StreamEncrypter) Close() error
func (*StreamEncrypter) Encrypt ¶ added in v1.1.1
func (e *StreamEncrypter) Encrypt(data []byte) (encrypted []byte, err error)
func (*StreamEncrypter) Write ¶
func (e *StreamEncrypter) Write(p []byte) (n int, err error)
type StreamSigner ¶
type StreamSigner struct {
Error error // Error field for storing signature errors
// contains filtered or unexported fields
}
func (*StreamSigner) Close ¶
func (s *StreamSigner) Close() error
func (*StreamSigner) Sign ¶
func (s *StreamSigner) Sign(hashed []byte) (signature []byte, err error)
func (*StreamSigner) Write ¶
func (s *StreamSigner) Write(p []byte) (n int, err error)
type StreamVerifier ¶
type StreamVerifier struct {
Error error // Error field for storing verification errors
// contains filtered or unexported fields
}
func (*StreamVerifier) Close ¶
func (v *StreamVerifier) Close() error
Close performs the final verification and closes the verifier
func (*StreamVerifier) Verify ¶
func (v *StreamVerifier) Verify(hashed, signature []byte) (valid bool, err error)
func (*StreamVerifier) Write ¶
func (v *StreamVerifier) Write(p []byte) (n int, err error)
Write processes data through the hash function for streaming verification
type VerifyError ¶
type VerifyError struct {
Err error
}
func (VerifyError) Error ¶
func (e VerifyError) Error() string
Source Files
¶
- errors.go
- rsa.go
Click to show internal directories.
Click to hide internal directories.