JCEDHPublicKeypublic class JCEDHPublicKey extends Object implements DHPublicKey
Fields Summary |
---|
private BigInteger | y | private DHParameterSpec | dhSpec |
Constructors Summary |
---|
JCEDHPublicKey(DHPublicKeySpec spec)
this.y = spec.getY();
this.dhSpec = new DHParameterSpec(spec.getP(), spec.getG());
| JCEDHPublicKey(DHPublicKey key)
this.y = key.getY();
this.dhSpec = key.getParams();
| JCEDHPublicKey(org.bouncycastle.crypto.params.DHPublicKeyParameters params)
this.y = params.getY();
this.dhSpec = new DHParameterSpec(params.getParameters().getP(), params.getParameters().getG(), 0);
| JCEDHPublicKey(BigInteger y, DHParameterSpec dhSpec)
this.y = y;
this.dhSpec = dhSpec;
| JCEDHPublicKey(org.bouncycastle.asn1.x509.SubjectPublicKeyInfo info)
DHParameter params = new DHParameter((ASN1Sequence)info.getAlgorithmId().getParameters());
DERInteger derY = null;
try
{
derY = (DERInteger)info.getPublicKey();
}
catch (IOException e)
{
throw new IllegalArgumentException("invalid info structure in DH public key");
}
this.y = derY.getValue();
if (params.getL() != null)
{
this.dhSpec = new DHParameterSpec(params.getP(), params.getG(), params.getL().intValue());
}
else
{
this.dhSpec = new DHParameterSpec(params.getP(), params.getG());
}
|
Methods Summary |
---|
public java.lang.String | getAlgorithm()
return "DH";
| public byte[] | getEncoded()
SubjectPublicKeyInfo info = new SubjectPublicKeyInfo(new AlgorithmIdentifier(X9ObjectIdentifiers.dhpublicnumber, new DHParameter(dhSpec.getP(), dhSpec.getG(), dhSpec.getL()).getDERObject()), new DERInteger(y));
return info.getDEREncoded();
| public java.lang.String | getFormat()
return "X.509";
| public javax.crypto.spec.DHParameterSpec | getParams()
return dhSpec;
| public java.math.BigInteger | getY()
return y;
| private void | readObject(java.io.ObjectInputStream in)
this.y = (BigInteger)in.readObject();
this.dhSpec = new DHParameterSpec((BigInteger)in.readObject(), (BigInteger)in.readObject(), in.readInt());
| private void | writeObject(java.io.ObjectOutputStream out)
out.writeObject(this.getY());
out.writeObject(dhSpec.getP());
out.writeObject(dhSpec.getG());
out.writeInt(dhSpec.getL());
|
|