use of java.security.spec.DSAParameterSpec in project robovm by robovm.
the class AlgorithmParametersSpi method engineInit.
protected void engineInit(byte[] params) throws IOException {
try {
DSAParameter dsaP = DSAParameter.getInstance(ASN1Primitive.fromByteArray(params));
currentSpec = new DSAParameterSpec(dsaP.getP(), dsaP.getQ(), dsaP.getG());
} catch (ClassCastException e) {
throw new IOException("Not a valid DSA Parameter encoding.");
} catch (ArrayIndexOutOfBoundsException e) {
throw new IOException("Not a valid DSA Parameter encoding.");
}
}
use of java.security.spec.DSAParameterSpec in project robovm by robovm.
the class BCDSAPrivateKey method readObject.
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
this.dsaSpec = new DSAParameterSpec((BigInteger) in.readObject(), (BigInteger) in.readObject(), (BigInteger) in.readObject());
this.attrCarrier = new PKCS12BagAttributeCarrierImpl();
}
use of java.security.spec.DSAParameterSpec in project robovm by robovm.
the class KeyPairGeneratorSpi method initialize.
public void initialize(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException {
if (!(params instanceof DSAParameterSpec)) {
throw new InvalidAlgorithmParameterException("parameter object not a DSAParameterSpec");
}
DSAParameterSpec dsaParams = (DSAParameterSpec) params;
param = new DSAKeyGenerationParameters(random, new DSAParameters(dsaParams.getP(), dsaParams.getQ(), dsaParams.getG()));
engine.init(param);
initialised = true;
}
use of java.security.spec.DSAParameterSpec in project robovm by robovm.
the class JDKDSAPublicKey method readObject.
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
this.y = (BigInteger) in.readObject();
this.dsaSpec = new DSAParameterSpec((BigInteger) in.readObject(), (BigInteger) in.readObject(), (BigInteger) in.readObject());
}
use of java.security.spec.DSAParameterSpec in project robovm by robovm.
the class OpenSSLDSAKeyPairGenerator method initialize.
@Override
public void initialize(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException {
this.random = random;
if (params instanceof DSAParameterSpec) {
DSAParameterSpec dsaParams = (DSAParameterSpec) params;
BigInteger gInt = dsaParams.getG();
if (gInt != null) {
g = gInt.toByteArray();
}
BigInteger pInt = dsaParams.getP();
if (pInt != null) {
p = pInt.toByteArray();
}
BigInteger qInt = dsaParams.getQ();
if (qInt != null) {
q = qInt.toByteArray();
}
} else if (params != null) {
throw new InvalidAlgorithmParameterException("Params must be DSAParameterSpec");
}
}
Aggregations