资源简介
为了解决静态口令的诸多问题,安全专家提出了“动态口令(OTP:One Time Password)”的解决方案。
代码片段和文件信息
/**
Copyright (c) 2011 IETF Trust and the persons identified as
authors of the code. All rights reserved.
Redistribution and use in source and binary forms with or without
modification is permitted pursuant to and subject to the license
terms contained in the Simplified BSD License set forth in Section
4.c of the IETF Trust’s Legal Provisions Relating to IETF Documents
(http://trustee.ietf.org/license-info).
*/
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.math.BigInteger;
/**
* This an example implementation of OCRA. Visit www.openauthentication.org for
* more information.
*
* @author Johan Rydell PortWise
*/
public class OCRA {
private OCRA() {
}
/**
* This method uses the JCE to provide the crypto algorithm. HMAC computes a
* Hashed Message Authentication Code with the crypto hash algorithm as a
* parameter.
*
* @param crypto
* the crypto algorithm (HmacSHA1 HmacSHA256 HmacSHA512)
* @param keyBytes
* the bytes to use for the HMAC key
* @param text
* the message or text to be authenticated.
*/
private static byte[] hmac_sha1(String crypto byte[] keyBytes byte[] text) {
Mac hmac = null;
try {
hmac = Mac.getInstance(crypto);
SecretKeySpec macKey = new SecretKeySpec(keyBytes “RAW“);
hmac.init(macKey);
return hmac.doFinal(text);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
private static final int[] DIGITS_POWER
// 0 1 2 3 4 5 6 7 8
= { 1 10 100 1000 10000 100000 1000000 10000000 100000000 };
/**
* This method converts HEX string to Byte[]
*
* @param hex
* the HEX string
*
* @return A byte array
*/
private static byte[] hexStr2Bytes(String hex) {
// Adding one byte to get the right conversion
// values starting with “0“ can be converted
byte[] bArray = new BigInteger(“10“ + hex 16).toByteArray();
// Copy all the REAL bytes not the “first“
byte[] ret = new byte[bArray.length - 1];
System.arraycopy(bArray 1 ret 0 ret.length);
return ret;
}
/**
* This method generates an OCRA HOTP value for the given set of parameters.
*
* @param ocraSuite
* the OCRA Suite
* @param key
* the shared secret HEX encoded
* @param counter
* the counter that changes on a per use basis HEX encoded
* @param question
* the challenge question HEX encoded
* @param password
* a password that can be used HEX encoded
* @param sessionInformation
* Static information that identifies the current session Hex
* encoded
* @param timeStamp
* a value that reflects a time
*
* @return A numeric String in base 10 that includes
* {@link truncationDigits} digits
*/
static public String generateOCRA(String ocraSuite String key
String counte
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 307 2011-12-16 11:39 OTPProject\.classpath
文件 386 2011-12-06 18:26 OTPProject\.project
文件 8298 2011-12-07 09:21 OTPProject\src\OCRA.java
文件 7675 2011-12-07 09:15 OTPProject\src\TOTP.java
文件 10931 2011-12-07 09:30 OTPProject\src\TestOCRA.java
文件 1083 2011-12-07 09:21 OTPProject\src\org\openauthentication\otp\OTPTest.java
文件 6473 2011-12-06 18:32 OTPProject\src\org\openauthentication\otp\OneTimePasswordAlgorithm.java
相关资源
- RJ45最全封装集成库AD含市面所有型号
- footprint maker--FPM_0.080
- GMT0061-2018 动态口令密码应用检测规范
- 所有电解电容贴片封装
- OATH动态口令令牌标准算法
-
potpla
yer zune皮肤第8版 - 基于时间同步的动态口令身份认证方
- hotplug 热插拔 测试程序
- BOTP单据转换自定义公式
-
potpla
yer直播源.7z - Cadence allegro 封装库生成器footprint ma
-
PotPla
yer最新1080直播源.txt -
PotPla
yer播放器wmp12风格皮肤 -
PotPla
yer播放器离线解码插件 OpenCo - 直播源-2020.rar
- pcb footprints 各种pcb封装库
-
potpla
yer zune皮肤 最新版 - CH341A编程器1.26
-
PotPla
yer电视直播列表 860.dpl -
PotPla
yer直播源20180520.dpl -
PotPla
yer最新直播源.dpl -
PotPla
yer直播源-4月最新稳定蓝光直播 - 支持OTP分区 CH341A
- af-otp-pdaf驱动正确性检查
- 基于动态口令的身份认证协议的实现
- EC20 AD footprint
- 菜农HotPower超级CRC计算器HotWC3
评论
共有 条评论