Skip to content

Instantly share code, notes, and snippets.

What is the first RRC message that a UE sends to the gNB in the 5G Standalone registration procedure?
What is the the response RRC message that a gNB sends to the UE upon receiving RRCSetupRequest message?
Which RRC message that a UE sends to the gNB with the NAS Registration Request as a dedicated NAS message field?
What is the NAS message used to request the UE identity in 5G standalone registration procedure?
What is the NAS message that a UE uses to respond to the NAS identity request?
Which NAS message is used to initiate the authentication procedure with the UE in 5G Standalone registration procedure?
What is NAS message a UE uses to respond to the authentication challenge?
Which NAS message is sent to the UE to inform the selected NAS security algorithm?
What is the NAS message a UE uses to signal the completion of the NAS security procedure?
What is the RRC message a gNB sends to a UE to activate the access stratum security?
{
"@context": "https://www.w3.org/2018/credentials/v1",
"id": "vc12345",
"type": [
"VerifiableCredential",
"MonashCredential"
],
"issuer": "MonashUniversity",
"issuanceDate": "2023-05-30T22:46:21.067940",
"credentialSubject": {
JsonObject jsonRepresentation = VCUtil.getJsonRepresentation(verifiableCredential);
System.out.println(jsonRepresentation);
VerifiableCredential verifiableCredential = new VerifiableCredential.Builder()
.credential(credential)
.metadata(credentialMetaData)
.proof(proof)
.build();
Proof proof = new Ed25519Signature2020(dateTime, credential, credentialMetaData, URI.create("linkToPublicKey"), "assertion", keyPair.getPrivate());
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("Ed25519");
byte[] keyBytesForSender = Mnemonic.toKey("sponsor ride say achieve senior height crumble promote " +
"universe write dove bomb faculty side human taste paper grocery robot grab reason fork soul above " +
"sphere");
keyPairGenerator.initialize(256, new FixedSecureRandom(keyBytesForSender));
KeyPair keyPair = keyPairGenerator.generateKeyPair();
var dateTime = LocalDateTime.now();
CredentialMetaData credentialMetaData = new CredentialMetaData.Builder()
.id("vc12345")
.issuer("MonashUniversity")
.additionalType("MonashCredential")
.issuanceDate(dateTime)
.expirationDate(dateTime.plusYears(1))
.build();
Credential credential = new Credential.Builder()
.credentialSubject(credentialSubject)
.build();
@thusithathilina
thusithathilina / credentialsubject.java
Created May 30, 2023 12:28
Create a CredentialSubject to represent a set of claims
CredentialSubject credentialSubject = new CredentialSubject();
credentialSubject.addClaim("name", "Thusitha Dayaratne");
credentialSubject.addClaim("job", "Research Fellow");
credentialSubject.addClaim("university", "Monash University");
credentialSubject.addClaim("id", "0123456789");
//Sender encrypt the message
Cipher cipher = Cipher.getInstance("AES");
cipher.init(Cipher.ENCRYPT_MODE, secretKeySender);
byte[] cipherText = cipher.doFinal(message.getBytes(StandardCharsets.UTF_8));
//Receiver decrypt the message
Cipher cipher = Cipher.getInstance("AES");
cipher.init(Cipher.DECRYPT_MODE, secretKeyReceiver);
String decryptMsg = new String(cipher.doFinal(cipherText));