当前位置: 首页>>代码示例>>Java>>正文


Java Hex.decode方法代码示例

本文整理汇总了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);
}
 
开发者ID:pivotalsoftware,项目名称:pivotal-cla,代码行数:19,代码来源:GitHubSignature.java

示例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);
}
 
开发者ID:greensopinion,项目名称:greenbeans,代码行数:9,代码来源:Encryptor.java

示例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;
}
 
开发者ID:bestarandyan,项目名称:ShoppingMall,代码行数:9,代码来源:AndroidAesBytesEncryptor.java

示例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);
}
 
开发者ID:mqprichard,项目名称:spring-greenhouse-clickstart,代码行数:10,代码来源:UpdateEncryptionMethod.java

示例5: decode

import org.springframework.security.crypto.codec.Hex; //导入方法依赖的package包/类
private byte[] decode(CharSequence encodedPassword) {
    return Hex.decode(encodedPassword);
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:4,代码来源:MessageDigestPasswordEncoder.java

示例6: generateBase32Key

import org.springframework.security.crypto.codec.Hex; //导入方法依赖的package包/类
public static String generateBase32Key() {
	byte[] hexBytes = Hex.decode(generateHexKey());
	return new Base32().encodeAsString(hexBytes);
}
 
开发者ID:melthaw,项目名称:spring-backend-boilerplate,代码行数:5,代码来源:SecurityUtils.java

示例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));
}
 
开发者ID:melthaw,项目名称:spring-backend-boilerplate,代码行数:5,代码来源:SecurityUtils.java

示例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);
}
 
开发者ID:melthaw,项目名称:spring-backend-boilerplate,代码行数:5,代码来源:KeyUtils.java

示例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);
}
 
开发者ID:melthaw,项目名称:spring-backend-boilerplate,代码行数:5,代码来源:KeyUtils.java

示例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));
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:7,代码来源:SimpleTextView.java

示例11: decode

import org.springframework.security.crypto.codec.Hex; //导入方法依赖的package包/类
private byte[] decode(String encodedPassword) {
	return Hex.decode(encodedPassword);		
}
 
开发者ID:mqprichard,项目名称:spring-greenhouse-clickstart,代码行数:4,代码来源:GreenhousePasswordEncoder.java


注:本文中的org.springframework.security.crypto.codec.Hex.decode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。