MCPcopy Index your code
hub / github.com/bcgit/bc-java / DHPublicKey

Class DHPublicKey

core/src/main/java/org/bouncycastle/asn1/x9/DHPublicKey.java:16–98  ·  view source on GitHub ↗

X9.42 definition of a DHPublicKey DHPublicKey ::= INTEGER

Source from the content-addressed store, hash-verified

14 * </pre>
15 */
16public class DHPublicKey
17 extends ASN1Object
18{
19 private ASN1Integer y;
20
21 /**
22 * Return a DHPublicKey from the passed in tagged object.
23 *
24 * @param obj a tagged object.
25 * @param explicit true if the contents of the object is explictly tagged, false otherwise.
26 * @return a DHPublicKey
27 */
28 public static DHPublicKey getInstance(ASN1TaggedObject obj, boolean explicit)
29 {
30 return getInstance(ASN1Integer.getInstance(obj, explicit));
31 }
32
33 /**
34 * Return a DHPublicKey from the passed in object.
35 *
36 * @param obj an object for conversion or a byte[].
37 * @return a DHPublicKey
38 */
39 public static DHPublicKey getInstance(Object obj)
40 {
41 if (obj == null || obj instanceof DHPublicKey)
42 {
43 return (DHPublicKey)obj;
44 }
45
46 if (obj instanceof ASN1Integer)
47 {
48 return new DHPublicKey((ASN1Integer)obj);
49 }
50
51 throw new IllegalArgumentException("Invalid DHPublicKey: " + obj.getClass().getName());
52 }
53
54 private DHPublicKey(ASN1Integer y)
55 {
56 if (y == null)
57 {
58 throw new IllegalArgumentException("'y' cannot be null");
59 }
60
61 this.y = y;
62 }
63
64 /**
65 * Base constructor.
66 *
67 * @param y the public value Y.
68 */
69 public DHPublicKey(BigInteger y)
70 {
71 if (y == null)
72 {
73 throw new IllegalArgumentException("'y' cannot be null");

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected