인디노트
Linux 계열의 OS 에서 랜덤하게 UUID 생성하는 간단한 방법 본문
public String convertStreamToString(InputStream is) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
StringBuilder sb = new StringBuilder();
String line = null;
while ((line = reader.readLine()) != null) {
sb.append(line).append("\n");
}
reader.close();
return sb.toString();
}
public String getStringFromFile (String filePath) throws Exception {
File fl = new File(filePath);
FileInputStream fin = new FileInputStream(fl);
String ret = convertStreamToString(fin);
//Make sure you close all streams.
fin.close();
return ret;
}
try {
String uuid = getStringFromFile("/proc/sys/kernel/random/uuid");
Log.d("TAG", ">>> uuid:" + uuid);
} catch (Exception e) {
e.printStackTrace();
}
반응형
'인증기술 > 보안기술' 카테고리의 다른 글
JSOTP KGY 버전 (0) | 2022.12.02 |
---|---|
KMIP4J - Open source implementation of Key Management Interoperability Protocol (0) | 2022.04.18 |
쉽게 설명해 놓은 암호학 관련 사이트 (0) | 2021.08.04 |
Triple DES (트리플 DES) (0) | 2021.08.04 |
KMIP 에 대한 내용 (0) | 2021.07.14 |