MCPcopy Create free account
hub / github.com/jwtk/jjwt / AbstractCurve

Class AbstractCurve

impl/src/main/java/io/jsonwebtoken/impl/security/AbstractCurve.java:25–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23import java.security.Key;
24
25abstract class AbstractCurve implements Curve {
26
27 private final String ID;
28
29 private final String JCA_NAME;
30
31 AbstractCurve(String id, String jcaName) {
32 this.ID = Assert.notNull(Strings.clean(id), "Curve ID cannot be null or empty.");
33 this.JCA_NAME = Assert.notNull(Strings.clean(jcaName), "Curve jcaName cannot be null or empty.");
34 }
35
36 @Override
37 public String getId() {
38 return this.ID;
39 }
40
41 public String getJcaName() {
42 return this.JCA_NAME;
43 }
44
45 @Override
46 public int hashCode() {
47 return ID.hashCode();
48 }
49
50 @Override
51 public boolean equals(Object obj) {
52 if (this == obj) {
53 return true;
54 }
55 if (obj instanceof Curve) {
56 Curve curve = (Curve) obj;
57 return ID.equals(curve.getId());
58 }
59 return false;
60 }
61
62 @Override
63 public String toString() {
64 return ID;
65 }
66
67 public KeyPairBuilder keyPair() {
68 return new DefaultKeyPairBuilder(this.JCA_NAME);
69 }
70
71 /**
72 * Returns {@code true} if the specified key is known to represent a point on the curve, {@code false} otherwise.
73 *
74 * @param key the key to test
75 * @return {@code true} if the specified key is known to represent a point on the curve, {@code false} otherwise.
76 */
77 abstract boolean contains(Key key);
78}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…