资源简介
为了解决静态口令的诸多问题,安全专家提出了“动态口令(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
相关资源
-
notepad++包含xm
l tools等插件 -
PotPla
yer.zip - 手机模组OTP烧录原理及相关知识介绍
- Altium PCB元件库
- Designing for Scalability with Erlang-OTP.pdf
- GM/T 0021-2012 动态口令密码应用技术规
-
csf文件播放解码插件for Potpla
yer - M5310开发资料含PCB封装
- OrCAD Library Builder使用详解
-
PotPla
yer最好看皮肤 - Lenovo-G480-OS-Mojave10.14.5-Clover-Hotpatch-m
-
PotPla
yer64位免安装绿色版 - 银行动态口令认证系统
-
倍速播放软件PotPla
yerSetup64 完整安装 - ErlangOTP并发编程实战(高清PDF版)
-
PotPla
yer离线OpenCodecSetup解码包x86-x - otp_src_22.0.tar.gz
- otp_win64_23.1.zip
- erlang安装包otp_win64_17.3.exe
- otp_win64_20.3 rabbitmq windows 基础依赖
- 官方获取_win64位_otp_win64_22.0.zip
-
用potpayer学习英语之我配置的potpla
-
PotPla
yer精选70套皮肤 - Erlang OTP并发编程实战
- FootprintExpert2012-51.rar
-
potpla
yer64位安装包 -
PotPla
yer倍速播放神器,几乎不变声 - ErlangOTP 21.3.zip
- otp_win64_21.3.exe
- erlang 20.3
评论
共有 条评论