{"modulePath":"github.com/eric-erki/https-hyperledger.org","version":"v1.0.0-alpha","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package utils\n\n## Constants\n\n```go\nconst (\n\t// AESKeyLength is the default AES key length\n\tAESKeyLength = 32\n\n\t// NonceSize is the default NonceSize\n\tNonceSize = 24\n)\n```\n\n## Variables\n\n```go\nvar (\n\t// TCertEncTCertIndex oid for TCertIndex\n\tTCertEncTCertIndex = asn1.ObjectIdentifier{1, 2, 3, 4, 5, 6, 7}\n\n\t// TCertEncEnrollmentID is the ASN1 object identifier of the TCert index.\n\tTCertEncEnrollmentID = asn1.ObjectIdentifier{1, 2, 3, 4, 5, 6, 8}\n\n\t// TCertEncAttributesBase is the base ASN1 object identifier for attributes.\n\t// When generating an extension to include the attribute an index will be\n\t// appended to this Object Identifier.\n\tTCertEncAttributesBase = asn1.ObjectIdentifier{1, 2, 3, 4, 5, 6}\n\n\t// TCertAttributesHeaders is the ASN1 object identifier of attributes header.\n\tTCertAttributesHeaders = asn1.ObjectIdentifier{1, 2, 3, 4, 5, 6, 9}\n)\n```\n\n## Functions\n\n```go\nfunc AEStoEncryptedPEM(raw []byte, pwd []byte) ([]byte, error)\n```\nAEStoEncryptedPEM encapsulates an AES key in the encrypted PEM format\n\n```go\nfunc AEStoPEM(raw []byte) []byte\n```\nAEStoPEM encapsulates an AES key in the PEM format\n\n```go\nfunc CBCDecrypt(key, src []byte) ([]byte, error)\n```\nCBCDecrypt decrypts using CBC mode\n\n```go\nfunc CBCEncrypt(key, s []byte) ([]byte, error)\n```\nCBCEncrypt encrypts using CBC mode\n\n```go\nfunc CBCPKCS7Decrypt(key, src []byte) ([]byte, error)\n```\nCBCPKCS7Decrypt combines CBC decryption and PKCS7 unpadding\n\n```go\nfunc CBCPKCS7Encrypt(key, src []byte) ([]byte, error)\n```\nCBCPKCS7Encrypt combines CBC encryption and PKCS7 padding\n\n```go\nfunc DERToX509Certificate(asn1Data []byte) (*x509.Certificate, error)\n```\nDERToX509Certificate converts der to x509\n\n```go\nfunc ECDSASign(signKey interface{}, msg []byte) ([]byte, error)\n```\nECDSASign signs\n\n```go\nfunc GenAESKey() ([]byte, error)\n```\nGenAESKey returns a random AES key of length AESKeyLength\n\n```go\nfunc GetCriticalExtension(cert *x509.Certificate, oid asn1.ObjectIdentifier) ([]byte, error)\n```\nGetCriticalExtension returns a requested critical extension. It also remove it from the list of unhandled critical extensions\n\n```go\nfunc IntArrayEquals(a []int, b []int) bool\n```\nIntArrayEquals checks if the arrays of ints are the same\n\n```go\nfunc NewECDSAKey() (*ecdsa.PrivateKey, error)\n```\nNewECDSAKey generates a new ECDSA Key\n\n```go\nfunc NewSelfSignedCert() ([]byte, interface{}, error)\n```\nNewSelfSignedCert create a self signed certificate\n\n```go\nfunc PEMtoAES(raw []byte, pwd []byte) ([]byte, error)\n```\nPEMtoAES extracts from the PEM an AES key\n\n```go\nfunc PKCS7Padding(src []byte) []byte\n```\nPKCS7Padding pads as prescribed by the PKCS7 standard\n\n```go\nfunc PKCS7UnPadding(src []byte) ([]byte, error)\n```\nPKCS7UnPadding unpads as prescribed by the PKCS7 standard\n\n## Types\n\n```go\ntype ECDSASignature struct {\n\tR, S *big.Int\n}\n```\nECDSASignature represents an ECDSA signature\n\n","path":"github.com/eric-erki/https-hyperledger.org/accesscontrol/crypto/utils","name":"utils","synopsis":"","isRedistributable":true}
