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

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

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

Util.toAes128Key介绍

[英]Converts a string into 128-bit AES key.
[中]将字符串转换为128位AES密钥。

代码示例

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

  1. /**
  2. * Gets {@linkplain #getSecretKey() the secret key} as a key for AES-128.
  3. * @since 1.308
  4. * @deprecated
  5. * See {@link #getSecretKey()}.
  6. */
  7. @Deprecated
  8. public SecretKey getSecretKeyAsAES128() {
  9. return Util.toAes128Key(secretKey);
  10. }

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

  1. /**
  2. * Turns {@link Jenkins#getSecretKey()} into an AES key.
  3. *
  4. * @deprecated
  5. * This is no longer the key we use to encrypt new information, but we still need this
  6. * to be able to decrypt what's already persisted.
  7. */
  8. @Deprecated
  9. /*package*/ static SecretKey getLegacyKey() throws GeneralSecurityException {
  10. String secret = Secret.SECRET;
  11. if(secret==null) return Jenkins.getInstance().getSecretKeyAsAES128();
  12. return Util.toAes128Key(secret);
  13. }

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

  1. public DefaultConfidentialStore(File rootDir) throws IOException, InterruptedException {
  2. this.rootDir = rootDir;
  3. if (rootDir.mkdirs()) {
  4. // protect this directory. but don't change the permission of the existing directory
  5. // in case the administrator changed this.
  6. new FilePath(rootDir).chmod(0700);
  7. }
  8. TextFile masterSecret = new TextFile(new File(rootDir,"master.key"));
  9. if (!masterSecret.exists()) {
  10. // we are only going to use small number of bits (since export control limits AES key length)
  11. // but let's generate a long enough key anyway
  12. masterSecret.write(Util.toHexString(randomBytes(128)));
  13. }
  14. this.masterKey = Util.toAes128Key(masterSecret.readTrim());
  15. }

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

  1. /**
  2. * Gets {@linkplain #getSecretKey() the secret key} as a key for AES-128.
  3. * @since 1.308
  4. */
  5. public SecretKey getSecretKeyAsAES128() {
  6. return Util.toAes128Key(secretKey);
  7. }

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

  1. /**
  2. * Gets {@linkplain #getSecretKey() the secret key} as a key for AES-128.
  3. *
  4. * @since 1.308
  5. */
  6. public SecretKey getSecretKeyAsAES128() {
  7. return Util.toAes128Key(secretKey);
  8. }

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

  1. /**
  2. * Gets {@linkplain #getSecretKey() the secret key} as a key for AES-128.
  3. * @since 1.308
  4. */
  5. public SecretKey getSecretKeyAsAES128() {
  6. return Util.toAes128Key(secretKey);
  7. }

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

  1. /**
  2. * Gets {@linkplain #getSecretKey() the secret key} as a key for AES-128.
  3. * @since 1.308
  4. */
  5. public SecretKey getSecretKeyAsAES128() {
  6. return Util.toAes128Key(secretKey);
  7. }

代码示例来源:origin: io.provis/provisio-jenkins-runtime

  1. /**
  2. * Gets {@linkplain #getSecretKey() the secret key} as a key for AES-128.
  3. * @since 1.308
  4. * @deprecated
  5. * See {@link #getSecretKey()}.
  6. */
  7. public SecretKey getSecretKeyAsAES128() {
  8. return Util.toAes128Key(secretKey);
  9. }

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

  1. /**
  2. * Gets {@linkplain #getSecretKey() the secret key} as a key for AES-128.
  3. * @since 1.308
  4. * @deprecated
  5. * See {@link #getSecretKey()}.
  6. */
  7. @Deprecated
  8. public SecretKey getSecretKeyAsAES128() {
  9. return Util.toAes128Key(secretKey);
  10. }

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

  1. /**
  2. * Turns {@link Jenkins#getSecretKey()} into an AES key.
  3. *
  4. * @deprecated
  5. * This is no longer the key we use to encrypt new information, but we still need this
  6. * to be able to decrypt what's already persisted.
  7. */
  8. @Deprecated
  9. /*package*/ static SecretKey getLegacyKey() throws GeneralSecurityException {
  10. String secret = Secret.SECRET;
  11. if(secret==null) return Jenkins.getInstance().getSecretKeyAsAES128();
  12. return Util.toAes128Key(secret);
  13. }

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

  1. /**
  2. * Turns {@link Hudson#getSecretKey()} into an AES key.
  3. */
  4. private static SecretKey getKey() throws UnsupportedEncodingException, GeneralSecurityException {
  5. String secret = SECRET;
  6. if(secret==null) return Hudson.getInstance().getSecretKeyAsAES128();
  7. return Util.toAes128Key(secret);
  8. }

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

  1. /**
  2. * Turns {@link Hudson#getSecretKey()} into an AES key.
  3. */
  4. private static SecretKey getKey() throws UnsupportedEncodingException, GeneralSecurityException {
  5. String secret = SECRET;
  6. if(secret==null) return Hudson.getInstance().getSecretKeyAsAES128();
  7. return Util.toAes128Key(secret);
  8. }

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

  1. /**
  2. * Turns {@link Hudson#getSecretKey()} into an AES key.
  3. */
  4. private static SecretKey getKey() throws UnsupportedEncodingException, GeneralSecurityException {
  5. String secret = SECRET;
  6. if (secret == null) {
  7. return Hudson.getInstance().getSecretKeyAsAES128();
  8. }
  9. return Util.toAes128Key(secret);
  10. }

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

  1. /**
  2. * Turns {@link Hudson#getSecretKey()} into an AES key.
  3. */
  4. private static SecretKey getKey() throws UnsupportedEncodingException, GeneralSecurityException {
  5. String secret = SECRET;
  6. if(secret==null) return Hudson.getInstance().getSecretKeyAsAES128();
  7. return Util.toAes128Key(secret);
  8. }

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

  1. public DefaultConfidentialStore(File rootDir) throws IOException, InterruptedException {
  2. this.rootDir = rootDir;
  3. if (rootDir.mkdirs()) {
  4. // protect this directory. but don't change the permission of the existing directory
  5. // in case the administrator changed this.
  6. new FilePath(rootDir).chmod(0700);
  7. }
  8. TextFile masterSecret = new TextFile(new File(rootDir,"master.key"));
  9. if (!masterSecret.exists()) {
  10. // we are only going to use small number of bits (since export control limits AES key length)
  11. // but let's generate a long enough key anyway
  12. masterSecret.write(Util.toHexString(randomBytes(128)));
  13. }
  14. this.masterKey = Util.toAes128Key(masterSecret.readTrim());
  15. }

相关文章