本文整理汇总了Java中org.springframework.security.crypto.codec.Hex.decode方法的典型用法代码示例。如果您正苦于以下问题:Java Hex.decode方法的具体用法?Java Hex.decode怎么用?Java Hex.decode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.security.crypto.codec.Hex
的用法示例。
在下文中一共展示了Hex.decode方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: check
import org.springframework.security.crypto.codec.Hex; //导入方法依赖的package包/类
@SneakyThrows
public boolean check(String gitHubSignature, String body) {
if(gitHubSignature == null || !gitHubSignature.startsWith(SIGNATURE_PREFIX)) {
return false;
}
AccessToken expectedToken = accessTokens.findOne(AccessToken.CLA_ACCESS_TOKEN_ID);
if(expectedToken == null) {
return false;
}
String providedHmac = gitHubSignature.substring(SIGNATURE_PREFIX.length());
byte[] providedHmacBytes = Hex.decode(providedHmac);
byte[] expectedBytes = sign(body, expectedToken.getToken());
return MessageDigest.isEqual(providedHmacBytes, expectedBytes);
}
示例2: decrypt
import org.springframework.security.crypto.codec.Hex; //导入方法依赖的package包/类
public String decrypt(String data) {
if (data == null) {
return null;
}
byte[] decodedBytes = Hex.decode(data);
byte[] decryptedBytes = encryptor.decrypt(decodedBytes);
return new String(decryptedBytes, StandardCharsets.UTF_8);
}
示例3: AndroidAesBytesEncryptor
import org.springframework.security.crypto.codec.Hex; //导入方法依赖的package包/类
public AndroidAesBytesEncryptor(String password, CharSequence salt, BytesKeyGenerator ivGenerator) {
PBEKeySpec keySpec = new PBEKeySpec(password.toCharArray(), Hex.decode(salt), 1024, 256);
SecretKey secretKey = newSecretKey("PBEWITHSHA256AND256BITAES-CBC-BC", keySpec);
this.secretKey = new SecretKeySpec(secretKey.getEncoded(), "AES");
encryptor = newCipher(AES_ALGORITHM);
decryptor = newCipher(AES_ALGORITHM);
this.ivGenerator = ivGenerator;
}
示例4: SearchableStringEncryptor
import org.springframework.security.crypto.codec.Hex; //导入方法依赖的package包/类
public SearchableStringEncryptor(String password, String salt) {
String algorithm = "PBEWithMD5AndDES";
byte[] saltBytes = Hex.decode(salt);
SecretKey secretKey = newSecretKey(algorithm, password);
encryptor = newCipher(algorithm);
initCipher(encryptor, Cipher.ENCRYPT_MODE, secretKey, saltBytes, 1000);
decryptor = newCipher(algorithm);
initCipher(decryptor, Cipher.DECRYPT_MODE, secretKey, saltBytes, 1000);
}
示例5: decode
import org.springframework.security.crypto.codec.Hex; //导入方法依赖的package包/类
private byte[] decode(CharSequence encodedPassword) {
return Hex.decode(encodedPassword);
}
示例6: generateBase32Key
import org.springframework.security.crypto.codec.Hex; //导入方法依赖的package包/类
public static String generateBase32Key() {
byte[] hexBytes = Hex.decode(generateHexKey());
return new Base32().encodeAsString(hexBytes);
}
示例7: generateBase64Key
import org.springframework.security.crypto.codec.Hex; //导入方法依赖的package包/类
public static String generateBase64Key() {
byte[] hexBytes = Hex.decode(generateHexKey());
return new String(Base64.encode(hexBytes));
}
示例8: generateBase32Key
import org.springframework.security.crypto.codec.Hex; //导入方法依赖的package包/类
public static String generateBase32Key() {
byte[] hexBytes = Hex.decode(UUID.randomUUID().toString().replace("-", ""));
return new Base32().encodeAsString(hexBytes);
}
示例9: generateBase64Key
import org.springframework.security.crypto.codec.Hex; //导入方法依赖的package包/类
public static String generateBase64Key() {
byte[] hexBytes = Hex.decode(UUID.randomUUID().toString().replace("-", ""));
return new Base64().encodeAsString(hexBytes);
}
示例10: toStringOnAction
import org.springframework.security.crypto.codec.Hex; //导入方法依赖的package包/类
@FXML
public void toStringOnAction() {
codeArea.getUndoManager().mark();
byte[] decode = Hex.decode(codeArea.getText());
codeArea.replaceText(new String(decode));
}
示例11: decode
import org.springframework.security.crypto.codec.Hex; //导入方法依赖的package包/类
private byte[] decode(String encodedPassword) {
return Hex.decode(encodedPassword);
}