-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added kid and alg to cipher and db packages (#55)
* added kid and alg to cipher and db packages * adding basic logger * Revert "adding basic logger" This reverts commit 9f175bd. * passing logger * merging rsaEncrypter struct and rsaDecrypter struct * adding algorithm to Ciphers Get() * adding ParseAlogrithmType * making Options of Ciphers public for testing
- Loading branch information
Showing
19 changed files
with
496 additions
and
213 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/** | ||
* Copyright 2019 Comcast Cable Communications Management, LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package cipher | ||
|
||
type AlgorithmType string | ||
|
||
const ( | ||
None AlgorithmType = "none" | ||
Box AlgorithmType = "box" | ||
RSASymmetric AlgorithmType = "rsa-sym" | ||
RSAAsymmetric AlgorithmType = "rsa-asy" | ||
) | ||
|
||
func ParseAlogrithmType(algo string) AlgorithmType { | ||
if algo == string(Box) { | ||
return Box | ||
} else if algo == string(RSASymmetric) { | ||
return RSASymmetric | ||
} else if algo == string(RSAAsymmetric) { | ||
return RSAAsymmetric | ||
} | ||
return None | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,16 @@ | ||
{ | ||
"algorithm": { | ||
"type": "box" | ||
}, | ||
"recipientPrivateKey": "boxPrivate.pem", | ||
"senderPublicKey": "sendBoxPublic.pem" | ||
} | ||
"cipher": [ | ||
{ | ||
"type": "box", | ||
"kid": "test", | ||
"keys": { | ||
"senderPublicKey": "sendBoxPublic.pem", | ||
"recipientPrivateKey": "boxPrivate.pem" | ||
} | ||
}, | ||
{ | ||
"type": "none", | ||
"kid": "none" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
{ | ||
"algorithm": { | ||
"type": "box" | ||
}, | ||
"senderPrivateKey": "sendBoxPrivate.pem", | ||
"recipientPublicKey": "boxPublic.pem" | ||
} | ||
"cipher": [ | ||
{ | ||
"type": "box", | ||
"kid": "test", | ||
"keys": { | ||
"senderPrivateKey": "sendBoxPrivate.pem", | ||
"recipientPublicKey": "boxPublic.pem" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,14 @@ | ||
{ | ||
"algorithm": { | ||
"type": "basic", | ||
"hash": "SHA512" | ||
}, | ||
"senderPrivateKey": "private.pem", | ||
"recipientPublicKey": "public.pem" | ||
"cipher": [ | ||
{ | ||
"type": "rsa-sym", | ||
"params": { | ||
"hash": "SHA512" | ||
}, | ||
"keys": { | ||
"publicKey": "public.pem", | ||
"privateKey": "private.pem" | ||
} | ||
} | ||
] | ||
} |
Oops, something went wrong.