File tree Expand file tree Collapse file tree 2 files changed +39
-1
lines changed
pg/src/main/java/org/bouncycastle/openpgp Expand file tree Collapse file tree 2 files changed +39
-1
lines changed Original file line number Diff line number Diff line change 1010
1111import org .bouncycastle .bcpg .BCPGInputStream ;
1212import org .bouncycastle .bcpg .PacketTags ;
13+ import org .bouncycastle .bcpg .TrustPacket ;
1314import org .bouncycastle .bcpg .UnknownPacket ;
1415import org .bouncycastle .bcpg .UnsupportedPacketVersionException ;
1516import org .bouncycastle .openpgp .operator .KeyFingerPrintCalculator ;
16- import org .bouncycastle .util .Iterable ;
1717
1818/**
1919 * General class for reading a PGP object stream.
@@ -141,6 +141,8 @@ public Object nextObject()
141141 return new PGPCompressedData (in );
142142 case PacketTags .LITERAL_DATA :
143143 return new PGPLiteralData (in );
144+ case PacketTags .TRUST :
145+ return new PGPTrust (in );
144146 case PacketTags .PUBLIC_KEY_ENC_SESSION :
145147 case PacketTags .SYMMETRIC_KEY_ENC_SESSION :
146148 case PacketTags .SYMMETRIC_KEY_ENC :
Original file line number Diff line number Diff line change 1+ package org .bouncycastle .openpgp ;
2+
3+ import org .bouncycastle .bcpg .BCPGInputStream ;
4+ import org .bouncycastle .bcpg .TrustPacket ;
5+
6+ import java .io .IOException ;
7+ import java .util .Arrays ;
8+
9+ public class PGPTrust
10+ {
11+
12+ private final TrustPacket packet ;
13+
14+ public PGPTrust (TrustPacket packet )
15+ {
16+ this .packet = packet ;
17+ }
18+
19+ public PGPTrust (BCPGInputStream inputStream )
20+ throws IOException
21+ {
22+ this ((TrustPacket ) inputStream .readPacket ());
23+ }
24+
25+ public TrustPacket getPacket ()
26+ {
27+ return packet ;
28+ }
29+
30+ public byte [] getLevelAndTrust ()
31+ {
32+ return Arrays .copyOf (
33+ packet .getLevelAndTrustAmount (),
34+ packet .getLevelAndTrustAmount ().length );
35+ }
36+ }
You can’t perform that action at this time.
0 commit comments