Free as in Freedom: Codeberg.org. Create your repos and join us!
Join Donate
Browse Source

add codeblock syntax

Paul Schaub 6 months ago
parent
commit
51991bdb07
Signed by: Paul Schaub <vanitasvitae@fsfe.org> GPG Key ID: 62BEE9264BF17311
1 changed files with 9 additions and 9 deletions
  1. 9
    9
      README.md

+ 9
- 9
README.md View File

@@ -21,7 +21,7 @@ PGPainless is based around the Bouncycastle java library and can be used on Andr
21 21
 PGPainless is available on maven central. In order to include it in your project, just add the 
22 22
 maven central repository and add PGPainless as a dependency.
23 23
 
24
-```
24
+```gradle
25 25
 repositories {
26 26
 	mavenCentral()
27 27
 }
@@ -39,7 +39,7 @@ The entry point to the API is the `PGPainless` class. Here you can find methods
39 39
 
40 40
 The first thing you probably want to do is generate you some nice tasty Key Pairs. The most straight forward way to do so is by calling
41 41
 
42
-```
42
+```java
43 43
         PGPSecretKeyRing keyRing = PGPainless.generateKeyRing()
44 44
                 .simpleRsaKeyRing("Juliet <juliet@montague.lit>", RsaLength._4096);
45 45
 ```
@@ -47,7 +47,7 @@ The first thing you probably want to do is generate you some nice tasty Key Pair
47 47
 but feel free to explore the API further. PGPainless allows you to create Key Pairs consisting of a master key plus several sub keys, even with different algorithms at the same time!
48 48
 Take for example a look at this delicious key:
49 49
 
50
-```
50
+```java
51 51
         PGPSecretKeyRing keyRing = PGPainless.generateKeyRing()
52 52
                 .withSubKey(
53 53
                         KeySpec.getBuilder(ECDSA.fromCurve(EllipticCurve._P256))
@@ -74,7 +74,7 @@ Take for example a look at this delicious key:
74 74
 ### Encrypt / Sign Data
75 75
 
76 76
 Encrypting and signing data is pretty straight forward as well.
77
-```
77
+```java
78 78
         EncryptionStream encryptor = PGPainless.createEncryptor()
79 79
                 .onOutputStream(targetOuputStream)
80 80
                 .toRecipients(publicKeyRings)
@@ -85,7 +85,7 @@ Encrypting and signing data is pretty straight forward as well.
85 85
 
86 86
 The resulting `EncryptionStream` can then be used to encrypt data like follows:
87 87
 
88
-```
88
+```java
89 89
         Streams.pipeAll(sourceInputStream, encryptor);
90 90
         sourceInputStream.close();
91 91
         encryptor.close();
@@ -95,7 +95,7 @@ The encrypted data will be written to the provided `targetOutputStream`.
95 95
 
96 96
 Additionally you can get information about the encrypted data by calling
97 97
 
98
-```
98
+```java
99 99
         PainlessResult result = encryptor.getResult();
100 100
 ```
101 101
 
@@ -105,7 +105,7 @@ That object will contain information like to which keys the message is encrypted
105 105
 
106 106
 To process incoming encrypted / signed data, just do the following:
107 107
 
108
-```
108
+```java
109 109
         DecryptionStream decryptor = PGPainless.createDecryptor()
110 110
                 .onInputStream(sourceInputStream) // insert encrypted data here
111 111
                 .decryptWith(secretKeyDecryptor, secretKey)
@@ -116,7 +116,7 @@ To process incoming encrypted / signed data, just do the following:
116 116
 
117 117
 Again, the resulting `DecryptionStream` can be used like a normal stream.
118 118
 
119
-```
119
+```java
120 120
         Streams.pipeAll(decryptor, targetOutputStream);
121 121
         decryptor.close();
122 122
 ```
@@ -124,7 +124,7 @@ Again, the resulting `DecryptionStream` can be used like a normal stream.
124 124
 *After* the `DecryptionStream` was closed, you can get metadata about the processed data by retrieving the `PainlessResult`.
125 125
 Again, this object will contain information about how the message was encrypted, who signed it and so on.
126 126
 
127
-```
127
+```java
128 128
         PainlessResult result = decryptor.getResult();
129 129
 ```
130 130
 

Loading…
Cancel
Save