示例#1
0
  private void setSignatureParameters(Signature var1, DEREncodable var2)
      throws NoSuchAlgorithmException, SignatureException, InvalidKeyException {
    if (var2 != null) {
      if (!DERNull.INSTANCE.equals(var2)) {
        String var3 = var1.getAlgorithm();
        Provider var4 = var1.getProvider();
        AlgorithmParameters var5 = AlgorithmParameters.getInstance(var3, var4);

        try {
          byte[] var6 = var2.getDERObject().getDEREncoded();
          var5.init(var6);
        } catch (IOException var17) {
          StringBuilder var9 = (new StringBuilder()).append("IOException decoding parameters: ");
          String var10 = var17.getMessage();
          String var11 = var9.append(var10).toString();
          throw new SignatureException(var11);
        }

        if (var1.getAlgorithm().endsWith("MGF1")) {
          try {
            AlgorithmParameterSpec var7 = var5.getParameterSpec(PSSParameterSpec.class);
            var1.setParameter(var7);
          } catch (GeneralSecurityException var16) {
            StringBuilder var13 = (new StringBuilder()).append("Exception extracting parameters: ");
            String var14 = var16.getMessage();
            String var15 = var13.append(var14).toString();
            throw new SignatureException(var15);
          }
        }
      }
    }
  }
示例#2
0
  static String getSignatureName(AlgorithmIdentifier var0) {
    DEREncodable var1 = var0.getParameters();
    String var7;
    if (var1 != null && !DERNull.INSTANCE.equals(var1)) {
      DERObjectIdentifier var2 = var0.getObjectId();
      DERObjectIdentifier var3 = PKCSObjectIdentifiers.id_RSASSA_PSS;
      if (var2.equals(var3)) {
        RSASSAPSSparams var4 = RSASSAPSSparams.getInstance(var1);
        StringBuilder var5 = new StringBuilder();
        String var6 = getDigestAlgName(var4.getHashAlgorithm().getObjectId());
        var7 = var5.append(var6).append("withRSAandMGF1").toString();
        return var7;
      }
    }

    var7 = var0.getObjectId().getId();
    return var7;
  }