Documentation
¶
Index ¶
- Constants
- type CipherData
- type CipherReference
- type Container
- type DSAKeyValue
- type DataReference
- type EncryptedData
- type EncryptedKey
- type Encryption
- type EncryptionMethod
- type EncryptionProperties
- type EncryptionProperty
- type FileEntry
- type KeyInfo
- type KeyReference
- type KeyValue
- type Link
- type Links
- type Manifest
- type MetaInf
- type Metadata
- type Method
- type OCFZipContainer
- func (z *OCFZipContainer) AddContainerXML(rootFiles ...string) (err error)
- func (z *OCFZipContainer) AddFile(filePath string, content []byte)
- func (z *OCFZipContainer) AddMimeType()
- func (z *OCFZipContainer) AddPackage(filename string, packageData pkg.Package) (err error)
- func (z *OCFZipContainer) AllFiles() map[string][]byte
- func (z *OCFZipContainer) Container() *Container
- func (z *OCFZipContainer) Encryption() *Encryption
- func (z *OCFZipContainer) Manifest() *Manifest
- func (z *OCFZipContainer) Metadata() *Metadata
- func (z *OCFZipContainer) MimeType() string
- func (z *OCFZipContainer) NonMetaInfFiles() map[string][]byte
- func (z *OCFZipContainer) Rights() *Rights
- func (z *OCFZipContainer) SelectFile(name string) (data []byte, err error)
- func (z *OCFZipContainer) Signatures() *Signatures
- func (z *OCFZipContainer) Write(filename string) (err error)
- type Object
- type RSAKeyValue
- type Reference
- type ReferenceList
- type Rights
- type RootFile
- type RootFiles
- type Signature
- type SignatureManifest
- type Signatures
- type SignedInfo
- type Transform
- type Transforms
- type X509Data
Constants ¶
const EPUBContainerMime = "application/oebps-package+xml"
const MimeType = "application/epub+zip"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CipherData ¶
type CipherData struct {
XMLName xml.Name `xml:"http://www.w3.org/2001/04/xmlenc# CipherData"`
CipherValue *string `xml:"http://www.w3.org/2001/04/xmlenc# CipherValue,omitempty"`
CipherReference *CipherReference `xml:"http://www.w3.org/2001/04/xmlenc# CipherReference,omitempty"`
}
CipherData represents the xenc:CipherData element
type CipherReference ¶
type CipherReference struct {
XMLName xml.Name `xml:"http://www.w3.org/2001/04/xmlenc# CipherReference"`
URI string `xml:"URI,attr"`
Transforms *Transforms `xml:"http://www.w3.org/2000/09/xmldsig# Transforms,omitempty"`
}
CipherReference represents the xenc:CipherReference element
type DSAKeyValue ¶
type DSAKeyValue struct {
P string `xml:"P,omitempty"`
Q string `xml:"Q,omitempty"`
G string `xml:"G,omitempty"`
Y string `xml:"Y,omitempty"`
}
DSAKeyValue represents DSA key parameters
type DataReference ¶
type DataReference struct {
XMLName xml.Name `xml:"http://www.w3.org/2001/04/xmlenc# DataReference"`
URI *string `xml:"URI,attr,omitempty"`
Id *string `xml:"Id,attr,omitempty"`
}
DataReference represents the xenc:DataReference element
type EncryptedData ¶
type EncryptedData struct {
XMLName xml.Name `xml:"http://www.w3.org/2001/04/xmlenc# EncryptedData"`
Id *string `xml:"Id,attr,omitempty"`
Type *string `xml:"Type,attr,omitempty"`
MimeType *string `xml:"MimeType,attr,omitempty"`
Encoding *string `xml:"Encoding,attr,omitempty"`
EncryptionMethod *EncryptionMethod `xml:"http://www.w3.org/2001/04/xmlenc# EncryptionMethod,omitempty"`
KeyInfo *KeyInfo `xml:"http://www.w3.org/2000/09/xmldsig# KeyInfo,omitempty"`
CipherData CipherData `xml:"http://www.w3.org/2001/04/xmlenc# CipherData"`
EncryptionProperties *EncryptionProperties `xml:"http://www.w3.org/2001/04/xmlenc# EncryptionProperties,omitempty"`
}
EncryptedData represents the xenc:EncryptedData element
type EncryptedKey ¶
type EncryptedKey struct {
XMLName xml.Name `xml:"http://www.w3.org/2001/04/xmlenc# EncryptedKey"`
Id *string `xml:"Id,attr,omitempty"`
Type *string `xml:"Type,attr,omitempty"`
MimeType *string `xml:"MimeType,attr,omitempty"`
Encoding *string `xml:"Encoding,attr,omitempty"`
Recipient *string `xml:"Recipient,attr,omitempty"`
EncryptionMethod *EncryptionMethod `xml:"http://www.w3.org/2001/04/xmlenc# EncryptionMethod"`
KeyInfo KeyInfo `xml:"http://www.w3.org/2000/09/xmldsig# KeyInfo"`
CipherData CipherData `xml:"http://www.w3.org/2001/04/xmlenc# CipherData"`
EncryptionProperties *EncryptionProperties `xml:"http://www.w3.org/2001/04/xmlenc# EncryptionProperties,omitempty"`
ReferenceList *ReferenceList `xml:"http://www.w3.org/2001/04/xmlenc# ReferenceList,omitempty"`
CarriedKeyName *string `xml:"http://www.w3.org/2001/04/xmlenc# CarriedKeyName,omitempty"`
}
EncryptedKey represents the xenc:EncryptedKey element
type Encryption ¶
type Encryption struct {
XMLName xml.Name `xml:"urn:oasis:names:tc:opendocument:xmlns:container encryption"`
EncryptedKey []EncryptedKey `xml:"http://www.w3.org/2001/04/xmlenc# EncryptedKey"`
EncryptedData []EncryptedData `xml:"http://www.w3.org/2001/04/xmlenc# EncryptedData"`
}
Encryption represents the root element of encryption.xml
type EncryptionMethod ¶
type EncryptionMethod struct {
XMLName xml.Name `xml:"http://www.w3.org/2001/04/xmlenc# EncryptionMethod"`
Algorithm string `xml:"Algorithm,attr"`
KeySize *int `xml:"http://www.w3.org/2001/04/xmlenc# KeySize,omitempty"`
OAEPparams *string `xml:"http://www.w3.org/2001/04/xmlenc# OAEPparams,omitempty"`
}
EncryptionMethod represents the xenc:EncryptionMethod element
type EncryptionProperties ¶
type EncryptionProperties struct {
XMLName xml.Name `xml:"http://www.w3.org/2001/04/xmlenc# EncryptionProperties"`
Id *string `xml:"Id,attr,omitempty"`
EncryptionProperty []EncryptionProperty `xml:"http://www.w3.org/2001/04/xmlenc# EncryptionProperty"`
}
EncryptionProperties represents the xenc:EncryptionProperties element
type EncryptionProperty ¶
type EncryptionProperty struct {
XMLName xml.Name `xml:"http://www.w3.org/2001/04/xmlenc# EncryptionProperty"`
Target *string `xml:"Target,attr,omitempty"`
Id *string `xml:"Id,attr,omitempty"`
}
EncryptionProperty represents the xenc:EncryptionProperty element
type KeyInfo ¶
type KeyInfo struct {
XMLName xml.Name `xml:"http://www.w3.org/2000/09/xmldsig# KeyInfo"`
// KeyInfo can contain various elements - this is a basic implementation
// You may need to extend this based on your specific needs
X509Data *X509Data `xml:"http://www.w3.org/2000/09/xmldsig# X509Data,omitempty"`
KeyName *string `xml:"http://www.w3.org/2000/09/xmldsig# KeyName,omitempty"`
KeyValue *KeyValue `xml:"http://www.w3.org/2000/09/xmldsig# KeyValue,omitempty"`
}
KeyInfo represents the ds:KeyInfo element
type KeyReference ¶
type KeyReference struct {
XMLName xml.Name `xml:"http://www.w3.org/2001/04/xmlenc# KeyReference"`
URI *string `xml:"URI,attr,omitempty"`
Id *string `xml:"Id,attr,omitempty"`
}
KeyReference represents the xenc:KeyReference element
type KeyValue ¶
type KeyValue struct {
XMLName xml.Name `xml:"http://www.w3.org/2000/09/xmldsig# KeyValue"`
RSAKeyValue *RSAKeyValue `xml:"http://www.w3.org/2000/09/xmldsig# RSAKeyValue,omitempty"`
}
KeyValue represents the ds:KeyValue element
type Link ¶
type Link struct {
Href string `xml:"href,attr"`
MediaType string `xml:"media-type,attr,omitempty"`
Rel string `xml:"rel,attr"`
}
Link represents a link element
type Metadata ¶
type Metadata struct {
XMLName xml.Name `xml:"http://www.idpf.org/2013/metadata metadata"`
// Content is flexible since this version doesn't define specific metadata
// Using Any to allow any namespace-qualified elements
Any []xml.Name `xml:",any"`
}
Metadata represents the container-level metadata file Root element: metadata in namespace http://www.idpf.org/2013/metadata
type Method ¶
type Method struct {
Algorithm string `xml:"Algorithm,attr"`
}
Method represents algorithm methods
type OCFZipContainer ¶
type OCFZipContainer struct {
// contains filtered or unexported fields
}
func NewOCFZipContainer ¶ added in v0.2.0
func NewOCFZipContainer() *OCFZipContainer
func NewReader ¶
func NewReader(b []byte) (container *OCFZipContainer, err error)
func OpenReader ¶
func OpenReader(name string) (container *OCFZipContainer, err error)
func (*OCFZipContainer) AddContainerXML ¶ added in v0.2.0
func (z *OCFZipContainer) AddContainerXML(rootFiles ...string) (err error)
func (*OCFZipContainer) AddFile ¶ added in v0.2.0
func (z *OCFZipContainer) AddFile(filePath string, content []byte)
func (*OCFZipContainer) AddMimeType ¶ added in v0.2.0
func (z *OCFZipContainer) AddMimeType()
func (*OCFZipContainer) AddPackage ¶ added in v0.2.0
func (z *OCFZipContainer) AddPackage(filename string, packageData pkg.Package) (err error)
func (*OCFZipContainer) AllFiles ¶
func (z *OCFZipContainer) AllFiles() map[string][]byte
func (*OCFZipContainer) Container ¶
func (z *OCFZipContainer) Container() *Container
func (*OCFZipContainer) Encryption ¶
func (z *OCFZipContainer) Encryption() *Encryption
func (*OCFZipContainer) Manifest ¶
func (z *OCFZipContainer) Manifest() *Manifest
func (*OCFZipContainer) Metadata ¶
func (z *OCFZipContainer) Metadata() *Metadata
func (*OCFZipContainer) MimeType ¶
func (z *OCFZipContainer) MimeType() string
func (*OCFZipContainer) NonMetaInfFiles ¶
func (z *OCFZipContainer) NonMetaInfFiles() map[string][]byte
func (*OCFZipContainer) Rights ¶
func (z *OCFZipContainer) Rights() *Rights
func (*OCFZipContainer) SelectFile ¶
func (z *OCFZipContainer) SelectFile(name string) (data []byte, err error)
func (*OCFZipContainer) Signatures ¶
func (z *OCFZipContainer) Signatures() *Signatures
func (*OCFZipContainer) Write ¶ added in v0.2.0
func (z *OCFZipContainer) Write(filename string) (err error)
type Object ¶
type Object struct {
Manifest SignatureManifest `xml:"Manifest,omitempty"`
}
Object contains additional data like Manifest
type RSAKeyValue ¶
type RSAKeyValue struct {
XMLName xml.Name `xml:"http://www.w3.org/2000/09/xmldsig# RSAKeyValue"`
Modulus string `xml:"http://www.w3.org/2000/09/xmldsig# Modulus"`
Exponent string `xml:"http://www.w3.org/2000/09/xmldsig# Exponent"`
}
RSAKeyValue represents the ds:RSAKeyValue element
type Reference ¶
type Reference struct {
URI string `xml:"URI,attr,omitempty"`
Transforms *Transforms `xml:"Transforms,omitempty"`
DigestMethod Method `xml:"DigestMethod"`
DigestValue string `xml:"DigestValue"`
}
Reference represents a reference to signed data
type ReferenceList ¶
type ReferenceList struct {
XMLName xml.Name `xml:"http://www.w3.org/2001/04/xmlenc# ReferenceList"`
DataReference []DataReference `xml:"http://www.w3.org/2001/04/xmlenc# DataReference,omitempty"`
KeyReference []KeyReference `xml:"http://www.w3.org/2001/04/xmlenc# KeyReference,omitempty"`
}
ReferenceList represents the xenc:ReferenceList element
type Rights ¶
type Rights struct {
XMLName xml.Name `xml:"rights"`
// Since the structure is reserved but not defined, use flexible content
Content any `xml:",innerxml"` // Store raw XML for rights expressions
}
Rights represents the rights management file The structure is not defined in this specification version
type RootFile ¶
type RootFile struct {
FullPath string `xml:"full-path,attr"`
MediaType string `xml:"media-type,attr"`
Media string `xml:"http://www.idpf.org/2013/rendition media,attr,omitempty"`
Layout string `xml:"http://www.idpf.org/2013/rendition layout,attr,omitempty"`
Language string `xml:"http://www.idpf.org/2013/rendition language,attr,omitempty"`
AccessMode string `xml:"http://www.idpf.org/2013/rendition accessMode,attr,omitempty"`
Label string `xml:"http://www.idpf.org/2013/rendition label,attr,omitempty"`
}
RootFile represents a rootfile element
type RootFiles ¶
type RootFiles struct {
RootFile []RootFile `xml:"rootfile"`
}
RootFiles represents the rootfiles element
type Signature ¶
type Signature struct {
ID string `xml:"Id,attr,omitempty"`
SignedInfo SignedInfo `xml:"SignedInfo"`
SignatureValue string `xml:"SignatureValue"`
KeyInfo KeyInfo `xml:"KeyInfo,omitempty"`
Object []Object `xml:"Object,omitempty"`
}
Signature represents an XML Signature as defined by xmldsig-core1
type SignatureManifest ¶
type SignatureManifest struct {
ID string `xml:"Id,attr,omitempty"`
Reference []Reference `xml:"Reference"`
}
Manifest contains references to the signed resources
type Signatures ¶
type SignedInfo ¶
type SignedInfo struct {
CanonicalizationMethod Method `xml:"CanonicalizationMethod"`
SignatureMethod Method `xml:"SignatureMethod"`
Reference []Reference `xml:"Reference"`
}
SignedInfo contains the canonicalization method, signature method, and references
type Transform ¶
type Transform struct {
XMLName xml.Name `xml:"http://www.w3.org/2000/09/xmldsig# Transform"`
Algorithm string `xml:"Algorithm,attr"`
}
Transform represents the ds:Transform element
type Transforms ¶
type Transforms struct {
XMLName xml.Name `xml:"http://www.w3.org/2000/09/xmldsig# Transforms"`
Transform []Transform `xml:"http://www.w3.org/2000/09/xmldsig# Transform"`
}
Transforms represents the ds:Transforms element
type X509Data ¶
type X509Data struct {
XMLName xml.Name `xml:"http://www.w3.org/2000/09/xmldsig# X509Data"`
X509Certificate *string `xml:"http://www.w3.org/2000/09/xmldsig# X509Certificate,omitempty"`
X509SubjectName *string `xml:"http://www.w3.org/2000/09/xmldsig# X509SubjectName,omitempty"`
}
X509Data represents the ds:X509Data element