public static HashAlgoType getNonNullHashAlgoType(final String nameOrOid) { HashAlgoType type = getHashAlgoType(nameOrOid); if (type == null) { throw new IllegalArgumentException("Unknown HashAlgo OID/name '" + nameOrOid + "'"); } return type; }
public static HashAlgoType getNonNullHashAlgoType(final ASN1ObjectIdentifier oid) { HashAlgoType type = getHashAlgoType(oid); if (type == null) { throw new IllegalArgumentException("Unknown HashAlgo OID '" + oid.getId() + "'"); } return type; }
public static ASN1ObjectIdentifier getHashAlg(final String hashAlgName) throws NoSuchAlgorithmException { ParamUtil.requireNonNull("hashAlgName", hashAlgName); HashAlgoType hashAlgo = HashAlgoType.getHashAlgoType(hashAlgName); if (hashAlgo == null) { throw new NoSuchAlgorithmException("Unsupported hash algorithm " + hashAlgName); } return hashAlgo.oid(); } // method getHashAlg
public static int getHashOutputSizeInOctets(final ASN1ObjectIdentifier hashAlgo) throws NoSuchAlgorithmException { ParamUtil.requireNonNull("hashAlgo", hashAlgo); HashAlgoType hashAlgoType = HashAlgoType.getHashAlgoType(hashAlgo); if (hashAlgoType == null) { throw new NoSuchAlgorithmException("Unsupported hash algorithm " + hashAlgo.getId()); } return hashAlgoType.length(); } // method getHashOutputSizeInOctets
public static Digest getDigest(final AlgorithmIdentifier hashAlgo) throws XiSecurityException { HashAlgoType hat = HashAlgoType.getHashAlgoType(hashAlgo.getAlgorithm()); if (hat != null) { return hat.createDigest(); } else { throw new XiSecurityException( "could not get digest for " + hashAlgo.getAlgorithm().getId()); } }
public P11RSAPkcsPssParams(final RSASSAPSSparams asn1Params) { ASN1ObjectIdentifier asn1Oid = asn1Params.getHashAlgorithm().getAlgorithm(); HashAlgoType contentHashAlgo = HashAlgoType.getHashAlgoType(asn1Oid); if (contentHashAlgo == null) { throw new IllegalArgumentException("unsupported hash algorithm " + asn1Oid.getId()); HashAlgoType mgfHashAlgo = HashAlgoType.getHashAlgoType(asn1Oid); if (mgfHashAlgo == null) { throw new IllegalArgumentException("unsupported MGF hash algorithm " + asn1Oid.getId());
HashAlgoType hashAlgo = HashAlgoType.getHashAlgoType(digestAlgOid); if (hashAlgo == null) { throw new XiSecurityException("unsupported hash algorithm " + digestAlgOid.getId());