Documentation
¶
Index ¶
- Constants
- Variables
- func DecodeASN1Header(b []byte) ([]byte, uint32, bool)
- func EncodeASN1Header(sz uint32) ([]byte, error)
- func EncodeASN1HeaderTo(b []byte, sz uint32) (int, error)
- func EncodeASN1Value(b []byte, oid asn1.ObjectIdentifier, dceStyle bool, extra [][]byte) ([]byte, error)
- func EncodeASN1ValueWithExtraSize(b []byte, oid asn1.ObjectIdentifier, extra ...[]byte) ([]byte, error)
- func IsASN1Value(b []byte) bool
- func ParseASN1Value(b []byte, extra [][]byte) ([]byte, asn1.ObjectIdentifier, error)
- func Rotate(b []byte, rc int) []byte
- type AESCTSHMACSHA1
- func (c *AESCTSHMACSHA1) ChecksumHash() (hash.Hash, error)
- func (c *AESCTSHMACSHA1) DeriveEncryptionKey() ([]byte, error)
- func (c *AESCTSHMACSHA1) IntegrityHash() (hash.Hash, error)
- func (c *AESCTSHMACSHA1) MICHeader(ctx context.Context, seqNum uint64) []byte
- func (c *AESCTSHMACSHA1) MakeSignature(ctx context.Context, seqNum uint64, forSgn [][]byte) ([]byte, error)
- func (c *AESCTSHMACSHA1) Size(ctx context.Context, conf bool) int
- func (c *AESCTSHMACSHA1) Unwrap(ctx context.Context, seqNum uint64, forSign, forSeal [][]byte, sgn []byte) (bool, error)
- func (c *AESCTSHMACSHA1) Wrap(ctx context.Context, seqNum uint64, forSign, forSeal [][]byte) ([]byte, error)
- func (c *AESCTSHMACSHA1) WrapHeader(ctx context.Context, seqNum uint64) []byte
- type Cipher
- func NewAESCipher(ctx context.Context, setting CipherSetting) (Cipher, error)
- func NewCipher(ctx context.Context, setting CipherSetting) (Cipher, error)
- func NewDESCipher(ctx context.Context, setting CipherSetting) (Cipher, error)
- func NewRC4Cipher(ctx context.Context, setting CipherSetting) (Cipher, error)
- type CipherSetting
- type DES
- func (c *DES) MakeSignature(ctx context.Context, seqNum uint64, forSign [][]byte) ([]byte, error)
- func (c *DES) Size(ctx context.Context, conf bool) int
- func (c *DES) Unwrap(ctx context.Context, seqNum uint64, forSign, forSeal [][]byte, sgn []byte) (bool, error)
- func (c *DES) Wrap(ctx context.Context, seqNum uint64, forSign, forSeal [][]byte) ([]byte, error)
- type RC4HMAC
- func (c *RC4HMAC) MakeSignature(ctx context.Context, seqNum uint64, forSign [][]byte) ([]byte, error)
- func (c *RC4HMAC) Size(ctx context.Context, conf bool) int
- func (c *RC4HMAC) Unwrap(ctx context.Context, seqNum uint64, forSign, forSeal [][]byte, sgn []byte) (bool, error)
- func (c *RC4HMAC) Wrap(ctx context.Context, seqNum uint64, forSign, forSeal [][]byte) ([]byte, error)
- type SizedHash
Constants ¶
const ( EC = 16 RRC = 28 )
Variables ¶
var ( CFXFlagSendByAcceptor = uint8(0x01) CFXFlagSealed = uint8(0x02) CFXFlagAcceptorSubKey = uint8(0x04) )
var (
KRB5OID = asn1.ObjectIdentifier{1, 2, 840, 113554, 1, 2, 2}
)
Functions ¶
func DecodeASN1Header ¶ added in v1.2.0
DecodeASN1Header function decodes the given byte slice as an ASN.1 header and returns the remaining data, the size and a boolean value indicating if the header is valid.
func EncodeASN1Header ¶ added in v1.2.0
EncodeASN1Header function encodes the given size into an ASN.1 header and returns the encoded byte slice. The function returns an error if any.
func EncodeASN1HeaderTo ¶ added in v1.2.0
EncodeASN1HeaderTo function encodes the given size into an ASN.1 header and writes it to the given byte slice. The function returns the number of bytes written and an error if any.
func EncodeASN1Value ¶ added in v1.2.0
func EncodeASN1Value(b []byte, oid asn1.ObjectIdentifier, dceStyle bool, extra [][]byte) ([]byte, error)
EncodeASN1Value function encodes the given byte slice into an ASN.1 value with the given object identifier. If dceStyle is true, the function will encode the value in DCE style, else it will encode the extra value size into the header.
func EncodeASN1ValueWithExtraSize ¶ added in v1.2.0
func EncodeASN1ValueWithExtraSize(b []byte, oid asn1.ObjectIdentifier, extra ...[]byte) ([]byte, error)
EncodeASN1ValueWithExtraSize function encodes the given byte slice into an ASN.1 value with the given object identifier. The function will encode the extra value size into the header.
func IsASN1Value ¶ added in v1.2.0
IsASN1Value function returns true if the given byte slice is an ASN.1 value with application tag.
func ParseASN1Value ¶ added in v1.2.0
ParseASN1Value function parses the given byte slice as an ASN.1 value. The function returns the remaining data, the object identifier and an error if any.
Types ¶
type AESCTSHMACSHA1 ¶
type AESCTSHMACSHA1 struct {
// contains filtered or unexported fields
}
AESCTSHMACSHA1 represents the integrity/confidentiality routines for the aes128-cts-hmac-sha1 and aes256-cts-hmac-sha1.
func (*AESCTSHMACSHA1) ChecksumHash ¶
func (c *AESCTSHMACSHA1) ChecksumHash() (hash.Hash, error)
func (*AESCTSHMACSHA1) DeriveEncryptionKey ¶ added in v1.2.0
func (c *AESCTSHMACSHA1) DeriveEncryptionKey() ([]byte, error)
func (*AESCTSHMACSHA1) IntegrityHash ¶
func (c *AESCTSHMACSHA1) IntegrityHash() (hash.Hash, error)
func (*AESCTSHMACSHA1) MICHeader ¶
func (c *AESCTSHMACSHA1) MICHeader(ctx context.Context, seqNum uint64) []byte
func (*AESCTSHMACSHA1) MakeSignature ¶
func (*AESCTSHMACSHA1) WrapHeader ¶
func (c *AESCTSHMACSHA1) WrapHeader(ctx context.Context, seqNum uint64) []byte
type Cipher ¶
type Cipher interface { Wrap(context.Context, uint64, [][]byte, [][]byte) ([]byte, error) Unwrap(context.Context, uint64, [][]byte, [][]byte, []byte) (bool, error) MakeSignature(context.Context, uint64, [][]byte) ([]byte, error) Size(context.Context, bool) int }
func NewAESCipher ¶
func NewAESCipher(ctx context.Context, setting CipherSetting) (Cipher, error)
func NewDESCipher ¶ added in v1.2.0
func NewDESCipher(ctx context.Context, setting CipherSetting) (Cipher, error)
func NewRC4Cipher ¶
func NewRC4Cipher(ctx context.Context, setting CipherSetting) (Cipher, error)
type CipherSetting ¶ added in v1.2.0
type CipherSetting struct { // Key is an encryption key for the cipher. Key types.EncryptionKey // Type is an encryption type for the cipher. Type etype.EType // IsSubKey is true if the key is a subkey. IsSubKey bool // IsLocal is true if cipher is an initiator's cipher. IsLocal bool // DCEStyle is true if the cipher is DCE style. DCEStyle bool }
type DES ¶ added in v1.2.0
type DES struct {
// contains filtered or unexported fields
}