use of org.openecard.bouncycastle.tls.crypto.TlsCrypto in project open-ecard by ecsec.
the class ClientCertPSKTlsClient method getSupportedSignatureAlgorithms.
@Override
protected Vector getSupportedSignatureAlgorithms() {
boolean weakCrypto = Boolean.valueOf(OpenecardProperties.getProperty("legacy.weak_crypto"));
TlsCrypto crypto = context.getCrypto();
short[] hashAlgorithms;
if (!weakCrypto) {
hashAlgorithms = new short[] { HashAlgorithm.sha512, HashAlgorithm.sha384, HashAlgorithm.sha256, HashAlgorithm.sha224 };
} else {
hashAlgorithms = new short[] { HashAlgorithm.sha512, HashAlgorithm.sha384, HashAlgorithm.sha256, HashAlgorithm.sha224, HashAlgorithm.sha1 };
}
short[] signatureAlgorithms = new short[] { SignatureAlgorithm.rsa, SignatureAlgorithm.ecdsa };
Vector result = new Vector();
for (int i = 0; i < signatureAlgorithms.length; ++i) {
for (int j = 0; j < hashAlgorithms.length; ++j) {
SignatureAndHashAlgorithm alg = new SignatureAndHashAlgorithm(hashAlgorithms[j], signatureAlgorithms[i]);
if (crypto.hasSignatureAndHashAlgorithm(alg)) {
result.addElement(alg);
}
}
}
return result;
}
Aggregations