1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package io.github.tonywasher.joceanus.gordianknot.impl.bc;
18
19 import io.github.tonywasher.joceanus.gordianknot.api.agree.GordianAgreementSpec;
20 import io.github.tonywasher.joceanus.gordianknot.api.base.GordianException;
21 import io.github.tonywasher.joceanus.gordianknot.api.keypair.GordianKeyPair;
22 import io.github.tonywasher.joceanus.gordianknot.impl.core.agree.GordianCoreAgreementEngine;
23 import io.github.tonywasher.joceanus.gordianknot.impl.core.agree.GordianCoreAgreementFactory;
24 import io.github.tonywasher.joceanus.gordianknot.impl.core.exc.GordianDataException;
25 import io.github.tonywasher.joceanus.gordianknot.impl.core.keypair.GordianPrivateKey;
26 import io.github.tonywasher.joceanus.gordianknot.impl.core.keypair.GordianPublicKey;
27
28
29
30
31 public abstract class BouncyAgreementBase
32 extends GordianCoreAgreementEngine {
33
34
35
36
37
38
39
40 BouncyAgreementBase(final GordianCoreAgreementFactory pFactory,
41 final GordianAgreementSpec pSpec) throws GordianException {
42
43 super(pFactory, pSpec);
44
45
46 enableDerivation();
47 }
48
49 @Override
50 protected GordianPublicKey getPublicKey(final GordianKeyPair pKeyPair) throws GordianException {
51
52 if (!(pKeyPair instanceof BouncyKeyPair)) {
53
54 throw new GordianDataException("Invalid KeyPair");
55 }
56
57
58 return super.getPublicKey(pKeyPair);
59 }
60
61 @Override
62 protected GordianPrivateKey getPrivateKey(final GordianKeyPair pKeyPair) throws GordianException {
63
64 if (!(pKeyPair instanceof BouncyKeyPair)) {
65
66 throw new GordianDataException("Invalid KeyPair");
67 }
68
69
70 return super.getPrivateKey(pKeyPair);
71 }
72 }