Documentation ¶
Index ¶
- Constants
- Variables
- func AEStoEncryptedPEM(raw []byte, pwd []byte) ([]byte, error)
- func AEStoPEM(raw []byte) []byte
- func CBCDecrypt(key, src []byte) ([]byte, error)
- func CBCEncrypt(key, s []byte) ([]byte, error)
- func CBCPKCS7Decrypt(key, src []byte) ([]byte, error)
- func CBCPKCS7Encrypt(key, src []byte) ([]byte, error)
- func DERToX509Certificate(asn1Data []byte) (*x509.Certificate, error)
- func ECDSASign(signKey interface{}, msg []byte) ([]byte, error)
- func GenAESKey() ([]byte, error)
- func GetCriticalExtension(cert *x509.Certificate, oid asn1.ObjectIdentifier) ([]byte, error)
- func IntArrayEquals(a []int, b []int) bool
- func NewECDSAKey() (*ecdsa.PrivateKey, error)
- func NewSelfSignedCert() ([]byte, interface{}, error)
- func PEMtoAES(raw []byte, pwd []byte) ([]byte, error)
- func PKCS7Padding(src []byte) []byte
- func PKCS7UnPadding(src []byte) ([]byte, error)
- type ECDSASignature
Constants ¶
const ( // AESKeyLength is the default AES key length AESKeyLength = 32 // NonceSize is the default NonceSize NonceSize = 24 )
Variables ¶
var ( // TCertEncTCertIndex oid for TCertIndex TCertEncTCertIndex = asn1.ObjectIdentifier{1, 2, 3, 4, 5, 6, 7} // TCertEncEnrollmentID is the ASN1 object identifier of the TCert index. TCertEncEnrollmentID = asn1.ObjectIdentifier{1, 2, 3, 4, 5, 6, 8} // TCertEncAttributesBase is the base ASN1 object identifier for attributes. // When generating an extension to include the attribute an index will be // appended to this Object Identifier. TCertEncAttributesBase = asn1.ObjectIdentifier{1, 2, 3, 4, 5, 6} // TCertAttributesHeaders is the ASN1 object identifier of attributes header. TCertAttributesHeaders = asn1.ObjectIdentifier{1, 2, 3, 4, 5, 6, 9} )
Functions ¶
func AEStoEncryptedPEM ¶
AEStoEncryptedPEM encapsulates an AES key in the encrypted PEM format
func CBCDecrypt ¶
CBCDecrypt decrypts using CBC mode
func CBCPKCS7Decrypt ¶
CBCPKCS7Decrypt combines CBC decryption and PKCS7 unpadding
func CBCPKCS7Encrypt ¶
CBCPKCS7Encrypt combines CBC encryption and PKCS7 padding
func DERToX509Certificate ¶
func DERToX509Certificate(asn1Data []byte) (*x509.Certificate, error)
DERToX509Certificate converts der to x509
func GetCriticalExtension ¶
func GetCriticalExtension(cert *x509.Certificate, oid asn1.ObjectIdentifier) ([]byte, error)
GetCriticalExtension returns a requested critical extension. It also remove it from the list of unhandled critical extensions
func IntArrayEquals ¶
IntArrayEquals checks if the arrays of ints are the same
func NewECDSAKey ¶
func NewECDSAKey() (*ecdsa.PrivateKey, error)
NewECDSAKey generates a new ECDSA Key
func NewSelfSignedCert ¶
NewSelfSignedCert create a self signed certificate
func PKCS7Padding ¶
PKCS7Padding pads as prescribed by the PKCS7 standard
func PKCS7UnPadding ¶
PKCS7UnPadding unpads as prescribed by the PKCS7 standard
Types ¶
type ECDSASignature ¶
ECDSASignature represents an ECDSA signature