Documentation
¶
Overview ¶
Ported from dss-model/.../AbstractSerializableSignatureParameters.java (DSS 6.5.RC1).
Ported from dss-model/.../BLevelParameters.java (DSS 6.5.RC1).
Ported from dss-model/src/main/java/eu/europa/esig/dss/model/x509/CertificateToken.java (DSS 6.5.RC1).
Ported from dss-model/src/main/java/eu/europa/esig/dss/model/identifier/CertificateTokenIdentifier.java (DSS 6.5.RC1).
Ported from dss-model/.../CommitmentQualifier.java (DSS 6.5.RC1).
Ported from dss-model/.../CommonCommitmentType.java (DSS 6.5.RC1).
Ported from dss-model/.../CommonDocument.java (DSS 6.5.RC1).
Ported from dss-model/.../CommonObjectIdentifier.java (DSS 6.5.RC1).
Ported from dss-model/.../ContainerInfo.java (DSS 6.5.RC1).
Ported from dss-model/src/main/java/eu/europa/esig/dss/model/identifier/DataIdentifier.java (DSS 6.5.RC1).
Ported from dss-model/.../Digest.java (DSS 6.5.RC1).
Ported from dss-model/.../DigestDocument.java (DSS 6.5.RC1).
Package model ports dss-model (eu.europa.esig.dss.model), the core value objects and interfaces every other package in this module builds on: the DSSDocument abstraction for in-memory/on-disk/streamed content, digest and signature value wrappers, certificate/revocation token types, and the signature/timestamp parameter hierarchies signing services consume.
The main entry types are DSSDocument and its implementations (InMemoryDocument, FileDocument, DigestDocument), CertificateToken and the Token/TokenBase interfaces, Digest and DSSMessageDigest, and the AbstractSerializableSignatureParameters/SerializableTimestampParameters family that per-format packages (cades, xades, ...) extend.
Subpackages group model types by concern: model/policy (cryptographic suite and certificate applicability rules), model/scope (signature scopes), model/signature (signature-level value objects such as SignaturePolicy), model/timedependent (time-varying value containers), model/tsl and model/lote (trusted-list and List of Trusted Entities identifiers), model/job (validation job info records), model/http (HTTP response envelopes), and model/tls (TLS certificate chains).
Ported from dss-model/.../DSSDocument.java (DSS 6.5.RC1).
Ported from dss-model/.../DSSException.java (DSS 6.5.RC1).
Ported from dss-model/.../DSSMessageDigest.java (DSS 6.5.RC1).
Ported from dss-model/src/main/java/eu/europa/esig/dss/model/identifier/EncapsulatedRevocationTokenIdentifier.java (DSS 6.5.RC1).
Ported from dss-model/src/main/java/eu/europa/esig/dss/model/identifier/EntityIdentifier.java (DSS 6.5.RC1).
Ported from dss-model/src/main/java/eu/europa/esig/dss/model/identifier/EntityIdentifierBuilder.java (DSS 6.5.RC1).
Ported from dss-model/.../FileDocument.java (DSS 6.5.RC1).
Ported from dss-model/src/main/java/eu/europa/esig/dss/model/identifier/Identifier.java (DSS 6.5.RC1).
Ported from dss-model/src/main/java/eu/europa/esig/dss/model/identifier/IdentifierBasedObject.java (DSS 6.5.RC1).
Ported from dss-model/src/main/java/eu/europa/esig/dss/model/identifier/IdentifierBuilder.java (DSS 6.5.RC1).
Ported from dss-model/.../InMemoryDocument.java (DSS 6.5.RC1).
Ported from dss-model/src/main/java/eu/europa/esig/dss/model/identifier/KeyIdentifier.java (DSS 6.5.RC1).
Ported from dss-model/.../ManifestEntry.java (DSS 6.5.RC1).
Ported from dss-model/.../ManifestFile.java (DSS 6.5.RC1).
Ported from dss-model/src/main/java/eu/europa/esig/dss/model/identifier/MultipleDigestIdentifier.java (DSS 6.5.RC1).
Ported from dss-model/.../OidRepository.java (DSS 6.5.RC1).
Ported from dss-model/src/main/java/eu/europa/esig/dss/model/identifier/OriginalIdentifierProvider.java (DSS 6.5.RC1).
Ported from dss-model/.../Policy.java (DSS 6.5.RC1).
Ported from the JDK types dss-model depends on: java.security.Key and java.security.PublicKey, as used by dss-model/.../x509/Token.java, x509/CertificateToken.java, identifier/KeyIdentifier.java and identifier/EntityIdentifierBuilder.java (DSS 6.5.RC1).
dss-model only ever asks a key for its encoded form and compares two keys, so this port carries the encoded form verbatim. That matters: EntityIdentifier digests the encoding, and a Go re-encoding through x509.MarshalPKIXPublicKey is not guaranteed to reproduce the SubjectPublicKeyInfo bytes that were parsed, which would change the identifier.
Ported from dss-model/.../ReferenceValidation.java (DSS 6.5.RC1).
Ported from dss-model/.../SerializableCounterSignatureParameters.java (DSS 6.5.RC1).
Ported from dss-model/.../SerializableEvidenceRecordIncorporationParameters.java (DSS 6.5.RC1).
Ported from dss-model/.../SerializableSignatureParameters.java (DSS 6.5.RC1).
Ported from dss-model/.../SerializableTimestampParameters.java (DSS 6.5.RC1).
Ported from dss-model/.../SignatureParametersBuilder.java (DSS 6.5.RC1).
Ported from dss-model/.../SignaturePolicyStore.java (DSS 6.5.RC1).
Ported from dss-model/.../SignatureValue.java (DSS 6.5.RC1).
Ported from dss-model/.../SignerLocation.java (DSS 6.5.RC1).
Ported from dss-model/.../SpDocSpecification.java (DSS 6.5.RC1).
Ported from dss-model/.../TimestampBinary.java (DSS 6.5.RC1).
Ported from dss-model/.../TimestampParameters.java (DSS 6.5.RC1).
Ported from dss-model/.../ToBeSigned.java (DSS 6.5.RC1).
Ported from dss-model/src/main/java/eu/europa/esig/dss/model/x509/Token.java (DSS 6.5.RC1).
Ported from dss-model/src/main/java/eu/europa/esig/dss/model/x509/TokenComparator.java (DSS 6.5.RC1).
Ported from dss-model/src/main/java/eu/europa/esig/dss/model/identifier/TokenIdentifier.java (DSS 6.5.RC1).
Ported from dss-model/src/main/java/eu/europa/esig/dss/model/identifier/TokenIdentifierProvider.java (DSS 6.5.RC1).
Ported from dss-model/.../UserNotice.java (DSS 6.5.RC1).
Ported from dss-model/src/main/java/eu/europa/esig/dss/model/identifier/X500NameIdentifier.java (DSS 6.5.RC1).
Ported from JDK javax.security.auth.x500.X500Principal and its sun.security.x509 backing classes (X500Name, RDN, AVA) of JDK 21, as required by dss-model/src/main/java/eu/europa/esig/dss/model/x509/X500PrincipalHelper.java (DSS 6.5.RC1).
dss-model exposes the CANONICAL and RFC2253 string forms of a distinguished name (X500PrincipalHelper#getCanonical / #getRFC2253 / #getPrettyPrintRFC2253) and those strings end up verbatim in DSS reports and in identity comparisons, so the JDK algorithms are reproduced here instead of being approximated with crypto/x509/pkix (whose pkix.Name.String() uses a different, incompatible syntax). The DER given to the constructor is kept byte-for-byte and is never re-encoded.
Ported from dss-model/src/main/java/eu/europa/esig/dss/model/x509/X500PrincipalHelper.java (DSS 6.5.RC1).
Index ¶
- Constants
- Variables
- func OidRepositoryGetDescription(oid string) string
- type AbstractSerializableSignatureParameters
- func (p *AbstractSerializableSignatureParameters[TP]) BLevel() *BLevelParameters
- func (p *AbstractSerializableSignatureParameters[TP]) CheckCertificateRevocation() bool
- func (p *AbstractSerializableSignatureParameters[TP]) DigestAlgorithm() enumerations.DigestAlgorithm
- func (p *AbstractSerializableSignatureParameters[TP]) EncryptionAlgorithm() enumerations.EncryptionAlgorithm
- func (p *AbstractSerializableSignatureParameters[TP]) Equals(other *AbstractSerializableSignatureParameters[TP]) bool
- func (p *AbstractSerializableSignatureParameters[TP]) GenerateTBSWithoutCertificate() bool
- func (p *AbstractSerializableSignatureParameters[TP]) GetArchiveTimestampParameters() TP
- func (p *AbstractSerializableSignatureParameters[TP]) GetContentTimestampParameters() TP
- func (p *AbstractSerializableSignatureParameters[TP]) GetSignatureTimestampParameters() TP
- func (p *AbstractSerializableSignatureParameters[TP]) ReferenceDigestAlgorithm() enumerations.DigestAlgorithm
- func (p *AbstractSerializableSignatureParameters[TP]) SetArchiveTimestampParameters(archiveTimestampParameters TP)
- func (p *AbstractSerializableSignatureParameters[TP]) SetBLevelParams(bLevelParams *BLevelParameters)
- func (p *AbstractSerializableSignatureParameters[TP]) SetCheckCertificateRevocation(checkCertificateRevocation bool)
- func (p *AbstractSerializableSignatureParameters[TP]) SetContentTimestampParameters(contentTimestampParameters TP)
- func (p *AbstractSerializableSignatureParameters[TP]) SetDigestAlgorithm(digestAlgorithm enumerations.DigestAlgorithm)
- func (p *AbstractSerializableSignatureParameters[TP]) SetEncryptionAlgorithm(encryptionAlgorithm enumerations.EncryptionAlgorithm)
- func (p *AbstractSerializableSignatureParameters[TP]) SetGenerateTBSWithoutCertificate(generateTBSWithoutCertificate bool)
- func (p *AbstractSerializableSignatureParameters[TP]) SetReferenceDigestAlgorithm(referenceDigestAlgorithm enumerations.DigestAlgorithm)
- func (p *AbstractSerializableSignatureParameters[TP]) SetSignatureLevel(signatureLevel enumerations.SignatureLevel)
- func (p *AbstractSerializableSignatureParameters[TP]) SetSignaturePackaging(signaturePackaging enumerations.SignaturePackaging)
- func (p *AbstractSerializableSignatureParameters[TP]) SetSignatureTimestampParameters(signatureTimestampParameters TP)
- func (p *AbstractSerializableSignatureParameters[TP]) SetValidationDataEncapsulationStrategy(...)
- func (p *AbstractSerializableSignatureParameters[TP]) SignatureAlgorithm() enumerations.SignatureAlgorithm
- func (p *AbstractSerializableSignatureParameters[TP]) SignatureLevel() enumerations.SignatureLevel
- func (p *AbstractSerializableSignatureParameters[TP]) SignaturePackaging() enumerations.SignaturePackaging
- func (p *AbstractSerializableSignatureParameters[TP]) String() string
- func (p *AbstractSerializableSignatureParameters[TP]) ValidationDataEncapsulationStrategy() enumerations.ValidationDataEncapsulationStrategy
- type BLevelParameters
- func (b *BLevelParameters) ClaimedSignerRoles() []string
- func (b *BLevelParameters) CommitmentTypeIndications() []enumerations.CommitmentType
- func (b *BLevelParameters) Equals(other *BLevelParameters) bool
- func (b *BLevelParameters) IsTrustAnchorBPPolicy() bool
- func (b *BLevelParameters) SetClaimedSignerRoles(claimedSignerRoles []string)
- func (b *BLevelParameters) SetCommitmentTypeIndications(commitmentTypeIndications []enumerations.CommitmentType)
- func (b *BLevelParameters) SetSignaturePolicy(signaturePolicy *Policy)
- func (b *BLevelParameters) SetSignedAssertions(signedAssertions []string)
- func (b *BLevelParameters) SetSignerLocation(signerLocation *SignerLocation)
- func (b *BLevelParameters) SetSigningDate(signingDate *time.Time)
- func (b *BLevelParameters) SetTrustAnchorBPPolicy(trustAnchorBPPolicy bool)
- func (b *BLevelParameters) SignaturePolicy() *Policy
- func (b *BLevelParameters) SignedAssertions() []string
- func (b *BLevelParameters) SignerLocation() *SignerLocation
- func (b *BLevelParameters) SigningDate() *time.Time
- func (b *BLevelParameters) String() string
- type CertificateToken
- func (c *CertificateToken) Abbreviation() string
- func (c *CertificateToken) BuildTokenIdentifier() *TokenIdentifier
- func (c *CertificateToken) Certificate() *x509.Certificate
- func (c *CertificateToken) CheckIsSignedBy(publicKey *PublicKey) enumerations.SignatureValidity
- func (c *CertificateToken) CheckKeyUsage(keyUsageBit enumerations.KeyUsageBit) bool
- func (c *CertificateToken) CreationDate() time.Time
- func (c *CertificateToken) Encoded() []byte
- func (c *CertificateToken) EntityKey() *EntityIdentifier
- func (c *CertificateToken) Equals(other *CertificateToken) bool
- func (c *CertificateToken) IsCA() bool
- func (c *CertificateToken) IsEquivalent(token *CertificateToken) bool
- func (c *CertificateToken) IsSelfIssued() bool
- func (c *CertificateToken) IsSelfSigned() bool
- func (c *CertificateToken) IsValidOn(date time.Time) bool
- func (c *CertificateToken) Issuer() *X500PrincipalHelper
- func (c *CertificateToken) IssuerEntityKey() *EntityIdentifier
- func (c *CertificateToken) IssuerX500Principal() *X500Principal
- func (c *CertificateToken) KeyUsageBits() []enumerations.KeyUsageBit
- func (c *CertificateToken) NotAfter() time.Time
- func (c *CertificateToken) NotBefore() time.Time
- func (c *CertificateToken) PathLenConstraint() int
- func (c *CertificateToken) PublicKey() *PublicKey
- func (c *CertificateToken) SerialNumber() *big.Int
- func (c *CertificateToken) SetSourceURL(sourceURL string)
- func (c *CertificateToken) Signature() []byte
- func (c *CertificateToken) SourceURL() string
- func (c *CertificateToken) String() string
- func (c *CertificateToken) Subject() *X500PrincipalHelper
- func (c *CertificateToken) ToString(indentStr string) string
- type CertificateTokenIdentifier
- type CommitmentQualifier
- type CommonCommitmentType
- func (c *CommonCommitmentType) CommitmentTypeQualifiers() []*CommitmentQualifier
- func (c *CommonCommitmentType) SetCommitmentTypeQualifiers(commitmentTypeQualifiers ...*CommitmentQualifier)
- func (c *CommonCommitmentType) SetSignedDataObjects(signedDataObjects ...string)
- func (c *CommonCommitmentType) SignedDataObjects() []string
- type CommonDocument
- type CommonObjectIdentifier
- func (c *CommonObjectIdentifier) Description() string
- func (c *CommonObjectIdentifier) DocumentationReferences() []string
- func (c *CommonObjectIdentifier) OID() string
- func (c *CommonObjectIdentifier) Qualifier() enumerations.ObjectIdentifierQualifier
- func (c *CommonObjectIdentifier) SetDescription(description string)
- func (c *CommonObjectIdentifier) SetDocumentationReferences(documentationReferences ...string)
- func (c *CommonObjectIdentifier) SetOid(oid string)
- func (c *CommonObjectIdentifier) SetQualifier(qualifier enumerations.ObjectIdentifierQualifier)
- func (c *CommonObjectIdentifier) SetUri(uri string)
- func (c *CommonObjectIdentifier) URI() string
- type ContainerInfo
- func (c *ContainerInfo) ContainerType() enumerations.ASiCContainerType
- func (c *ContainerInfo) IsMimeTypeFilePresent() bool
- func (c *ContainerInfo) ManifestFiles() []*ManifestFile
- func (c *ContainerInfo) MimeTypeContent() string
- func (c *ContainerInfo) SetContainerType(containerType enumerations.ASiCContainerType)
- func (c *ContainerInfo) SetManifestFiles(manifestFiles []*ManifestFile)
- func (c *ContainerInfo) SetMimeTypeContent(mimeTypeContent string)
- func (c *ContainerInfo) SetSignedDocumentFilenames(signedDocumentFilenames []string)
- func (c *ContainerInfo) SetZipComment(zipComment string)
- func (c *ContainerInfo) SignedDocumentFilenames() []string
- func (c *ContainerInfo) ZipComment() string
- type DSSDocument
- type DSSError
- type DSSMessageDigest
- type DataIdentifier
- type Digest
- func (d Digest) Algorithm() enumerations.DigestAlgorithm
- func (d Digest) Base64Value() string
- func (d Digest) Equals(other Digest) bool
- func (d Digest) HexValue() string
- func (d Digest) IsEmpty() bool
- func (d *Digest) SetAlgorithm(algorithm enumerations.DigestAlgorithm)
- func (d *Digest) SetValue(value []byte)
- func (d Digest) String() string
- func (d Digest) Value() []byte
- type DigestDocument
- func NewDigestDocument() *DigestDocument
- func NewDigestDocumentFromBase64(digestAlgorithm enumerations.DigestAlgorithm, base64EncodeDigest string) *DigestDocument
- func NewDigestDocumentFromBase64WithMimeType(digestAlgorithm enumerations.DigestAlgorithm, base64EncodeDigest string, ...) *DigestDocument
- func NewDigestDocumentFromBase64WithName(digestAlgorithm enumerations.DigestAlgorithm, base64EncodeDigest string, ...) *DigestDocument
- func NewDigestDocumentFromDigest(digest Digest) *DigestDocument
- func NewDigestDocumentFromDigestWithMimeType(digest Digest, name string, mimeType enumerations.MimeType) *DigestDocument
- func NewDigestDocumentFromDigestWithName(digest Digest, name string) *DigestDocument
- func NewDigestDocumentFromValue(digestAlgorithm enumerations.DigestAlgorithm, digestValue []byte) *DigestDocument
- func NewDigestDocumentFromValueWithMimeType(digestAlgorithm enumerations.DigestAlgorithm, digestValue []byte, name string, ...) *DigestDocument
- func NewDigestDocumentFromValueWithName(digestAlgorithm enumerations.DigestAlgorithm, digestValue []byte, name string) *DigestDocument
- func (d *DigestDocument) AddDigest(digest Digest)
- func (d *DigestDocument) AddDigestBase64(digestAlgorithm enumerations.DigestAlgorithm, base64EncodeDigest string) error
- func (d *DigestDocument) AddDigestValue(digestAlgorithm enumerations.DigestAlgorithm, digestValue []byte)
- func (d *DigestDocument) Digest(digestAlgorithm enumerations.DigestAlgorithm) (Digest, error)
- func (d *DigestDocument) DigestValue(digestAlgorithm enumerations.DigestAlgorithm) ([]byte, error)
- func (d *DigestDocument) Equals(other *DigestDocument) bool
- func (d *DigestDocument) ExistingDigest() (Digest, error)
- func (d *DigestDocument) OpenStream() (io.ReadCloser, error)
- func (d *DigestDocument) Save(filePath string) error
- func (d *DigestDocument) WriteTo(w io.Writer) (int64, error)
- type EncapsulatedRevocationTokenIdentifier
- type EntityIdentifier
- type EntityIdentifierBuilder
- type FileDocument
- func (d *FileDocument) AbsolutePath() string
- func (d *FileDocument) Digest(digestAlgorithm enumerations.DigestAlgorithm) (Digest, error)
- func (d *FileDocument) DigestValue(digestAlgorithm enumerations.DigestAlgorithm) ([]byte, error)
- func (d *FileDocument) Equals(other *FileDocument) bool
- func (d *FileDocument) Exists() bool
- func (d *FileDocument) OpenStream() (io.ReadCloser, error)
- func (d *FileDocument) Path() string
- func (d *FileDocument) Save(filePath string) error
- func (d *FileDocument) WriteTo(w io.Writer) (int64, error)
- type Identifier
- type IdentifierBase
- func (i *IdentifierBase) AsXmlID() string
- func (i *IdentifierBase) DigestID() Digest
- func (i *IdentifierBase) Equals(other Identifier) bool
- func (i *IdentifierBase) MessageDigest(digestAlgorithm enumerations.DigestAlgorithm) (hash.Hash, error)
- func (i *IdentifierBase) Prefix() string
- func (i *IdentifierBase) String() string
- type IdentifierBasedObject
- type IdentifierBuilder
- type InMemoryDocument
- func CreateEmptyDocument() *InMemoryDocument
- func NewInMemoryDocument(data []byte) *InMemoryDocument
- func NewInMemoryDocumentFromStream(r io.Reader) (*InMemoryDocument, error)
- func NewInMemoryDocumentFromStreamWithMimeType(r io.Reader, name string, mimeType enumerations.MimeType) (*InMemoryDocument, error)
- func NewInMemoryDocumentFromStreamWithName(r io.Reader, name string) (*InMemoryDocument, error)
- func NewInMemoryDocumentWithMimeType(data []byte, name string, mimeType enumerations.MimeType) *InMemoryDocument
- func NewInMemoryDocumentWithName(data []byte, name string) *InMemoryDocument
- func (d *InMemoryDocument) Base64Encoded() string
- func (d *InMemoryDocument) Bytes() []byte
- func (d *InMemoryDocument) Digest(digestAlgorithm enumerations.DigestAlgorithm) (Digest, error)
- func (d *InMemoryDocument) DigestValue(digestAlgorithm enumerations.DigestAlgorithm) ([]byte, error)
- func (d *InMemoryDocument) Equals(other *InMemoryDocument) bool
- func (d *InMemoryDocument) OpenStream() (io.ReadCloser, error)
- func (d *InMemoryDocument) Save(filePath string) error
- func (d *InMemoryDocument) SetBytes(data []byte)
- func (d *InMemoryDocument) WriteTo(w io.Writer) (int64, error)
- type Key
- type KeyIdentifier
- type ManifestEntry
- func (m *ManifestEntry) Digest() Digest
- func (m *ManifestEntry) Document() DSSDocument
- func (m *ManifestEntry) IsFound() bool
- func (m *ManifestEntry) IsIntact() bool
- func (m *ManifestEntry) IsRootfile() bool
- func (m *ManifestEntry) MimeType() enumerations.MimeType
- func (m *ManifestEntry) SetDigest(digest Digest)
- func (m *ManifestEntry) SetDocument(document DSSDocument)
- func (m *ManifestEntry) SetDocumentName(documentName string)
- func (m *ManifestEntry) SetFound(found bool)
- func (m *ManifestEntry) SetIntact(intact bool)
- func (m *ManifestEntry) SetMimeType(mimeType enumerations.MimeType)
- func (m *ManifestEntry) SetRootfile(rootfile bool)
- func (m *ManifestEntry) SetUri(uri string)
- func (m *ManifestEntry) Uri() string
- type ManifestFile
- func (m *ManifestFile) DigestValue(digestAlgorithm enumerations.DigestAlgorithm) ([]byte, error)
- func (m *ManifestFile) Document() DSSDocument
- func (m *ManifestFile) Entries() []*ManifestEntry
- func (m *ManifestFile) Filename() string
- func (m *ManifestFile) IsDocumentCovered(documentName string) bool
- func (m *ManifestFile) ManifestType() enumerations.ASiCManifestTypeEnum
- func (m *ManifestFile) RootFile() *ManifestEntry
- func (m *ManifestFile) SetDocument(document DSSDocument)
- func (m *ManifestFile) SetEntries(entries []*ManifestEntry)
- func (m *ManifestFile) SetManifestType(manifestType enumerations.ASiCManifestTypeEnum)
- func (m *ManifestFile) SetSignatureFilename(signatureFilename string)
- func (m *ManifestFile) SignatureFilename() string
- type MultipleDigestIdentifier
- type OriginalIdentifierProvider
- type Policy
- func (p *Policy) Description() string
- func (p *Policy) DigestAlgorithm() enumerations.DigestAlgorithm
- func (p *Policy) DigestValue() []byte
- func (p *Policy) DocumentationReferences() []string
- func (p *Policy) Equals(other *Policy) bool
- func (p *Policy) Id() string
- func (p *Policy) IsEmpty() bool
- func (p *Policy) IsHashAsInTechnicalSpecification() bool
- func (p *Policy) IsSPQualifierPresent() bool
- func (p *Policy) Qualifier() enumerations.ObjectIdentifierQualifier
- func (p *Policy) SetDescription(description string)
- func (p *Policy) SetDigestAlgorithm(digestAlgorithm enumerations.DigestAlgorithm)
- func (p *Policy) SetDigestValue(digestValue []byte)
- func (p *Policy) SetDocumentationReferences(documentationReferences ...string)
- func (p *Policy) SetHashAsInTechnicalSpecification(hashAsInTechnicalSpecification bool)
- func (p *Policy) SetId(id string)
- func (p *Policy) SetQualifier(qualifier enumerations.ObjectIdentifierQualifier)
- func (p *Policy) SetSpDocSpecification(spDocSpecification *SpDocSpecification)
- func (p *Policy) SetSpuri(spUri string)
- func (p *Policy) SetUserNotice(userNotice *UserNotice)
- func (p *Policy) SpDocSpecification() *SpDocSpecification
- func (p *Policy) Spuri() string
- func (p *Policy) String() string
- func (p *Policy) UserNotice() *UserNotice
- type PublicKey
- type ReferenceValidation
- func (r *ReferenceValidation) AddDependentValidations(dependentValidations ...*ReferenceValidation)
- func (r *ReferenceValidation) DataObjectReferences() []string
- func (r *ReferenceValidation) DependentValidations() []*ReferenceValidation
- func (r *ReferenceValidation) Digest() Digest
- func (r *ReferenceValidation) Document() DSSDocument
- func (r *ReferenceValidation) ErrorMessages() []string
- func (r *ReferenceValidation) Id() string
- func (r *ReferenceValidation) IsDuplicated() bool
- func (r *ReferenceValidation) IsFound() bool
- func (r *ReferenceValidation) IsIntact() bool
- func (r *ReferenceValidation) SetDataObjectReferences(dataObjectReferences []string)
- func (r *ReferenceValidation) SetDigest(digest Digest)
- func (r *ReferenceValidation) SetDocument(document DSSDocument)
- func (r *ReferenceValidation) SetDuplicated(isDuplicated bool)
- func (r *ReferenceValidation) SetErrorMessages(errorMessages []string)
- func (r *ReferenceValidation) SetFound(found bool)
- func (r *ReferenceValidation) SetId(id string)
- func (r *ReferenceValidation) SetIntact(intact bool)
- func (r *ReferenceValidation) SetTransformationNames(transforms []string)
- func (r *ReferenceValidation) SetType(typ enumerations.DigestMatcherType)
- func (r *ReferenceValidation) SetUri(uri string)
- func (r *ReferenceValidation) TransformationNames() []string
- func (r *ReferenceValidation) Type() enumerations.DigestMatcherType
- func (r *ReferenceValidation) Uri() string
- type SerializableCounterSignatureParameters
- type SerializableEvidenceRecordIncorporationParameters
- type SerializableSignatureParameters
- type SerializableTimestampParameters
- type SignatureParametersBuilder
- type SignaturePolicyStore
- func (s *SignaturePolicyStore) Id() string
- func (s *SignaturePolicyStore) SetId(id string)
- func (s *SignaturePolicyStore) SetSigPolDocLocalURI(sigPolDocLocalURI string)
- func (s *SignaturePolicyStore) SetSignaturePolicyContent(signaturePolicyContent DSSDocument)
- func (s *SignaturePolicyStore) SetSpDocSpecification(spDocSpecification *SpDocSpecification)
- func (s *SignaturePolicyStore) SigPolDocLocalURI() string
- func (s *SignaturePolicyStore) SignaturePolicyContent() DSSDocument
- func (s *SignaturePolicyStore) SpDocSpecification() *SpDocSpecification
- type SignatureValue
- func (s *SignatureValue) Algorithm() enumerations.SignatureAlgorithm
- func (s *SignatureValue) Equals(other *SignatureValue) bool
- func (s *SignatureValue) SetAlgorithm(algorithm enumerations.SignatureAlgorithm)
- func (s *SignatureValue) SetValue(value []byte)
- func (s *SignatureValue) String() string
- func (s *SignatureValue) Value() []byte
- type SignerLocation
- func (s *SignerLocation) AddPostalAddress(addressItem string)
- func (s *SignerLocation) Country() string
- func (s *SignerLocation) Equals(other *SignerLocation) bool
- func (s *SignerLocation) IsEmpty() bool
- func (s *SignerLocation) Locality() string
- func (s *SignerLocation) PostOfficeBoxNumber() string
- func (s *SignerLocation) PostalAddress() []string
- func (s *SignerLocation) PostalCode() string
- func (s *SignerLocation) SetCountry(country string)
- func (s *SignerLocation) SetLocality(locality string)
- func (s *SignerLocation) SetPostOfficeBoxNumber(postOfficeBoxNumber string)
- func (s *SignerLocation) SetPostalAddress(postalAddress []string)
- func (s *SignerLocation) SetPostalCode(postalCode string)
- func (s *SignerLocation) SetStateOrProvince(stateOrProvince string)
- func (s *SignerLocation) SetStreetAddress(streetAddress string)
- func (s *SignerLocation) StateOrProvince() string
- func (s *SignerLocation) StreetAddress() string
- func (s *SignerLocation) String() string
- type SpDocSpecification
- func (s *SpDocSpecification) Description() string
- func (s *SpDocSpecification) DocumentationReferences() []string
- func (s *SpDocSpecification) Equals(other *SpDocSpecification) bool
- func (s *SpDocSpecification) Id() string
- func (s *SpDocSpecification) Qualifier() enumerations.ObjectIdentifierQualifier
- func (s *SpDocSpecification) SetDescription(description string)
- func (s *SpDocSpecification) SetDocumentationReferences(documentationReferences ...string)
- func (s *SpDocSpecification) SetId(id string)
- func (s *SpDocSpecification) SetQualifier(qualifier enumerations.ObjectIdentifierQualifier)
- func (s *SpDocSpecification) String() string
- type TimestampBinary
- type TimestampParameters
- type ToBeSigned
- type Token
- type TokenBase
- func (t *TokenBase) Abbreviation() string
- func (t *TokenBase) DSSID() Identifier
- func (t *TokenBase) DSSIDAsString() string
- func (t *TokenBase) Digest(digestAlgorithm enumerations.DigestAlgorithm) ([]byte, error)
- func (t *TokenBase) InitToken(overrides TokenOverrides)
- func (t *TokenBase) InvalidityReason() string
- func (t *TokenBase) IsSelfSigned() bool
- func (t *TokenBase) IsSignatureIntact() bool
- func (t *TokenBase) IsSignedBy(publicKey *PublicKey) bool
- func (t *TokenBase) IsSignedByToken(token *CertificateToken) bool
- func (t *TokenBase) IsValid() bool
- func (t *TokenBase) IssuerEntityKey() *EntityIdentifier
- func (t *TokenBase) PublicKeyOfTheSigner() *PublicKey
- func (t *TokenBase) SetInvalidityReason(reason string)
- func (t *TokenBase) SetPublicKeyOfTheSigner(publicKey *PublicKey)
- func (t *TokenBase) SetSignatureAlgorithm(signatureAlgorithm enumerations.SignatureAlgorithm)
- func (t *TokenBase) SetSignatureValidity(signatureValidity enumerations.SignatureValidity)
- func (t *TokenBase) SignatureAlgorithm() enumerations.SignatureAlgorithm
- func (t *TokenBase) SignatureValidity() enumerations.SignatureValidity
- type TokenComparator
- type TokenIdentifier
- type TokenIdentifierProvider
- type TokenOverrides
- type UserNotice
- func (u *UserNotice) Equals(other *UserNotice) bool
- func (u *UserNotice) ExplicitText() string
- func (u *UserNotice) IsEmpty() bool
- func (u *UserNotice) NoticeNumbers() []int
- func (u *UserNotice) Organization() string
- func (u *UserNotice) SetExplicitText(explicitText string)
- func (u *UserNotice) SetNoticeNumbers(noticeNumbers ...int)
- func (u *UserNotice) SetOrganization(organization string)
- func (u *UserNotice) String() string
- type X500NameIdentifier
- type X500Principal
- func (p *X500Principal) Canonical() string
- func (p *X500Principal) Encoded() []byte
- func (p *X500Principal) Equals(other *X500Principal) bool
- func (p *X500Principal) RFC2253Name() string
- func (p *X500Principal) RFC2253NameWithOIDMap(oidMap map[string]string) (string, error)
- func (p *X500Principal) String() string
- type X500PrincipalHelper
- func (h *X500PrincipalHelper) Canonical() string
- func (h *X500PrincipalHelper) Encoded() []byte
- func (h *X500PrincipalHelper) Equals(other *X500PrincipalHelper) bool
- func (h *X500PrincipalHelper) PrettyPrintRFC2253() (string, error)
- func (h *X500PrincipalHelper) Principal() *X500Principal
- func (h *X500PrincipalHelper) RFC2253() string
Constants ¶
const IdentifierDigestAlgorithm = enumerations.DigestAlgorithm_SHA256
IdentifierDigestAlgorithm is the DigestAlgorithm every Identifier is computed with. Port of the protected constant Identifier.DIGEST_ALGO.
Variables ¶
var ErrNoDigest = errors.New("The DigestDocument does not contain any digest! You must specify it by using addDigest() method.")
ErrNoDigest is returned by ExistingDigest when the DigestDocument does not contain any digest. Ports the IllegalStateException thrown by DigestDocument#getExistingDigest; the message is kept verbatim from Java, including its reference to the Java method name addDigest().
var ErrNotPossibleWithDigestDocument = errors.New("Not possible with Digest document")
ErrNotPossibleWithDigestDocument is returned by OpenStream and Save, which a digest-only document cannot serve. Ports the UnsupportedOperationException both methods throw; the message is kept verbatim from Java.
Functions ¶
func OidRepositoryGetDescription ¶
OidRepositoryGetDescription gets the description corresponding to the given OID. Ports OidRepository#getDescription (the class is a static utility in Java; the Go port drops the private constructor / no-instance idiom in favor of a package-level function).
Types ¶
type AbstractSerializableSignatureParameters ¶
type AbstractSerializableSignatureParameters[TP SerializableTimestampParameters] struct { // ContentTimestampParameters holds parameters related to the content // timestamp (Baseline-B). Exported: Java exposes it as `protected` for // direct subclass access, and concrete parameter subclasses live in // other Go packages (cades, xades, ...). ContentTimestampParameters TP // SignatureTimestampParameters holds parameters related to the // signature timestamp (Baseline-T). SignatureTimestampParameters TP // ArchiveTimestampParameters holds parameters related to the archive // timestamp (Baseline-LTA). ArchiveTimestampParameters TP // contains filtered or unexported fields }
AbstractSerializableSignatureParameters holds parameters for a signature creation/extension, generic over the SerializableTimestampParameters implementation TP used for content/signature/archive timestamps.
SerializableSignatureParameters (the implemented Java interface), SerializableTimestampParameters and BLevelParameters are outside this manifest; assumed to already exist in this package.
func NewAbstractSerializableSignatureParameters ¶
func NewAbstractSerializableSignatureParameters[TP SerializableTimestampParameters]() AbstractSerializableSignatureParameters[TP]
NewAbstractSerializableSignatureParameters instantiates the object with default values. Ports the protected no-arg constructor.
func (*AbstractSerializableSignatureParameters[TP]) BLevel ¶
func (p *AbstractSerializableSignatureParameters[TP]) BLevel() *BLevelParameters
BLevel gets the Baseline B parameters (signed properties). Ports AbstractSerializableSignatureParameters#bLevel.
func (*AbstractSerializableSignatureParameters[TP]) CheckCertificateRevocation ¶
func (p *AbstractSerializableSignatureParameters[TP]) CheckCertificateRevocation() bool
CheckCertificateRevocation ports AbstractSerializableSignatureParameters#isCheckCertificateRevocation.
func (*AbstractSerializableSignatureParameters[TP]) DigestAlgorithm ¶
func (p *AbstractSerializableSignatureParameters[TP]) DigestAlgorithm() enumerations.DigestAlgorithm
DigestAlgorithm ports AbstractSerializableSignatureParameters#getDigestAlgorithm.
func (*AbstractSerializableSignatureParameters[TP]) EncryptionAlgorithm ¶
func (p *AbstractSerializableSignatureParameters[TP]) EncryptionAlgorithm() enumerations.EncryptionAlgorithm
EncryptionAlgorithm ports AbstractSerializableSignatureParameters#getEncryptionAlgorithm.
func (*AbstractSerializableSignatureParameters[TP]) Equals ¶
func (p *AbstractSerializableSignatureParameters[TP]) Equals(other *AbstractSerializableSignatureParameters[TP]) bool
Equals ports AbstractSerializableSignatureParameters#equals.
Java's getClass() check belongs to the concrete subclass, so this method compares only the fields the abstract class owns and is meant to be called from a subclass's own Equals, the way Java subclasses call super.equals(o).
NOTE: upstream deliberately leaves validationDataEncapsulationStrategy out of equals(), hashCode() and toString(); the omission is reproduced here rather than "fixed".
func (*AbstractSerializableSignatureParameters[TP]) GenerateTBSWithoutCertificate ¶
func (p *AbstractSerializableSignatureParameters[TP]) GenerateTBSWithoutCertificate() bool
GenerateTBSWithoutCertificate indicates if it is possible to generate ToBeSigned data without the signing certificate. Default: false. Ports AbstractSerializableSignatureParameters#isGenerateTBSWithoutCertificate.
func (*AbstractSerializableSignatureParameters[TP]) GetArchiveTimestampParameters ¶
func (p *AbstractSerializableSignatureParameters[TP]) GetArchiveTimestampParameters() TP
GetArchiveTimestampParameters gets the parameters for archive timestamp (Baseline-LTA). See GetContentTimestampParameters doc: the base implementation always panics.
func (*AbstractSerializableSignatureParameters[TP]) GetContentTimestampParameters ¶
func (p *AbstractSerializableSignatureParameters[TP]) GetContentTimestampParameters() TP
GetContentTimestampParameters gets the parameters for content timestamp (Baseline-B). Ports AbstractSerializableSignatureParameters#getContentTimestampParameters: the Java base implementation always throws UnsupportedOperationException ("Cannot extract ContentTimestampParameters! Not implemented by default."); concrete parameter subclasses override it. Direct field access via ContentTimestampParameters is available to embedding types.
func (*AbstractSerializableSignatureParameters[TP]) GetSignatureTimestampParameters ¶
func (p *AbstractSerializableSignatureParameters[TP]) GetSignatureTimestampParameters() TP
GetSignatureTimestampParameters gets the parameters for signature timestamp (Baseline-T). See GetContentTimestampParameters doc: the base implementation always panics.
func (*AbstractSerializableSignatureParameters[TP]) ReferenceDigestAlgorithm ¶
func (p *AbstractSerializableSignatureParameters[TP]) ReferenceDigestAlgorithm() enumerations.DigestAlgorithm
ReferenceDigestAlgorithm gets the digest algorithm for ds:Reference or message-digest attribute.
func (*AbstractSerializableSignatureParameters[TP]) SetArchiveTimestampParameters ¶
func (p *AbstractSerializableSignatureParameters[TP]) SetArchiveTimestampParameters(archiveTimestampParameters TP)
SetArchiveTimestampParameters sets the parameters to produce the archive timestamp (Baseline-LTA).
func (*AbstractSerializableSignatureParameters[TP]) SetBLevelParams ¶
func (p *AbstractSerializableSignatureParameters[TP]) SetBLevelParams(bLevelParams *BLevelParameters)
SetBLevelParams sets the Baseline B parameters (signed properties). Panics if bLevelParams is nil (Java Objects.requireNonNull( "bLevelParams cannot be null!")).
func (*AbstractSerializableSignatureParameters[TP]) SetCheckCertificateRevocation ¶
func (p *AbstractSerializableSignatureParameters[TP]) SetCheckCertificateRevocation(checkCertificateRevocation bool)
SetCheckCertificateRevocation allows setting whether a revocation status for a signing certificate should be checked on signature creation or T-level extension.
NOTE: in order to specify a behavior for this check, the relevant alerts should be specified within a CertificateVerifier instance, used in a service for signing/extension.
Default: false (do not perform revocation data check on signature creation/T-level extension).
func (*AbstractSerializableSignatureParameters[TP]) SetContentTimestampParameters ¶
func (p *AbstractSerializableSignatureParameters[TP]) SetContentTimestampParameters(contentTimestampParameters TP)
SetContentTimestampParameters sets the parameters to produce the content timestamp (Baseline-B).
func (*AbstractSerializableSignatureParameters[TP]) SetDigestAlgorithm ¶
func (p *AbstractSerializableSignatureParameters[TP]) SetDigestAlgorithm(digestAlgorithm enumerations.DigestAlgorithm)
SetDigestAlgorithm sets the digest algorithm, and recomputes signatureAlgorithm from the current encryptionAlgorithm when defined. Panics if digestAlgorithm is the zero value (Java Objects.requireNonNull("DigestAlgorithm cannot be null!")).
func (*AbstractSerializableSignatureParameters[TP]) SetEncryptionAlgorithm ¶
func (p *AbstractSerializableSignatureParameters[TP]) SetEncryptionAlgorithm(encryptionAlgorithm enumerations.EncryptionAlgorithm)
SetEncryptionAlgorithm sets the encryption algorithm to be used on signature creation, useful when a specific encryption algorithm is expected; it becomes the algorithm used to create the SignatureValue. NOTE: the encryption algorithm is automatically extracted from the certificate's key when a signing certificate is set elsewhere.
func (*AbstractSerializableSignatureParameters[TP]) SetGenerateTBSWithoutCertificate ¶
func (p *AbstractSerializableSignatureParameters[TP]) SetGenerateTBSWithoutCertificate(generateTBSWithoutCertificate bool)
SetGenerateTBSWithoutCertificate changes the default behaviour regarding the requirement of a signing certificate to generate ToBeSigned data. NOTE: when using this method, ensure the same EncryptionAlgorithm is provided via SetEncryptionAlgorithm as the one used on signature value creation.
func (*AbstractSerializableSignatureParameters[TP]) SetReferenceDigestAlgorithm ¶
func (p *AbstractSerializableSignatureParameters[TP]) SetReferenceDigestAlgorithm(referenceDigestAlgorithm enumerations.DigestAlgorithm)
SetReferenceDigestAlgorithm sets the DigestAlgorithm to be used for reference digest calculation.
func (*AbstractSerializableSignatureParameters[TP]) SetSignatureLevel ¶
func (p *AbstractSerializableSignatureParameters[TP]) SetSignatureLevel(signatureLevel enumerations.SignatureLevel)
SetSignatureLevel sets the signature level. Panics if signatureLevel is the zero value (Java Objects.requireNonNull("Signature Level cannot be null")).
func (*AbstractSerializableSignatureParameters[TP]) SetSignaturePackaging ¶
func (p *AbstractSerializableSignatureParameters[TP]) SetSignaturePackaging(signaturePackaging enumerations.SignaturePackaging)
SetSignaturePackaging sets the expected signature packaging.
func (*AbstractSerializableSignatureParameters[TP]) SetSignatureTimestampParameters ¶
func (p *AbstractSerializableSignatureParameters[TP]) SetSignatureTimestampParameters(signatureTimestampParameters TP)
SetSignatureTimestampParameters sets the parameters to produce the signature timestamp (Baseline-T).
func (*AbstractSerializableSignatureParameters[TP]) SetValidationDataEncapsulationStrategy ¶
func (p *AbstractSerializableSignatureParameters[TP]) SetValidationDataEncapsulationStrategy(validationDataEncapsulationStrategy enumerations.ValidationDataEncapsulationStrategy)
SetValidationDataEncapsulationStrategy sets the validation data encapsulation mechanism to be used on -LT and -LTA level augmentation.
Default: CERTIFICATE_REVOCATION_VALUES_AND_TIMESTAMP_VALIDATION_DATA_AND_ANY_VALIDATION_DATA (the validation data for a signature's certificate chain is included within CertificateValues and RevocationValues elements on LT-level augmentation, and within AnyValidationData element on LTA-level augmentation. The validation data for all present timestamps will be included within TimeStampValidationData element.)
NOTE: Applicable only for XAdES and JAdES signatures. Panics if validationDataEncapsulationStrategy is the zero value.
func (*AbstractSerializableSignatureParameters[TP]) SignatureAlgorithm ¶
func (p *AbstractSerializableSignatureParameters[TP]) SignatureAlgorithm() enumerations.SignatureAlgorithm
SignatureAlgorithm ports AbstractSerializableSignatureParameters#getSignatureAlgorithm.
func (*AbstractSerializableSignatureParameters[TP]) SignatureLevel ¶
func (p *AbstractSerializableSignatureParameters[TP]) SignatureLevel() enumerations.SignatureLevel
SignatureLevel gets the expected signature level: XAdES_BASELINE_T, CAdES_BASELINE_LTA...
func (*AbstractSerializableSignatureParameters[TP]) SignaturePackaging ¶
func (p *AbstractSerializableSignatureParameters[TP]) SignaturePackaging() enumerations.SignaturePackaging
SignaturePackaging gets the expected signature packaging.
func (*AbstractSerializableSignatureParameters[TP]) String ¶
func (p *AbstractSerializableSignatureParameters[TP]) String() string
String ports AbstractSerializableSignatureParameters#toString.
func (*AbstractSerializableSignatureParameters[TP]) ValidationDataEncapsulationStrategy ¶
func (p *AbstractSerializableSignatureParameters[TP]) ValidationDataEncapsulationStrategy() enumerations.ValidationDataEncapsulationStrategy
ValidationDataEncapsulationStrategy gets the validation data encapsulation mechanism to be used on -LT and -LTA level augmentation.
type BLevelParameters ¶
type BLevelParameters struct {
// contains filtered or unexported fields
}
BLevelParameters is used to define common b-level parameters for a signature creation.
Policy and SignerLocation are outside this manifest; assumed to already exist in this package.
func NewBLevelParameters ¶
func NewBLevelParameters() *BLevelParameters
NewBLevelParameters instantiates the object with default values. Ports the default constructor.
func (*BLevelParameters) ClaimedSignerRoles ¶
func (b *BLevelParameters) ClaimedSignerRoles() []string
ClaimedSignerRoles gets the list of claimed roles.
func (*BLevelParameters) CommitmentTypeIndications ¶
func (b *BLevelParameters) CommitmentTypeIndications() []enumerations.CommitmentType
CommitmentTypeIndications gets the commitment type indications.
func (*BLevelParameters) Equals ¶
func (b *BLevelParameters) Equals(other *BLevelParameters) bool
Equals ports BLevelParameters#equals.
func (*BLevelParameters) IsTrustAnchorBPPolicy ¶
func (b *BLevelParameters) IsTrustAnchorBPPolicy() bool
IsTrustAnchorBPPolicy checks if the trust anchor policy shall be used when creating -B and -LT levels.
func (*BLevelParameters) SetClaimedSignerRoles ¶
func (b *BLevelParameters) SetClaimedSignerRoles(claimedSignerRoles []string)
SetClaimedSignerRoles sets a list of claimed signer roles.
func (*BLevelParameters) SetCommitmentTypeIndications ¶
func (b *BLevelParameters) SetCommitmentTypeIndications(commitmentTypeIndications []enumerations.CommitmentType)
SetCommitmentTypeIndications sets the commitment type indications (predefined values are available as enumerations.CommitmentType implementations).
func (*BLevelParameters) SetSignaturePolicy ¶
func (b *BLevelParameters) SetSignaturePolicy(signaturePolicy *Policy)
SetSignaturePolicy indicates the signature policy to use.
func (*BLevelParameters) SetSignedAssertions ¶
func (b *BLevelParameters) SetSignedAssertions(signedAssertions []string)
SetSignedAssertions sets signed assertions.
func (*BLevelParameters) SetSignerLocation ¶
func (b *BLevelParameters) SetSignerLocation(signerLocation *SignerLocation)
SetSignerLocation sets the signer location.
func (*BLevelParameters) SetSigningDate ¶
func (b *BLevelParameters) SetSigningDate(signingDate *time.Time)
SetSigningDate sets the signing date. Panics if signingDate is nil (Java Objects.requireNonNull("SigningDate cannot be null!")).
func (*BLevelParameters) SetTrustAnchorBPPolicy ¶
func (b *BLevelParameters) SetTrustAnchorBPPolicy(trustAnchorBPPolicy bool)
SetTrustAnchorBPPolicy allows setting the trust anchor policy to use when creating -B and -LT levels.
NOTE: when trust anchor baseline profile policy is defined only the certificates previous to the trust anchor are included when building -B level.
func (*BLevelParameters) SignaturePolicy ¶
func (b *BLevelParameters) SignaturePolicy() *Policy
SignaturePolicy gets the signature policy to use during the signature creation process.
func (*BLevelParameters) SignedAssertions ¶
func (b *BLevelParameters) SignedAssertions() []string
SignedAssertions gets the signed assertions.
func (*BLevelParameters) SignerLocation ¶
func (b *BLevelParameters) SignerLocation() *SignerLocation
SignerLocation gets the signer location.
func (*BLevelParameters) SigningDate ¶
func (b *BLevelParameters) SigningDate() *time.Time
SigningDate gets the signing date.
func (*BLevelParameters) String ¶
func (b *BLevelParameters) String() string
String ports BLevelParameters#toString.
type CertificateToken ¶
type CertificateToken struct {
TokenBase
// contains filtered or unexported fields
}
CertificateToken wraps an X.509 certificate encountered during signature validation, caching the frequently used information (identifiers, key usages, self-signed state) that the validation process would otherwise recompute.
func NewCertificateToken ¶
func NewCertificateToken(x509Certificate *x509.Certificate) (*CertificateToken, error)
NewCertificateToken creates a CertificateToken wrapping the provided certificate.
Panics with the Java message when the certificate is missing (Objects.requireNonNull). The signature algorithm is resolved from the certificate's signature algorithm OID rather than from its Java name, and an unknown OID - Java's IllegalArgumentException - is returned as an error.
func (*CertificateToken) Abbreviation ¶
func (c *CertificateToken) Abbreviation() string
Abbreviation returns the DSS Id string of the token. Port of getAbbreviation().
func (*CertificateToken) BuildTokenIdentifier ¶
func (c *CertificateToken) BuildTokenIdentifier() *TokenIdentifier
BuildTokenIdentifier builds the token's unique identifier. Port of the protected buildTokenIdentifier().
func (*CertificateToken) Certificate ¶
func (c *CertificateToken) Certificate() *x509.Certificate
Certificate returns the enclosed X.509 certificate. Port of getCertificate().
func (*CertificateToken) CheckIsSignedBy ¶
func (c *CertificateToken) CheckIsSignedBy(publicKey *PublicKey) enumerations.SignatureValidity
CheckIsSignedBy verifies the certificate's signature with the given public key, recording the outcome and, on failure, the reason. Port of the protected checkIsSignedBy(PublicKey).
DEVIATION: upstream raises a DSSException ("No provider has been found for signature validation : %s") when the JCA has no provider for the algorithm; Go has no provider mechanism, so that branch is absent and an unsupported algorithm is reported as an invalidity reason like any other verification failure.
func (*CertificateToken) CheckKeyUsage ¶
func (c *CertificateToken) CheckKeyUsage(keyUsageBit enumerations.KeyUsageBit) bool
CheckKeyUsage reports whether the certificate carries the given key usage bit. Port of checkKeyUsage(KeyUsageBit).
func (*CertificateToken) CreationDate ¶
func (c *CertificateToken) CreationDate() time.Time
CreationDate returns the certificate's notBefore date. Port of getCreationDate().
func (*CertificateToken) Encoded ¶
func (c *CertificateToken) Encoded() []byte
Encoded returns the ASN.1 DER encoded form of this certificate. Port of getEncoded().
Unlike the Java method this does not clone, and the CertificateEncodingException branch (which raises "Unable to encode the certificate") has no Go counterpart because the DER is retained by crypto/x509 rather than re-encoded.
func (*CertificateToken) EntityKey ¶
func (c *CertificateToken) EntityKey() *EntityIdentifier
EntityKey returns the identifier of the current entity key (public key plus subject name). Several certificates can share it (cross-certificates). Port of getEntityKey().
func (*CertificateToken) Equals ¶
func (c *CertificateToken) Equals(other *CertificateToken) bool
Equals reports whether both tokens carry the same DSS Id. Port of Token#equals(Object), which additionally requires the two tokens to be of the same class.
Java relies on hashCode-based collections keyed on tokens; the Go equivalent keys maps on DSSIDAsString().
func (*CertificateToken) IsCA ¶
func (c *CertificateToken) IsCA() bool
IsCA reports whether the BasicConstraints extension marks the certificate as a CA. Port of isCA().
func (*CertificateToken) IsEquivalent ¶
func (c *CertificateToken) IsEquivalent(token *CertificateToken) bool
IsEquivalent reports whether the given token has the same public key. Port of isEquivalent(CertificateToken).
func (*CertificateToken) IsSelfIssued ¶
func (c *CertificateToken) IsSelfIssued() bool
IsSelfIssued reports whether the certificate is self-issued, i.e. its issuer and subject are the same entity [RFC5280]. Port of isSelfIssued().
func (*CertificateToken) IsSelfSigned ¶
func (c *CertificateToken) IsSelfSigned() bool
IsSelfSigned reports whether the certificate is self-signed, i.e. it is self-issued and its signature verifies with the public key bound into it [RFC5280]. The answer is computed once and cached, and a positive answer marks the token's signature as VALID. Port of the isSelfSigned() override.
func (*CertificateToken) IsValidOn ¶
func (c *CertificateToken) IsValidOn(date time.Time) bool
IsValidOn reports whether the given date lies in the certificate's validity period, both bounds included. Port of isValidOn(Date).
Java answers false for a null date; the Go port maps that to the zero time.Time.
func (*CertificateToken) Issuer ¶
func (c *CertificateToken) Issuer() *X500PrincipalHelper
Issuer returns the issuer wrapped in an X500PrincipalHelper. Port of getIssuer().
func (*CertificateToken) IssuerEntityKey ¶
func (c *CertificateToken) IssuerEntityKey() *EntityIdentifier
IssuerEntityKey returns the entity key identifier of the certificate's issuer; a self-signed certificate is its own issuer. Port of the getIssuerEntityKey() override.
func (*CertificateToken) IssuerX500Principal ¶
func (c *CertificateToken) IssuerX500Principal() *X500Principal
IssuerX500Principal returns the X500Principal of the certificate that signed this token. Port of the getIssuerX500Principal() override.
func (*CertificateToken) KeyUsageBits ¶
func (c *CertificateToken) KeyUsageBits() []enumerations.KeyUsageBit
KeyUsageBits returns the certificate's key usages, computed once and cached. Port of getKeyUsageBits().
Java reads the KeyUsage extension as a boolean array and treats an absent extension as null; crypto/x509 collapses both an absent extension and an all-zero one to a zero bitmask, which yields the same empty result.
func (*CertificateToken) NotAfter ¶
func (c *CertificateToken) NotAfter() time.Time
NotAfter returns the expiration date of the certificate. Port of getNotAfter().
func (*CertificateToken) NotBefore ¶
func (c *CertificateToken) NotBefore() time.Time
NotBefore returns the issuance date of the certificate. Port of getNotBefore().
func (*CertificateToken) PathLenConstraint ¶
func (c *CertificateToken) PathLenConstraint() int
PathLenConstraint returns the pathLenConstraint value when the BasicConstraints extension is present and cA is true, math.MaxInt32 when it is a CA without a pathLenConstraint, and -1 otherwise. Port of getPathLenConstraint(), i.e. java.security.cert.X509Certificate#getBasicConstraints().
func (*CertificateToken) PublicKey ¶
func (c *CertificateToken) PublicKey() *PublicKey
PublicKey returns the public key associated with the certificate, paired with the exact SubjectPublicKeyInfo bytes it was parsed from. Port of getPublicKey().
func (*CertificateToken) SerialNumber ¶
func (c *CertificateToken) SerialNumber() *big.Int
SerialNumber returns the certificate serial number, the integer the CA assigns to each certificate it issues. Port of getSerialNumber().
func (*CertificateToken) SetSourceURL ¶
func (c *CertificateToken) SetSourceURL(sourceURL string)
SetSourceURL sets the certificate's source URL. Port of setSourceURL(String).
func (*CertificateToken) Signature ¶
func (c *CertificateToken) Signature() []byte
Signature returns the signature value of the certificate. Port of getSignature().
func (*CertificateToken) SourceURL ¶
func (c *CertificateToken) SourceURL() string
SourceURL returns the certificate's source URL. Port of getSourceURL().
func (*CertificateToken) String ¶
func (c *CertificateToken) String() string
String returns ToString(""). Port of toString().
func (*CertificateToken) Subject ¶
func (c *CertificateToken) Subject() *X500PrincipalHelper
Subject returns the subject wrapped in an X500PrincipalHelper. Port of getSubject().
func (*CertificateToken) ToString ¶
func (c *CertificateToken) ToString(indentStr string) string
ToString returns a string representation of the token using the given indentation. Port of toString(String).
type CertificateTokenIdentifier ¶
type CertificateTokenIdentifier struct {
TokenIdentifier
}
CertificateTokenIdentifier is the unique id of a CertificateToken.
func NewCertificateTokenIdentifier ¶
func NewCertificateTokenIdentifier(certificateToken *CertificateToken) *CertificateTokenIdentifier
NewCertificateTokenIdentifier builds the identifier of the given certificate token: the SHA-256 digest of its DER encoding, rendered with the "C-" prefix.
type CommitmentQualifier ¶
type CommitmentQualifier struct {
// contains filtered or unexported fields
}
CommitmentQualifier defines a CommitmentTypeQualifier to be incorporated within a signature.
func NewCommitmentQualifier ¶
func NewCommitmentQualifier() *CommitmentQualifier
NewCommitmentQualifier instantiates the object with null values. Ports the default constructor.
func (*CommitmentQualifier) Content ¶
func (c *CommitmentQualifier) Content() DSSDocument
Content gets the content of the Commitment Qualifier.
func (*CommitmentQualifier) Oid ¶
func (c *CommitmentQualifier) Oid() string
Oid gets the unique object identifier of the Commitment Qualifier.
func (*CommitmentQualifier) SetContent ¶
func (c *CommitmentQualifier) SetContent(content DSSDocument)
SetContent sets the content of the Commitment Qualifier. Use: REQUIRED.
func (*CommitmentQualifier) SetOid ¶
func (c *CommitmentQualifier) SetOid(oid string)
SetOid sets the unique object identifier of the Commitment Qualifier (CAdES/PAdES only!). Use: CONDITIONAL (required for CAdES/PAdES).
type CommonCommitmentType ¶
type CommonCommitmentType struct {
CommonObjectIdentifier
// contains filtered or unexported fields
}
CommonCommitmentType provides a basic implementation of enumerations.CommitmentType, allowing creation of a customized CommitmentType signed property.
func NewCommonCommitmentType ¶
func NewCommonCommitmentType() *CommonCommitmentType
NewCommonCommitmentType instantiates the object with null values. Ports the default constructor.
func (*CommonCommitmentType) CommitmentTypeQualifiers ¶
func (c *CommonCommitmentType) CommitmentTypeQualifiers() []*CommitmentQualifier
CommitmentTypeQualifiers gets the custom CommitmentTypeQualifiers list.
func (*CommonCommitmentType) SetCommitmentTypeQualifiers ¶
func (c *CommonCommitmentType) SetCommitmentTypeQualifiers(commitmentTypeQualifiers ...*CommitmentQualifier)
SetCommitmentTypeQualifiers sets the custom CommitmentTypeQualifiers list. Use: OPTIONAL.
func (*CommonCommitmentType) SetSignedDataObjects ¶
func (c *CommonCommitmentType) SetSignedDataObjects(signedDataObjects ...string)
SetSignedDataObjects sets signed data objects referenced by the current CommitmentType.
When CommitmentType is made for a subset of signed data objects, each element of the slice shall refer to one ds:Reference element within the ds:SignedInfo element or within a signed ds:Manifest element. When CommitmentType is made for all signed data objects, the slice shall be:
- empty (default), then AllSignedDataObjects element will be created; or
- contain references to all signed data objects (one ObjectReference will be created for each).
Use: OPTIONAL (XAdES only).
func (*CommonCommitmentType) SignedDataObjects ¶
func (c *CommonCommitmentType) SignedDataObjects() []string
SignedDataObjects gets references to signed data objects for the current CommitmentType.
type CommonDocument ¶
type CommonDocument struct {
// contains filtered or unexported fields
}
CommonDocument is embedded by concrete DSSDocument implementations (InMemoryDocument, FileDocument, DigestDocument) and provides ports of DSSDocument's Java default methods (save, writeTo, getMimeType, setMimeType, getName, setName, getDigest, getDigestValue).
OpenStream is NOT implemented here (it is abstract in Java); embedders must implement it. Because Go embedding has no virtual dispatch, the default methods that need OpenStream (WriteTo, Save, Digest, DigestValue) are exposed here as free functions taking the owning DSSDocument, and each concrete type wires up a trivial forwarding method.
func (*CommonDocument) MimeType ¶
func (c *CommonDocument) MimeType() enumerations.MimeType
MimeType returns the document's MimeType. Ports CommonDocument#getMimeType.
func (*CommonDocument) Name ¶
func (c *CommonDocument) Name() string
Name returns the document name. Ports CommonDocument#getName.
func (*CommonDocument) SetMimeType ¶
func (c *CommonDocument) SetMimeType(mimeType enumerations.MimeType)
SetMimeType sets the document's MimeType. Ports CommonDocument#setMimeType.
func (*CommonDocument) SetName ¶
func (c *CommonDocument) SetName(name string)
SetName sets the document name. Ports CommonDocument#setName.
func (*CommonDocument) String ¶
func (c *CommonDocument) String() string
String ports CommonDocument#toString.
type CommonObjectIdentifier ¶
type CommonObjectIdentifier struct {
// contains filtered or unexported fields
}
CommonObjectIdentifier provides a basic implementation of enumerations.ObjectIdentifier, allowing creation of a customized ObjectIdentifierType signed property.
func NewCommonObjectIdentifier ¶
func NewCommonObjectIdentifier() *CommonObjectIdentifier
NewCommonObjectIdentifier instantiates the object with null values. Ports the default constructor.
func (*CommonObjectIdentifier) Description ¶
func (c *CommonObjectIdentifier) Description() string
Description implements enumerations.OidDescription / ObjectIdentifier.
func (*CommonObjectIdentifier) DocumentationReferences ¶
func (c *CommonObjectIdentifier) DocumentationReferences() []string
DocumentationReferences implements ObjectIdentifier.
func (*CommonObjectIdentifier) OID ¶
func (c *CommonObjectIdentifier) OID() string
OID implements enumerations.OidBasedEnum / ObjectIdentifier.
func (*CommonObjectIdentifier) Qualifier ¶
func (c *CommonObjectIdentifier) Qualifier() enumerations.ObjectIdentifierQualifier
Qualifier implements ObjectIdentifier.
func (*CommonObjectIdentifier) SetDescription ¶
func (c *CommonObjectIdentifier) SetDescription(description string)
SetDescription sets text describing the ObjectIdentifierType object. Use: OPTIONAL.
func (*CommonObjectIdentifier) SetDocumentationReferences ¶
func (c *CommonObjectIdentifier) SetDocumentationReferences(documentationReferences ...string)
SetDocumentationReferences sets references pointing to documentation describing the ObjectIdentifierType. Use: OPTIONAL.
func (*CommonObjectIdentifier) SetOid ¶
func (c *CommonObjectIdentifier) SetOid(oid string)
SetOid sets the OID identifying the ObjectIdentifierType. Use: CONDITIONAL (shall be present in CAdES, PAdES. May be present in XAdES, JAdES). Note: when using OID in XAdES, a Qualifier shall be defined via SetQualifier. See EN 319 132-1 "5.1.2 The ObjectIdentifierType data type" for more information.
func (*CommonObjectIdentifier) SetQualifier ¶
func (c *CommonObjectIdentifier) SetQualifier(qualifier enumerations.ObjectIdentifierQualifier)
SetQualifier sets the Qualifier defining the type of OID identifier used for ObjectIdentifierType. See EN 319 132-1 "5.1.2 The ObjectIdentifierType data type" for more information. Use: CONDITIONAL (shall be present in XAdES when using OID identifier, but not URI). Note: used only in XAdES.
func (*CommonObjectIdentifier) SetUri ¶
func (c *CommonObjectIdentifier) SetUri(uri string)
SetUri sets the URI identifying the ObjectIdentifierType. Use: CONDITIONAL (should be present in XAdES, JAdES).
func (*CommonObjectIdentifier) URI ¶
func (c *CommonObjectIdentifier) URI() string
URI implements enumerations.UriBasedEnum / ObjectIdentifier.
type ContainerInfo ¶
type ContainerInfo struct {
// contains filtered or unexported fields
}
ContainerInfo contains information about an ASiC container.
func NewContainerInfo ¶
func NewContainerInfo() *ContainerInfo
NewContainerInfo instantiates the object with null values. Ports the default constructor.
func (*ContainerInfo) ContainerType ¶
func (c *ContainerInfo) ContainerType() enumerations.ASiCContainerType
ContainerType gets the ASiCContainerType.
func (*ContainerInfo) IsMimeTypeFilePresent ¶
func (c *ContainerInfo) IsMimeTypeFilePresent() bool
IsMimeTypeFilePresent returns whether the mimetype file is present.
func (*ContainerInfo) ManifestFiles ¶
func (c *ContainerInfo) ManifestFiles() []*ManifestFile
ManifestFiles gets the list of manifest files.
func (*ContainerInfo) MimeTypeContent ¶
func (c *ContainerInfo) MimeTypeContent() string
MimeTypeContent gets the mimetype file content.
func (*ContainerInfo) SetContainerType ¶
func (c *ContainerInfo) SetContainerType(containerType enumerations.ASiCContainerType)
SetContainerType sets the ASiCContainerType.
func (*ContainerInfo) SetManifestFiles ¶
func (c *ContainerInfo) SetManifestFiles(manifestFiles []*ManifestFile)
SetManifestFiles sets the list of manifest files.
func (*ContainerInfo) SetMimeTypeContent ¶
func (c *ContainerInfo) SetMimeTypeContent(mimeTypeContent string)
SetMimeTypeContent sets the mimetype file content.
func (*ContainerInfo) SetSignedDocumentFilenames ¶
func (c *ContainerInfo) SetSignedDocumentFilenames(signedDocumentFilenames []string)
SetSignedDocumentFilenames sets the signed document filenames.
func (*ContainerInfo) SetZipComment ¶
func (c *ContainerInfo) SetZipComment(zipComment string)
SetZipComment sets the zip comment.
func (*ContainerInfo) SignedDocumentFilenames ¶
func (c *ContainerInfo) SignedDocumentFilenames() []string
SignedDocumentFilenames gets the list of signed document filenames.
func (*ContainerInfo) ZipComment ¶
func (c *ContainerInfo) ZipComment() string
ZipComment gets the zip comment.
type DSSDocument ¶
type DSSDocument interface {
// OpenStream opens an io.ReadCloser on the document's contents. The
// caller is responsible for closing it. Ports DSSDocument#openStream.
OpenStream() (io.ReadCloser, error)
// WriteTo writes the content of the document to the provided writer.
// Ports DSSDocument#writeTo.
WriteTo(w io.Writer) (int64, error)
// Name returns the name of the document. If the DSSDocument was built
// based on a file, the file name is returned. Ports DSSDocument#getName.
Name() string
// SetName sets the name of the document. Ports DSSDocument#setName.
SetName(name string)
// MimeType returns the mime-type of the document. Ports
// DSSDocument#getMimeType.
MimeType() enumerations.MimeType
// SetMimeType sets the mime-type of the document. Ports
// DSSDocument#setMimeType.
SetMimeType(mimeType enumerations.MimeType)
// Save writes the content of the document to the file at filePath.
// Ports DSSDocument#save.
Save(filePath string) error
// Digest returns the Digest of the document's content, computed (and
// cached) using digestAlgorithm. Ports DSSDocument#getDigest.
Digest(digestAlgorithm enumerations.DigestAlgorithm) (Digest, error)
// DigestValue returns the digest value of the document's content for
// digestAlgorithm. Ports DSSDocument#getDigestValue.
DigestValue(digestAlgorithm enumerations.DigestAlgorithm) ([]byte, error)
}
DSSDocument represents a DSS document.
java.io.Serializable is dropped silently (no Go counterpart).
type DSSError ¶
type DSSError struct {
// Message is the error message.
Message string
// Cause is the wrapped underlying error, if any.
Cause error
}
DSSError is the error raised for data-dependent failures during DSS framework processing. Ports DSSException (a RuntimeException in Java; callers in other Go packages match it with errors.As).
func NewDSSError ¶
NewDSSError creates a DSSError with a message. Ports DSSException(String message).
func NewDSSErrorMessageCause ¶
NewDSSErrorMessageCause creates a DSSError with a custom message wrapping cause. Ports DSSException(String message, Throwable cause).
func NewDSSErrorWithCause ¶
NewDSSErrorWithCause creates a re-throwable DSSError wrapping cause. Ports DSSException(Throwable cause).
type DSSMessageDigest ¶
type DSSMessageDigest struct {
Digest
}
DSSMessageDigest holds a digest algorithm and digest value for message-digest computation.
Digest (the embedded/extended Java class) is outside this manifest; assumed to already exist in this package with a NewDigest(algorithm, value) constructor and Algorithm()/Value()/String() accessors mirroring its Java getAlgorithm()/getValue()/toString().
func CreateEmptyDSSMessageDigest ¶
func CreateEmptyDSSMessageDigest() DSSMessageDigest
CreateEmptyDSSMessageDigest creates an empty message-digest object with empty values. Ports DSSMessageDigest#createEmptyDigest.
func NewDSSMessageDigest ¶
func NewDSSMessageDigest() DSSMessageDigest
NewDSSMessageDigest creates an empty message-digest object. Ports the empty constructor.
func NewDSSMessageDigestFromDigest ¶
func NewDSSMessageDigestFromDigest(digest Digest) DSSMessageDigest
NewDSSMessageDigestFromDigest creates a message-digest from the provided Digest object. Ports DSSMessageDigest(Digest).
func NewDSSMessageDigestWithValue ¶
func NewDSSMessageDigestWithValue(algorithm enumerations.DigestAlgorithm, value []byte) DSSMessageDigest
NewDSSMessageDigestWithValue creates a message-digest with the provided digest algorithm and the corresponding hash value. Ports DSSMessageDigest(DigestAlgorithm, byte[]).
func (DSSMessageDigest) String ¶
func (d DSSMessageDigest) String() string
String ports DSSMessageDigest#toString.
type DataIdentifier ¶
type DataIdentifier struct {
IdentifierBase
}
DataIdentifier is the DSS identifier for a SignedData.
func NewDataIdentifier ¶
func NewDataIdentifier(data []byte) *DataIdentifier
NewDataIdentifier builds a DataIdentifier over the signed data binaries.
func NewDataIdentifierForDocument ¶
func NewDataIdentifierForDocument(name string, document DSSDocument) (*DataIdentifier, error)
NewDataIdentifierForDocument builds an identifier from a document name and the document's content. Port of DataIdentifier(String, DSSDocument).
type Digest ¶
type Digest struct {
// contains filtered or unexported fields
}
Digest is a container for a digest value and the algorithm used to compute it.
func NewDigest ¶
func NewDigest(algorithm enumerations.DigestAlgorithm, value []byte) Digest
NewDigest creates a Digest with the given algorithm and value. Ports the default constructor Digest(DigestAlgorithm, byte[]). The empty constructor is the zero value Digest{}.
func (Digest) Algorithm ¶
func (d Digest) Algorithm() enumerations.DigestAlgorithm
Algorithm gets the DigestAlgorithm.
func (Digest) Base64Value ¶
Base64Value gets the base64-encoded digest value string. Panics if the digest value is not defined (Java Objects.requireNonNull("Digest value is not defined!")).
func (Digest) HexValue ¶
HexValue gets the HEX (base16) encoded digest value string, uppercase. Panics if the digest value is not defined (Java Objects.requireNonNull("Digest value is not defined!")).
Mirrors Java's `new BigInteger(1, value).toString(16)`: leading zero bytes of value do not appear in the output (BigInteger normalizes the magnitude), and the result is left-padded with a single "0" when its length is odd.
func (*Digest) SetAlgorithm ¶
func (d *Digest) SetAlgorithm(algorithm enumerations.DigestAlgorithm)
SetAlgorithm sets the DigestAlgorithm.
type DigestDocument ¶
type DigestDocument struct {
CommonDocument
}
DigestDocument is a digest-only representation of a DSSDocument. It can be used to handle a large file to be signed whose digest was computed externally.
func NewDigestDocument ¶
func NewDigestDocument() *DigestDocument
NewDigestDocument creates a DigestDocument with an empty digest map. An initial algorithm and digest must be added via AddDigest before use. Ports DigestDocument().
func NewDigestDocumentFromBase64 ¶
func NewDigestDocumentFromBase64(digestAlgorithm enumerations.DigestAlgorithm, base64EncodeDigest string) *DigestDocument
NewDigestDocumentFromBase64 creates a DigestDocument with a digest provided as a base64-encoded string. Ports DigestDocument(DigestAlgorithm, String). Panics on invalid base64 (Java threw IllegalArgumentException from a helper called only from constructors; kept as a panic here since the caller-supplied literal is a programmer error).
func NewDigestDocumentFromBase64WithMimeType ¶
func NewDigestDocumentFromBase64WithMimeType(digestAlgorithm enumerations.DigestAlgorithm, base64EncodeDigest string, name string, mimeType enumerations.MimeType) *DigestDocument
NewDigestDocumentFromBase64WithMimeType creates a DigestDocument with a base64-encoded digest, name and MimeType. Ports DigestDocument( DigestAlgorithm, String, String, MimeType).
func NewDigestDocumentFromBase64WithName ¶
func NewDigestDocumentFromBase64WithName(digestAlgorithm enumerations.DigestAlgorithm, base64EncodeDigest string, name string) *DigestDocument
NewDigestDocumentFromBase64WithName creates a DigestDocument with a base64-encoded digest and document name, deriving the MimeType from name. Ports DigestDocument(DigestAlgorithm, String, String).
func NewDigestDocumentFromDigest ¶
func NewDigestDocumentFromDigest(digest Digest) *DigestDocument
NewDigestDocumentFromDigest creates a DigestDocument with an initial Digest. Ports DigestDocument(Digest).
Digest is a Go value type, so Java's Objects.requireNonNull(digest, "The Digest is not defined") has no direct counterpart; the zero Digest is the port of Java's empty Digest(), and passing it panics with "The Digest Algorithm is not defined" exactly as Java does.
func NewDigestDocumentFromDigestWithMimeType ¶
func NewDigestDocumentFromDigestWithMimeType(digest Digest, name string, mimeType enumerations.MimeType) *DigestDocument
NewDigestDocumentFromDigestWithMimeType creates a DigestDocument with an initial Digest, name and MimeType. Ports DigestDocument(Digest, String, MimeType).
func NewDigestDocumentFromDigestWithName ¶
func NewDigestDocumentFromDigestWithName(digest Digest, name string) *DigestDocument
NewDigestDocumentFromDigestWithName creates a DigestDocument with an initial Digest and document name, deriving the MimeType from name. Ports DigestDocument(Digest, String).
func NewDigestDocumentFromValue ¶
func NewDigestDocumentFromValue(digestAlgorithm enumerations.DigestAlgorithm, digestValue []byte) *DigestDocument
NewDigestDocumentFromValue creates a DigestDocument with a digest provided as a byte array. Ports DigestDocument(DigestAlgorithm, byte[]).
func NewDigestDocumentFromValueWithMimeType ¶
func NewDigestDocumentFromValueWithMimeType(digestAlgorithm enumerations.DigestAlgorithm, digestValue []byte, name string, mimeType enumerations.MimeType) *DigestDocument
NewDigestDocumentFromValueWithMimeType creates a DigestDocument with a digest byte array, name and MimeType. Ports DigestDocument(DigestAlgorithm, byte[], String, MimeType).
func NewDigestDocumentFromValueWithName ¶
func NewDigestDocumentFromValueWithName(digestAlgorithm enumerations.DigestAlgorithm, digestValue []byte, name string) *DigestDocument
NewDigestDocumentFromValueWithName creates a DigestDocument with a digest byte array and document name, deriving the MimeType from name. Ports DigestDocument(DigestAlgorithm, byte[], String).
func (*DigestDocument) AddDigest ¶
func (d *DigestDocument) AddDigest(digest Digest)
AddDigest adds digest to the DigestDocument, overwriting any existing entry for the same algorithm. Ports DigestDocument#addDigest(Digest).
func (*DigestDocument) AddDigestBase64 ¶
func (d *DigestDocument) AddDigestBase64(digestAlgorithm enumerations.DigestAlgorithm, base64EncodeDigest string) error
AddDigestBase64 adds a (DigestAlgorithm, digestValue) pair whose digest value is base64-encoded. Ports DigestDocument#addDigest(DigestAlgorithm, String).
func (*DigestDocument) AddDigestValue ¶
func (d *DigestDocument) AddDigestValue(digestAlgorithm enumerations.DigestAlgorithm, digestValue []byte)
AddDigestValue adds a (DigestAlgorithm, digestValue) pair computed externally on the encapsulated file. Ports DigestDocument#addDigest(DigestAlgorithm, byte[]).
Panics with the Java messages when the algorithm or the value is missing (Objects.requireNonNull), keeping Java's order of checks: the algorithm is validated before the value.
func (*DigestDocument) Digest ¶
func (d *DigestDocument) Digest(digestAlgorithm enumerations.DigestAlgorithm) (Digest, error)
Digest ports CommonDocument#getDigest for DigestDocument (uses the overridden DigestValue).
func (*DigestDocument) DigestValue ¶
func (d *DigestDocument) DigestValue(digestAlgorithm enumerations.DigestAlgorithm) ([]byte, error)
DigestValue ports DigestDocument#getDigestValue: returns an error if no digest is stored for digestAlgorithm (Java IllegalArgumentException).
func (*DigestDocument) Equals ¶
func (d *DigestDocument) Equals(other *DigestDocument) bool
Equals ports DigestDocument#equals.
func (*DigestDocument) ExistingDigest ¶
func (d *DigestDocument) ExistingDigest() (Digest, error)
ExistingDigest returns the first defined digest for the DigestDocument. Ports DigestDocument#getExistingDigest.
func (*DigestDocument) OpenStream ¶
func (d *DigestDocument) OpenStream() (io.ReadCloser, error)
OpenStream ports DigestDocument#openStream: not possible with a digest-only document.
func (*DigestDocument) Save ¶
func (d *DigestDocument) Save(filePath string) error
Save ports DigestDocument#save: not possible with a digest-only document.
type EncapsulatedRevocationTokenIdentifier ¶
type EncapsulatedRevocationTokenIdentifier[R revocation.Revocation] struct { MultipleDigestIdentifier }
EncapsulatedRevocationTokenIdentifier is a unique identifier for revocation data binaries. R is the revocation data implementation the identifier belongs to (revocation.CRL or revocation.OCSP), mirroring the Java type parameter; like in Java it is a phantom parameter that only constrains callers.
func NewEncapsulatedRevocationTokenIdentifier ¶
func NewEncapsulatedRevocationTokenIdentifier[R revocation.Revocation](binaries []byte) *EncapsulatedRevocationTokenIdentifier[R]
NewEncapsulatedRevocationTokenIdentifier builds the identifier over the revocation data binaries, rendered with the "R-" prefix.
func NewEncapsulatedRevocationTokenIdentifierWithClassName ¶
func NewEncapsulatedRevocationTokenIdentifierWithClassName[R revocation.Revocation](className string, binaries []byte) *EncapsulatedRevocationTokenIdentifier[R]
NewEncapsulatedRevocationTokenIdentifierWithClassName is the constructor subclasses in other packages (CRLBinary, OCSPResponseBinary, ...) use, so that the Java simple class name their toString() and equals() rely on stays correct.
func (*EncapsulatedRevocationTokenIdentifier[R]) DSSID ¶
func (e *EncapsulatedRevocationTokenIdentifier[R]) DSSID() Identifier
DSSID returns this identifier. Port of getDSSId().
type EntityIdentifier ¶
type EntityIdentifier struct {
IdentifierBase
}
EntityIdentifier is a unique id for a public key and subject name combination.
func NewEntityIdentifier ¶
func NewEntityIdentifier(binaries []byte) *EntityIdentifier
NewEntityIdentifier builds an EntityIdentifier over the given binaries.
type EntityIdentifierBuilder ¶
type EntityIdentifierBuilder struct {
// contains filtered or unexported fields
}
EntityIdentifierBuilder builds an EntityIdentifier for a public key and subject name pair.
func NewEntityIdentifierBuilder ¶
func NewEntityIdentifierBuilder(publicKey *PublicKey, subjectName *X500Principal) *EntityIdentifierBuilder
NewEntityIdentifierBuilder creates the builder for the given key and subject name; either may be nil, in which case it contributes nothing to the identifier binaries.
func (*EntityIdentifierBuilder) Build ¶
func (b *EntityIdentifierBuilder) Build() *EntityIdentifier
Build builds the EntityIdentifier.
Java declares build() on the IdentifierBuilder interface as returning an Identifier and narrows it here to EntityIdentifier. Go has no covariant returns, so this method keeps the useful concrete type and EntityIdentifierBuilder consequently does not satisfy the IdentifierBuilder interface.
func (*EntityIdentifierBuilder) BuildBinaries ¶
func (b *EntityIdentifierBuilder) BuildBinaries() []byte
BuildBinaries builds the unique binary data describing the entity key: the DER SubjectPublicKeyInfo of the public key followed by the DER encoding of the subject name. Port of the protected buildBinaries().
type FileDocument ¶
type FileDocument struct {
CommonDocument
// contains filtered or unexported fields
}
FileDocument is a DSSDocument implementation backed by the file-system.
func NewFileDocument ¶
func NewFileDocument(path string) (*FileDocument, error)
NewFileDocument creates a FileDocument for the file at path. Ports FileDocument(String) / FileDocument(File). Returns a *DSSError if the file does not exist (Java throw new DSSException(...) on a data-dependent failure).
upstream logs a debug message with the file's absolute path when the file is missing; omitted here (slf4j LOG dropped).
func (*FileDocument) AbsolutePath ¶
func (d *FileDocument) AbsolutePath() string
AbsolutePath returns the absolute path to the encapsulated document. Ports FileDocument#getAbsolutePath.
func (*FileDocument) Digest ¶
func (d *FileDocument) Digest(digestAlgorithm enumerations.DigestAlgorithm) (Digest, error)
Digest ports CommonDocument#getDigest for FileDocument.
func (*FileDocument) DigestValue ¶
func (d *FileDocument) DigestValue(digestAlgorithm enumerations.DigestAlgorithm) ([]byte, error)
DigestValue ports CommonDocument#getDigestValue for FileDocument.
func (*FileDocument) Equals ¶
func (d *FileDocument) Equals(other *FileDocument) bool
Equals ports FileDocument#equals.
func (*FileDocument) Exists ¶
func (d *FileDocument) Exists() bool
Exists checks if the file exists in the file system. Ports FileDocument#exists.
func (*FileDocument) OpenStream ¶
func (d *FileDocument) OpenStream() (io.ReadCloser, error)
OpenStream ports FileDocument#openStream.
func (*FileDocument) Path ¶
func (d *FileDocument) Path() string
Path returns the path the FileDocument was created with (ports FileDocument#getFile, adapted: Go has no java.io.File type).
func (*FileDocument) Save ¶
func (d *FileDocument) Save(filePath string) error
Save ports CommonDocument#save for FileDocument.
type Identifier ¶
type Identifier interface {
// AsXmlID returns an ID conformant to XML Id: the identifier prefix followed by the
// hex value of the digest.
AsXmlID() string
// DigestID returns the Digest the identifier is built from.
DigestID() Digest
// Equals reports whether the two identifiers have the same concrete type and digest.
Equals(other Identifier) bool
// String returns the Java toString() form, "<SimpleClassName>:<digest>".
String() string
}
Identifier is the contract of the abstract Java class eu.europa.esig.dss.model.identifier.Identifier. Java's covariant overrides (Token#getDSSId returning a TokenIdentifier, EntityIdentifierBuilder#build returning an EntityIdentifier) cannot be expressed in Go, so every polymorphic position uses this interface and callers type-assert to the concrete identifier when they need more.
type IdentifierBase ¶
type IdentifierBase struct {
// contains filtered or unexported fields
}
IdentifierBase carries the state and behaviour of the abstract Java class Identifier. Every identifier embeds it; the Java class name each subclass reports from getClass().getSimpleName() is passed to the constructor because Java's equals() compares classes and toString() prints the simple name.
func NewIdentifierBase ¶
func NewIdentifierBase(className, prefix string, data []byte) IdentifierBase
NewIdentifierBase computes an identifier from the binaries with a defined prefix. Port of the protected Identifier(String, byte[]) constructor.
Panics with the Java message when data is missing (Objects.requireNonNull("Data binaries cannot be null!")). Java's companion check Objects.requireNonNull(prefix, "Prefix cannot be null!") has no counterpart: prefix is a Go string, and every caller in dss-model passes a constant literal.
func NewIdentifierBaseFromDigest ¶
func NewIdentifierBaseFromDigest(className, prefix string, digest Digest) IdentifierBase
NewIdentifierBaseFromDigest builds an identifier over an already computed digest with a defined prefix. Port of the protected Identifier(String, Digest) constructor.
Digest is a Go value type, so the Objects.requireNonNull("Digest cannot be null!") check upstream performs has no counterpart; the zero Digest is the port of Java's empty Digest(), not of null.
func (*IdentifierBase) AsXmlID ¶
func (i *IdentifierBase) AsXmlID() string
AsXmlID returns an ID conformant to XML Id. Port of Identifier#asXmlId().
func (*IdentifierBase) DigestID ¶
func (i *IdentifierBase) DigestID() Digest
DigestID returns the Digest Id. Port of the package-private Identifier#getDigestId().
func (*IdentifierBase) Equals ¶
func (i *IdentifierBase) Equals(other Identifier) bool
Equals reports whether both identifiers are of the same Java class and carry an equal digest. Port of Identifier#equals(Object), including its getClass() check - a DataIdentifier never equals an EntityIdentifier even when the digests match.
func (*IdentifierBase) MessageDigest ¶
func (i *IdentifierBase) MessageDigest(digestAlgorithm enumerations.DigestAlgorithm) (hash.Hash, error)
MessageDigest returns a hash for the given DigestAlgorithm. Port of the protected Identifier#getMessageDigest(DigestAlgorithm); Java's DSSException on an unavailable algorithm becomes the returned error.
func (*IdentifierBase) Prefix ¶
func (i *IdentifierBase) Prefix() string
Prefix returns the identifier prefix, e.g. "C-" for a CertificateTokenIdentifier. Java keeps this field private; it is exposed here because it is part of the identifier's documented, report-visible string form.
func (*IdentifierBase) String ¶
func (i *IdentifierBase) String() string
String returns "<SimpleClassName>:<digest>". Port of Identifier#toString().
type IdentifierBasedObject ¶
type IdentifierBasedObject interface {
// DSSID returns the Identifier of the object. Port of getDSSId().
//
// Java narrows the return type in subclasses (Token#getDSSId returns a TokenIdentifier);
// Go has no covariant returns, so callers that need the narrower type assert on the
// result, e.g. tokenIdentifier, ok := token.DSSID().(*TokenIdentifier). Note that a
// token hands out its embedded *TokenIdentifier, not the concrete subclass value, so an
// assertion to *CertificateTokenIdentifier does not succeed; the concrete Java class is
// still reflected in the identifier's String() and Equals().
DSSID() Identifier
}
IdentifierBasedObject defines an object having an identifier (e.g. AdvancedSignature, Token).
type IdentifierBuilder ¶
type IdentifierBuilder interface {
// Build builds the Identifier. Port of build().
Build() Identifier
}
IdentifierBuilder builds an Identifier.
type InMemoryDocument ¶
type InMemoryDocument struct {
CommonDocument
// contains filtered or unexported fields
}
InMemoryDocument is an in-memory representation of a DSSDocument.
func CreateEmptyDocument ¶
func CreateEmptyDocument() *InMemoryDocument
CreateEmptyDocument creates an empty in-memory document. Ports InMemoryDocument#createEmptyDocument.
func NewInMemoryDocument ¶
func NewInMemoryDocument(data []byte) *InMemoryDocument
NewInMemoryDocument creates a document that retains data in memory. Ports InMemoryDocument(byte[]). Panics if bytes is nil (Java Objects.requireNonNull("Bytes cannot be null")).
func NewInMemoryDocumentFromStream ¶
func NewInMemoryDocumentFromStream(r io.Reader) (*InMemoryDocument, error)
NewInMemoryDocumentFromStream creates a document that retains data read fully into memory from r. Ports InMemoryDocument(InputStream).
func NewInMemoryDocumentFromStreamWithMimeType ¶
func NewInMemoryDocumentFromStreamWithMimeType(r io.Reader, name string, mimeType enumerations.MimeType) (*InMemoryDocument, error)
NewInMemoryDocumentFromStreamWithMimeType creates a document that retains data read fully into memory from r with an explicit name and MimeType. Ports InMemoryDocument(InputStream, String, MimeType).
func NewInMemoryDocumentFromStreamWithName ¶
func NewInMemoryDocumentFromStreamWithName(r io.Reader, name string) (*InMemoryDocument, error)
NewInMemoryDocumentFromStreamWithName creates a document that retains data read fully into memory from r, deriving the MimeType from name. Ports InMemoryDocument(InputStream, String).
func NewInMemoryDocumentWithMimeType ¶
func NewInMemoryDocumentWithMimeType(data []byte, name string, mimeType enumerations.MimeType) *InMemoryDocument
NewInMemoryDocumentWithMimeType creates a document that retains data in memory with an explicit name and MimeType. Ports InMemoryDocument(byte[], String, MimeType).
func NewInMemoryDocumentWithName ¶
func NewInMemoryDocumentWithName(data []byte, name string) *InMemoryDocument
NewInMemoryDocumentWithName creates a document that retains data in memory, deriving the MimeType from name. Ports InMemoryDocument(byte[], String).
func (*InMemoryDocument) Base64Encoded ¶
func (d *InMemoryDocument) Base64Encoded() string
Base64Encoded returns the base64-encoded content of the document. Panics if the byte array is not defined.
func (*InMemoryDocument) Bytes ¶
func (d *InMemoryDocument) Bytes() []byte
Bytes returns the binary content of the document.
func (*InMemoryDocument) Digest ¶
func (d *InMemoryDocument) Digest(digestAlgorithm enumerations.DigestAlgorithm) (Digest, error)
Digest ports CommonDocument#getDigest for InMemoryDocument.
func (*InMemoryDocument) DigestValue ¶
func (d *InMemoryDocument) DigestValue(digestAlgorithm enumerations.DigestAlgorithm) ([]byte, error)
DigestValue ports CommonDocument#getDigestValue for InMemoryDocument.
func (*InMemoryDocument) Equals ¶
func (d *InMemoryDocument) Equals(other *InMemoryDocument) bool
Equals ports InMemoryDocument#equals.
func (*InMemoryDocument) OpenStream ¶
func (d *InMemoryDocument) OpenStream() (io.ReadCloser, error)
OpenStream ports InMemoryDocument#openStream. Panics if the byte array is not defined (Java Objects.requireNonNull("Byte array is not defined!")).
func (*InMemoryDocument) Save ¶
func (d *InMemoryDocument) Save(filePath string) error
Save ports CommonDocument#save for InMemoryDocument.
func (*InMemoryDocument) SetBytes ¶
func (d *InMemoryDocument) SetBytes(data []byte)
SetBytes sets the binary content of the document.
type Key ¶
type Key interface {
// Encoded returns the key in its primary encoding format - a DER SubjectPublicKeyInfo
// for public keys, a DER PrivateKeyInfo for private keys - or nil when the key does
// not support encoding. Port of java.security.Key#getEncoded().
Encoded() []byte
}
Key is the port of java.security.Key, reduced to the single accessor dss-model uses.
type KeyIdentifier ¶
type KeyIdentifier struct {
IdentifierBase
}
KeyIdentifier is a unique identifier for a java.security.Key object.
func NewKeyIdentifier ¶
func NewKeyIdentifier(key Key) *KeyIdentifier
NewKeyIdentifier builds a KeyIdentifier over the encoded form of the given key.
type ManifestEntry ¶
type ManifestEntry struct {
// contains filtered or unexported fields
}
ManifestEntry defines a referenced document entry of a ManifestFile.
func NewManifestEntry ¶
func NewManifestEntry() *ManifestEntry
NewManifestEntry instantiates the object with null values. Ports the default constructor.
func (*ManifestEntry) Digest ¶
func (m *ManifestEntry) Digest() Digest
Digest gets the manifest entry digest.
func (*ManifestEntry) Document ¶
func (m *ManifestEntry) Document() DSSDocument
Document gets the corresponding document.
func (*ManifestEntry) IsFound ¶
func (m *ManifestEntry) IsFound() bool
IsFound gets if the referenced document has been found.
func (*ManifestEntry) IsIntact ¶
func (m *ManifestEntry) IsIntact() bool
IsIntact gets if the digest of the reference document matches.
func (*ManifestEntry) IsRootfile ¶
func (m *ManifestEntry) IsRootfile() bool
IsRootfile checks if it is a rootfile.
func (*ManifestEntry) MimeType ¶
func (m *ManifestEntry) MimeType() enumerations.MimeType
MimeType gets the mimetype.
func (*ManifestEntry) SetDigest ¶
func (m *ManifestEntry) SetDigest(digest Digest)
SetDigest sets the manifest entry digest.
func (*ManifestEntry) SetDocument ¶
func (m *ManifestEntry) SetDocument(document DSSDocument)
SetDocument sets the corresponding document.
func (*ManifestEntry) SetDocumentName ¶
func (m *ManifestEntry) SetDocumentName(documentName string)
SetDocumentName is deprecated: it no longer sets anything. Ports the deprecated ManifestEntry#setDocumentName, which upstream logs a warning and skips processing. Use SetDocument instead.
upstream logs "Use of deprecated method #setDocumentName. Please switch to #setDocument. Current method processing is skipped" here.
func (*ManifestEntry) SetFound ¶
func (m *ManifestEntry) SetFound(found bool)
SetFound sets if the referenced document has been found.
func (*ManifestEntry) SetIntact ¶
func (m *ManifestEntry) SetIntact(intact bool)
SetIntact sets if the digest of the reference document matches.
func (*ManifestEntry) SetMimeType ¶
func (m *ManifestEntry) SetMimeType(mimeType enumerations.MimeType)
SetMimeType sets the mimetype.
func (*ManifestEntry) SetRootfile ¶
func (m *ManifestEntry) SetRootfile(rootfile bool)
SetRootfile sets if the entry is a rootfile.
type ManifestFile ¶
type ManifestFile struct {
// contains filtered or unexported fields
}
ManifestFile represents a parsed Manifest File object.
func NewManifestFile ¶
func NewManifestFile() *ManifestFile
NewManifestFile instantiates the object with null values. Ports the default constructor.
func (*ManifestFile) DigestValue ¶
func (m *ManifestFile) DigestValue(digestAlgorithm enumerations.DigestAlgorithm) ([]byte, error)
DigestValue gets the digest value of the manifest document for digestAlgorithm.
func (*ManifestFile) Document ¶
func (m *ManifestFile) Document() DSSDocument
Document gets the DSSDocument representing the manifest.
func (*ManifestFile) Entries ¶
func (m *ManifestFile) Entries() []*ManifestEntry
Entries gets the list of ManifestEntry values, lazily initializing it. Ports ManifestFile#getEntries.
func (*ManifestFile) Filename ¶
func (m *ManifestFile) Filename() string
Filename gets the manifest document's filename. Panics if no document is set (Java calls document.getName() unguarded, i.e. NullPointerException).
func (*ManifestFile) IsDocumentCovered ¶
func (m *ManifestFile) IsDocumentCovered(documentName string) bool
IsDocumentCovered checks if the document with documentName is covered by the Manifest.
func (*ManifestFile) ManifestType ¶
func (m *ManifestFile) ManifestType() enumerations.ASiCManifestTypeEnum
ManifestType gets the type of the ASiC Manifest file.
func (*ManifestFile) RootFile ¶
func (m *ManifestFile) RootFile() *ManifestEntry
RootFile returns the ManifestEntry with Rootfile()==true, or nil if none is found. Ports ManifestFile#getRootFile.
func (*ManifestFile) SetDocument ¶
func (m *ManifestFile) SetDocument(document DSSDocument)
SetDocument sets the manifest document.
func (*ManifestFile) SetEntries ¶
func (m *ManifestFile) SetEntries(entries []*ManifestEntry)
SetEntries sets the list of ManifestEntry values.
func (*ManifestFile) SetManifestType ¶
func (m *ManifestFile) SetManifestType(manifestType enumerations.ASiCManifestTypeEnum)
SetManifestType sets the type of the ASiC Manifest file.
func (*ManifestFile) SetSignatureFilename ¶
func (m *ManifestFile) SetSignatureFilename(signatureFilename string)
SetSignatureFilename sets the signature filename.
func (*ManifestFile) SignatureFilename ¶
func (m *ManifestFile) SignatureFilename() string
SignatureFilename gets the signature filename.
type MultipleDigestIdentifier ¶
type MultipleDigestIdentifier struct {
IdentifierBase
// contains filtered or unexported fields
}
MultipleDigestIdentifier obtains a requested digest from a stored binary array, caching every digest it has already computed. It is the port of the abstract Java class of the same name and is meant to be embedded.
func NewMultipleDigestIdentifier ¶
func NewMultipleDigestIdentifier(className, prefix string, binaries []byte) MultipleDigestIdentifier
NewMultipleDigestIdentifier builds the identifier over the token binaries, pre-populating the digest cache with the SHA-256 digest the identifier itself is made of. Port of the protected MultipleDigestIdentifier(String, byte[]) constructor; className carries the Java simple class name of the concrete subclass.
func (*MultipleDigestIdentifier) Binaries ¶
func (m *MultipleDigestIdentifier) Binaries() []byte
Binaries returns the token binaries. Port of getBinaries().
Unlike the Java method this does not clone: the returned slice is the identifier's own binary and must not be modified by the caller.
func (*MultipleDigestIdentifier) DigestValue ¶
func (m *MultipleDigestIdentifier) DigestValue(digestAlgorithm enumerations.DigestAlgorithm) ([]byte, error)
DigestValue returns the digest value of the binaries for the given algorithm, computing and caching it on first use. Port of getDigestValue(DigestAlgorithm); Java's DSSException for an unavailable algorithm becomes the returned error.
type OriginalIdentifierProvider ¶
type OriginalIdentifierProvider struct{}
OriginalIdentifierProvider returns the original hash-based calculated String identifier for the given token.
func NewOriginalIdentifierProvider ¶
func NewOriginalIdentifierProvider() *OriginalIdentifierProvider
NewOriginalIdentifierProvider creates the provider.
func (*OriginalIdentifierProvider) IDAsString ¶
func (p *OriginalIdentifierProvider) IDAsString(object IdentifierBasedObject) string
IDAsString returns the XML Id of the object's identifier. Port of getIdAsString().
type Policy ¶
type Policy struct {
// contains filtered or unexported fields
}
Policy allows defining the signature policy.
UserNotice and SpDocSpecification are outside this manifest; assumed to already exist in this package.
func NewPolicy ¶
func NewPolicy() *Policy
NewPolicy instantiates the object with null values. Ports the empty constructor.
func (*Policy) Description ¶
Description gets the signature policy description.
func (*Policy) DigestAlgorithm ¶
func (p *Policy) DigestAlgorithm() enumerations.DigestAlgorithm
DigestAlgorithm returns the hash algorithm for the signature policy.
func (*Policy) DigestValue ¶
DigestValue gets the hash value of the explicit signature policy.
func (*Policy) DocumentationReferences ¶
DocumentationReferences gets the signature policy documentation references.
func (*Policy) IsHashAsInTechnicalSpecification ¶
IsHashAsInTechnicalSpecification gets if the digests of the signature policy has been computed as in a technical specification.
func (*Policy) IsSPQualifierPresent ¶
IsSPQualifierPresent checks if there is a definition at least for one signature policy qualifier.
func (*Policy) Qualifier ¶
func (p *Policy) Qualifier() enumerations.ObjectIdentifierQualifier
Qualifier gets the identifier qualifier.
func (*Policy) SetDescription ¶
SetDescription sets the signature policy description.
func (*Policy) SetDigestAlgorithm ¶
func (p *Policy) SetDigestAlgorithm(digestAlgorithm enumerations.DigestAlgorithm)
SetDigestAlgorithm sets the hash algorithm for the explicit signature policy.
func (*Policy) SetDigestValue ¶
SetDigestValue sets the hash value of the implicit signature policy.
func (*Policy) SetDocumentationReferences ¶
SetDocumentationReferences sets a list of signature documentation references.
func (*Policy) SetHashAsInTechnicalSpecification ¶
SetHashAsInTechnicalSpecification sets if the digests of the signature policy has been computed as in a technical specification. If the property is set to FALSE, digest of the signature policy is computed in a default way (on the policy file).
NOTE: The property is used only in JAdES.
Use SetSpDocSpecification to provide the technical specification.
func (*Policy) SetQualifier ¶
func (p *Policy) SetQualifier(qualifier enumerations.ObjectIdentifierQualifier)
SetQualifier sets the identifier qualifier (used in XAdES only).
func (*Policy) SetSpDocSpecification ¶
func (p *Policy) SetSpDocSpecification(spDocSpecification *SpDocSpecification)
SetSpDocSpecification sets the SP Document Specification qualifier identifying the technical specification that defines the syntax used for producing the signature policy document.
func (*Policy) SetUserNotice ¶
func (p *Policy) SetUserNotice(userNotice *UserNotice)
SetUserNotice sets the SP UserNotice qualifier.
func (*Policy) SpDocSpecification ¶
func (p *Policy) SpDocSpecification() *SpDocSpecification
SpDocSpecification gets the SP Document Specification qualifier.
func (*Policy) UserNotice ¶
func (p *Policy) UserNotice() *UserNotice
UserNotice gets the SP UserNotice qualifier.
type PublicKey ¶
type PublicKey struct {
// contains filtered or unexported fields
}
PublicKey is the port of java.security.PublicKey. It pairs the parsed Go key with the exact SubjectPublicKeyInfo DER it came from.
func NewPublicKey ¶
NewPublicKey parses a DER SubjectPublicKeyInfo and keeps its bytes as the key's encoded form. Corresponds to KeyFactory.generatePublic(new X509EncodedKeySpec(spki)).
func NewPublicKeyFromEncoded ¶
NewPublicKeyFromEncoded pairs an already parsed key with the SubjectPublicKeyInfo DER it was parsed from. Use it when the DER is available (x509.Certificate.RawSubjectPublicKeyInfo) so that no re-encoding happens.
func (*PublicKey) Algorithm ¶
Algorithm returns the JCA standard algorithm name of the key ("RSA", "EC", "EdDSA", "DSA"), or the empty string when it cannot be determined. Port of java.security.Key#getAlgorithm().
func (*PublicKey) Encoded ¶
Encoded returns the DER SubjectPublicKeyInfo of this key.
Unlike java.security.Key#getEncoded() this does not clone: the returned slice is the key's own DER and must not be modified by the caller.
type ReferenceValidation ¶
type ReferenceValidation struct {
// contains filtered or unexported fields
}
ReferenceValidation stores individual reference validations.
For XAdES, that means reference tag(s) validation. For CAdES, that means message-digest validation.
func NewReferenceValidation ¶
func NewReferenceValidation() *ReferenceValidation
NewReferenceValidation instantiates the object with null values (an empty errorMessages list, per Java field initializer). Ports the default constructor.
func (*ReferenceValidation) AddDependentValidations ¶
func (r *ReferenceValidation) AddDependentValidations(dependentValidations ...*ReferenceValidation)
AddDependentValidations appends to the list of dependent validations.
Java has no such method: callers there write "validation.getDependentValidations().addAll(...)", mutating the live List the lazy getter hands back. A Go slice returned by value cannot be appended to through its caller, so the getter alone leaves no way to populate the list - which is exactly what happened, in XAdESSignature's ds:Reference[@Type=".../Manifest"] branch: the manifest entries were computed and discarded, so every DataObjectFormat qualifying property pointing at a manifest entry failed to find its reference and the whole signature was reported as XML_NOT_ETSI (found by the Phase 4d audit on testdata/upstream/Signature-X-CZ_SEF-5.xml, where upstream reports XAdES_BASELINE_LT). This is the additive setter that closes it.
func (*ReferenceValidation) DataObjectReferences ¶
func (r *ReferenceValidation) DataObjectReferences() []string
DataObjectReferences gets extracted data object reference URIs, covered by the current reference. Example: JAdES signatures with SigDMechanism.OBJECT_ID_BY_URI.
func (*ReferenceValidation) DependentValidations ¶
func (r *ReferenceValidation) DependentValidations() []*ReferenceValidation
DependentValidations returns the list of dependent validations from this ReferenceValidation, lazily initializing it. Note: used to contain manifest entries.
func (*ReferenceValidation) Digest ¶
func (r *ReferenceValidation) Digest() Digest
Digest gets the incorporated Digest.
func (*ReferenceValidation) Document ¶
func (r *ReferenceValidation) Document() DSSDocument
Document gets the matching document.
func (*ReferenceValidation) ErrorMessages ¶
func (r *ReferenceValidation) ErrorMessages() []string
ErrorMessages gets error messages occurred during the reference validation.
func (*ReferenceValidation) Id ¶
func (r *ReferenceValidation) Id() string
Id gets the unique identifier of a reference. (E.g. for XAdES: reference Id attribute value).
func (*ReferenceValidation) IsDuplicated ¶
func (r *ReferenceValidation) IsDuplicated() bool
IsDuplicated returns if the referenced data is ambiguous.
func (*ReferenceValidation) IsFound ¶
func (r *ReferenceValidation) IsFound() bool
IsFound gets if the reference's data has been found.
func (*ReferenceValidation) IsIntact ¶
func (r *ReferenceValidation) IsIntact() bool
IsIntact gets if the digest of a referenced document matches the one defined in the reference.
func (*ReferenceValidation) SetDataObjectReferences ¶
func (r *ReferenceValidation) SetDataObjectReferences(dataObjectReferences []string)
SetDataObjectReferences sets extracted data object reference URIs, covered by the current reference.
func (*ReferenceValidation) SetDigest ¶
func (r *ReferenceValidation) SetDigest(digest Digest)
SetDigest sets the reference's Digest.
func (*ReferenceValidation) SetDocument ¶
func (r *ReferenceValidation) SetDocument(document DSSDocument)
SetDocument sets the matching document.
func (*ReferenceValidation) SetDuplicated ¶
func (r *ReferenceValidation) SetDuplicated(isDuplicated bool)
SetDuplicated sets if the referenced data is ambiguous.
func (*ReferenceValidation) SetErrorMessages ¶
func (r *ReferenceValidation) SetErrorMessages(errorMessages []string)
SetErrorMessages sets error messages occurred during the reference validation.
func (*ReferenceValidation) SetFound ¶
func (r *ReferenceValidation) SetFound(found bool)
SetFound sets if the reference's data has been found.
func (*ReferenceValidation) SetId ¶
func (r *ReferenceValidation) SetId(id string)
SetId sets the unique identifier of a reference. (E.g. for XAdES: reference Id attribute value).
func (*ReferenceValidation) SetIntact ¶
func (r *ReferenceValidation) SetIntact(intact bool)
SetIntact sets if the digest value of a referenced document matches.
func (*ReferenceValidation) SetTransformationNames ¶
func (r *ReferenceValidation) SetTransformationNames(transforms []string)
SetTransformationNames sets the list of transforms for the reference.
func (*ReferenceValidation) SetType ¶
func (r *ReferenceValidation) SetType(typ enumerations.DigestMatcherType)
SetType sets the type of the reference.
func (*ReferenceValidation) SetUri ¶
func (r *ReferenceValidation) SetUri(uri string)
SetUri sets the reference to the original document. (E.g. for XAdES: reference URI attribute value).
func (*ReferenceValidation) TransformationNames ¶
func (r *ReferenceValidation) TransformationNames() []string
TransformationNames returns the list of transformations contained in the reference.
func (*ReferenceValidation) Type ¶
func (r *ReferenceValidation) Type() enumerations.DigestMatcherType
Type returns the type of the validated reference.
func (*ReferenceValidation) Uri ¶
func (r *ReferenceValidation) Uri() string
Uri gets the reference to the original document. (E.g. for XAdES: reference URI attribute value).
type SerializableCounterSignatureParameters ¶
type SerializableCounterSignatureParameters interface {
SerializableSignatureParameters
// SignatureIdToCounterSign returns the Id of a signature that needs
// to be counter signed. Ports #getSignatureIdToCounterSign.
SignatureIdToCounterSign() string
// SetSignatureIdToCounterSign sets the Id of a signature to be
// counter signed.
//
// NOTE: the id shall represent the DSS (hash-based) id of a signature
// or a provided id in the signature document, when available (i.e.
// XML Id for a XAdES signature).
SetSignatureIdToCounterSign(signatureId string)
}
SerializableCounterSignatureParameters contains the common methods for counter signature parameters.
type SerializableEvidenceRecordIncorporationParameters ¶
type SerializableEvidenceRecordIncorporationParameters interface {
// SignatureId gets an identifier of the signature to include the
// evidence record into. Ports #getSignatureId.
SignatureId() string
// SetSignatureId sets an identifier of the signature to include the
// evidence record into. When a document with a single signature is
// provided, the value can be set to empty. Otherwise, the signature
// with the given identifier shall be found in order to perform the
// operation.
SetSignatureId(signatureId string)
// DetachedContents gets detached documents signed by a signature.
// Ports #getDetachedContents.
DetachedContents() []DSSDocument
// SetDetachedContents sets detached documents signed by a signature.
SetDetachedContents(detachedContents []DSSDocument)
// IsParallelEvidenceRecord gets whether the evidence record should be
// incorporated within an existing (latest) evidence-record unsigned
// property, when available. Otherwise, a new evidence record
// attribute is to be created for incorporation of the evidence
// record. Ports #isParallelEvidenceRecord.
IsParallelEvidenceRecord() bool
// SetParallelEvidenceRecord sets whether the evidence record should
// be incorporated within an existing (latest) evidence-record
// unsigned property, when available. Otherwise, a new evidence
// record attribute is to be created for incorporation of the
// evidence record.
//
// Default: false (a new evidence record unsigned property is to be
// created).
SetParallelEvidenceRecord(parallelEvidenceRecord bool)
}
SerializableEvidenceRecordIncorporationParameters contains common methods for evidence records incorporation within existing signatures.
type SerializableSignatureParameters ¶
type SerializableSignatureParameters interface {
// SigningCertificate gets the signing certificate. Ports
// #getSigningCertificate.
SigningCertificate() *CertificateToken
// GenerateTBSWithoutCertificate indicates if it is possible to
// generate ToBeSigned data without the signing certificate. The
// default value is false. Ports
// #isGenerateTBSWithoutCertificate.
GenerateTBSWithoutCertificate() bool
// CheckCertificateRevocation indicates whether a revocation check
// shall be performed before -LT level incorporation (i.e. on signing
// or T-level creation) for a signing certificate and a respectful
// certificate chain. When false, the revocation check is not
// performed. When true, a real-time revocation is being requested
// from external sources (shall be defined in CertificateVerifier) and
// processed according to alerts set within that CertificateVerifier.
//
// Default value: false (no revocation check is performed on
// signature creation or T-level extension). Ports
// #isCheckCertificateRevocation.
CheckCertificateRevocation() bool
// BLevel gets Baseline B parameters (signed properties). Ports
// #bLevel.
BLevel() *BLevelParameters
// DigestAlgorithm gets the digest algorithm. Ports
// #getDigestAlgorithm.
DigestAlgorithm() enumerations.DigestAlgorithm
// EncryptionAlgorithm gets the encryption algorithm. Ports
// #getEncryptionAlgorithm.
EncryptionAlgorithm() enumerations.EncryptionAlgorithm
// SignatureAlgorithm gets the signature algorithm. Ports
// #getSignatureAlgorithm.
SignatureAlgorithm() enumerations.SignatureAlgorithm
}
SerializableSignatureParameters defines signature parameters.
CertificateToken (ported from model.x509, flattened into this package) is outside this manifest; assumed to already exist in this package.
type SerializableTimestampParameters ¶
type SerializableTimestampParameters interface {
// DigestAlgorithm returns a DigestAlgorithm to be used to hash the
// data to be timestamped. Ports #getDigestAlgorithm.
DigestAlgorithm() enumerations.DigestAlgorithm
}
SerializableTimestampParameters is the common interface for timestamp parameters.
type SignatureParametersBuilder ¶
type SignatureParametersBuilder[SP SerializableSignatureParameters] interface { // Build creates a Signature Parameters instance. Build() SP }
SignatureParametersBuilder hides the complexity of a configuration for particular usages and simplifies signature creation, generic over the SerializableSignatureParameters implementation SP to be created.
SerializableSignatureParameters is outside this manifest; assumed to already exist in this package.
type SignaturePolicyStore ¶
type SignaturePolicyStore struct {
// contains filtered or unexported fields
}
SignaturePolicyStore represents the SignaturePolicyStore.
SpDocSpecification and DSSDocument are outside this manifest; assumed to already exist in this package.
func NewSignaturePolicyStore ¶
func NewSignaturePolicyStore() *SignaturePolicyStore
NewSignaturePolicyStore instantiates the object with null values. Ports the default constructor.
func (*SignaturePolicyStore) Id ¶
func (s *SignaturePolicyStore) Id() string
Id gets the optional Id.
func (*SignaturePolicyStore) SetId ¶
func (s *SignaturePolicyStore) SetId(id string)
SetId sets the optional Id.
func (*SignaturePolicyStore) SetSigPolDocLocalURI ¶
func (s *SignaturePolicyStore) SetSigPolDocLocalURI(sigPolDocLocalURI string)
SetSigPolDocLocalURI sets the SigPolDocLocalURI element value, defining the local URI where the policy document can be retrieved.
NOTE: one of SignaturePolicyContent or SigPolDocLocalURI shall be used.
func (*SignaturePolicyStore) SetSignaturePolicyContent ¶
func (s *SignaturePolicyStore) SetSignaturePolicyContent(signaturePolicyContent DSSDocument)
SetSignaturePolicyContent sets the policy store content.
NOTE: one of SignaturePolicyContent or SigPolDocLocalURI shall be used.
func (*SignaturePolicyStore) SetSpDocSpecification ¶
func (s *SignaturePolicyStore) SetSpDocSpecification(spDocSpecification *SpDocSpecification)
SetSpDocSpecification sets the SpDocSpecification.
func (*SignaturePolicyStore) SigPolDocLocalURI ¶
func (s *SignaturePolicyStore) SigPolDocLocalURI() string
SigPolDocLocalURI gets the SigPolDocLocalURI element value.
func (*SignaturePolicyStore) SignaturePolicyContent ¶
func (s *SignaturePolicyStore) SignaturePolicyContent() DSSDocument
SignaturePolicyContent gets the policy store content.
func (*SignaturePolicyStore) SpDocSpecification ¶
func (s *SignaturePolicyStore) SpDocSpecification() *SpDocSpecification
SpDocSpecification gets the SpDocSpecification content.
type SignatureValue ¶
type SignatureValue struct {
// contains filtered or unexported fields
}
SignatureValue holds the signature value binaries.
func NewSignatureValue ¶
func NewSignatureValue() *SignatureValue
NewSignatureValue creates an empty SignatureValue. Ports the empty constructor.
func NewSignatureValueWithValue ¶
func NewSignatureValueWithValue(algorithm enumerations.SignatureAlgorithm, value []byte) *SignatureValue
NewSignatureValueWithValue creates a SignatureValue with the given algorithm and binaries. Ports SignatureValue(SignatureAlgorithm, byte[]).
func (*SignatureValue) Algorithm ¶
func (s *SignatureValue) Algorithm() enumerations.SignatureAlgorithm
Algorithm gets the SignatureAlgorithm.
func (*SignatureValue) Equals ¶
func (s *SignatureValue) Equals(other *SignatureValue) bool
Equals ports SignatureValue#equals.
func (*SignatureValue) SetAlgorithm ¶
func (s *SignatureValue) SetAlgorithm(algorithm enumerations.SignatureAlgorithm)
SetAlgorithm sets the SignatureAlgorithm.
func (*SignatureValue) SetValue ¶
func (s *SignatureValue) SetValue(value []byte)
SetValue sets the SignatureValue binaries.
func (*SignatureValue) String ¶
func (s *SignatureValue) String() string
String ports SignatureValue#toString.
func (*SignatureValue) Value ¶
func (s *SignatureValue) Value() []byte
Value gets the SignatureValue binaries.
type SignerLocation ¶
type SignerLocation struct {
// contains filtered or unexported fields
}
SignerLocation represents the information concerning the signature production place.
func NewSignerLocation ¶
func NewSignerLocation() *SignerLocation
NewSignerLocation creates the default SignerLocation. Ports the default constructor.
func (*SignerLocation) AddPostalAddress ¶
func (s *SignerLocation) AddPostalAddress(addressItem string)
AddPostalAddress adds an address item to the complete address. NOTE: used in CAdES.
func (*SignerLocation) Country ¶
func (s *SignerLocation) Country() string
Country gets the country.
func (*SignerLocation) Equals ¶
func (s *SignerLocation) Equals(other *SignerLocation) bool
Equals ports SignerLocation#equals.
func (*SignerLocation) IsEmpty ¶
func (s *SignerLocation) IsEmpty() bool
IsEmpty checks if the SignerLocation instance is empty.
func (*SignerLocation) Locality ¶
func (s *SignerLocation) Locality() string
Locality gets the locality (city).
func (*SignerLocation) PostOfficeBoxNumber ¶
func (s *SignerLocation) PostOfficeBoxNumber() string
PostOfficeBoxNumber gets the post office box number.
func (*SignerLocation) PostalAddress ¶
func (s *SignerLocation) PostalAddress() []string
PostalAddress gets the postal address.
func (*SignerLocation) PostalCode ¶
func (s *SignerLocation) PostalCode() string
PostalCode gets the postal code.
func (*SignerLocation) SetCountry ¶
func (s *SignerLocation) SetCountry(country string)
SetCountry sets the country. Can be a country name or its two-letter ISO 3166-1 alpha-2 country code.
func (*SignerLocation) SetLocality ¶
func (s *SignerLocation) SetLocality(locality string)
SetLocality sets the locality (city).
func (*SignerLocation) SetPostOfficeBoxNumber ¶
func (s *SignerLocation) SetPostOfficeBoxNumber(postOfficeBoxNumber string)
SetPostOfficeBoxNumber sets the post office box number. NOTE: used in JAdES.
func (*SignerLocation) SetPostalAddress ¶
func (s *SignerLocation) SetPostalAddress(postalAddress []string)
SetPostalAddress sets the postal address. NOTE: used in CAdES.
func (*SignerLocation) SetPostalCode ¶
func (s *SignerLocation) SetPostalCode(postalCode string)
SetPostalCode sets the postal code.
func (*SignerLocation) SetStateOrProvince ¶
func (s *SignerLocation) SetStateOrProvince(stateOrProvince string)
SetStateOrProvince sets the state or province (the region where the locality is).
func (*SignerLocation) SetStreetAddress ¶
func (s *SignerLocation) SetStreetAddress(streetAddress string)
SetStreetAddress sets the street address. NOTE: used in XAdES and JAdES.
func (*SignerLocation) StateOrProvince ¶
func (s *SignerLocation) StateOrProvince() string
StateOrProvince gets the state or province.
func (*SignerLocation) StreetAddress ¶
func (s *SignerLocation) StreetAddress() string
StreetAddress gets the street address.
func (*SignerLocation) String ¶
func (s *SignerLocation) String() string
String ports SignerLocation#toString.
type SpDocSpecification ¶
type SpDocSpecification struct {
// contains filtered or unexported fields
}
SpDocSpecification represents an "SpDocSpecification" element.
func NewSpDocSpecification ¶
func NewSpDocSpecification() *SpDocSpecification
NewSpDocSpecification instantiates the object with null values. Ports the default constructor.
func (*SpDocSpecification) Description ¶
func (s *SpDocSpecification) Description() string
Description gets the description.
func (*SpDocSpecification) DocumentationReferences ¶
func (s *SpDocSpecification) DocumentationReferences() []string
DocumentationReferences gets the documentation references.
func (*SpDocSpecification) Equals ¶
func (s *SpDocSpecification) Equals(other *SpDocSpecification) bool
Equals ports SpDocSpecification#equals.
func (*SpDocSpecification) Qualifier ¶
func (s *SpDocSpecification) Qualifier() enumerations.ObjectIdentifierQualifier
Qualifier gets the qualifier (used in XAdES).
func (*SpDocSpecification) SetDescription ¶
func (s *SpDocSpecification) SetDescription(description string)
SetDescription sets the description.
func (*SpDocSpecification) SetDocumentationReferences ¶
func (s *SpDocSpecification) SetDocumentationReferences(documentationReferences ...string)
SetDocumentationReferences sets the documentation references.
func (*SpDocSpecification) SetId ¶
func (s *SpDocSpecification) SetId(id string)
SetId sets the identifier (URI or OID), e.g. 2.2.25.1 for OID.
func (*SpDocSpecification) SetQualifier ¶
func (s *SpDocSpecification) SetQualifier(qualifier enumerations.ObjectIdentifierQualifier)
SetQualifier sets the qualifier (used in XAdES).
func (*SpDocSpecification) String ¶
func (s *SpDocSpecification) String() string
String ports SpDocSpecification#toString.
type TimestampBinary ¶
type TimestampBinary struct {
// contains filtered or unexported fields
}
TimestampBinary contains only a binary representation of a timestamp.
func NewTimestampBinary ¶
func NewTimestampBinary(data []byte) *TimestampBinary
NewTimestampBinary creates a TimestampBinary. Ports the default constructor.
func (*TimestampBinary) Bytes ¶
func (t *TimestampBinary) Bytes() []byte
Bytes gets the timestamp's binary.
type TimestampParameters ¶
type TimestampParameters struct {
// contains filtered or unexported fields
}
TimestampParameters represents the parameters provided when generating specific timestamps in a signature, such as an AllDataObjectsTimestamp or an IndividualDataObjectsTimestamp. It implements SerializableTimestampParameters and is designed to be embedded by format-specific timestamp parameter structs.
func NewTimestampParameters ¶
func NewTimestampParameters() TimestampParameters
NewTimestampParameters creates the object with the default digest algorithm (SHA512). Ports the empty constructor.
func NewTimestampParametersWithDigestAlgorithm ¶
func NewTimestampParametersWithDigestAlgorithm(digestAlgorithm enumerations.DigestAlgorithm) TimestampParameters
NewTimestampParametersWithDigestAlgorithm creates the object with the given digest algorithm to use for data digest computation. Ports TimestampParameters(DigestAlgorithm).
func (*TimestampParameters) DigestAlgorithm ¶
func (t *TimestampParameters) DigestAlgorithm() enumerations.DigestAlgorithm
DigestAlgorithm ports TimestampParameters#getDigestAlgorithm.
func (*TimestampParameters) Equals ¶
func (t *TimestampParameters) Equals(other *TimestampParameters) bool
Equals ports TimestampParameters#equals.
func (*TimestampParameters) SetDigestAlgorithm ¶
func (t *TimestampParameters) SetDigestAlgorithm(digestAlgorithm enumerations.DigestAlgorithm)
SetDigestAlgorithm sets the DigestAlgorithm to use for timestamped data's digest computation. Panics if digestAlgorithm is the zero value (Java Objects.requireNonNull("DigestAlgorithm cannot be null!")).
func (*TimestampParameters) String ¶
func (t *TimestampParameters) String() string
String ports TimestampParameters#toString.
type ToBeSigned ¶
type ToBeSigned struct {
// contains filtered or unexported fields
}
ToBeSigned represents the ToBeSigned data.
func NewToBeSigned ¶
func NewToBeSigned() *ToBeSigned
NewToBeSigned creates an empty ToBeSigned. Ports the empty constructor.
func NewToBeSignedWithBytes ¶
func NewToBeSignedWithBytes(data []byte) *ToBeSigned
NewToBeSignedWithBytes creates a ToBeSigned wrapping the given bytes to be signed. Ports ToBeSigned(byte[]).
func (*ToBeSigned) Equals ¶
func (t *ToBeSigned) Equals(other *ToBeSigned) bool
Equals ports ToBeSigned#equals.
func (*ToBeSigned) SetBytes ¶
func (t *ToBeSigned) SetBytes(data []byte)
SetBytes sets the bytes to be signed.
type Token ¶
type Token interface {
IdentifierBasedObject
// IsSelfSigned reports whether the token is self-signed. Only a CertificateToken can
// answer true.
IsSelfSigned() bool
// DSSIDAsString returns the unique string of the token, i.e. its identifier's XML Id.
DSSIDAsString() string
// IsSignedByToken reports whether the token is signed by the given certificate token.
// Port of the isSignedBy(CertificateToken) overload.
IsSignedByToken(token *CertificateToken) bool
// IsSignedBy reports whether the token is signed by the given public key. Port of the
// isSignedBy(PublicKey) overload.
IsSignedBy(publicKey *PublicKey) bool
// IssuerX500Principal returns the X500Principal of the certificate that signed this token.
IssuerX500Principal() *X500Principal
// CreationDate returns the creation date of the token (notBefore for a certificate,
// productionDate for revocation data, ...).
CreationDate() time.Time
// Abbreviation returns the DSS abbreviation of the token, used for debugging.
Abbreviation() string
// IssuerEntityKey returns the entity key identifier of the token's issuer, or nil when
// the signer has not been established with a successful CheckIsSignedBy call.
IssuerEntityKey() *EntityIdentifier
// SignatureAlgorithm returns the algorithm that was used to sign the token.
SignatureAlgorithm() enumerations.SignatureAlgorithm
// IsSignatureIntact reports whether the token's signature is intact.
IsSignatureIntact() bool
// IsValid reports whether the conditions corresponding to the token validity are met.
IsValid() bool
// SignatureValidity returns the three-state status of the token's signature validity.
SignatureValidity() enumerations.SignatureValidity
// InvalidityReason returns the token invalidity reason, empty when the token is valid.
InvalidityReason() string
// PublicKeyOfTheSigner returns the public key which signed this token.
PublicKeyOfTheSigner() *PublicKey
// ToString returns a string representation of the token using the given indentation.
ToString(indentStr string) string
// String returns ToString("").
String() string
// Encoded returns the encoded form of the wrapped token.
Encoded() []byte
// Digest returns the digest value of the wrapped token for the requested algorithm.
Digest(digestAlgorithm enumerations.DigestAlgorithm) ([]byte, error)
}
Token is the contract of the different token types (certificate, OCSP, CRL, timestamp) used in the process of signature validation. It is the polymorphic half of the Java abstract class Token; the state and the concrete method bodies live in TokenBase.
type TokenBase ¶
type TokenBase struct {
// contains filtered or unexported fields
}
TokenBase carries the state and the concrete behaviour of the Java abstract class Token. Concrete tokens embed it and register themselves with InitToken.
func NewTokenBase ¶
func NewTokenBase() TokenBase
NewTokenBase instantiates the base state of a token with the Java default values. Port of the protected Token() constructor. The concrete token must still call InitToken.
func (*TokenBase) Abbreviation ¶
Abbreviation returns the DSS abbreviation of the token, used for debugging. Port of getAbbreviation().
func (*TokenBase) DSSID ¶
func (t *TokenBase) DSSID() Identifier
DSSID returns the DSS unique token identifier, building it on first use. Port of getDSSId(); Java narrows the return type to TokenIdentifier, which Go cannot express, so callers needing the token identifier assert on the result.
func (*TokenBase) DSSIDAsString ¶
DSSIDAsString returns a string representation of the unique DSS token identifier. Port of getDSSIdAsString().
func (*TokenBase) Digest ¶
func (t *TokenBase) Digest(digestAlgorithm enumerations.DigestAlgorithm) ([]byte, error)
Digest returns the digest value of the wrapped token for the requested algorithm. Port of getDigest(DigestAlgorithm); Java's DSSException for an unavailable algorithm becomes the returned error.
func (*TokenBase) InitToken ¶
func (t *TokenBase) InitToken(overrides TokenOverrides)
InitToken registers the concrete token with its base so that the base can dispatch to the operations Java would reach through virtual dispatch. It must be called exactly once, by the concrete token's constructor, before any other method.
func (*TokenBase) InvalidityReason ¶
InvalidityReason returns the token invalidity reason when applicable, empty when the token is valid. Port of getInvalidityReason().
func (*TokenBase) IsSelfSigned ¶
IsSelfSigned reports whether the token is self-signed. For all tokens other than a CertificateToken this always returns false; the method exists so that the different tokens can be managed uniformly.
func (*TokenBase) IsSignatureIntact ¶
IsSignatureIntact reports whether the token's signature is intact. IsSignedBy must have been called first; the method returns false both when the check has not run and when the signer's public key does not match. Port of isSignatureIntact().
func (*TokenBase) IsSignedBy ¶
IsSignedBy reports whether the token is signed by the given public key, remembering the signer on success. Port of the isSignedBy(PublicKey) overload.
Upstream declares both isSignedBy overloads synchronized; the Go port is not goroutine-safe, matching the rest of the value objects in this package.
func (*TokenBase) IsSignedByToken ¶
func (t *TokenBase) IsSignedByToken(token *CertificateToken) bool
IsSignedByToken reports whether the token is signed by the given certificate token. Port of the isSignedBy(CertificateToken) overload; Go has no overloading, so the two isSignedBy methods carry different names.
func (*TokenBase) IsValid ¶
IsValid reports whether the conditions corresponding to the token validity are met. Port of isValid().
func (*TokenBase) IssuerEntityKey ¶
func (t *TokenBase) IssuerEntityKey() *EntityIdentifier
IssuerEntityKey returns the identifier of the entity key of the issuer of the current token, or nil when the signer has not been established by a successful CheckIsSignedBy. Port of getIssuerEntityKey().
func (*TokenBase) PublicKeyOfTheSigner ¶
PublicKeyOfTheSigner returns the public key which signed this token. Port of getPublicKeyOfTheSigner().
func (*TokenBase) SetInvalidityReason ¶
SetInvalidityReason sets the token invalidity reason; the Go counterpart of writing Java's protected signatureInvalidityReason field from a subclass.
func (*TokenBase) SetPublicKeyOfTheSigner ¶
SetPublicKeyOfTheSigner sets the public key which signed this token; the Go counterpart of writing Java's protected publicKeyOfTheSigner field from a subclass.
func (*TokenBase) SetSignatureAlgorithm ¶
func (t *TokenBase) SetSignatureAlgorithm(signatureAlgorithm enumerations.SignatureAlgorithm)
SetSignatureAlgorithm sets the algorithm that was used to sign the token. Java writes the protected field directly from its subclasses; Go subclasses outside this package need this setter instead.
func (*TokenBase) SetSignatureValidity ¶
func (t *TokenBase) SetSignatureValidity(signatureValidity enumerations.SignatureValidity)
SetSignatureValidity sets the status of the token's signature validity; the Go counterpart of writing Java's protected signatureValidity field from a subclass.
func (*TokenBase) SignatureAlgorithm ¶
func (t *TokenBase) SignatureAlgorithm() enumerations.SignatureAlgorithm
SignatureAlgorithm returns the algorithm that was used to sign the token (e.g. RSA_SHA256). Port of getSignatureAlgorithm().
func (*TokenBase) SignatureValidity ¶
func (t *TokenBase) SignatureValidity() enumerations.SignatureValidity
SignatureValidity returns the three-state status of the token's signature validity. Port of getSignatureValidity().
type TokenComparator ¶
type TokenComparator struct{}
TokenComparator compares and sorts tokens by their DSS identifier.
func NewTokenComparator ¶
func NewTokenComparator() TokenComparator
NewTokenComparator creates the comparator.
func (TokenComparator) Compare ¶
func (c TokenComparator) Compare(o1, o2 Token) int
Compare orders two tokens by their DSS Id string, returning a negative number, zero or a positive number as o1 sorts before, equal to, or after o2. Port of compare(Token, Token).
Java returns String#compareTo's UTF-16 code unit difference rather than -1/0/1; DSS Id strings are ASCII (a prefix plus hex), so the ordering is identical even though the exact magnitudes are not.
func (TokenComparator) Less ¶
func (c TokenComparator) Less(o1, o2 Token) bool
Less adapts Compare to the sort.Slice / slices.SortFunc convention.
type TokenIdentifier ¶
type TokenIdentifier struct {
MultipleDigestIdentifier
}
TokenIdentifier is a unique id for a Token. It is the port of the abstract Java class of the same name and is meant to be embedded by the concrete token identifiers.
func NewTokenIdentifier ¶
func NewTokenIdentifier(className, prefix string, binaries []byte) TokenIdentifier
NewTokenIdentifier builds an identifier from the provided token binaries. Port of the protected TokenIdentifier(String, byte[]) constructor.
func NewTokenIdentifierFromToken ¶
func NewTokenIdentifierFromToken(className, prefix string, token Token) TokenIdentifier
NewTokenIdentifierFromToken computes an identifier from the encoded form of the given token. Port of the protected TokenIdentifier(String, Token) constructor; className carries the Java simple class name of the concrete subclass.
type TokenIdentifierProvider ¶
type TokenIdentifierProvider interface {
// IDAsString returns a String identifier for the given object. Port of getIdAsString().
IDAsString(object IdentifierBasedObject) string
}
TokenIdentifierProvider generates a String identifier for a given token (an AdvancedSignature, a CertificateToken, ...). Implementations cache the calculated values and take care of duplicates.
type TokenOverrides ¶
type TokenOverrides interface {
// BuildTokenIdentifier builds the token's unique identifier. Port of the abstract
// protected buildTokenIdentifier().
BuildTokenIdentifier() *TokenIdentifier
// CheckIsSignedBy verifies whether the token has been signed by the given public key,
// updating the token's validity state and invalidity reason. Port of the abstract
// protected checkIsSignedBy(PublicKey).
CheckIsSignedBy(publicKey *PublicKey) enumerations.SignatureValidity
// IssuerX500Principal returns the issuer's X500Principal. Port of the abstract
// getIssuerX500Principal().
IssuerX500Principal() *X500Principal
// IsSelfSigned reports whether the token is self-signed; TokenBase supplies the
// always-false default and CertificateToken overrides it.
IsSelfSigned() bool
}
TokenOverrides declares the operations Java's abstract Token class declares abstract, or expects a subclass to override, and that the base implementation itself calls back into. It stands in for the virtual dispatch a Java abstract class gets for free; a concrete token registers itself with TokenBase.InitToken so that the base can reach them.
type UserNotice ¶
type UserNotice struct {
// contains filtered or unexported fields
}
UserNotice may be used to define a User Notice signature policy qualifier.
func NewUserNotice ¶
func NewUserNotice() *UserNotice
NewUserNotice instantiates the object with null values. Ports the empty constructor.
func (*UserNotice) Equals ¶
func (u *UserNotice) Equals(other *UserNotice) bool
Equals ports UserNotice#equals.
func (*UserNotice) ExplicitText ¶
func (u *UserNotice) ExplicitText() string
ExplicitText gets the notice text.
func (*UserNotice) IsEmpty ¶
func (u *UserNotice) IsEmpty() bool
IsEmpty checks if the content of the UserNotice is empty or not.
func (*UserNotice) NoticeNumbers ¶
func (u *UserNotice) NoticeNumbers() []int
NoticeNumbers gets the notice numbers.
func (*UserNotice) Organization ¶
func (u *UserNotice) Organization() string
Organization gets the organization name.
func (*UserNotice) SetExplicitText ¶
func (u *UserNotice) SetExplicitText(explicitText string)
SetExplicitText sets the text of the notice to be displayed.
func (*UserNotice) SetNoticeNumbers ¶
func (u *UserNotice) SetNoticeNumbers(noticeNumbers ...int)
SetNoticeNumbers sets the notice numbers identifying a group of textual statements prepared by the organization.
NOTE: when the property is not empty, the Organization also shall be set!
func (*UserNotice) SetOrganization ¶
func (u *UserNotice) SetOrganization(organization string)
SetOrganization sets the organization name.
NOTE: when the property is not empty, the NoticeNumbers also shall be set!
type X500NameIdentifier ¶
type X500NameIdentifier struct {
IdentifierBase
}
X500NameIdentifier is a unique identifier for a Relative Distinguished Name (RDN).
func NewX500NameIdentifier ¶
func NewX500NameIdentifier(x500Principal *X500Principal) *X500NameIdentifier
NewX500NameIdentifier builds an X500NameIdentifier over the DER encoding of the principal.
type X500Principal ¶
type X500Principal struct {
// contains filtered or unexported fields
}
X500Principal represents an X.500 distinguished name, holding the DER encoding it was built from. It is the Go stand-in for javax.security.auth.x500.X500Principal.
func NewX500Principal ¶
func NewX500Principal(encoded []byte) (*X500Principal, error)
NewX500Principal parses the DER encoding of an X.501 Name (an RDNSequence) and returns the corresponding principal. The encoding is retained as given and is returned unchanged by Encoded. Port of the X500Principal(byte[] name) constructor; the Java constructor throws IllegalArgumentException on malformed input, which becomes an error here.
func (*X500Principal) Canonical ¶
func (p *X500Principal) Canonical() string
Canonical returns the canonical form of the name, as specified for getName(X500Principal.CANONICAL): the RFC 2253 form restricted to PrintableString and UTF8String values, with multi-valued RDNs sorted, internal whitespace collapsed, leading and trailing whitespace removed, the whole string upper-cased then lower-cased with the US locale, and finally normalized to Unicode Normalization Form KD.
func (*X500Principal) Encoded ¶
func (p *X500Principal) Encoded() []byte
Encoded returns the distinguished name in ASN.1 DER encoded form, exactly as supplied to NewX500Principal. Port of X500Principal#getEncoded().
Unlike the Java method this does not clone: the returned slice is the principal's own DER and must not be modified by the caller.
func (*X500Principal) Equals ¶
func (p *X500Principal) Equals(other *X500Principal) bool
Equals reports whether the two principals denote the same distinguished name, comparing their canonical forms. Port of X500Principal#equals(Object), which delegates to X500Name#equals and therefore compares RFC 2253 canonical names, NOT the DER encodings.
func (*X500Principal) RFC2253Name ¶
func (p *X500Principal) RFC2253Name() string
RFC2253Name returns the RFC 2253 form of the name, emitting only the attribute type keywords RFC 2253 defines. Port of getName(X500Principal.RFC2253).
func (*X500Principal) RFC2253NameWithOIDMap ¶
func (p *X500Principal) RFC2253NameWithOIDMap(oidMap map[string]string) (string, error)
RFC2253NameWithOIDMap returns the RFC 2253 form of the name, additionally emitting the attribute type keywords given by oidMap (keys are dotted-decimal OIDs, values keywords). Entries of oidMap take precedence over the built-in keywords. Port of getName(X500Principal.RFC2253, Map).
Java throws IllegalArgumentException when an OID present in the name maps to an improperly specified keyword; that becomes the returned error.
func (*X500Principal) String ¶
func (p *X500Principal) String() string
String returns the RFC 2253 form of the name.
DEVIATION: the JDK's X500Principal#toString() emits the RFC 1779 flavoured "DEFAULT" format, which dss-model never consumes and which is therefore not ported. Callers that print a principal get the RFC 2253 form instead.
type X500PrincipalHelper ¶
type X500PrincipalHelper struct {
// contains filtered or unexported fields
}
X500PrincipalHelper extracts the String representations of an X500Principal distinguishing name.
func NewX500PrincipalHelper ¶
func NewX500PrincipalHelper(principal *X500Principal) *X500PrincipalHelper
NewX500PrincipalHelper wraps the given principal.
Panics with the Java message when the principal is missing (Objects.requireNonNull).
func (*X500PrincipalHelper) Canonical ¶
func (h *X500PrincipalHelper) Canonical() string
Canonical returns the canonical name. Port of getCanonical(), i.e. principal.getName(X500Principal.CANONICAL).
func (*X500PrincipalHelper) Encoded ¶
func (h *X500PrincipalHelper) Encoded() []byte
Encoded returns the encoded X500Principal binaries. Port of getEncoded().
func (*X500PrincipalHelper) Equals ¶
func (h *X500PrincipalHelper) Equals(other *X500PrincipalHelper) bool
Equals reports whether both helpers wrap a principal with the same DER encoding. Port of equals(Object).
NOTE: this deliberately differs from X500Principal.Equals, which compares canonical names; the helper compares the raw encodings, exactly as upstream does.
func (*X500PrincipalHelper) PrettyPrintRFC2253 ¶
func (h *X500PrincipalHelper) PrettyPrintRFC2253() (string, error)
PrettyPrintRFC2253 returns the pretty-printed RFC 2253 standard name, i.e. the RFC 2253 form with the X520Attributes OID descriptions substituted for the attribute type keywords. Port of getPrettyPrintRFC2253().
Java throws IllegalArgumentException when an OID in the name maps to an improperly specified keyword; that becomes the returned error. Every X520Attributes description is a valid keyword, so the error cannot trigger for the built-in map.
func (*X500PrincipalHelper) Principal ¶
func (h *X500PrincipalHelper) Principal() *X500Principal
Principal returns the wrapped X500Principal. Port of getPrincipal().
func (*X500PrincipalHelper) RFC2253 ¶
func (h *X500PrincipalHelper) RFC2253() string
RFC2253 returns the RFC 2253 standard name. Port of getRFC2253(), i.e. principal.getName(X500Principal.RFC2253).
Source Files
¶
- abstract_serializable_signature_parameters.go
- blevel_parameters.go
- certificate_token.go
- certificate_token_identifier.go
- commitment_qualifier.go
- common_commitment_type.go
- common_document.go
- common_object_identifier.go
- container_info.go
- data_identifier.go
- digest.go
- digest_document.go
- doc.go
- dss_document.go
- dss_exception.go
- dss_message_digest.go
- encapsulated_revocation_token_identifier.go
- entity_identifier.go
- entity_identifier_builder.go
- file_document.go
- identifier.go
- identifier_based_object.go
- identifier_builder.go
- in_memory_document.go
- key_identifier.go
- manifest_entry.go
- manifest_file.go
- multiple_digest_identifier.go
- oid_repository.go
- original_identifier_provider.go
- policy.go
- public_key.go
- reference_validation.go
- serializable_counter_signature_parameters.go
- serializable_evidence_record_incorporation_parameters.go
- serializable_signature_parameters.go
- serializable_timestamp_parameters.go
- signature_parameters_builder.go
- signature_policy_store.go
- signature_value.go
- signer_location.go
- sp_doc_specification.go
- timestamp_binary.go
- timestamp_parameters.go
- to_be_signed.go
- token.go
- token_comparator.go
- token_identifier.go
- token_identifier_provider.go
- user_notice.go
- x500_name_identifier.go
- x500_principal.go
- x500_principal_helper.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Ported from dss-model/.../eaa/DisclosureValidation.java (DSS 6.5.RC1).
|
Ported from dss-model/.../eaa/DisclosureValidation.java (DSS 6.5.RC1). |
|
claim
Ported from dss-model/.../claim/AbstractClaim.java (DSS 6.5.RC1).
|
Ported from dss-model/.../claim/AbstractClaim.java (DSS 6.5.RC1). |
|
Package http ports the dss-model http subpackage (eu.europa.esig.dss.model.http), a small envelope type wrapping an HTTP response's body and metadata as returned by DSS's data-loader clients.
|
Package http ports the dss-model http subpackage (eu.europa.esig.dss.model.http), a small envelope type wrapping an HTTP response's body and metadata as returned by DSS's data-loader clients. |
|
Ported from dss-model/src/main/java/eu/europa/esig/dss/model/job/AbstractDocumentInfo.java (DSS 6.5.RC1).
|
Ported from dss-model/src/main/java/eu/europa/esig/dss/model/job/AbstractDocumentInfo.java (DSS 6.5.RC1). |
|
Ported from dss-model/src/main/java/eu/europa/esig/dss/model/lote/identifier/AbstractLoTEIdentifier.java (DSS 6.5.RC1).
|
Ported from dss-model/src/main/java/eu/europa/esig/dss/model/lote/identifier/AbstractLoTEIdentifier.java (DSS 6.5.RC1). |
|
Ported from dss-model/.../model/policy/CertificateApplicabilityRule.java (DSS 6.5.RC1).
|
Ported from dss-model/.../model/policy/CertificateApplicabilityRule.java (DSS 6.5.RC1). |
|
Package scope ports the dss-model scope subpackage (eu.europa.esig.dss.model.scope), the value object describing what part of a signed document a signature actually covers (the whole document, an XML element, a PDF byte range, an ASiC manifest entry, ...).
|
Package scope ports the dss-model scope subpackage (eu.europa.esig.dss.model.scope), the value object describing what part of a signed document a signature actually covers (the whole document, an XML element, a PDF byte range, an ASiC manifest entry, ...). |
|
Ported from dss-model/src/main/java/eu/europa/esig/dss/model/signature/CommitmentTypeIndication.java (DSS 6.5.RC1).
|
Ported from dss-model/src/main/java/eu/europa/esig/dss/model/signature/CommitmentTypeIndication.java (DSS 6.5.RC1). |
|
Ported from dss-model/src/main/java/eu/europa/esig/dss/model/timedependent/BaseTimeDependent.java (DSS 6.5.RC1).
|
Ported from dss-model/src/main/java/eu/europa/esig/dss/model/timedependent/BaseTimeDependent.java (DSS 6.5.RC1). |
|
Package tls ports the dss-model tls subpackage (eu.europa.esig.dss.model.tls), a value object wrapping the certificate chain presented by a TLS server, used when validating a Trusted List fetched over HTTPS against its expected TLS identity.
|
Package tls ports the dss-model tls subpackage (eu.europa.esig.dss.model.tls), a value object wrapping the certificate chain presented by a TLS server, used when validating a Trusted List fetched over HTTPS against its expected TLS identity. |
|
Ported from dss-model/src/main/java/eu/europa/esig/dss/model/tsl/identifier/AbstractTLIdentifier.java (DSS 6.5.RC1).
|
Ported from dss-model/src/main/java/eu/europa/esig/dss/model/tsl/identifier/AbstractTLIdentifier.java (DSS 6.5.RC1). |
|
x509
|
|
|
extension
Ported from dss-model/src/main/java/eu/europa/esig/dss/model/x509/extension/AuthorityInformationAccess.java (DSS 6.5.RC1).
|
Ported from dss-model/src/main/java/eu/europa/esig/dss/model/x509/extension/AuthorityInformationAccess.java (DSS 6.5.RC1). |
|
revocation
Ported from dss-model/src/main/java/eu/europa/esig/dss/model/x509/revocation/crl/CRL.java (DSS 6.5.RC1).
|
Ported from dss-model/src/main/java/eu/europa/esig/dss/model/x509/revocation/crl/CRL.java (DSS 6.5.RC1). |