10
10
11
11
import org .bouncycastle .asn1 .ASN1ObjectIdentifier ;
12
12
import org .bouncycastle .asn1 .cryptlib .CryptlibObjectIdentifiers ;
13
+ import org .bouncycastle .asn1 .edec .EdECObjectIdentifiers ;
13
14
import org .bouncycastle .asn1 .gnu .GNUObjectIdentifiers ;
14
15
import org .bouncycastle .asn1 .x9 .ECNamedCurveTable ;
15
16
import org .bouncycastle .asn1 .x9 .X9ECParametersHolder ;
16
17
import org .bouncycastle .bcpg .BCPGKey ;
17
18
import org .bouncycastle .bcpg .BCPGOutputStream ;
18
19
import org .bouncycastle .bcpg .DSAPublicBCPGKey ;
19
20
import org .bouncycastle .bcpg .ECPublicBCPGKey ;
21
+ import org .bouncycastle .bcpg .Ed448PublicBCPGKey ;
20
22
import org .bouncycastle .bcpg .ElGamalPublicBCPGKey ;
21
23
import org .bouncycastle .bcpg .KeyIdentifier ;
24
+ import org .bouncycastle .bcpg .OctetArrayBCPGKey ;
22
25
import org .bouncycastle .bcpg .PublicKeyAlgorithmTags ;
23
26
import org .bouncycastle .bcpg .PublicKeyPacket ;
24
27
import org .bouncycastle .bcpg .PublicSubkeyPacket ;
28
31
import org .bouncycastle .bcpg .UserAttributePacket ;
29
32
import org .bouncycastle .bcpg .UserDataPacket ;
30
33
import org .bouncycastle .bcpg .UserIDPacket ;
34
+ import org .bouncycastle .bcpg .X448PublicBCPGKey ;
31
35
import org .bouncycastle .openpgp .operator .KeyFingerPrintCalculator ;
32
36
import org .bouncycastle .util .Arrays ;
33
37
@@ -47,7 +51,7 @@ public class PGPPublicKey
47
51
List <List <PGPSignature >> idSigs = new ArrayList <List <PGPSignature >>();
48
52
49
53
List <PGPSignature > subSigs = null ;
50
-
54
+
51
55
private KeyIdentifier keyIdentifier ;
52
56
private int keyStrength ;
53
57
@@ -90,6 +94,14 @@ else if (key instanceof ECPublicBCPGKey)
90
94
{
91
95
this .keyStrength = 256 ;
92
96
}
97
+ else if (curveOID .equals (EdECObjectIdentifiers .id_X448 ))
98
+ {
99
+ this .keyStrength = X448PublicBCPGKey .LENGTH * 8 ;
100
+ }
101
+ else if (curveOID .equals (EdECObjectIdentifiers .id_Ed448 ))
102
+ {
103
+ this .keyStrength = Ed448PublicBCPGKey .LENGTH * 8 ;
104
+ }
93
105
else
94
106
{
95
107
X9ECParametersHolder ecParameters = ECNamedCurveTable .getByOIDLazy (curveOID );
@@ -104,6 +116,10 @@ else if (key instanceof ECPublicBCPGKey)
104
116
}
105
117
}
106
118
}
119
+ else if (key instanceof OctetArrayBCPGKey )
120
+ {
121
+ this .keyStrength = key .getEncoded ().length * 8 ;
122
+ }
107
123
}
108
124
}
109
125
@@ -150,7 +166,7 @@ public PGPPublicKey(PublicKeyPacket publicKeyPacket, KeyFingerPrintCalculator fi
150
166
this .publicPk = key .publicPk ;
151
167
this .trustPk = trust ;
152
168
this .subSigs = subSigs ;
153
-
169
+
154
170
this .keyStrength = key .keyStrength ;
155
171
this .keyIdentifier = key .keyIdentifier ;
156
172
}
0 commit comments