-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#2] File references can be added to stamps
- Loading branch information
Showing
3 changed files
with
223 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?> | ||
<asic:XAdESSignatures xmlns:asic="http://uri.etsi.org/02918/v1.2.1#" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xades="http://uri.etsi.org/01903/v1.3.2#"> | ||
|
||
<ds:Signature Id=""> | ||
<ds:SignedInfo> | ||
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2006/12/xml-c14n11"/> | ||
<ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/> | ||
<!-- | ||
<ds:Reference Id="S0-RefId0" URI="hello.txt"> | ||
<ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/> | ||
<ds:DigestValue /> | ||
</ds:Reference> | ||
<ds:Reference Id="S0-RefId1" Type="http://uri.etsi.org/01903#SignedProperties" URI="#S0-SignedProperties"> | ||
<ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/> | ||
<ds:DigestValue /> | ||
</ds:Reference> | ||
--> | ||
</ds:SignedInfo> | ||
<ds:SignatureValue Id="" /> | ||
<ds:KeyInfo> | ||
<ds:X509Data> | ||
<ds:X509Certificate /> | ||
</ds:X509Data> | ||
</ds:KeyInfo> | ||
<ds:Object> | ||
<xades:QualifyingProperties Target=""> | ||
<xades:SignedProperties Id=""> | ||
<xades:SignedSignatureProperties> | ||
<xades:SigningTime /> | ||
<xades:SigningCertificate> | ||
<xades:Cert> | ||
<xades:CertDigest> | ||
<ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/> | ||
<ds:DigestValue /> | ||
</xades:CertDigest> | ||
<xades:IssuerSerial> | ||
<!-- | ||
<ds:X509IssuerName>[email protected],CN=ESTEID-SK 2011,O=AS Sertifitseerimiskeskus,C=EE</ds:X509IssuerName> | ||
<ds:X509SerialNumber>42514520234216594820678577464228965245</ds:X509SerialNumber> | ||
--> | ||
</xades:IssuerSerial> | ||
</xades:Cert> | ||
</xades:SigningCertificate> | ||
<xades:SignaturePolicyIdentifier> | ||
<xades:SignaturePolicyId> | ||
<xades:SigPolicyId> | ||
<xades:Identifier Qualifier="OIDAsURN">urn:oid:1.3.6.1.4.1.10015.1000.3.2.1</xades:Identifier> | ||
<xades:Description>BDOC – FORMAT FOR DIGITAL SIGNATURES</xades:Description> | ||
</xades:SigPolicyId> | ||
<xades:SigPolicyHash> | ||
<ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/> | ||
<ds:DigestValue /> | ||
</xades:SigPolicyHash> | ||
<xades:SigPolicyQualifiers> | ||
<xades:SigPolicyQualifier> | ||
<xades:SPURI>https://www.sk.ee/repository/bdoc-spec21.pdf</xades:SPURI> | ||
</xades:SigPolicyQualifier> | ||
</xades:SigPolicyQualifiers> | ||
</xades:SignaturePolicyId> | ||
</xades:SignaturePolicyIdentifier> | ||
<xades:SignatureProductionPlace> | ||
<xades:City /> | ||
<xades:StateOrProvince /> | ||
<xades:PostalCode /> | ||
<xades:CountryName /> | ||
</xades:SignatureProductionPlace> | ||
<xades:SignerRole> | ||
<xades:ClaimedRoles> | ||
<xades:ClaimedRole /> | ||
</xades:ClaimedRoles> | ||
</xades:SignerRole> | ||
</xades:SignedSignatureProperties> | ||
<xades:SignedDataObjectProperties> | ||
<!-- | ||
<xades:DataObjectFormat ObjectReference="#S0-RefId0"> | ||
<xades:MimeType>application/octet-stream</xades:MimeType> | ||
</xades:DataObjectFormat> | ||
--> | ||
</xades:SignedDataObjectProperties> | ||
</xades:SignedProperties> | ||
<xades:UnsignedProperties> | ||
<xades:UnsignedSignatureProperties> | ||
<xades:CertificateValues> | ||
<!-- <xades:EncapsulatedX509Certificate Id="S0-RESPONDER_CERT" /> --> | ||
<!-- <xades:EncapsulatedX509Certificate Id="S0-CA-CERT" /> --> | ||
</xades:CertificateValues> | ||
<xades:RevocationValues> | ||
<xades:OCSPValues> | ||
<xades:EncapsulatedOCSPValue Id=""></xades:EncapsulatedOCSPValue> | ||
</xades:OCSPValues> | ||
</xades:RevocationValues> | ||
</xades:UnsignedSignatureProperties> | ||
</xades:UnsignedProperties> | ||
</xades:QualifyingProperties> | ||
</ds:Object> | ||
</ds:Signature> | ||
|
||
</asic:XAdESSignatures> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the DigiDoc package. | ||
* | ||
* (c) Kristen Gilden <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace KG\DigiDoc\Tests\Native; | ||
|
||
use KG\DigiDoc\Native\Stamp; | ||
use VirtualFileSystem\FileSystem; | ||
|
||
class StampTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
public function testAddFile() | ||
{ | ||
$fs = new FileSystem(); | ||
file_put_contents($fs->path('/foo.txt'), $text = 'Hello, world!'); | ||
|
||
$stamp = new Stamp(); | ||
$stamp->addFile('example.txt', $fs->path('/foo.txt')); | ||
|
||
$this->assertEquals( | ||
hash('sha256', $text, true), | ||
$stamp->getFileDigest('example.txt') | ||
); | ||
} | ||
} |