hudson.Util.fromHexString()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(4.6k)|赞(0)|评价(0)|浏览(371)

本文整理了Java中hudson.Util.fromHexString()方法的一些代码示例,展示了Util.fromHexString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.fromHexString()方法的具体详情如下:
包路径:hudson.Util
类名称:Util
方法名:fromHexString

Util.fromHexString介绍

暂无

代码示例

代码示例来源:origin: jenkinsci/jenkins

private RSAPublicKey getKey() {
  try {
    if (key == null) {
      KeyFactory keyFactory = KeyFactory.getInstance("RSA");
      key = (RSAPublicKey)keyFactory.generatePublic(new X509EncodedKeySpec(Util.fromHexString(keyImage)));
    }
    return key;
  } catch (GeneralSecurityException e) {
    throw new Error(e); // impossible
  }
}

代码示例来源:origin: jenkinsci/jenkins

public boolean match(byte[] hashedBytes) {
  byte[] hashFromHex;
  try {
    hashFromHex = Util.fromHexString(value.hash);
  } catch (NumberFormatException e) {
    LOGGER.log(Level.INFO, "The API token with name=[{0}] is not in hex-format and so cannot be used", name);
    return false;
  }
  
  // String.equals() is not constant-time but this method is. No link between correctness and time spent
  return MessageDigest.isEqual(hashFromHex, hashedBytes);
}

代码示例来源:origin: jenkinsci/jenkins

public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
    String data = reader.getValue(); // needs to be called before hasMoreChildren.
    return Util.fromHexString(data);
  }
}

代码示例来源:origin: jenkinsci/jenkins

jnlpMac = Util.fromHexString(((SlaveComputer)it).getJnlpMac());
} else {
  jnlpMac = JnlpSlaveAgentProtocol.SLAVE_SECRET.mac(slaveName.getBytes("UTF-8"));

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

private RSAPublicKey getKey() {
  try {
    if (key == null) {
      KeyFactory keyFactory = KeyFactory.getInstance("RSA");
      key = (RSAPublicKey)keyFactory.generatePublic(new X509EncodedKeySpec(Util.fromHexString(keyImage)));
    }
    return key;
  } catch (GeneralSecurityException e) {
    throw new Error(e); // impossible
  }
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
    String data = reader.getValue(); // needs to be called before hasMoreChildren.
    return Util.fromHexString(data);
  }
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
    String data = reader.getValue(); // needs to be called before hasMoreChildren.
    return Util.fromHexString(data);
  }
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
    String data = reader.getValue(); // needs to be called before hasMoreChildren.
    return Util.fromHexString(data);
  }
}

代码示例来源:origin: hudson/hudson-2.x

public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
    String data = reader.getValue(); // needs to be called before hasMoreChildren.
    return Util.fromHexString(data);
  }
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
    String data = reader.getValue(); // needs to be called before hasMoreChildren.
    return Util.fromHexString(data);
  }
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

private Cipher getCipher() {
  try {
    if (key == null) {
      KeyFactory keyFactory = KeyFactory.getInstance("RSA");
      key = keyFactory.generatePublic(new X509EncodedKeySpec(Util.fromHexString(keyImage)));
    }
    Cipher cipher = Secret.getCipher("RSA");
    cipher.init(Cipher.ENCRYPT_MODE, key);
    return cipher;
  } catch (GeneralSecurityException e) {
    throw new Error(e); // impossible
  }
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

private Cipher getCipher() {
  try {
    if (key == null) {
      KeyFactory keyFactory = KeyFactory.getInstance("RSA");
      key = keyFactory.generatePublic(new X509EncodedKeySpec(Util.fromHexString(keyImage)));
    }
    Cipher cipher = Secret.getCipher("RSA");
    cipher.init(Cipher.ENCRYPT_MODE, key);
    return cipher;
  } catch (GeneralSecurityException e) {
    throw new Error(e); // impossible
  }
}

代码示例来源:origin: hudson/hudson-2.x

private Cipher getCipher() {
  try {
    if (key == null) {
      KeyFactory keyFactory = KeyFactory.getInstance("RSA");
      key = keyFactory.generatePublic(new X509EncodedKeySpec(Util.fromHexString(keyImage)));
    }
    Cipher cipher = Secret.getCipher("RSA");
    cipher.init(Cipher.ENCRYPT_MODE, key);
    return cipher;
  } catch (GeneralSecurityException e) {
    throw new Error(e); // impossible
  }
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

private Cipher getCipher() {
  try {
    if (key == null) {
      KeyFactory keyFactory = KeyFactory.getInstance("RSA");
      key = keyFactory.generatePublic(new X509EncodedKeySpec(Util.fromHexString(keyImage)));
    }
    Cipher cipher = Secret.getCipher("RSA");
    cipher.init(Cipher.ENCRYPT_MODE, key);
    return cipher;
  } catch (GeneralSecurityException e) {
    throw new Error(e); // impossible
  }
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

jnlpMac = Util.fromHexString(((SlaveComputer)it).getJnlpMac());
} else {
  jnlpMac = JnlpSlaveAgentProtocol.SLAVE_SECRET.mac(slaveName.getBytes("UTF-8"));

相关文章