Skip to content

Commit

Permalink
Merge branch 'Hemuu:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Hemuu authored Feb 19, 2023
2 parents 00ace5b + 4d0fb3c commit d7c5a7b
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ MssClient client = new MssClient.Builder().withRestUrl("https://demo.methics.fi/
.withPassword("TestAP", "9TMzfH7EKXETOB8FT5gz")
.build();
try {
MSS_SignatureResp resp = client.authenticate("35847001001", "Authentication test", SignatureProfile.of("http://alauda.mobi/digitalSignature"));
MSS_SignatureResp resp = client.authenticate("35847001001",
"Authentication test",
SignatureProfile.of("http://alauda.mobi/digitalSignature"));
if (resp.isSuccess()) {
System.out.println("Successfully authenticated " + resp.getSubjectDN());
}
Expand All @@ -37,10 +39,13 @@ PdfSigner signer = new PdfSigner(client);

File doc = new File("example.pdf");
InputStream is = new FileInputStream(doc);
ByteArrayOutputStream os = signer.signDocument("35847001001", "Please sign example.pdf", is, SignatureProfile.of("http://alauda.mobi/digitalSignature"));
ByteArrayOutputStream os = signer.signDocument("35847001001",
"Please sign example.pdf",
is,
SignatureProfile.of("http://alauda.mobi/digitalSignature"));
try (FileOutputStream fos = new FileOutputStream(new File("example.signed.pdf"))) {
os.writeTo(fos);
}
}
```

DOCX Signing
Expand All @@ -49,12 +54,15 @@ DOCX Signing
MssClient client = new MssClient.Builder().withRestUrl("https://demo.methics.fi/restapi/")
.withPassword("TestAP", "9TMzfH7EKXETOB8FT5gz")
.build();
DocxSigner signer = new DocxSigner(client);
DocxSigner signer = new DocxSigner(client);

File doc = new File("example.docx");
InputStream is = new FileInputStream(doc);
ByteArrayOutputStream os = signer.signDocument("35847001001", "Please sign example.docx", is, SignatureProfile.of("http://alauda.mobi/digitalSignature"));
try (FileOutputStream fos = new FileOutputStream(new File("example.signed.docx"))) {
os.writeTo(fos);
File doc = new File("example.docx");
InputStream is = new FileInputStream(doc);
ByteArrayOutputStream os = signer.signDocument("35847001001",
"Please sign example.docx",
is,
SignatureProfile.of("http://alauda.mobi/digitalSignature"));
try (FileOutputStream fos = new FileOutputStream(new File("example.signed.docx"))) {
os.writeTo(fos);
}
```

0 comments on commit d7c5a7b

Please sign in to comment.