org.bouncycastle.util.encoders.Base64.toBase64String()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(209)

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

Base64.toBase64String介绍

暂无

代码示例

代码示例来源:origin: apache/nifi

private String base64Encode(byte[] input) {
  return Base64.toBase64String(input).replaceAll("=", "");
}

代码示例来源:origin: apache/nifi

private String encode(byte[] rawBytes) {
  if (this.encoding.equalsIgnoreCase("HEX")) {
    return Hex.encodeHexString(rawBytes);
  } else {
    return Base64.toBase64String(rawBytes);
  }
}

代码示例来源:origin: spotify/helios

public static String digest(final String user, final String password) {
 return Base64.toBase64String(Hash.sha1digest(
   String.format("%s:%s", user, password).getBytes()));
}

代码示例来源:origin: com.dracoon/dracoon-crypto-sdk

/**
 * Converts a byte array into a Base64 encoded string.
 *
 * @param bytes The byte array to convert.
 *
 * @return The Base64 encoded string.
 */
public static String byteArrayToString(byte[] bytes) {
  return Base64.toBase64String(bytes);
}

代码示例来源:origin: radixdlt/radixdlt-java

@Override
  public String toString() {
    return Base64.toBase64String(hash);
  }
}

代码示例来源:origin: com.yoti/yoti-sdk-impl

public String getDisplayReceiptId() {
    return receiptId != null ? toBase64String(receiptId) : "<>";
  }
}

代码示例来源:origin: radixdlt/radixdlt-java

public String getExpectedBase64() {
  return Base64.toBase64String(expected);
}

代码示例来源:origin: com.xeiam.xchange/xchange-coinfloor

private static String bigIntegerToBase64(BigInteger bi) {
 byte[] bytes = bi.toByteArray();
 return bytes[0] == 0 ? org.bouncycastle.util.encoders.Base64.toBase64String(bytes, 1, bytes.length - 1)
   : org.bouncycastle.util.encoders.Base64.toBase64String(bytes);
}

代码示例来源:origin: radixdlt/radixdlt-java

@Override
  public String toString() {
    boolean encrypted = (Boolean) metaData.get("encrypted");

    return encrypted ? ("encrypted: " + Base64.toBase64String(bytes)) : ("unencrypted: " + new String(bytes));
  }
}

代码示例来源:origin: OpenAS2/OpenAs2App

private static String getRandomBase62UUID() {
  UUID uuid = UUID.randomUUID();
  ByteBuffer uuidBytes = ByteBuffer.wrap(new byte[16]);
  uuidBytes.putLong(uuid.getMostSignificantBits()); 
  uuidBytes.putLong(uuid.getLeastSignificantBits());
  return base64ToBase62(Base64.toBase64String(uuidBytes.array()));
}

代码示例来源:origin: radixdlt/radixdlt-java

@Override
  public String toString() {
    return "POW: nonce(" + nonce + ") magic(" + magic + ") seed(" + Base64.toBase64String(seed) + ") target(" + getTargetHex() + ")";
  }
}

代码示例来源:origin: Archistar/archistar-smc

@Override
public HashMap<String, String> getMetaData() {
  HashMap<String, String> res = getCommonMetaData();
  res.put("archistar-original-length", Integer.toString(originalLength));
  res.put("archistar-krawczyk-algorithm", Integer.toString(encAlgorithm));
  res.put("archistar-krawczyk-key", Base64.toBase64String(encKey));
  return res;
}

代码示例来源:origin: net.anwiba.commons/anwiba-commons-crypto

public static String sign(final String string) throws CodingException {
 try {
  return Base64.toBase64String(sign(string.getBytes("UTF-8"))); //$NON-NLS-1$
 } catch (final UnsupportedEncodingException exception) {
  throw new CodingException(exception.getMessage(), exception);
 }
}

代码示例来源:origin: iterate-ch/cyberduck

@Override
  protected void allow(final String hostname, final PublicKey key, final boolean persist) {
    if(persist) {
      preferences.setProperty(this.getFormat(hostname, key), Base64.toBase64String(key.getEncoded()));
    }
  }
}

代码示例来源:origin: redfish64/TinyTravelTracker

public static String toBase64String(
  byte[] data,
  int    off,
  int    length)
{
  byte[] encoded = encode(data, off, length);
  return Strings.fromByteArray(encoded);
}

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

public static String toBase64String(
  byte[] data,
  int off,
  int length)
{
  byte[] encoded = encode(data, off, length);
  return Strings.fromByteArray(encoded);
}

代码示例来源:origin: DanielKrawisz/Shufflepuff

public EncryptionKeyImpl(String hexString)
    throws InvalidKeySpecException, NoSuchAlgorithmException {
  try {
    // get base64 of passed hexstring and use BitcoinCrypto to load publickey
    this.publicKey = BitcoinCrypto.loadPublicKey(org.bouncycastle.util.encoders.Base64.toBase64String(org.spongycastle.util.encoders.Hex.decode(hexString)));
  } catch (GeneralSecurityException e) {
    e.printStackTrace();
    throw new RuntimeException();
  }
}

代码示例来源:origin: DanielKrawisz/Shufflepuff

@Override
// Unmarshall an encryption key from a string.
public EncryptionKey unmarshallEncryptionKey(String str)
    throws InvalidKeySpecException, NoSuchAlgorithmException {
  try {
    return new EncryptionKeyImpl(BitcoinCrypto.loadPublicKey(org.bouncycastle.util.encoders.Base64.toBase64String(org.spongycastle.util.encoders.Hex.decode(str))));
  } catch (GeneralSecurityException e) {
    e.printStackTrace();
    throw new RuntimeException();
  }
}

代码示例来源:origin: DanielKrawisz/Shufflepuff

public DecryptionKeyImpl(String privString, String publicString) {
  try {
   // will take keys as string in hex and convert to base64 and then load keys from that
   this.privateKey = BitcoinCrypto.loadPrivateKey(org.bouncycastle.util.encoders.Base64.toBase64String(Hex.decode(privString)));
   this.ek = new EncryptionKeyImpl(BitcoinCrypto.loadPublicKey(org.bouncycastle.util.encoders.Base64.toBase64String(Hex.decode(publicString))));
   this.key = ECKey.fromPrivate(this.privateKey.getEncoded());
  } catch (GeneralSecurityException e) {
   e.printStackTrace();
   throw new RuntimeCryptoException();
  }
}

代码示例来源:origin: com.yoti/yoti-sdk-impl

public SimpleActivityDetails(String rememberMeId, String parentRememberMeId, Profile userProfile, Profile applicationProfile, Date timestamp, byte[] receiptId) {
  this.rememberMeId = notNull(rememberMeId, "Remember Me id");
  this.parentRememberMeId = parentRememberMeId;
  this.userProfile = HumanProfileAdapter.wrap(notNull(userProfile, "User profile"));
  this.applicationProfile = ApplicationProfileAdapter.wrap(notNull(applicationProfile, "Application profile"));
  this.timestamp = notNull(timestamp, "Timestamp");
  this.receiptId = toBase64String(notNull(receiptId, "Receipt id"));
  
  if(this.userProfile.getSelfie() != null) {
    this.base64Selfie = "data:image/jpeg;base64," + toBase64String(this.userProfile.getSelfie().getValue().getContent());
  } else {
    this.base64Selfie = "";
  }
}

相关文章